View Javadoc
1   package de.dlr.shepard.data.timeseries.io;
2   
3   import de.dlr.shepard.data.timeseries.model.Timeseries;
4   import de.dlr.shepard.data.timeseries.model.enums.DataPointValueType;
5   import jakarta.validation.constraints.NotBlank;
6   import lombok.Data;
7   import lombok.NoArgsConstructor;
8   import org.eclipse.microprofile.openapi.annotations.media.Schema;
9   
10  /**
11   * IO-Object relating to a client side Timeseries.
12   * It encompasses the timeseries ID, the ID of the associated container, a value type aswell as the tuple identifying
13   * a timeseries: measurement, device, location, symbolicName and field.
14   *
15   */
16  @Schema(name = "TimeseriesEntity")
17  @Data
18  @NoArgsConstructor(force = true) // needed for serialization
19  public class TimeseriesIO {
20  
21    @NotBlank
22    private final long id;
23  
24    @NotBlank
25    private final long containerId;
26  
27    @NotBlank
28    private final DataPointValueType valueType;
29  
30    @NotBlank
31    private final String measurement;
32  
33    @NotBlank
34    private final String device;
35  
36    @NotBlank
37    private final String location;
38  
39    @NotBlank
40    private final String symbolicName;
41  
42    @NotBlank
43    private final String field;
44  
45    public TimeseriesIO(Timeseries timeseries) {
46      this.id = timeseries.getTimeseriesId();
47      this.containerId = timeseries.getContainer().getId();
48      this.valueType = timeseries.getValueType();
49      this.measurement = timeseries.getTimeseriesTuple().getMeasurement();
50      this.device = timeseries.getTimeseriesTuple().getDevice();
51      this.location = timeseries.getTimeseriesTuple().getLocation();
52      this.symbolicName = timeseries.getTimeseriesTuple().getSymbolicName();
53      this.field = timeseries.getTimeseriesTuple().getField();
54    }
55  }