|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface UsageSummaryDAO
| Method Summary | |
|---|---|
UsageSummary |
findByIdWithMinimalSelect(Long usageSummaryId)
Find a UsageSummary by its id, but load only
certain primitive properties. |
List<Long> |
findByNonZeroRateAtInstant(String resourceId,
long instant)
Find entity IDs for UsageSummarys belonging to the resource identified
by resourceId and having a non-zero absolute rate at time instant
instant |
UsageSummary |
findByResourceAndMetric(Long entityId,
Long metricId)
Find by the owning ResourceWithUsageByMetric and a Metric. |
List<UsageSummary> |
findByResourceId(String resourceId)
Find all UsageSummarys belonging to the
owning ResourceWithUsageByMetric that has a resource
id of resourceId. |
UsageSummary |
findByResourceIdAndMetric(String resourceId,
Long metricId)
Find by the owning ResourceWithUsageByMetric and a Metric. |
UsageSummaryElement |
findElementByInstant(Long usageSummaryId,
long instant)
Find the child UsageSummaryElement at an instant
in time. |
Long |
findIdByResourceAndMetric(Long entityId,
Long metricId)
Find by the owning ResourceWithUsageByMetric and a Metric,
but select only the entity id. |
Long |
findIdByResourceIdAndMetric(String resourceId,
Long metricId)
Find by the owning ResourceWithUsageByMetric and a Metric,
but select only the entity id. |
List<Metric> |
findMetricsForResource(Long entityId)
Get a list of Metrics associated witht the
ResourceWithUsageByMetric identified by entityId. |
UsageSummaryElement |
findNextElement(Long usageSummaryId,
long instant)
Find the next UsageSummaryElement after an instant
in time. |
UsageSummaryElement |
findNextElementWithNonZeroRate(Long usageSummaryId,
long instant)
Find the next UsageSummaryElement with a non zero rate after
an instant in time. |
UsageSummaryElement |
findPreviousElement(Long usageSummaryId,
long instant)
Find the previous UsageSummaryElement before an instant
in time. |
long |
getPreviousInstant(Long usageSummaryId,
long instant)
Get the time instant of the UsageSummaryElement |
double |
getRate(Long usageSummaryId)
Calculate the current rate for the UsageSummary
identified by usageSummaryId. |
double |
getRate(Long usageSummaryId,
long instant)
Calculate the rate at an instant in time, for the UsageSummary
identified by usageSummaryId and at the time instant,
instant, |
double |
getTotalPositiveRateChange(Long usageSummaryId,
long startInstant,
long endInstant)
Aggregate all positive rate changes between startInstant and endInstant
for the for the UsageSummary identified by usageSummaryId. |
double |
getUsage(Long usageSummaryId)
Calculate the current usage for the UsageSummary
identified by usageSummaryId. |
double |
getUsage(Long usageSummaryId,
long instant)
Calculate the usage at an instant in time, for the UsageSummary
identified by usageSummaryId and at the time instant,
instant, |
boolean |
isElementAtInstant(Long usageSummaryId,
long instant)
Determine if there is a UsageSummaryElement whose time
instant at instant. |
void |
updateLastElement(UsageSummary usageSummary,
long latestElementId,
long latestElementInstant)
Update the record for the latest element (by time instant, not time report received). |
void |
updateTotalRate(UsageSummary usageSummary,
double totalRate)
Each UsageSummary maintains an aggregation of the total rate over the
UsageSummaryElements it contains. |
| Methods inherited from interface uk.ac.soton.itinnovation.grid.service.sla.dao.GenericDAO |
|---|
delete, findAll, findById, findById, saveOrUpdate |
| Method Detail |
|---|
UsageSummary findByIdWithMinimalSelect(Long usageSummaryId)
UsageSummary by its id, but load only
certain primitive properties. This is a more efficient finder
than findById, for when only these fields are required.
usageSummaryId - the id of the UsageSummary
null.List<UsageSummary> findByResourceId(String resourceId)
UsageSummarys belonging to the
owning ResourceWithUsageByMetric that has a resource
id of resourceId. A minimal select only occurs.
resourceId -
List<Metric> findMetricsForResource(Long entityId)
Metrics associated witht the
ResourceWithUsageByMetric identified by entityId.
entityId - the id for the owning ResourceWithUsageByMetric
List of Metrics associated with the resource
UsageSummary findByResourceAndMetric(Long entityId,
Long metricId)
ResourceWithUsageByMetric and a Metric.
entityId - the id for the owning ResourceWithUsageByMetricmetricId - the id for the Metric
null.
Long findIdByResourceAndMetric(Long entityId,
Long metricId)
ResourceWithUsageByMetric and a Metric,
but select only the entity id.
entityId - the id for the owning ResourceWithUsageByMetricmetricId - the id for the Metric
null.
Long findIdByResourceIdAndMetric(String resourceId,
Long metricId)
ResourceWithUsageByMetric and a Metric,
but select only the entity id.
resourceId - the resource id for the owning ResourceWithUsageByMetricmetricId - the id for the Metric
null.
UsageSummary findByResourceIdAndMetric(String resourceId,
Long metricId)
ResourceWithUsageByMetric and a Metric.
resourceId - the resource id for the owning ResourceWithUsageByMetricmetricId - the id for the Metric
null.
List<Long> findByNonZeroRateAtInstant(String resourceId,
long instant)
UsageSummarys belonging to the resource identified
by resourceId and having a non-zero absolute rate at time instant
instant
resourceId - the resource id for the owning ResourceWithUsageByMetricinstant - the time instant for which there may be a non zero rate.double getRate(Long usageSummaryId)
UsageSummary
identified by usageSummaryId.
usageSummaryId - the id of the UsageSummary
double getUsage(Long usageSummaryId)
UsageSummary
identified by usageSummaryId.
usageSummaryId - the id of the UsageSummary
double getRate(Long usageSummaryId,
long instant)
UsageSummary
identified by usageSummaryId and at the time instant,
instant,
instant - the time instant in millisecondsusageSummaryId - the id of the UsageSummary
double getUsage(Long usageSummaryId,
long instant)
UsageSummary
identified by usageSummaryId and at the time instant,
instant,
instant - the time instant in millisecondsusageSummaryId - the id of the UsageSummary
double getTotalPositiveRateChange(Long usageSummaryId,
long startInstant,
long endInstant)
startInstant and endInstant
for the for the UsageSummary identified by usageSummaryId.
Note that only positive rate changes are included in the result. Also, a rate change at
startInstant is excluded whereas a rate change at endInstant is
included.
usageSummaryId - the id of the UsageSummarystartInstant - the time instant in milliseconds at the start of the periodendInstant - the time instant in milliseconds at the end of the period
long getPreviousInstant(Long usageSummaryId,
long instant)
UsageSummaryElement previous
to instant.
Note that if there is a UsageSummaryElement whose time
instant is actually at instant, it is ignored.
- Parameters:
usageSummaryId - the id of the owning UsageSummaryinstant - the time instant in milliseconds
- Returns:
- the instant of the previous
UsageSummaryElement
or -1, if there is not a previous element.
boolean isElementAtInstant(Long usageSummaryId,
long instant)
UsageSummaryElement whose time
instant at instant.
usageSummaryId - the id of the owning UsageSummaryinstant - the time instant in milliseconds
- Returns:
true if there is an element at instant, or
false, if there is not.
UsageSummaryElement findElementByInstant(Long usageSummaryId,
long instant)
UsageSummaryElement at an instant
in time.
usageSummaryId - the id of the owning UsageSummaryinstant - the time instant in milliseconds
UsageSummaryElement or null
UsageSummaryElement findPreviousElement(Long usageSummaryId,
long instant)
UsageSummaryElement before an instant
in time.
Note that the UsageSummaryElement whose time instant is actually at
instant (if any), is excluded from the search.
usageSummaryId - the id of the owning UsageSummaryinstant - the time instant in milliseconds
UsageSummaryElement or null
UsageSummaryElement findNextElement(Long usageSummaryId,
long instant)
UsageSummaryElement after an instant
in time.
Note that the UsageSummaryElement whose time instant is actually at
instant (if any), is excluded from the search.
usageSummaryId - the id of the owning UsageSummaryinstant - the time instant in milliseconds
UsageSummaryElement or null
UsageSummaryElement findNextElementWithNonZeroRate(Long usageSummaryId,
long instant)
UsageSummaryElement with a non zero rate after
an instant in time.
Note that the UsageSummaryElement whose time instant is actually at
instant (if any), is excluded from the search.
usageSummaryId - the id of the owning UsageSummaryinstant - the time instant in milliseconds
UsageSummaryElement or null
void updateLastElement(UsageSummary usageSummary,
long latestElementId,
long latestElementInstant)
UsageSummary
argument. This is because the implementation uses SQL to update the database rather than using
hibernate, so that the UsageSummary can be partially loaded for efficiency.
We therefore have to be careful to update the in memory object also.
usageSummary - the owning UsageSummarylatestElementId - the entity id for the latest elementlatestElementInstant - the time instant in millis for the latest element
void updateTotalRate(UsageSummary usageSummary,
double totalRate)
UsageSummary maintains an aggregation of the total rate over the
UsageSummaryElements it contains.
This method updates the database appropriately. It also updates the in-memory UsageSummary
argument. This is because the implementation uses SQL to update the database rather than using
hibernate, so that the UsageSummary can be partially loaded for efficiency.
We therefore have to be careful to update the in memory object also.
usageSummary - the UsageSummary to updatetotalRate - the new total rate for the usage summary
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||