From ba13726c2ceaf785e32b008b6aa97018154f6219 Mon Sep 17 00:00:00 2001 From: Clemens Zagler Date: Mon, 22 Jan 2024 13:16:33 +0100 Subject: [PATCH] - Remove _t property from Record DTO. Always use SimpleRecordDTO - Remove deprecated and unused DTO types Text and FullRecord --- .../timeseries/bdp/dto/dto/FullRecordDto.java | 61 ------------------- .../timeseries/bdp/dto/dto/RecordDto.java | 9 ++- .../timeseries/bdp/dto/dto/TextDto.java | 35 ----------- 3 files changed, 8 insertions(+), 97 deletions(-) delete mode 100644 dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/FullRecordDto.java delete mode 100644 dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/TextDto.java diff --git a/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/FullRecordDto.java b/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/FullRecordDto.java deleted file mode 100644 index f3fe30ad..00000000 --- a/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/FullRecordDto.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright © 2018 IDM Südtirol - Alto Adige (info@idm-suedtirol.com) -// Copyright © 2019 NOI Techpark - Südtirol / Alto Adige (info@opendatahub.com) -// -// SPDX-License-Identifier: GPL-3.0-only - -package com.opendatahub.timeseries.bdp.dto.dto; - -@Deprecated -public class FullRecordDto extends RecordDtoImpl{ - - private static final long serialVersionUID = 5279857732736895894L; - private String station; - private String type; - private Object value; - private Integer period; - - - public FullRecordDto(Long timestamp, Object value, String station, String type, Integer period) { - this.timestamp = timestamp; - this.value = value; - this.station = station; - this.type = type; - this.period = period; - } - - public String getStation() { - return station; - } - - public void setStation(String station) { - this.station = station; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - @Override - public Object getValue() { - return this.value; - } - - - public Integer getPeriod() { - return period; - } - - public void setPeriod(Integer period) { - this.period = period; - } - - @Override - public boolean validate() { - return this.getStation()!=null && this.getType()!=null && super.validate(); - } - -} diff --git a/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/RecordDto.java b/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/RecordDto.java index 067d68e4..810b3c09 100644 --- a/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/RecordDto.java +++ b/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/RecordDto.java @@ -7,14 +7,21 @@ import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; /** * describes the validity of a record and makes it serializable * * @author Patrick Bertolla */ -@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="_t") +@JsonTypeInfo(use = Id.DEDUCTION) +@JsonSubTypes({@JsonSubTypes.Type(SimpleRecordDto.class)}) +// _t used to be the type information as a class name. +// now we just ignore it +@JsonIgnoreProperties(value = {"_t"}) public interface RecordDto extends Serializable{ public abstract boolean validate(); } diff --git a/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/TextDto.java b/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/TextDto.java deleted file mode 100644 index ae2ac4d1..00000000 --- a/dto/src/main/java/com/opendatahub/timeseries/bdp/dto/dto/TextDto.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright © 2018 IDM Südtirol - Alto Adige (info@idm-suedtirol.com) -// Copyright © 2019 NOI Techpark - Südtirol / Alto Adige (info@opendatahub.com) -// -// SPDX-License-Identifier: GPL-3.0-only - -package com.opendatahub.timeseries.bdp.dto.dto; - -@Deprecated -public class TextDto extends RecordDtoImpl{ - - private static final long serialVersionUID = 8824412836092026904L; - private String text; - - public TextDto() { - } - public TextDto(Long timestamp, String text) { - super(); - this.timestamp = timestamp; - this.text = text; - } - - @Override - public Object getValue() { - return text; - } - public void setValue(Object value) { - this.text = value.toString(); - } - public String getText() { - return text; - } - public void setText(String text) { - this.text = text; - } -}