-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/fallback to generic device creation in case the sensor is not…
… found (#98)
- Loading branch information
1 parent
3b5883f
commit 77a49dc
Showing
16 changed files
with
291 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package de.app.fivegla.api; | ||
|
||
/** | ||
* This interface contains global definitions for the application. | ||
*/ | ||
public interface GlobalDefinitions { | ||
/** | ||
* The INSTANT_JSON_PATTERN is a string constant that represents the pattern used to format | ||
* and parse Instant objects in JSON format. | ||
* <p> | ||
* The pattern is defined as "yyyy-MM-dd'T'HH:mm:ss.SSS", where: | ||
* - "yyyy" represents the year using four digits | ||
* - "MM" represents the month using two digits | ||
* - "dd" represents the day using two digits | ||
* - "T" is a literal 'T' character, used to separate the date and time | ||
* - "HH" represents the hour using two digits in the 24-hour format | ||
* - "mm" represents the minute using two digits | ||
* - "ss" represents the second using two digits | ||
* - "SSS" represents the milliseconds using three digits | ||
* <p> | ||
* This pattern is commonly used in JSON APIs for representing Instant objects in a consistent manner. | ||
* It can be used to format Instant objects into strings or parse strings into Instant objects. | ||
* <p> | ||
* Example usage: | ||
* <pre>{@code | ||
* String instantString = "2022-12-31T23:59:59.999"; | ||
* | ||
* DateTimeFormatter formatter = DateTimeFormatter.ofPattern(INSTANT_JSON_PATTERN); | ||
* Instant instant = Instant.parse(instantString, formatter); | ||
* | ||
* String formattedInstant = formatter.format(instant); | ||
* System.out.println(formattedInstant); | ||
* }</pre> | ||
*/ | ||
String INSTANT_JSON_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/de/app/fivegla/integration/agvolution/model/TimeSeriesEntry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
package de.app.fivegla.integration.agvolution.model; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represents an entry in a time series. | ||
* The entry consists of a key, unit, aggregate, and a list of time series values. | ||
*/ | ||
@Getter | ||
@Setter | ||
@Schema(description = "Represents an entry in a time series.") | ||
public class TimeSeriesEntry { | ||
|
||
@Schema(description = "The key of the entry.") | ||
private String key; | ||
|
||
@Schema(description = "The unit of the entry.") | ||
private String unit; | ||
|
||
@Schema(description = "The aggregate of the entry.") | ||
private String aggregate; | ||
|
||
@Schema(description = "The values of the entry.") | ||
private List<TimeSeriesValue> values; | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/java/de/app/fivegla/integration/agvolution/model/TimeSeriesValue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,44 @@ | ||
package de.app.fivegla.integration.agvolution.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonFormat; | ||
import de.app.fivegla.api.GlobalDefinitions; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.time.Instant; | ||
|
||
/** | ||
* Represents a value for a specific time in a time series. | ||
* <p> | ||
* This class is annotated with the Lombok's @Getter and @Setter annotations, | ||
* which generate getters and setters for the private fields automatically. | ||
* The class is also annotated with @Schema which can be used for generating | ||
* documentation for API endpoints using Swagger or other similar frameworks. | ||
* <p> | ||
* An instance of this class contains information about the time and value of | ||
* a specific data point in a time series. The time is represented as an | ||
* Instant object using the UTC timezone. The value is a Double representing | ||
* the numeric value associated with the time. | ||
* <p> | ||
* The time is formatted using the ISO 8601 standard date and time format, | ||
* with milliseconds precision, and the UTC timezone. | ||
* <p> | ||
* Example usage: | ||
* <p> | ||
* TimeSeriesValue value = new TimeSeriesValue(); | ||
* value.setTime(Instant.now()); | ||
* value.setValue(42.0); | ||
*/ | ||
@Getter | ||
@Setter | ||
@Schema(description = "Represents a value for a specific time in a time series.") | ||
public class TimeSeriesValue { | ||
|
||
@Schema(description = "The time of the value in the time series.") | ||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = GlobalDefinitions.INSTANT_JSON_PATTERN, timezone = "UTC") | ||
private Instant time; | ||
|
||
@Schema(description = "The value of the value in the time series.") | ||
private Double value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.