Class PersistenceExtensions

java.lang.Object
org.openhab.core.persistence.extensions.PersistenceExtensions

@NonNullByDefault public class PersistenceExtensions extends Object
This class provides static methods that can be used in automation rules for using persistence services
Author:
Kai Kreuzer - Initial contribution, Thomas Eichstaedt-Engelen - Initial contribution, Chris Jackson - Initial contribution, Gaƫl L'hopital - Add deltaSince, lastUpdate, evolutionRate, Jan N. Klug - Added sumSince, John Cocula - Added sumSince, Jan N. Klug - Added interval methods and refactoring, Mark Herwege - Changed return types to State for some interval methods to also return unit, Mark Herwege - Extended for future dates, Mark Herwege - lastChange and nextChange methods, mark Herwege - handle persisted GroupItem with QuantityType
  • Constructor Details

  • Method Details

    • persist

      public static void persist(Item item)
      Persists the state of a given item through the default persistence service.
      Parameters:
      item - the item to store
    • persist

      public static void persist(Item item, @Nullable String serviceId)
      Persists the state of a given item through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item to store
      serviceId - the name of the PersistenceService to use
    • persist

      public static void persist(Item item, ZonedDateTime timestamp, State state)
      Persists a state at a given timestamp of an item through the default persistence service.
      Parameters:
      item - the item to store
      timestamp - the date for the item state to be stored
      state - the state to be stored
    • persist

      public static void persist(Item item, ZonedDateTime timestamp, State state, @Nullable String serviceId)
      Persists a state at a given timestamp of an item through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item
      timestamp - the date for the item state to be stored
      state - the state to be stored
      serviceId - the name of the PersistenceService to use
    • persist

      public static void persist(Item item, ZonedDateTime timestamp, String stateString)
      Persists a state at a given timestamp of an item through the default persistence service.
      Parameters:
      item - the item to store
      timestamp - the date for the item state to be stored
      stateString - the state to be stored
    • persist

      public static void persist(Item item, ZonedDateTime timestamp, String stateString, @Nullable String serviceId)
      Persists a state at a given timestamp of an item through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item
      timestamp - the date for the item state to be stored
      stateString - the state to be stored
      serviceId - the name of the PersistenceService to use
    • persist

      public static void persist(Item item, TimeSeries timeSeries)
      Persists a timeSeries of an item through the default persistence service.
      Parameters:
      item - the item to store
      timeSeries - the timeSeries of states to be stored
    • persist

      public static void persist(Item item, TimeSeries timeSeries, @Nullable String serviceId)
      Persists a timeSeries of an item through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item
      timeSeries - the timeSeries of states to be stored
      serviceId - the name of the PersistenceService to use
    • historicState

      @Deprecated public static @Nullable HistoricItem historicState(Item item, ZonedDateTime timestamp)
      Deprecated.
      Retrieves the historic item for a given item at a certain point in time through the default persistence service. This method has been deprecated and persistedState(Item, ZonedDateTime) should be used instead.
      Parameters:
      item - the item for which to retrieve the historic item
      timestamp - the point in time for which the historic item should be retrieved
      Returns:
      the historic item at the given point in time, or null if no historic item could be found, the default persistence service is not available or does not refer to a QueryablePersistenceService
    • historicState

      @Deprecated public static @Nullable HistoricItem historicState(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Deprecated.
      Retrieves the historic item for a given item at a certain point in time through a PersistenceService identified by the serviceId. This method has been deprecated and persistedState(Item, ZonedDateTime, String) should be used instead.
      Parameters:
      item - the item for which to retrieve the historic item
      timestamp - the point in time for which the historic item should be retrieved
      serviceId - the name of the PersistenceService to use
      Returns:
      the historic item at the given point in time, or null if no historic item could be found or if the provided serviceId does not refer to an available QueryablePersistenceService
    • persistedState

      public static @Nullable HistoricItem persistedState(Item item, ZonedDateTime timestamp)
      Retrieves the persisted item for a given item at a certain point in time through the default persistence service.
      Parameters:
      item - the item for which to retrieve the persisted item
      timestamp - the point in time for which the persisted item should be retrieved
      Returns:
      the historic item at the given point in time, or null if no persisted item could be found, the default persistence service is not available or does not refer to a QueryablePersistenceService
    • persistedState

      public static @Nullable HistoricItem persistedState(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Retrieves the persisted item for a given item at a certain point in time through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item for which to retrieve the persisted item
      timestamp - the point in time for which the persisted item should be retrieved
      serviceId - the name of the PersistenceService to use
      Returns:
      the persisted item at the given point in time, or null if no persisted item could be found or if the provided serviceId does not refer to an available QueryablePersistenceService
    • lastUpdate

      public static @Nullable ZonedDateTime lastUpdate(Item item)
      Query the last historic update time of a given item. The default persistence service is used.
      Parameters:
      item - the item for which the last historic update time is to be returned
      Returns:
      point in time of the last historic update to item, null if there are no historic persisted updates, the state has changed since the last update or the default persistence service is not available or not a QueryablePersistenceService
    • lastUpdate

      public static @Nullable ZonedDateTime lastUpdate(Item item, @Nullable String serviceId)
      Query for the last historic update time of a given item.
      Parameters:
      item - the item for which the last historic update time is to be returned
      serviceId - the name of the PersistenceService to use
      Returns:
      point in time of the last historic update to item, null if there are no historic persisted updates, the state has changed since the last update or if persistence service given by serviceId does not refer to an available QueryablePersistenceService
    • nextUpdate

      public static @Nullable ZonedDateTime nextUpdate(Item item)
      Query the first future update time of a given item. The default persistence service is used.
      Parameters:
      item - the item for which the first future update time is to be returned
      Returns:
      point in time of the first future update to item, or null if there are no future persisted updates or the default persistence service is not available or not a QueryablePersistenceService
    • nextUpdate

      public static @Nullable ZonedDateTime nextUpdate(Item item, @Nullable String serviceId)
      Query for the first future update time of a given item.
      Parameters:
      item - the item for which the first future update time is to be returned
      serviceId - the name of the PersistenceService to use
      Returns:
      point in time of the first future update to item, or null if there are no future persisted updates or if persistence service given by serviceId does not refer to an available QueryablePersistenceService
    • lastChange

      public static @Nullable ZonedDateTime lastChange(Item item)
      Query the last historic change time of a given item. The default persistence service is used.
      Parameters:
      item - the item for which the last historic change time is to be returned
      Returns:
      point in time of the last historic change to item, null if there are no historic persisted changes, the state has changed since the last update or the default persistence service is not available or not a QueryablePersistenceService
    • lastChange

      public static @Nullable ZonedDateTime lastChange(Item item, @Nullable String serviceId)
      Query for the last historic change time of a given item.
      Parameters:
      item - the item for which the last historic change time is to be returned
      serviceId - the name of the PersistenceService to use
      Returns:
      point in time of the last historic change to item null if there are no historic persisted changes, the state has changed since the last update or if persistence service given by serviceId does not refer to an available QueryablePersistenceService
    • nextChange

      public static @Nullable ZonedDateTime nextChange(Item item)
      Query the first future change time of a given item. The default persistence service is used.
      Parameters:
      item - the item for which the first future change time is to be returned
      Returns:
      point in time of the first future change to item, or null if there are no future persisted changes or the default persistence service is not available or not a QueryablePersistenceService
    • nextChange

      public static @Nullable ZonedDateTime nextChange(Item item, @Nullable String serviceId)
      Query for the first future change time of a given item.
      Parameters:
      item - the item for which the first future change time is to be returned
      serviceId - the name of the PersistenceService to use
      Returns:
      point in time of the first future change to item, or null if there are no future persisted changes or if persistence service given by serviceId does not refer to an available QueryablePersistenceService
    • previousState

      public static @Nullable HistoricItem previousState(Item item)
      Returns the previous state of a given item.
      Parameters:
      item - the item to get the previous state value for
      Returns:
      the previous state or null if no previous state could be found, or if the default persistence service is not configured or does not refer to a QueryablePersistenceService
    • previousState

      public static @Nullable HistoricItem previousState(Item item, boolean skipEqual)
      Returns the previous state of a given item.
      Parameters:
      item - the item to get the previous state value for
      skipEqual - if true, skips equal state values and searches the first state not equal the current state
      Returns:
      the previous state or null if no previous state could be found, or if the default persistence service is not configured or does not refer to a QueryablePersistenceService
    • previousState

      public static @Nullable HistoricItem previousState(Item item, @Nullable String serviceId)
      Returns the previous state of a given item. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the previous state value for
      serviceId - the name of the PersistenceService to use
      Returns:
      the previous state or null if no previous state could be found, or if the default persistence service is not configured or does not refer to a QueryablePersistenceService
    • previousState

      public static @Nullable HistoricItem previousState(Item item, boolean skipEqual, @Nullable String serviceId)
      Returns the previous state of a given item. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the previous state value for
      skipEqual - if true, skips equal state values and searches the first state not equal the current state
      serviceId - the name of the PersistenceService to use
      Returns:
      the previous state or null if no previous state could be found, or if the given serviceId is not available or does not refer to a QueryablePersistenceService
    • nextState

      public static @Nullable HistoricItem nextState(Item item)
      Returns the next state of a given item.
      Parameters:
      item - the item to get the next state value for
      Returns:
      the next state or null if no next state could be found, or if the default persistence service is not configured or does not refer to a QueryablePersistenceService
    • nextState

      public static @Nullable HistoricItem nextState(Item item, boolean skipEqual)
      Returns the next state of a given item.
      Parameters:
      item - the item to get the next state value for
      skipEqual - if true, skips equal state values and searches the first state not equal the current state
      Returns:
      the next state or null if no next state could be found, or if the default persistence service is not configured or does not refer to a QueryablePersistenceService
    • nextState

      public static @Nullable HistoricItem nextState(Item item, @Nullable String serviceId)
      Returns the next state of a given item. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the next state value for
      serviceId - the name of the PersistenceService to use
      Returns:
      the next state or null if no next state could be found, or if the default persistence service is not configured or does not refer to a QueryablePersistenceService
    • nextState

      public static @Nullable HistoricItem nextState(Item item, boolean skipEqual, @Nullable String serviceId)
      Returns the next state of a given item. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the next state value for
      skipEqual - if true, skips equal state values and searches the first state not equal the current state
      serviceId - the name of the PersistenceService to use
      Returns:
      the next state or null if no next state could be found, or if the given serviceId is not available or does not refer to a QueryablePersistenceService
    • changedSince

      public static @Nullable Boolean changedSince(Item item, ZonedDateTime timestamp)
      Checks if the state of a given item has changed since a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to check for state changes
      timestamp - the point in time to start the check
      Returns:
      true if item state has changed, false if it has not changed, null if timestamp is in the future, if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • changedUntil

      public static @Nullable Boolean changedUntil(Item item, ZonedDateTime timestamp)
      Checks if the state of a given item will change by a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to check for state changes
      timestamp - the point in time to end the check
      Returns:
      true if item state will change, false if it will not change, null if timestamp> is in the past, if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • changedBetween

      public static @Nullable Boolean changedBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Checks if the state of a given item changes between two points in time. The default persistence service is used.
      Parameters:
      item - the item to check for state changes
      Returns:
      true if item state changes, false if the item does not change in the given interval, null if begin is after end, if the default persistence does not refer to a QueryablePersistenceService, or null if the default persistence service is not available
    • changedSince

      public static @Nullable Boolean changedSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Checks if the state of a given item has changed since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to check for state changes
      timestamp - the point in time to start the check
      serviceId - the name of the PersistenceService to use
      Returns:
      true if item state has changed, or false if it has not changed, null if timestamp is in the future, if the provided serviceId does not refer to an available QueryablePersistenceService
    • changedUntil

      public static @Nullable Boolean changedUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Checks if the state of a given item will change by a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to check for state changes
      timestamp - the point in time to end the check
      serviceId - the name of the PersistenceService to use
      Returns:
      true if item state will change, or false if it will not change, null if timestamp is in the past, if the provided serviceId does not refer to an available QueryablePersistenceService
    • changedBetween

      public static @Nullable Boolean changedBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Checks if the state of a given item changes between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to check for state changes
      begin - the point in time to start the check
      end - the point in time to stop the check
      serviceId - the name of the PersistenceService to use
      Returns:
      true if item state changed or false if the item does not change in the given interval, null if begin is after end, if the given serviceId does not refer to a QueryablePersistenceService
    • updatedSince

      public static @Nullable Boolean updatedSince(Item item, ZonedDateTime timestamp)
      Checks if the state of a given item has been updated since a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to check for state updates
      timestamp - the point in time to start the check
      Returns:
      true if item state was updated, false if the item has not been updated since timestamp, null if timestamp is in the future, if the default persistence does not refer to a QueryablePersistenceService, or null if the default persistence service is not available
    • updatedUntil

      public static @Nullable Boolean updatedUntil(Item item, ZonedDateTime timestamp)
      Checks if the state of a given item will be updated until a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to check for state updates
      timestamp - the point in time to end the check
      Returns:
      true if item state is updated, false if the item is not updated until timestamp, null if timestamp is in the past, if the default persistence does not refer to a QueryablePersistenceService, or null if the default persistence service is not available
    • updatedBetween

      public static @Nullable Boolean updatedBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Checks if the state of a given item has been updated between two points in time. The default persistence service is used.
      Parameters:
      item - the item to check for state updates
      begin - the point in time to start the check
      end - the point in time to stop the check
      Returns:
      true if item state was updated, false if the item has not been updated in the given interval, null if begin is after end, if the default persistence does not refer to a QueryablePersistenceService, or null if the default persistence service is not available
    • updatedSince

      public static @Nullable Boolean updatedSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Checks if the state of a given item has been updated since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to check for state changes
      timestamp - the point in time to start the check
      serviceId - the name of the PersistenceService to use
      Returns:
      true if item state was updated or false if the item has not been updated since timestamp, null if timestamp is in the future, if the given serviceId does not refer to a QueryablePersistenceService
    • updatedUntil

      public static @Nullable Boolean updatedUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Checks if the state of a given item will be updated until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to check for state changes
      timestamp - the point in time to end the check
      serviceId - the name of the PersistenceService to use
      Returns:
      true if item state was updated or false if the item is not updated since timestamp, null if timestamp is in the past, if the given serviceId does not refer to a QueryablePersistenceService
    • updatedBetween

      public static @Nullable Boolean updatedBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Checks if the state of a given item is updated between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to check for state changes
      begin - the point in time to start the check
      end - the point in time to stop the check
      serviceId - the name of the PersistenceService to use
      Returns:
      true if item state was updated or false if the item is not updated in the given interval, null if begin is after end, if the given serviceId does not refer to a QueryablePersistenceService
    • maximumSince

      public static @Nullable HistoricItem maximumSince(Item item, ZonedDateTime timestamp)
      Gets the historic item with the maximum value of the state of a given item since a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to get the maximum state value for
      timestamp - the point in time to start the check
      Returns:
      a historic item with the maximum state value since the given point in time, a HistoricItem constructed from the item's state if item's state is the maximum value, null if timestamp is in the future or if the default persistence service does not refer to a QueryablePersistenceService
    • maximumUntil

      public static @Nullable HistoricItem maximumUntil(Item item, ZonedDateTime timestamp)
      Gets the historic item with the maximum value of the state of a given item until a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to get the maximum state value for
      timestamp - the point in time to end the check
      Returns:
      a historic item with the maximum state value until the given point in time, a HistoricItem constructed from the item's state if item's state is the maximum value, null if timestamp is in the past or if the default persistence service does not refer to a QueryablePersistenceService
    • maximumBetween

      public static @Nullable HistoricItem maximumBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the historic item with the maximum value of the state of a given item between two points in time. The default persistence service is used.
      Parameters:
      item - the item to get the maximum state value for
      begin - the point in time to start the check
      end - the point in time to stop the check
      Returns:
      a HistoricItem with the maximum state value between two points in time, a HistoricItem constructed from the item's state if no persisted states found, or null if begin is after end or if the default persistence service does not refer to an availableQueryablePersistenceService
    • maximumSince

      public static @Nullable HistoricItem maximumSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the historic item with the maximum value of the state of a given item since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the maximum state value for
      timestamp - the point in time to start the check
      serviceId - the name of the PersistenceService to use
      Returns:
      a HistoricItem with the maximum state value since the given point in time, a HistoricItem constructed from the item's state if item's state is the maximum value, null if timestamp is in the future or if the given serviceId does not refer to an available QueryablePersistenceService
    • maximumUntil

      public static @Nullable HistoricItem maximumUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the historic item with the maximum value of the state of a given item until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the maximum state value for
      timestamp - the point in time to end the check
      serviceId - the name of the PersistenceService to use
      Returns:
      a HistoricItem with the maximum state value until the given point in time, a HistoricItem constructed from the item's state if item's state is the maximum value, null if timestamp is in the past or if the given serviceId does not refer to an available QueryablePersistenceService
    • maximumBetween

      public static @Nullable HistoricItem maximumBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the historic item with the maximum value of the state of a given item between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the maximum state value for
      begin - the point in time to start the check
      end - the point in time to stop the check
      serviceId - the name of the PersistenceService to use
      Returns:
      a HistoricItem with the maximum state value between two points in time, a HistoricItem constructed from the item's state if no persisted states found, or null if begin is after end or if the given serviceId does not refer to an available QueryablePersistenceService
    • minimumSince

      public static @Nullable HistoricItem minimumSince(Item item, ZonedDateTime timestamp)
      Gets the historic item with the minimum value of the state of a given item since a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to get the minimum state value for
      timestamp - the point in time from which to search for the minimum state value
      Returns:
      a historic item with the minimum state value since the given point in time, a HistoricItem constructed from the item's state if item's state is the minimum value, null if timestamp is in the future or if the default persistence service does not refer to a QueryablePersistenceService
    • minimumUntil

      public static @Nullable HistoricItem minimumUntil(Item item, ZonedDateTime timestamp)
      Gets the historic item with the minimum value of the state of a given item until a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to get the minimum state value for
      timestamp - the point in time to which to search for the minimum state value
      Returns:
      a historic item with the minimum state value until the given point in time, a HistoricItem constructed from the item's state if item's state is the minimum value, null if timestamp is in the past or if the default persistence service does not refer to a QueryablePersistenceService
    • minimumBetween

      public static @Nullable HistoricItem minimumBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the historic item with the minimum value of the state of a given item between two certain points in time. The default persistence service is used.
      Parameters:
      item - the item to get the minimum state value for
      begin - the beginning point in time
      end - the ending point in time to
      Returns:
      a HistoricItem with the minimum state value between two points in time, a HistoricItem constructed from the item's state if no persisted states found, or null if begin is after end or if the default persistence service does not refer to an availableQueryablePersistenceService
    • minimumSince

      public static @Nullable HistoricItem minimumSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the historic item with the minimum value of the state of a given item since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the minimum state value for
      timestamp - the point in time from which to search for the minimum state value
      serviceId - the name of the PersistenceService to use
      Returns:
      a HistoricItem with the minimum state value since the given point in time, a HistoricItem constructed from the item's state if item's state is the minimum value, null if timestamp is in the future or if the given serviceId does not refer to an available QueryablePersistenceService
    • minimumUntil

      public static @Nullable HistoricItem minimumUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the historic item with the minimum value of the state of a given item until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the minimum state value for
      timestamp - the point in time to which to search for the minimum state value
      serviceId - the name of the PersistenceService to use
      Returns:
      a HistoricItem with the minimum state value until the given point in time, a HistoricItem constructed from the item's state if item's state is the minimum value, null if timestamp is in the past or if the given serviceId does not refer to an available QueryablePersistenceService
    • minimumBetween

      public static @Nullable HistoricItem minimumBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the historic item with the minimum value of the state of a given item between two certain points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the minimum state value for
      begin - the beginning point in time
      end - the end point in time to
      serviceId - the name of the PersistenceService to use
      Returns:
      a HistoricItem with the minimum state value between two points in time, a HistoricItem constructed from the item's state if no persisted states found, or null if begin is after end or if the given serviceId does not refer to an available QueryablePersistenceService
    • varianceSince

      public static @Nullable State varianceSince(Item item, ZonedDateTime timestamp)
      Gets the variance of the state of the given Item since a certain point in time. The default PersistenceService is used.
      Parameters:
      item - the Item to get the variance for
      timestamp - the point in time from which to compute the variance
      Returns:
      the variance between then and now, or null if timestamp is in the future, if there is no default persistence service available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • varianceUntil

      public static @Nullable State varianceUntil(Item item, ZonedDateTime timestamp)
      Gets the variance of the state of the given Item until a certain point in time. The default PersistenceService is used.
      Parameters:
      item - the Item to get the variance for
      timestamp - the point in time to which to compute the variance
      Returns:
      the variance between now and then, or null if timestamp is in the past, if there is no default persistence service available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • varianceBetween

      public static @Nullable State varianceBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the variance of the state of the given Item between two certain point in time. The default PersistenceService is used.
      Parameters:
      item - the Item to get the variance for
      begin - the point in time from which to compute the variance
      end - the end time for the computation
      Returns:
      the variance between both points of time, or null if begin is after end, if there is no default persistence service available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item between begin and end
    • varianceSince

      public static @Nullable State varianceSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the variance of the state of the given Item since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the variance for
      timestamp - the point in time from which to compute the variance
      serviceId - the name of the PersistenceService to use
      Returns:
      the variance between then and now, or null if timestamp is in the future, if the persistence service given by serviceId is not available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • varianceUntil

      public static @Nullable State varianceUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the variance of the state of the given Item until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the variance for
      timestamp - the point in time to which to compute the variance
      serviceId - the name of the PersistenceService to use
      Returns:
      the variance between now and then, or null if timestamp is in the past, if the persistence service given by serviceId is not available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • varianceBetween

      public static @Nullable State varianceBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the variance of the state of the given Item between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the variance for
      begin - the point in time from which to compute
      end - the end time for the computation
      serviceId - the name of the PersistenceService to use
      Returns:
      the variance between both points of time, or null if begin is after end, if the persistence service given by serviceId is not available, or it is not a QueryablePersistenceService, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item between begin and end
    • deviationSince

      public static @Nullable State deviationSince(Item item, ZonedDateTime timestamp)
      Gets the standard deviation of the state of the given Item since a certain point in time. The default PersistenceService is used. Note: If you need variance and standard deviation at the same time do not query both as it is a costly operation. Get the variance only, it is the squared deviation.
      Parameters:
      item - the Item to get the standard deviation for
      timestamp - the point in time from which to compute the standard deviation
      Returns:
      the standard deviation between then and now, or null if timestamp is in the future, if there is no default persistence service available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • deviationUntil

      public static @Nullable State deviationUntil(Item item, ZonedDateTime timestamp)
      Gets the standard deviation of the state of the given Item until a certain point in time. The default PersistenceService is used. Note: If you need variance and standard deviation at the same time do not query both as it is a costly operation. Get the variance only, it is the squared deviation.
      Parameters:
      item - the Item to get the standard deviation for
      timestamp - the point in time to which to compute the standard deviation
      Returns:
      the standard deviation between now and then, or null if timestamp is in the past, if there is no default persistence service available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • deviationBetween

      public static @Nullable State deviationBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the standard deviation of the state of the given Item between two points in time. The default PersistenceService is used. Note: If you need variance and standard deviation at the same time do not query both as it is a costly operation. Get the variance only, it is the squared deviation.
      Parameters:
      item - the Item to get the standard deviation for
      begin - the point in time from which to compute
      end - the end time for the computation
      Returns:
      the standard deviation between both points of time, or null if begin is after end, if there is no default persistence service available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item between begin and end
    • deviationSince

      public static @Nullable State deviationSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the standard deviation of the state of the given Item since a certain point in time. The PersistenceService identified by the serviceId is used. Note: If you need variance and standard deviation at the same time do not query both as it is a costly operation. Get the variance only, it is the squared deviation.
      Parameters:
      item - the Item to get the standard deviation for
      timestamp - the point in time from which to compute the standard deviation
      serviceId - the name of the PersistenceService to use
      Returns:
      the standard deviation between then and now, or null if timestamp is in the future, if the persistence service given by serviceId is not available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • deviationUntil

      public static @Nullable State deviationUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the standard deviation of the state of the given Item until a certain point in time. The PersistenceService identified by the serviceId is used. Note: If you need variance and standard deviation at the same time do not query both as it is a costly operation. Get the variance only, it is the squared deviation.
      Parameters:
      item - the Item to get the standard deviation for
      timestamp - the point in time to which to compute the standard deviation
      serviceId - the name of the PersistenceService to use
      Returns:
      the standard deviation between now and then, or null if timestamp is in the past, if the persistence service given by serviceId is not available, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item at the given timestamp
    • deviationBetween

      public static @Nullable State deviationBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the standard deviation of the state of the given Item between two points in time. The PersistenceService identified by the serviceId is used. Note: If you need variance and standard deviation at the same time do not query both as it is a costly operation. Get the variance only, it is the squared deviation.
      Parameters:
      item - the Item to get the standard deviation for
      begin - the point in time from which to compute
      end - the end time for the computation
      serviceId - the name of the PersistenceService to use
      Returns:
      the standard deviation between both points of time, or null if begin is after end, if the persistence service given by serviceId is not available, or it is not a QueryablePersistenceService, or it is not a QueryablePersistenceService, or if there is no persisted state for the given item between begin and end
    • averageSince

      public static @Nullable State averageSince(Item item, ZonedDateTime timestamp)
      Gets the average value of the state of a given Item since a certain point in time. The default PersistenceService is used.
      Parameters:
      item - the Item to get the average value for
      timestamp - the point in time from which to search for the average value
      Returns:
      the average value since timestamp or null if no previous states could be found or if the default persistence service does not refer to an available QueryablePersistenceService. The current state is included in the calculation.
    • averageUntil

      public static @Nullable State averageUntil(Item item, ZonedDateTime timestamp)
      Gets the average value of the state of a given Item until a certain point in time. The default PersistenceService is used.
      Parameters:
      item - the Item to get the average value for
      timestamp - the point in time to which to search for the average value
      Returns:
      the average value until timestamp or null if no future states could be found or if the default persistence service does not refer to an available QueryablePersistenceService. The current state is included in the calculation.
    • averageBetween

      public static @Nullable State averageBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the average value of the state of a given Item between two certain points in time. The default PersistenceService is used.
      Parameters:
      item - the Item to get the average value for
      begin - the point in time from which to start the summation
      end - the point in time to which to start the summation
      Returns:
      the average value between begin and end or null if no states could be found or if the default persistence service does not refer to an available QueryablePersistenceService.
    • averageSince

      public static @Nullable State averageSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the average value of the state of a given Item since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the average value for
      timestamp - the point in time from which to search for the average value
      serviceId - the name of the PersistenceService to use
      Returns:
      the average value since timestamp, or null if no previous states could be found or if the persistence service given by serviceId does not refer to an available QueryablePersistenceService. The current state is included in the calculation.
    • averageUntil

      public static @Nullable State averageUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the average value of the state of a given Item until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the average value for
      timestamp - the point in time to which to search for the average value
      serviceId - the name of the PersistenceService to use
      Returns:
      the average value until timestamp, or null if no future states could be found or if the persistence service given by serviceId does not refer to an available QueryablePersistenceService. The current state is included in the calculation.
    • averageBetween

      public static @Nullable State averageBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the average value of the state of a given Item between two certain points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the average value for
      begin - the point in time from which to start the summation
      end - the point in time to which to start the summation
      serviceId - the name of the PersistenceService to use
      Returns:
      the average value between begin and end, or null if no states could be found or if the persistence service given by serviceId does not refer to an available QueryablePersistenceService
    • sumSince

      public static @Nullable State sumSince(Item item, ZonedDateTime timestamp)
      Gets the sum of the state of a given item since a certain point in time. The default persistence service is used.
      Parameters:
      item - the item for which we will sum its persisted state values since timestamp
      timestamp - the point in time from which to start the summation
      Returns:
      the sum of the state values since timestamp, or null if timestamp is in the future or the default persistence service does not refer to a QueryablePersistenceService
    • sumUntil

      public static @Nullable State sumUntil(Item item, ZonedDateTime timestamp)
      Gets the sum of the state of a given item until a certain point in time. The default persistence service is used.
      Parameters:
      item - the item for which we will sum its persisted state values to timestamp
      timestamp - the point in time to which to start the summation
      Returns:
      the sum of the state values until timestamp, or null if timestamp is in the past or the default persistence service does not refer to a QueryablePersistenceService
    • sumBetween

      public static @Nullable State sumBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the sum of the state of a given item between two certain points in time. The default persistence service is used.
      Parameters:
      item - the item for which we will sum its persisted state values between begin and end
      begin - the point in time from which to start the summation
      end - the point in time to which to start the summation
      Returns:
      the sum of the state values between the given points in time, or null if begin is after end or if the default persistence service does not refer to a QueryablePersistenceService
    • sumSince

      public static @Nullable State sumSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the sum of the state of a given item since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item for which we will sum its persisted state values since timestamp
      timestamp - the point in time from which to start the summation
      serviceId - the name of the PersistenceService to use
      Returns:
      the sum of the state values since timestamp, or null if timestamp is in the future or serviceId does not refer to a QueryablePersistenceService
    • sumUntil

      public static @Nullable State sumUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the sum of the state of a given item until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item for which we will sum its persisted state values to timestamp
      timestamp - the point in time to which to start the summation
      serviceId - the name of the PersistenceService to use
      Returns:
      the sum of the state values until timestamp, or null if timestamp is in the past or serviceId does not refer to a QueryablePersistenceService
    • sumBetween

      public static @Nullable State sumBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the sum of the state of a given item between two certain points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item for which we will sum its persisted state values between begin and end
      begin - the point in time from which to start the summation
      end - the point in time to which to start the summation
      serviceId - the name of the PersistenceService to use
      Returns:
      the sum of the state values between the given points in time, or null if begin is after end or serviceId does not refer to a QueryablePersistenceService
    • deltaSince

      public static @Nullable State deltaSince(Item item, ZonedDateTime timestamp)
      Gets the difference value of the state of a given item since a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to get the delta state value for
      timestamp - the point in time from which to compute the delta
      Returns:
      the difference between now and then, or null 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 service
    • deltaUntil

      public static @Nullable State deltaUntil(Item item, ZonedDateTime timestamp)
      Gets the difference value of the state of a given item until a certain point in time. The default persistence service is used.
      Parameters:
      item - the item to get the delta state value for
      timestamp - the point in time to which to compute the delta
      Returns:
      the difference between then and now, or null 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 service
    • deltaBetween

      public static @Nullable State deltaBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the difference value of the state of a given item between two points in time. The default persistence service is used.
      Parameters:
      item - the item to get the delta for
      begin - the beginning point in time
      end - the end point in time
      Returns:
      the difference between end and begin, or null if the default persistence service does not refer to an available QueryablePersistenceService, or if there is no persisted state for the given item for the given points in time
    • deltaSince

      public static @Nullable State deltaSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the difference value of the state of a given item since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the delta for
      timestamp - the point in time from which to compute the delta
      serviceId - the name of the PersistenceService to use
      Returns:
      the difference between now and then, or null 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 serviceId
    • deltaUntil

      public static @Nullable State deltaUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the difference value of the state of a given item until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the delta for
      timestamp - the point in time to which to compute the delta
      serviceId - the name of the PersistenceService to use
      Returns:
      the difference between then and now, or null 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 serviceId
    • deltaBetween

      public static @Nullable State deltaBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the difference value of the state of a given item between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the item to get the delta for
      begin - the beginning point in time
      end - the end point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the difference between end and begin, or null 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 points in time
    • evolutionRate

      @Deprecated public static @Nullable DecimalType evolutionRate(Item item, ZonedDateTime timestamp)
      Deprecated.
      Gets the evolution rate of the state of a given Item since a certain point in time. The default PersistenceService is used. This method has been deprecated and evolutionRateSince(Item, ZonedDateTime) should be used instead.
      Parameters:
      item - the item to get the evolution rate value for
      timestamp - the point in time from which to compute the evolution rate
      Returns:
      the evolution rate in percent (positive and negative) between now and then, or null 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)
    • evolutionRateSince

      public static @Nullable DecimalType evolutionRateSince(Item item, ZonedDateTime timestamp)
      Gets the evolution rate of the state of a given Item since a certain point in time. The default PersistenceService is used.
      Parameters:
      item - the item to get the evolution rate value for
      timestamp - the point in time from which to compute the evolution rate
      Returns:
      the evolution rate in percent (positive and negative) between now and then, or null 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)
    • evolutionRateUntil

      public static @Nullable DecimalType evolutionRateUntil(Item item, ZonedDateTime timestamp)
      Gets the evolution rate of the state of a given Item until a certain point in time. The default PersistenceService is used.
      Parameters:
      item - the item to get the evolution rate value for
      timestamp - the point in time to which to compute the evolution rate
      Returns:
      the evolution rate in percent (positive and negative) between then and now, or null 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)
    • evolutionRate

      @Deprecated public static @Nullable DecimalType evolutionRate(Item item, ZonedDateTime begin, ZonedDateTime end)
      Deprecated.
      Gets the evolution rate of the state of a given Item between two points in time. The default PersistenceService is used. This method has been deprecated and evolutionRateBetween(Item, ZonedDateTime, ZonedDateTime) should be used instead.
      Parameters:
      item - the item to get the evolution rate value for
      begin - the beginning point in time
      end - the end point in time
      Returns:
      the evolution rate in percent (positive and negative) in the given interval, or null if there is no default persistence service available, the default persistence service is not a QueryablePersistenceService, or if there are no persisted state for the given item at the given interval, or if there is a state but it is zero (which would cause a divide-by-zero error)
    • evolutionRateBetween

      public static @Nullable DecimalType evolutionRateBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the evolution rate of the state of a given Item between two points in time. The default PersistenceService is used.
      Parameters:
      item - the item to get the evolution rate value for
      begin - the beginning point in time
      end - the end point in time
      Returns:
      the evolution rate in percent (positive and negative) in the given interval, or null if there is no default persistence service available, the default persistence service is not a QueryablePersistenceService, or if there are no persisted state for the given item at the given interval, or if there is a state but it is zero (which would cause a divide-by-zero error)
    • evolutionRate

      @Deprecated public static @Nullable DecimalType evolutionRate(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Deprecated.
      Gets the evolution rate of the state of a given Item since a certain point in time. The PersistenceService identified by the serviceId is used. This method has been deprecated and evolutionRateSince(Item, ZonedDateTime, String) should be used instead.
      Parameters:
      item - the Item to get the evolution rate value for
      timestamp - the point in time from which to compute the evolution rate
      serviceId - the name of the PersistenceService to use
      Returns:
      the evolution rate in percent (positive and negative) between now and then, or null 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)
    • evolutionRateSince

      public static @Nullable DecimalType evolutionRateSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the evolution rate of the state of a given Item since a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the evolution rate value for
      timestamp - the point in time from which to compute the evolution rate
      serviceId - the name of the PersistenceService to use
      Returns:
      the evolution rate in percent (positive and negative) between now and then, or null 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)
    • evolutionRateUntil

      public static @Nullable DecimalType evolutionRateUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the evolution rate of the state of a given Item until a certain point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the evolution rate value for
      timestamp - the point in time to which to compute the evolution rate
      serviceId - the name of the PersistenceService to use
      Returns:
      the evolution rate in percent (positive and negative) between then and now, or null 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)
    • evolutionRate

      @Deprecated public static @Nullable DecimalType evolutionRate(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Deprecated.
      Gets the evolution rate of the state of a given Item between two points in time. The PersistenceService identified by the serviceId is used. This method has been deprecated and evolutionRateBetween(Item, ZonedDateTime, ZonedDateTime, String) should be used instead.
      Parameters:
      item - the Item to get the evolution rate value for
      begin - the beginning point in time
      end - the end point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the evolution rate in percent (positive and negative) in the given interval, or null 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 begin and end 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)
    • evolutionRateBetween

      public static @Nullable DecimalType evolutionRateBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the evolution rate of the state of a given Item between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to get the evolution rate value for
      begin - the beginning point in time
      end - the end point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the evolution rate in percent (positive and negative) in the given interval, or null 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 begin and end 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)
    • countSince

      public static @Nullable Long countSince(Item item, ZonedDateTime timestamp)
      Gets the number of available historic data points of a given Item from a point in time until now. The default PersistenceService is used.
      Parameters:
      item - the Item to query
      timestamp - the beginning point in time
      Returns:
      the number of values persisted for this item, null if timestamp is in the future, if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • countUntil

      public static @Nullable Long countUntil(Item item, ZonedDateTime timestamp)
      Gets the number of available data points of a given Item from now to a point in time. The default PersistenceService is used.
      Parameters:
      item - the Item to query
      timestamp - the ending point in time
      Returns:
      the number of values persisted for this item, null if timestamp is in the past, if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • countBetween

      public static @Nullable Long countBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the number of available data points of a given Item between two points in time. The default PersistenceService is used.
      Parameters:
      item - the Item to query
      begin - the beginning point in time
      end - the end point in time
      Returns:
      the number of values persisted for this item, null if begin is after end, if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • countSince

      public static @Nullable Long countSince(Item item, ZonedDateTime begin, @Nullable String serviceId)
      Gets the number of available historic data points of a given Item from a point in time until now. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to query
      begin - the beginning point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the number of values persisted for this item, null if timestamp is in the future, if the persistence service is not available or does not refer to a QueryablePersistenceService
    • countUntil

      public static @Nullable Long countUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the number of available data points of a given Item from now to a point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to query
      timestamp - the ending point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the number of values persisted for this item, null if timestamp is in the past, if the persistence service is not available or does not refer to a QueryablePersistenceService
    • countBetween

      public static @Nullable Long countBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the number of available data points of a given Item between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to query
      begin - the beginning point in time
      end - the end point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the number of values persisted for this item, null if begin is after end, if the persistence service is not available or does not refer to a QueryablePersistenceService
    • countStateChangesSince

      public static @Nullable Long countStateChangesSince(Item item, ZonedDateTime timestamp)
      Gets the number of changes in historic data points of a given Item from a point in time until now. The default PersistenceService is used.
      Parameters:
      item - the Item to query
      timestamp - the beginning point in time
      Returns:
      the number of state changes for this item, null if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • countStateChangesUntil

      public static @Nullable Long countStateChangesUntil(Item item, ZonedDateTime timestamp)
      Gets the number of changes in data points of a given Item from now until a point in time. The default PersistenceService is used.
      Parameters:
      item - the Item to query
      timestamp - the ending point in time
      Returns:
      the number of state changes for this item, null if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • countStateChangesBetween

      public static @Nullable Long countStateChangesBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Gets the number of changes in data points of a given Item between two points in time. The default PersistenceService is used.
      Parameters:
      item - the Item to query
      begin - the beginning point in time
      end - the end point in time
      Returns:
      the number of state changes for this item, null if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • countStateChangesSince

      public static @Nullable Long countStateChangesSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the number of changes in historic data points of a given Item from a point in time until now. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to query
      timestamp - the beginning point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the number of state changes for this item, null if the persistence service is not available or does not refer to a QueryablePersistenceService
    • countStateChangesUntil

      public static @Nullable Long countStateChangesUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Gets the number of changes in data points of a given Item from now until a point in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to query
      timestamp - the ending point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the number of state changes for this item, null if the persistence service is not available or does not refer to a QueryablePersistenceService
    • countStateChangesBetween

      public static @Nullable Long countStateChangesBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Gets the number of changes in data points of a given Item between two points in time. The PersistenceService identified by the serviceId is used.
      Parameters:
      item - the Item to query
      begin - the beginning point in time
      end - the end point in time
      serviceId - the name of the PersistenceService to use
      Returns:
      the number of state changes for this item, null if the persistence service is not available or does not refer to a QueryablePersistenceService
    • getAllStatesSince

      public static @Nullable Iterable<HistoricItem> getAllStatesSince(Item item, ZonedDateTime timestamp)
      Retrieves the historic items for a given item since a certain point in time. The default persistence service is used.
      Parameters:
      item - the item for which to retrieve the historic item
      timestamp - the point in time from which to retrieve the states
      Returns:
      the historic items since the given point in time, or null if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • getAllStatesUntil

      public static @Nullable Iterable<HistoricItem> getAllStatesUntil(Item item, ZonedDateTime timestamp)
      Retrieves the future items for a given item until a certain point in time. The default persistence service is used.
      Parameters:
      item - the item for which to retrieve the future item
      timestamp - the point in time to which to retrieve the states
      Returns:
      the future items to the given point in time, or null if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • getAllStatesBetween

      public static @Nullable Iterable<HistoricItem> getAllStatesBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Retrieves the historic items for a given item between two points in time. The default persistence service is used.
      Parameters:
      item - the item for which to retrieve the historic item
      begin - the point in time from which to retrieve the states
      end - the point in time to which to retrieve the states
      Returns:
      the historic items between the given points in time, or null if the default persistence service is not available or does not refer to a QueryablePersistenceService
    • getAllStatesSince

      public static @Nullable Iterable<HistoricItem> getAllStatesSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Retrieves the historic items for a given item since a certain point in time through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item for which to retrieve the historic item
      timestamp - the point in time from which to retrieve the states
      serviceId - the name of the PersistenceService to use
      Returns:
      the historic items since the given point in time, or null if the provided serviceId does not refer to an available QueryablePersistenceService
    • getAllStatesUntil

      public static @Nullable Iterable<HistoricItem> getAllStatesUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Retrieves the future items for a given item until a certain point in time through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item for which to retrieve the future item
      timestamp - the point in time to which to retrieve the states
      serviceId - the name of the PersistenceService to use
      Returns:
      the future items to the given point in time, or null if the provided serviceId does not refer to an available QueryablePersistenceService
    • getAllStatesBetween

      public static @Nullable Iterable<HistoricItem> getAllStatesBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Retrieves the historic items for a given item between two points in time through a PersistenceService identified by the serviceId.
      Parameters:
      item - the item for which to retrieve the historic item
      begin - the point in time from which to retrieve the states
      end - the point in time to which to retrieve the states
      serviceId - the name of the PersistenceService to use
      Returns:
      the historic items between the given points in time, or null if the provided serviceId does not refer to an available QueryablePersistenceService
    • removeAllStatesSince

      public static void removeAllStatesSince(Item item, ZonedDateTime timestamp)
      Removes from persistence the historic items for a given item since a certain point in time. The default persistence service is used. This will only have effect if the pPersistenceService is a ModifiablePersistenceService.
      Parameters:
      item - the item for which to remove the historic item
      timestamp - the point in time from which to remove the states
    • removeAllStatesUntil

      public static void removeAllStatesUntil(Item item, ZonedDateTime timestamp)
      Removes from persistence the future items for a given item until a certain point in time. The default persistence service is used. This will only have effect if the pPersistenceService is a ModifiablePersistenceService.
      Parameters:
      item - the item for which to remove the future item
      timestamp - the point in time to which to remove the states
    • removeAllStatesBetween

      public static void removeAllStatesBetween(Item item, ZonedDateTime begin, ZonedDateTime end)
      Removes from persistence the historic items for a given item between two points in time. The default persistence service is used. This will only have effect if the pPersistenceService is a ModifiablePersistenceService.
      Parameters:
      item - the item for which to remove the historic item
      begin - the point in time from which to remove the states
      end - the point in time to which to remove the states
    • removeAllStatesSince

      public static void removeAllStatesSince(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Removes from persistence the historic items for a given item since a certain point in time through a PersistenceService identified by the serviceId. This will only have effect if the pPersistenceService is a ModifiablePersistenceService.
      Parameters:
      item - the item for which to remove the historic item
      timestamp - the point in time from which to remove the states
      serviceId - the name of the PersistenceService to use
    • removeAllStatesUntil

      public static void removeAllStatesUntil(Item item, ZonedDateTime timestamp, @Nullable String serviceId)
      Removes from persistence the future items for a given item until a certain point in time through a PersistenceService identified by the serviceId. This will only have effect if the pPersistenceService is a ModifiablePersistenceService.
      Parameters:
      item - the item for which to remove the future item
      timestamp - the point in time to which to remove the states
      serviceId - the name of the PersistenceService to use
    • removeAllStatesBetween

      public static void removeAllStatesBetween(Item item, ZonedDateTime begin, ZonedDateTime end, @Nullable String serviceId)
      Removes from persistence the historic items for a given item beetween two points in time through a PersistenceService identified by the serviceId. This will only have effect if the pPersistenceService is a ModifiablePersistenceService.
      Parameters:
      item - the item for which to remove the historic item
      begin - the point in time from which to remove the states
      end - the point in time to which to remove the states
      serviceId - the name of the PersistenceService to use