1 package de.dlr.shepard.neo4Core.dao;
2
3 import java.util.Map;
4
5 import de.dlr.shepard.influxDB.Timeseries;
6 import de.dlr.shepard.util.CypherQueryHelper;
7
8 public class TimeseriesDAO extends GenericDAO<Timeseries> {
9
10
11
12
13
14
15
16
17
18
19
20
21 public Timeseries find(String measurement, String device, String location, String symbolicName, String field) {
22 var query = String.format(
23 "MATCH (t:Timeseries { measurement: $measurement, device: $device, location: $location, symbolicName: $symbolicName, field: $field }) %s",
24 CypherQueryHelper.getReturnPart("t"));
25 Map<String, Object> params = Map.of("measurement", measurement, "device", device, "location", location,
26 "symbolicName", symbolicName, "field", field);
27 var results = findByQuery(query, params);
28 return results.iterator().hasNext() ? results.iterator().next() : null;
29 }
30
31 @Override
32 public Class<Timeseries> getEntityType() {
33 return Timeseries.class;
34 }
35 }