Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistence extension, re-add deprecated evolutionRate method variants #4212

Merged
merged 1 commit into from
May 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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