From 6e3245ca0bb474bc4eee6816623f130d44943a84 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Mon, 22 Mar 2021 11:53:41 +0100 Subject: [PATCH] Removed old uneeded queries --- .../AccountingPersistenceBackendQuery.java | 61 +-------------- .../AccountingPersistenceQuery.java | 74 ++----------------- 2 files changed, 6 insertions(+), 129 deletions(-) diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java index 7767883..19bc7e4 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceBackendQuery.java @@ -18,7 +18,6 @@ import org.gcube.accounting.analytics.exception.KeyException; import org.gcube.accounting.analytics.exception.ValueException; import org.gcube.accounting.datamodel.BasicUsageRecord; import org.gcube.documentstore.records.AggregatedRecord; -import org.json.JSONObject; /** * @author Luca Frosini (ISTI - CNR) @@ -132,22 +131,6 @@ public interface AccountingPersistenceBackendQuery { throws DuplicatedKeyFilterException, KeyException, ValueException, Exception; - /* - @Deprecated - public SortedSet getNextPossibleValues( - Class> clz, - TemporalConstraint temporalConstraint, List filters, - String key, String orderingProperty) throws - DuplicatedKeyFilterException, KeyException, ValueException, - Exception; - - @Deprecated - public SortedSet getNextPossibleValuesWithMap( - Class> clz, - TemporalConstraint temporalConstraint, List filters, - String key, String orderingProperty) throws Exception; - */ - /** * Close the connection to persistence * @@ -166,48 +149,6 @@ public interface AccountingPersistenceBackendQuery { TemporalConstraint temporalConstraint, List filters, String key, Integer limit) throws Exception; - /** - * Return a JsonObject with value - * e.g.for StorageUsageRecord {"dataVolume":1860328,"operationCount":4115} - * e.g. for ServiceUsageRcord {"operationCount":1651624} - * - * @param clz - * the Usage Record Class of interest - * @param temporalConstraint - * the TemporalConstraint (interval and aggregation) - * @param applicant - * the type field and value - * @return JSONObject - * @throws Exception - */ - public JSONObject getUsageValue(Class> clz, - TemporalConstraint temporalConstraint, Filter applicant) - throws Exception; - - /* * - * - * getUsageValueQuota - * use for a specifiy consumer id and for single quota - * - * in:[{ "consumerId" : "alessandro.pieve" }, { "serviceClass" : "DataAccess" }, { "serviceName" : "CkanConnector" }], d=null, orderingProperty=null] - * out:[{ "consumerId" : "alessandro.pieve" }, { "serviceClass" : "DataAccess" }, { "serviceName" : "CkanConnector" }], d=88.0, orderingProperty=operationCount] - * @param clz - * the Usage Record Class of interest - * @param temporalConstraint - * the TemporalConstraint (interval and aggregation) - * @param applicant - * the type field and value - * @parm list - * the list of service or task what you want - * @return - * @throws Exception - */ - /* - public List getUsageValueQuota(Class> clz, - TemporalConstraint temporalConstraint, - List filterPackageQuota) throws Exception; -*/ - /** * getUsageValueQuotaTotal * @@ -269,7 +210,7 @@ public interface AccountingPersistenceBackendQuery { TemporalConstraint temporalConstraint, List filters,List contexts) throws Exception; - public String getRecord(String recordId, String type ) throws Exception; + public String getRecord(String recordId, String type) throws Exception; public SortedSet getSpaceProvidersIds() throws Exception; diff --git a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java index 78c9129..5effa14 100644 --- a/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java +++ b/src/main/java/org/gcube/accounting/analytics/persistence/AccountingPersistenceQuery.java @@ -50,12 +50,6 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ return accountingPersistenceQuery; } - @Deprecated - public static SortedSet getQuerableKeys(@SuppressWarnings("rawtypes") AggregatedRecord instance) - throws Exception { - return instance.getQuerableKeys(); - } - public static SortedSet getQuerableKeys(Class> clz) throws Exception { AggregatedRecord instance = clz.newInstance(); @@ -108,7 +102,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ * @throws Exception * if fails */ - public static SortedMap padMap(SortedMap unpaddedData, + protected static SortedMap padMap(SortedMap unpaddedData, TemporalConstraint temporalConstraint) throws Exception { JSONObject jsonObject = getPaddingJSONObject(unpaddedData); @@ -123,9 +117,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ return unpaddedData; } - /** - * {@inheritDoc} - */ + @Override public SortedMap getTimeSeries(Class> clz, TemporalConstraint temporalConstraint, List filters) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { @@ -150,6 +142,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ return ret; } + @Override public SortedMap getNoContextTimeSeries(Class> clz, TemporalConstraint temporalConstraint, List filters) throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { @@ -217,9 +210,6 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ return this.getTopValues(clz, temporalConstraint, filters, topKey, orderingProperty, false, 0); } - /** - * {@inheritDoc} - */ @Override public SortedMap> getTopValues( Class> clz, TemporalConstraint temporalConstraint, List filters, @@ -228,56 +218,11 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ return this.getTopValues(clz, temporalConstraint, filters, topKey, orderingProperty, false, 0); } - /* - public SortedSet getNextPossibleValues(Class> clz, - TemporalConstraint temporalConstraint, List filters, String key) - throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { - - String orderingProperty = AccountingPersistenceQuery.getDefaultOrderingProperties(clz); - - return this.getNextPossibleValues(clz, temporalConstraint, filters, key, orderingProperty); - } -*/ - - /* * - * {@inheritDoc} - */ - /* - @Override - public SortedSet getNextPossibleValues(Class> clz, - TemporalConstraint temporalConstraint, List filters, String key, String orderingProperty) - throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { - - return AccountingPersistenceBackendQueryFactory.getInstance().getNextPossibleValues(clz, temporalConstraint, - filters, key, orderingProperty); - - } - */ - - /* * - * {@inheritDoc} - */ - /* - @Override - public SortedSet getNextPossibleValuesWithMap(Class> clz, - TemporalConstraint temporalConstraint, List filters, String key, String orderingProperty) - throws Exception { - return AccountingPersistenceBackendQueryFactory.getInstance().getNextPossibleValuesWithMap(clz, - temporalConstraint, filters, key, orderingProperty); - } - */ - - /** - * {@inheritDoc} - */ @Override public void close() throws Exception { AccountingPersistenceBackendQueryFactory.getInstance().close(); } - /** - * {@inheritDoc} - */ @Override public void prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) throws Exception { throw new InvalidActivityException(); @@ -297,14 +242,6 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ key, limit); } - - @Override - public JSONObject getUsageValue(Class> clz, TemporalConstraint temporalConstraint, - Filter applicant) throws Exception { - - return AccountingPersistenceBackendQueryFactory.getInstance().getUsageValue(clz, temporalConstraint, applicant); - } - @Override public List getUsageValueQuotaTotal(List listUsage) throws Exception { @@ -348,17 +285,16 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ return got; } + @Override public String getRecord(String recordId, String type) throws Exception { String record = AccountingPersistenceBackendQueryFactory.getInstance().getRecord(recordId, type); return record; - } @Override public SortedSet getSpaceProvidersIds() throws Exception { SortedSet providersId = AccountingPersistenceBackendQueryFactory.getInstance().getSpaceProvidersIds(); return providersId; - } @Override @@ -388,7 +324,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ } - public SortedMap padMapStorage(SortedMap unpaddedData, + protected SortedMap padMapStorage(SortedMap unpaddedData, TemporalConstraint temporalConstraint) throws Exception { SortedSet sequence = temporalConstraint.getCalendarSequence(); Long longValuePre = null;