Skip to content

Commit

Permalink
re-add deprecated evolutionRate variant
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Herwege <[email protected]>
  • Loading branch information
mherwege committed May 3, 2024
1 parent 767cbd9 commit 44aa427
Showing 1 changed file with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,26 @@ private static void internalPersist(Item item, TimeSeries timeSeries, String ser
return internalEvolutionRateBetween(item, null, timestamp);
}

/**
* Gets the evolution rate of the state of a given {@link Item} between two points in time.
* The default {@link PersistenceService} is used.
*
* @param item the item to get the evolution rate value for
* @param begin the beginning point in time
* @param end the end point in time
* @return the evolution rate in percent (positive and negative) in the given interval, or <code>null</code> if
* there is no default persistence service available, the default persistence service is not a
* {@link QueryablePersistenceService}, or if there are no persisted state for the given <code>item</code>
* at the given interval, or if there is a state but it is zero (which would cause a
* divide-by-zero error)
*/
@Deprecated
public static @Nullable DecimalType evolutionRate(Item item, ZonedDateTime begin, ZonedDateTime end) {
LoggerFactory.getLogger(PersistenceExtensions.class).info(
"The evolutionRate method has been deprecated and will be removed in a future version, use evolutionRateBetween instead.");
return internalEvolutionRateBetween(item, begin, end);
}

/**
* Gets the evolution rate of the state of a given {@link Item} between two points in time.
* The default {@link PersistenceService} is used.
Expand Down Expand Up @@ -1803,6 +1823,29 @@ private static void internalPersist(Item item, TimeSeries timeSeries, String ser
return internalEvolutionRateBetween(item, null, timestamp, serviceId);
}

/**
* Gets the evolution rate of the state of a given {@link Item} between two points in time.
* The {@link PersistenceService} identified by the <code>serviceId</code> is used.
*
* @param item the {@link Item} to get the evolution rate value for
* @param begin the beginning point in time
* @param end the end point in time
* @param serviceId the name of the {@link PersistenceService} to use
* @return the evolution rate in percent (positive and negative) in the given interval, or <code>null</code> if
* the persistence service given by <code>serviceId</code> is not available or is not a
* {@link QueryablePersistenceService}, or if there is no persisted state for the given
* <code>item</code> at the given <code>begin</code> and <code>end</code> using the persistence service
* given by <code>serviceId</code>, or if there is a state but it is zero (which would cause a
* divide-by-zero error)
*/
@Deprecated
public static @Nullable DecimalType evolutionRate(Item item, ZonedDateTime begin, ZonedDateTime end,
String serviceId) {
LoggerFactory.getLogger(PersistenceExtensions.class).info(
"The evolutionRate method has been deprecated and will be removed in a future version, use evolutionRateBetween instead.");
return internalEvolutionRateBetween(item, begin, end, serviceId);
}

/**
* Gets the evolution rate of the state of a given {@link Item} between two points in time.
* The {@link PersistenceService} identified by the <code>serviceId</code> is used.
Expand Down

0 comments on commit 44aa427

Please sign in to comment.