Package net.solarnetwork.node.dao
Class FilteringDatumDao
java.lang.Object
net.solarnetwork.node.dao.FilteringDatumDao
- All Implemented Interfaces:
DatumDao
Delegating DAO for
NodeDatum that applies filters before persisting.- Since:
- 2.0
- Version:
- 1.0
- Author:
- matt
-
Field Summary
Fields inherited from interface net.solarnetwork.node.dao.DatumDao
EVENT_TOPIC_DATUM_STORED -
Constructor Summary
ConstructorsConstructorDescriptionFilteringDatumDao(net.solarnetwork.service.OptionalService<DatumDao> delegate, net.solarnetwork.service.OptionalService<net.solarnetwork.service.DatumFilterService> filterService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintdeleteUploadedDataOlderThan(int hours) Delete both Datum and DatumUpload objects that have been successfully uploaded to at least one destination and are older than the specified number of hours.getDatumNotUploaded(String destination) Get a List of Datum instances that have not been uploaded yet to a specific destination.voidsetDatumUploaded(NodeDatum datum, Instant date, String destination, String trackingId) Mark a datum as uploaded.voidstoreDatum(NodeDatum datum) Store (create or update) a datum.
-
Constructor Details
-
FilteringDatumDao
public FilteringDatumDao(net.solarnetwork.service.OptionalService<DatumDao> delegate, net.solarnetwork.service.OptionalService<net.solarnetwork.service.DatumFilterService> filterService) Constructor.- Parameters:
delegate- the DAO to delegate tofilterService- the transformer service
-
-
Method Details
-
storeDatum
Description copied from interface:DatumDaoStore (create or update) a datum.- Specified by:
storeDatumin interfaceDatumDao- Parameters:
datum- the datum to persist
-
getDatumNotUploaded
Description copied from interface:DatumDaoGet a List of Datum instances that have not been uploaded yet to a specific destination.This does not need to return all data, it can limit the amount returned at one time to conserve memory. This method can be called repeatedly if needed.
- Specified by:
getDatumNotUploadedin interfaceDatumDao- Parameters:
destination- the destination to check- Returns:
- list of Datum, or empty List if none available
-
setDatumUploaded
Description copied from interface:DatumDaoMark a datum as uploaded.- Specified by:
setDatumUploadedin interfaceDatumDao- Parameters:
datum- the Datum that has been uploaded successfullydate- the date it was uploadeddestination- the destination the Datum was uploaded totrackingId- the remote tracking ID assigned to the uploaded Datum
-
deleteUploadedDataOlderThan
public int deleteUploadedDataOlderThan(int hours) Description copied from interface:DatumDaoDelete both Datum and DatumUpload objects that have been successfully uploaded to at least one destination and are older than the specified number of hours.This is designed to free up space from local database storage for devices with limited storage capacity. It will not delete any Datum objects that have not been successfully uploaded anywhere.
- Specified by:
deleteUploadedDataOlderThanin interfaceDatumDao- Parameters:
hours- the minimum number of hours old the data must be to delete- Returns:
- the number of Datum (and associated DatumUpload) entities deleted
-