public class AccountingPersistenceQuery extends Object implements AccountingPersistenceBackendQuery
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_LIMIT_RESULT_NUMBER |
KEY_VALUES_LIMIT| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection to persistence
|
SortedMap<Filter,SortedMap<Calendar,Info>> |
getContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
List<String> contexts)
Return a SortedMap containing the TimeSeries for each context.
|
SortedMap<Filter,SortedMap<Calendar,Info>> |
getContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
List<String> contexts,
boolean pad) |
static String |
getDefaultOrderingProperties(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz) |
SortedSet<NumberedFilter> |
getFilterValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
String key)
Return a sortedSet filter value
|
protected static AccountingPersistenceQuery |
getInstance() |
SortedSet<NumberedFilter> |
getNextPossibleValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
String key) |
SortedSet<NumberedFilter> |
getNextPossibleValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
String key,
String orderingProperty) |
protected static org.json.JSONObject |
getPaddingJSONObject(Map<Calendar,Info> unpaddedResults) |
static SortedSet<String> |
getQuerableKeys(org.gcube.documentstore.records.AggregatedRecord instance)
Deprecated.
|
static SortedSet<String> |
getQuerableKeys(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz) |
SortedMap<Calendar,Info> |
getTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters)
Query the persistence obtaining a Map where the date is the key and the
#Info is the value.
|
SortedMap<Calendar,Info> |
getTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
boolean pad) |
SortedMap<NumberedFilter,SortedMap<Calendar,Info>> |
getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
String topKey) |
SortedMap<NumberedFilter,SortedMap<Calendar,Info>> |
getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
String topKey,
String orderingProperty)
Return a SortedMap containing the TimeSeries for top values for a certain
key taking in account all Filters.
|
SortedMap<NumberedFilter,SortedMap<Calendar,Info>> |
getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
List<Filter> filters,
String topKey,
String orderingProperty,
boolean pad,
int limit) |
org.json.JSONObject |
getUsageValue(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz,
TemporalConstraint temporalConstraint,
Filter applicant)
Return a JsonObject with value
e.g.for StorageUsageRecord {"dataVolume":1860328,"operationCount":4115}
e.g.
|
List<UsageValue> |
getUsageValueQuotaTotal(List<UsageValue> listUsage)
getUsageValueQuotaTotal
Example for crequire 2 different quota (lucio.lelii for service and alessandro.pieve for storage)
Input:
[
TotalFilters [
clz=class org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord,
temporalConstraint=StartTime : 2015-05-01 11:42:34:515 UTC (1430480554515 millis), EndTime : 2016-11-09 11:42:34:515 UTC (1478691754515 millis),
Aggregated DAILY,
totalFilters=[
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "DataAccess" },
{ "serviceName" : "CkanConnector" }
], d=null, orderingProperty=null],
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "VREManagement" }
], d=null, orderingProperty=null]
], d=null, orderingProperty=null]
]
Output:
[
TotalFilters [
clz=class org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord,
temporalConstraint=StartTime : 2015-05-01 11:42:34:515 UTC (1430480554515 millis), EndTime : 2016-11-09 11:42:34:515 UTC (1478691754515 millis),
Aggregated DAILY,
totalFilters=[
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "DataAccess" },
{ "serviceName" : "CkanConnector" }
], d=1.0, orderingProperty=operationCount],
Filters [filters=[
{ "consumerId" : "lucio.lelii" },
{ "serviceClass" : "VREManagement" }
], d=1.0, orderingProperty=operationCount]
], d=2.0, orderingProperty=null]
]
|
static SortedMap<Calendar,Info> |
padMap(SortedMap<Calendar,Info> unpaddedData,
TemporalConstraint temporalConstraint)
Pad the data
|
void |
prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) |
public static final int DEFAULT_LIMIT_RESULT_NUMBER
protected static AccountingPersistenceQuery getInstance()
@Deprecated public static SortedSet<String> getQuerableKeys(org.gcube.documentstore.records.AggregatedRecord instance) throws Exception
Exceptionpublic static SortedSet<String> getQuerableKeys(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz) throws Exception
Exceptionpublic static String getDefaultOrderingProperties(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz)
protected static org.json.JSONObject getPaddingJSONObject(Map<Calendar,Info> unpaddedResults) throws org.json.JSONException
org.json.JSONExceptionpublic static SortedMap<Calendar,Info> padMap(SortedMap<Calendar,Info> unpaddedData, TemporalConstraint temporalConstraint) throws Exception
unpaddedData - the data to be padtemporalConstraint - temporalConstraint the temporal interval and the granularity
of the data to padException - if failspublic SortedMap<Calendar,Info> getTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception
getTimeSeries in interface AccountingPersistenceBackendQueryclz - the Record Class of interesttemporalConstraint - the TemporalConstraint (interval and aggregation)filters - list of filter to obtain the time series. If null or empty
list get all data for the interested Record Class with the
applying temporal constraint. All Filter must have not null
and not empty key and value. The filters are must be related
to different keys and are in AND. If the list contains more
than one filter with the same key an Exception is thrown.DuplicatedKeyFilterExceptionKeyExceptionValueExceptionExceptionpublic SortedMap<Calendar,Info> getTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, boolean pad) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception
public SortedMap<NumberedFilter,SortedMap<Calendar,Info>> getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, String topKey, String orderingProperty, boolean pad, int limit) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception
public SortedMap<NumberedFilter,SortedMap<Calendar,Info>> getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, String topKey) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception
public SortedMap<NumberedFilter,SortedMap<Calendar,Info>> getTopValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, String topKey, String orderingProperty) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception
getTopValues in interface AccountingPersistenceBackendQueryclz - the Usage Record Class of interesttemporalConstraint - the TemporalConstraint (interval and aggregation)filters - list of filter to obtain the time series of top values. If
null or empty list get all data for the interested Record
Class with the applying temporal constraint. All Filter must
have not null and not empty key and value. The filters are
must be related to different keys and are in AND. If the list
contains more than one filter with the same key an Exception
is thrown.DuplicatedKeyFilterExceptionKeyExceptionValueExceptionExceptionpublic SortedSet<NumberedFilter> getNextPossibleValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, String key) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception
public SortedSet<NumberedFilter> getNextPossibleValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, String key, String orderingProperty) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception
getNextPossibleValues in interface AccountingPersistenceBackendQueryDuplicatedKeyFilterExceptionKeyExceptionValueExceptionExceptionpublic void close()
throws Exception
close in interface AccountingPersistenceBackendQueryException - if the close failspublic void prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) throws Exception
prepareConnection in interface AccountingPersistenceBackendQueryExceptionpublic SortedSet<NumberedFilter> getFilterValues(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, String key) throws Exception
AccountingPersistenceBackendQuerygetFilterValues in interface AccountingPersistenceBackendQueryDuplicatedKeyFilterExceptionKeyExceptionValueExceptionExceptionpublic org.json.JSONObject getUsageValue(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, Filter applicant) throws Exception
AccountingPersistenceBackendQuerygetUsageValue in interface AccountingPersistenceBackendQueryclz - the Usage Record Class of interesttemporalConstraint - the TemporalConstraint (interval and aggregation)applicant - the type field and valueExceptionpublic List<UsageValue> getUsageValueQuotaTotal(List<UsageValue> listUsage) throws Exception
AccountingPersistenceBackendQuerygetUsageValueQuotaTotal in interface AccountingPersistenceBackendQueryExceptionpublic SortedMap<Filter,SortedMap<Calendar,Info>> getContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, List<String> contexts) throws Exception
AccountingPersistenceBackendQuerygetContextTimeSeries in interface AccountingPersistenceBackendQueryExceptionpublic SortedMap<Filter,SortedMap<Calendar,Info>> getContextTimeSeries(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, List<String> contexts, boolean pad) throws DuplicatedKeyFilterException, Exception
Copyright © 2017. All Rights Reserved.