public class PersistenceExtensions extends Object
| Constructor and Description |
|---|
PersistenceExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static org.eclipse.smarthome.core.library.types.DecimalType |
averageSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Gets the average value of the state of a given
item since a certain point in time. |
static org.eclipse.smarthome.core.library.types.DecimalType |
averageSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Gets the average value of the state of a given
item since a certain point in time. |
static Boolean |
changedSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Checks if the state of a given
item has changed since a certain point in time. |
static Boolean |
changedSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Checks if the state of a given
item has changed since a certain point in time. |
static org.eclipse.smarthome.core.library.types.DecimalType |
deltaSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Gets the difference value of the state of a given
item since a certain point in time. |
static org.eclipse.smarthome.core.library.types.DecimalType |
deltaSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Gets the difference value of the state of a given
item since a certain point in time. |
static org.eclipse.smarthome.core.library.types.DecimalType |
evolutionRate(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Gets the evolution rate of the state of a given
item since a certain point in time. |
static org.eclipse.smarthome.core.library.types.DecimalType |
evolutionRate(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Gets the evolution rate of the state of a given
item since a certain point in time. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
historicState(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Retrieves the historic item for a given
item at a certain point in time through the default
persistence service. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
historicState(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Retrieves the historic item for a given
item at a certain point in time through a
PersistenceService identified by the serviceId. |
static Instant |
lastUpdate(org.eclipse.smarthome.core.items.Item item)
Query the last update time of a given
item. |
static Instant |
lastUpdate(org.eclipse.smarthome.core.items.Item item,
String serviceId)
Query for the last update time of a given
item. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
maximumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Gets the historic item with the maximum value of the state of a given
item since
a certain point in time. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
maximumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Gets the historic item with the maximum value of the state of a given
item since
a certain point in time. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
minimumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Gets the historic item with the minimum value of the state of a given
item since
a certain point in time. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
minimumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Gets the historic item with the minimum value of the state of a given
item since
a certain point in time. |
static void |
persist(org.eclipse.smarthome.core.items.Item item)
Persists the state of a given
item through the default persistence service. |
static void |
persist(org.eclipse.smarthome.core.items.Item item,
String serviceId)
Persists the state of a given
item through a PersistenceService identified
by the serviceId. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
previousState(org.eclipse.smarthome.core.items.Item item)
Returns the previous state of a given
item. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
previousState(org.eclipse.smarthome.core.items.Item item,
boolean skipEqual)
Returns the previous state of a given
item. |
static org.eclipse.smarthome.core.persistence.HistoricItem |
previousState(org.eclipse.smarthome.core.items.Item item,
boolean skipEqual,
String serviceId)
Returns the previous state of a given
item. |
protected void |
setPersistenceServiceRegistry(org.eclipse.smarthome.core.persistence.PersistenceServiceRegistry registry) |
protected void |
setTimeZoneProvider(org.eclipse.smarthome.core.i18n.TimeZoneProvider timeZoneProvider) |
static org.eclipse.smarthome.core.library.types.DecimalType |
sumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Gets the sum of the state of a given
item since a certain point in time. |
static org.eclipse.smarthome.core.library.types.DecimalType |
sumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Gets the sum of the state of a given
item since a certain point in time. |
protected void |
unsetPersistenceServiceRegistry(org.eclipse.smarthome.core.persistence.PersistenceServiceRegistry registry) |
protected void |
unsetTimeZoneProvider(org.eclipse.smarthome.core.i18n.TimeZoneProvider timeZoneProvider) |
static Boolean |
updatedSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
Checks if the state of a given
item has been updated since a certain point in time. |
static Boolean |
updatedSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
Checks if the state of a given
item has changed since a certain point in time. |
protected void setPersistenceServiceRegistry(org.eclipse.smarthome.core.persistence.PersistenceServiceRegistry registry)
protected void unsetPersistenceServiceRegistry(org.eclipse.smarthome.core.persistence.PersistenceServiceRegistry registry)
protected void setTimeZoneProvider(org.eclipse.smarthome.core.i18n.TimeZoneProvider timeZoneProvider)
protected void unsetTimeZoneProvider(org.eclipse.smarthome.core.i18n.TimeZoneProvider timeZoneProvider)
public static void persist(org.eclipse.smarthome.core.items.Item item,
String serviceId)
item through a PersistenceService identified
by the serviceId.item - the item to storeserviceId - the name of the PersistenceService to usepublic static void persist(org.eclipse.smarthome.core.items.Item item)
item through the default persistence service.item - the item to storepublic static org.eclipse.smarthome.core.persistence.HistoricItem historicState(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
item at a certain point in time through the default
persistence service.item - the item for which to retrieve the historic itemtimestamp - the point in time for which the historic item should be retrievednull if no historic item could be found,
the default persistence service is not available or does not refer to a
QueryablePersistenceServicepublic static org.eclipse.smarthome.core.persistence.HistoricItem historicState(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
item at a certain point in time through a
PersistenceService identified by the serviceId.item - the item for which to retrieve the historic itemtimestamp - the point in time for which the historic item should be retrievedserviceId - the name of the PersistenceService to usenull if no historic item could be found or
if the provided serviceId does not refer to an available
QueryablePersistenceServicepublic static Boolean changedSince(org.eclipse.smarthome.core.items.Item item, Instant timestamp)
item has changed since a certain point in time.
The default persistence service is used.item - the item to check for state changestimestamp - the point in time to start the checktrue if item state had changed, false if it hasn't or if the default
persistence service does not refer to a QueryablePersistenceService, or null if the
default persistence service is not availablepublic static Boolean changedSince(org.eclipse.smarthome.core.items.Item item, Instant timestamp, String serviceId)
item has changed since a certain point in time.
The PersistenceService identified by the serviceId is used.item - the item to check for state changestimestamp - the point in time to start the checkserviceId - the name of the PersistenceService to usetrue if item state has changed, or false if it hasn't or if the given
serviceId does not refer to an available QueryablePersistenceServicepublic static Boolean updatedSince(org.eclipse.smarthome.core.items.Item item, Instant timestamp)
item has been updated since a certain point in time.
The default persistence service is used.item - the item to check for state updatestimestamp - the point in time to start the checktrue if item state was updated, false if either item has not been updated since
timestamp or if the default persistence does not refer to a
QueryablePersistenceService, or null if the default persistence service is not
availablepublic static Boolean updatedSince(org.eclipse.smarthome.core.items.Item item, Instant timestamp, String serviceId)
item has changed since a certain point in time.
The PersistenceService identified by the serviceId is used.item - the item to check for state changestimestamp - the point in time to start the checkserviceId - the name of the PersistenceService to usetrue if item state was updated or false if either the item has not been updated
since timestamp or if the given serviceId does not refer to a
QueryablePersistenceServicepublic static org.eclipse.smarthome.core.persistence.HistoricItem maximumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
item since
a certain point in time. The default persistence service is used.item - the item to get the maximum state value fortimestamp - the point in time to start the checknull if the
default persistence service is not available, or a HistoricItem constructed from the
item if the default persistence service does not refer to a
QueryablePersistenceServicepublic static org.eclipse.smarthome.core.persistence.HistoricItem maximumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
item since
a certain point in time. The PersistenceService identified by the serviceId is used.item - the item to get the maximum state value fortimestamp - the point in time to start the checkserviceId - the name of the PersistenceService to useHistoricItem with the maximum state value since the given point in time, or a
HistoricItem constructed from the item's state if item's state is the
maximum value or if the given serviceId does not refer to an available
QueryablePersistenceServicepublic static org.eclipse.smarthome.core.persistence.HistoricItem minimumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
item since
a certain point in time. The default persistence service is used.item - the item to get the minimum state value fortimestamp - the point in time from which to search for the minimum state valuenull if the
default persistence service is not available, or a HistoricItem constructed from the
item's state if item's state is the minimum value or if the default persistence
service does not refer to an available QueryablePersistenceServicepublic static org.eclipse.smarthome.core.persistence.HistoricItem minimumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
item since
a certain point in time. The PersistenceService identified by the serviceId is used.item - the item to get the minimum state value fortimestamp - the point in time from which to search for the minimum state valueserviceId - the name of the PersistenceService to useHistoricItem
constructed from the item's state if item's state is the minimum value or if
the given serviceId does not refer to an available QueryablePersistenceServicepublic static org.eclipse.smarthome.core.library.types.DecimalType averageSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
item since a certain point in time.
The default persistence service is used.item - the item to get the average state value fortimestamp - the point in time from which to search for the average state valuetimestamp, null if the default persistence
service is not available, or the state of the given item if no previous states could be
found or if the default persistence service does not refer to an available
QueryablePersistenceServicepublic static org.eclipse.smarthome.core.library.types.DecimalType averageSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
item since a certain point in time.
The PersistenceService identified by the serviceId is used.item - the item to get the average state value fortimestamp - the point in time from which to search for the average state valueserviceId - the name of the PersistenceService to usetimestamp, or the state of the given item if no
previous states could be found or if the persistence service given by serviceId does not
refer to an available QueryablePersistenceServicepublic static org.eclipse.smarthome.core.library.types.DecimalType sumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
item since a certain point in time.
The default persistence service is used.item - the item for which we will sum its persisted state values since timestamptimestamp - the point in time from which to start the summationtimestamp, null if the default persistence
service is not available, or DecimalType.ZERO if no historic states could be found or if the
default persistence service does not refer to a QueryablePersistenceServicepublic static org.eclipse.smarthome.core.library.types.DecimalType sumSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
item since a certain point in time.
The PersistenceService identified by the serviceId is used.item - the item for which we will sum its persisted state values since timestamptimestamp - the point in time from which to start the summationserviceId - the name of the PersistenceService to useDecimalType.ZERO if no historic
states could be found for the item or if serviceId does no refer to a
QueryablePersistenceServicepublic static Instant lastUpdate(org.eclipse.smarthome.core.items.Item item)
item. The default persistence service is used.item - the item for which the last update time is to be returneditem, or null if there are no previously
persisted updates or the default persistence service is not available or a
QueryablePersistenceServicepublic static Instant lastUpdate(org.eclipse.smarthome.core.items.Item item, String serviceId)
item.item - the item for which the last update time is to be returnedserviceId - the name of the PersistenceService to useitem was updated, or null if there are no previously
persisted updates or if persistence service given by serviceId does not refer to an
available QueryablePersistenceServicepublic static org.eclipse.smarthome.core.library.types.DecimalType deltaSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
item since a certain point in time.
The default persistence service is used.item - the item to get the average state value fortimestamp - the point in time from which to compute the deltanull if there is no default persistence
service available, the default persistence service is not a QueryablePersistenceService, or if
there is no persisted state for the given item at the given timestamp available
in the default persistence servicepublic static org.eclipse.smarthome.core.library.types.DecimalType deltaSince(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
item since a certain point in time.
The PersistenceService identified by the serviceId is used.item - the item to get the average state value fortimestamp - the point in time from which to compute the deltaserviceId - the name of the PersistenceService to usenull if the given serviceId does not refer to an
available QueryablePersistenceService, or if there is no persisted state for the given
item at the given timestamp using the persistence service named
serviceIdpublic static org.eclipse.smarthome.core.library.types.DecimalType evolutionRate(org.eclipse.smarthome.core.items.Item item,
Instant timestamp)
item since a certain point in time.
The PersistenceService identified by the serviceId is used.item - the item to get the evolution rate value fortimestamp - the point in time from which to compute the evolution ratenull if
there is no default persistence service available, the default persistence service is not a
QueryablePersistenceService, or if there is no persisted state for the given item at
the given timestamp, or if there is a state but it is zero (which would cause a
divide-by-zero error)public static org.eclipse.smarthome.core.library.types.DecimalType evolutionRate(org.eclipse.smarthome.core.items.Item item,
Instant timestamp,
String serviceId)
item since a certain point in time.
The PersistenceService identified by the serviceId is used.item - the item to get the evolution rate value fortimestamp - the point in time from which to compute the evolution rateserviceId - the name of the PersistenceService to usenull if
the persistence service given by serviceId is not available or is not a
QueryablePersistenceService, or if there is no persisted state for the given
item at the given timestamp using the persistence service given by
serviceId, or if there is a state but it is zero (which would cause a divide-by-zero
error)public static org.eclipse.smarthome.core.persistence.HistoricItem previousState(org.eclipse.smarthome.core.items.Item item)
item.item - the item to get the previous state value fornull if no previous state could be found, or if the default
persistence service is not configured or does not refer to a QueryablePersistenceServicepublic static org.eclipse.smarthome.core.persistence.HistoricItem previousState(org.eclipse.smarthome.core.items.Item item,
boolean skipEqual)
item.item - the item to get the previous state value forskipEqual - if true, skips equal state values and searches the first state not equal the current statenull if no previous state could be found, or if the default
persistence service is not configured or does not refer to a QueryablePersistenceServicepublic static org.eclipse.smarthome.core.persistence.HistoricItem previousState(org.eclipse.smarthome.core.items.Item item,
boolean skipEqual,
String serviceId)
item.
The PersistenceService identified by the serviceId is used.item - the item to get the previous state value forskipEqual - if true, skips equal state values and searches the first state not equal the
current stateserviceId - the name of the PersistenceService to usenull if no previous state could be found, or if the given
serviceId is not available or does not refer to a QueryablePersistenceServiceCopyright © 2018–2020 ConnectorIO Sp. z o.o.. All rights reserved.