Class AccountingPersistenceQueryPostgreSQL
- java.lang.Object
-
- org.gcube.accounting.analytics.persistence.postgresql.AccountingPersistenceQueryPostgreSQL
-
- All Implemented Interfaces:
org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
public class AccountingPersistenceQueryPostgreSQL extends Object implements org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>>clzprotected org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfigurationconfigurationprotected Set<String>contextsstatic intDEFAULT_TOP_LIMITprotected Collection<org.gcube.accounting.analytics.Filter>filtersprotected static org.slf4j.Loggerloggerprotected org.gcube.com.fasterxml.jackson.databind.ObjectMapperobjectMapperprotected org.gcube.accounting.utility.postgresql.RecordToDBMappingrecordToDBMappingprotected org.gcube.accounting.analytics.TemporalConstrainttemporalConstraintstatic StringURL_PROPERTY_KEY
-
Constructor Summary
Constructors Constructor Description AccountingPersistenceQueryPostgreSQL()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddProperty(org.gcube.com.fasterxml.jackson.databind.node.ObjectNode objectNode, String key, Object value)voidclose()protected CalendargetCalendar(java.time.OffsetDateTime offsetDateTime)protected ConnectiongetConnection(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz)SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>>getContextTimeSeries()SortedSet<org.gcube.accounting.analytics.NumberedFilter>getFilterValues(String key)SortedSet<org.gcube.accounting.analytics.NumberedFilter>getFilterValues(String key, Integer limit)protected SortedSet<org.gcube.accounting.analytics.NumberedFilter>getNumberedValues(String key, String orderingProperty, Integer limit)org.gcube.documentstore.records.RecordgetRecord(String recordId, String type)org.gcube.accounting.utility.postgresql.RecordToDBMappinggetRecordToDBMapping()SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>>getSpaceTimeSeries(Set<String> dataTypes)SortedMap<Calendar,org.gcube.accounting.analytics.Info>getTimeSeries()protected SortedMap<Calendar,org.gcube.accounting.analytics.Info>getTimeSeries(Set<String> contexts)SortedMap<org.gcube.accounting.analytics.NumberedFilter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>>getTopValues(String topKey, String orderingProperty, Integer limit)List<org.gcube.accounting.analytics.UsageValue>getUsageValueQuotaTotal(List<org.gcube.accounting.analytics.UsageValue> listUsage)booleanisConnectionActive()voidprepareConnection(org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration configuration)voidsetContexts(Set<String> contexts)voidsetFilters(Collection<? extends org.gcube.accounting.analytics.Filter> filters)voidsetRequestedRecords(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz)voidsetTemporalConstraint(org.gcube.accounting.analytics.TemporalConstraint temporalConstraint)
-
-
-
Field Detail
-
logger
protected static final org.slf4j.Logger logger
-
URL_PROPERTY_KEY
public static final String URL_PROPERTY_KEY
- See Also:
- Constant Field Values
-
DEFAULT_TOP_LIMIT
public static final int DEFAULT_TOP_LIMIT
- See Also:
- Constant Field Values
-
configuration
protected org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration configuration
-
objectMapper
protected org.gcube.com.fasterxml.jackson.databind.ObjectMapper objectMapper
-
clz
protected Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz
-
temporalConstraint
protected org.gcube.accounting.analytics.TemporalConstraint temporalConstraint
-
filters
protected Collection<org.gcube.accounting.analytics.Filter> filters
-
recordToDBMapping
protected org.gcube.accounting.utility.postgresql.RecordToDBMapping recordToDBMapping
-
-
Method Detail
-
prepareConnection
public void prepareConnection(org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration configuration) throws Exception- Specified by:
prepareConnectionin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getConnection
protected Connection getConnection(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz) throws Exception
- Throws:
Exception
-
setRequestedRecords
public void setRequestedRecords(Class<? extends org.gcube.documentstore.records.AggregatedRecord<?,?>> clz)
- Specified by:
setRequestedRecordsin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
-
setTemporalConstraint
public void setTemporalConstraint(org.gcube.accounting.analytics.TemporalConstraint temporalConstraint)
- Specified by:
setTemporalConstraintin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
-
setContexts
public void setContexts(Set<String> contexts)
- Specified by:
setContextsin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
-
setFilters
public void setFilters(Collection<? extends org.gcube.accounting.analytics.Filter> filters)
- Specified by:
setFiltersin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
-
getRecordToDBMapping
public org.gcube.accounting.utility.postgresql.RecordToDBMapping getRecordToDBMapping()
-
addProperty
protected void addProperty(org.gcube.com.fasterxml.jackson.databind.node.ObjectNode objectNode, String key, Object value)
-
getTimeSeries
protected SortedMap<Calendar,org.gcube.accounting.analytics.Info> getTimeSeries(Set<String> contexts) throws Exception
- Throws:
Exception
-
getTimeSeries
public SortedMap<Calendar,org.gcube.accounting.analytics.Info> getTimeSeries() throws Exception
- Specified by:
getTimeSeriesin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getCalendar
protected Calendar getCalendar(java.time.OffsetDateTime offsetDateTime)
-
getContextTimeSeries
public SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> getContextTimeSeries() throws Exception
- Specified by:
getContextTimeSeriesin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getNumberedValues
protected SortedSet<org.gcube.accounting.analytics.NumberedFilter> getNumberedValues(String key, String orderingProperty, Integer limit) throws Exception
- Throws:
Exception
-
getFilterValues
public SortedSet<org.gcube.accounting.analytics.NumberedFilter> getFilterValues(String key) throws Exception
- Specified by:
getFilterValuesin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getFilterValues
public SortedSet<org.gcube.accounting.analytics.NumberedFilter> getFilterValues(String key, Integer limit) throws Exception
- Specified by:
getFilterValuesin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getTopValues
public SortedMap<org.gcube.accounting.analytics.NumberedFilter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> getTopValues(String topKey, String orderingProperty, Integer limit) throws Exception
- Specified by:
getTopValuesin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getRecord
public org.gcube.documentstore.records.Record getRecord(String recordId, String type) throws Exception
- Specified by:
getRecordin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getSpaceTimeSeries
public SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> getSpaceTimeSeries(Set<String> dataTypes) throws Exception
- Specified by:
getSpaceTimeSeriesin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
getUsageValueQuotaTotal
public List<org.gcube.accounting.analytics.UsageValue> getUsageValueQuotaTotal(List<org.gcube.accounting.analytics.UsageValue> listUsage) throws Exception
- Specified by:
getUsageValueQuotaTotalin interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
close
public void close() throws Exception- Specified by:
closein interfaceorg.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery- Throws:
Exception
-
-