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 Details

    • logger

      protected static final org.slf4j.Logger logger
    • URL_PROPERTY_KEY

      public static final String URL_PROPERTY_KEY
      See Also:
    • DEFAULT_TOP_LIMIT

      public static final int DEFAULT_TOP_LIMIT
      See Also:
    • 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
    • contexts

      protected Set<String> contexts
    • filters

      protected Collection<org.gcube.accounting.analytics.Filter> filters
    • recordToDBMapping

      protected org.gcube.accounting.utility.postgresql.RecordToDBMapping recordToDBMapping
  • Constructor Details

    • AccountingPersistenceQueryPostgreSQL

      public AccountingPersistenceQueryPostgreSQL()
  • Method Details

    • prepareConnection

      public void prepareConnection(org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQueryConfiguration configuration) throws Exception
      Specified by:
      prepareConnection in interface org.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:
      setRequestedRecords in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
    • setTemporalConstraint

      public void setTemporalConstraint(org.gcube.accounting.analytics.TemporalConstraint temporalConstraint)
      Specified by:
      setTemporalConstraint in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
    • setContexts

      public void setContexts(Set<String> contexts)
      Specified by:
      setContexts in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
    • setFilters

      public void setFilters(Collection<? extends org.gcube.accounting.analytics.Filter> filters)
      Specified by:
      setFilters in interface org.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:
      getTimeSeries in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
      Throws:
      Exception
    • getCalendar

      protected Calendar getCalendar(OffsetDateTime offsetDateTime)
    • getContextTimeSeries

      public SortedMap<org.gcube.accounting.analytics.Filter,SortedMap<Calendar,org.gcube.accounting.analytics.Info>> getContextTimeSeries() throws Exception
      Specified by:
      getContextTimeSeries in interface org.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:
      getFilterValues in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
      Throws:
      Exception
    • getFilterValues

      public SortedSet<org.gcube.accounting.analytics.NumberedFilter> getFilterValues(String key, Integer limit) throws Exception
      Specified by:
      getFilterValues in interface org.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:
      getTopValues in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
      Throws:
      Exception
    • getRecord

      public org.gcube.documentstore.records.Record getRecord(String recordId, String type) throws Exception
      Specified by:
      getRecord in interface org.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:
      getSpaceTimeSeries in interface org.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:
      getUsageValueQuotaTotal in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
      Throws:
      Exception
    • close

      public void close() throws Exception
      Specified by:
      close in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
      Throws:
      Exception
    • isConnectionActive

      public boolean isConnectionActive() throws Exception
      Specified by:
      isConnectionActive in interface org.gcube.accounting.analytics.persistence.AccountingPersistenceBackendQuery
      Throws:
      Exception