Removed old uneeded queries

This commit is contained in:
Luca Frosini 2021-03-22 11:53:41 +01:00
parent 31c10aa1b4
commit 6e3245ca0b
2 changed files with 6 additions and 129 deletions

View File

@ -18,7 +18,6 @@ import org.gcube.accounting.analytics.exception.KeyException;
import org.gcube.accounting.analytics.exception.ValueException; import org.gcube.accounting.analytics.exception.ValueException;
import org.gcube.accounting.datamodel.BasicUsageRecord; import org.gcube.accounting.datamodel.BasicUsageRecord;
import org.gcube.documentstore.records.AggregatedRecord; import org.gcube.documentstore.records.AggregatedRecord;
import org.json.JSONObject;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -132,22 +131,6 @@ public interface AccountingPersistenceBackendQuery {
throws DuplicatedKeyFilterException, KeyException, ValueException, throws DuplicatedKeyFilterException, KeyException, ValueException,
Exception; Exception;
/*
@Deprecated
public SortedSet<NumberedFilter> getNextPossibleValues(
Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters,
String key, String orderingProperty) throws
DuplicatedKeyFilterException, KeyException, ValueException,
Exception;
@Deprecated
public SortedSet<NumberedFilter> getNextPossibleValuesWithMap(
Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters,
String key, String orderingProperty) throws Exception;
*/
/** /**
* Close the connection to persistence * Close the connection to persistence
* *
@ -166,48 +149,6 @@ public interface AccountingPersistenceBackendQuery {
TemporalConstraint temporalConstraint, List<Filter> filters, TemporalConstraint temporalConstraint, List<Filter> filters,
String key, Integer limit) throws Exception; 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<? extends AggregatedRecord<?, ?>> 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<Filters> getUsageValueQuota(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint,
List<Filters> filterPackageQuota) throws Exception;
*/
/** /**
* getUsageValueQuotaTotal * getUsageValueQuotaTotal
* *
@ -269,7 +210,7 @@ public interface AccountingPersistenceBackendQuery {
TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts) TemporalConstraint temporalConstraint, List<Filter> filters,List<String> contexts)
throws Exception; throws Exception;
public String getRecord(String recordId, String type ) throws Exception; public String getRecord(String recordId, String type) throws Exception;
public SortedSet<String> getSpaceProvidersIds() throws Exception; public SortedSet<String> getSpaceProvidersIds() throws Exception;

View File

@ -50,12 +50,6 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return accountingPersistenceQuery; return accountingPersistenceQuery;
} }
@Deprecated
public static SortedSet<String> getQuerableKeys(@SuppressWarnings("rawtypes") AggregatedRecord instance)
throws Exception {
return instance.getQuerableKeys();
}
public static SortedSet<String> getQuerableKeys(Class<? extends AggregatedRecord<?, ?>> clz) throws Exception { public static SortedSet<String> getQuerableKeys(Class<? extends AggregatedRecord<?, ?>> clz) throws Exception {
AggregatedRecord<?, ?> instance = clz.newInstance(); AggregatedRecord<?, ?> instance = clz.newInstance();
@ -108,7 +102,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
* @throws Exception * @throws Exception
* if fails * if fails
*/ */
public static SortedMap<Calendar, Info> padMap(SortedMap<Calendar, Info> unpaddedData, protected static SortedMap<Calendar, Info> padMap(SortedMap<Calendar, Info> unpaddedData,
TemporalConstraint temporalConstraint) throws Exception { TemporalConstraint temporalConstraint) throws Exception {
JSONObject jsonObject = getPaddingJSONObject(unpaddedData); JSONObject jsonObject = getPaddingJSONObject(unpaddedData);
@ -123,9 +117,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return unpaddedData; return unpaddedData;
} }
/** @Override
* {@inheritDoc}
*/
public SortedMap<Calendar, Info> getTimeSeries(Class<? extends AggregatedRecord<?, ?>> clz, public SortedMap<Calendar, Info> getTimeSeries(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters) TemporalConstraint temporalConstraint, List<Filter> filters)
throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
@ -150,6 +142,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return ret; return ret;
} }
@Override
public SortedMap<Calendar, Info> getNoContextTimeSeries(Class<? extends AggregatedRecord<?, ?>> clz, public SortedMap<Calendar, Info> getNoContextTimeSeries(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters) TemporalConstraint temporalConstraint, List<Filter> filters)
throws DuplicatedKeyFilterException, KeyException, ValueException, Exception { throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
@ -217,9 +210,6 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return this.getTopValues(clz, temporalConstraint, filters, topKey, orderingProperty, false, 0); return this.getTopValues(clz, temporalConstraint, filters, topKey, orderingProperty, false, 0);
} }
/**
* {@inheritDoc}
*/
@Override @Override
public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues( public SortedMap<NumberedFilter, SortedMap<Calendar, Info>> getTopValues(
Class<? extends AggregatedRecord<?, ?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters, Class<? extends AggregatedRecord<?, ?>> clz, TemporalConstraint temporalConstraint, List<Filter> filters,
@ -228,56 +218,11 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return this.getTopValues(clz, temporalConstraint, filters, topKey, orderingProperty, false, 0); return this.getTopValues(clz, temporalConstraint, filters, topKey, orderingProperty, false, 0);
} }
/*
public SortedSet<NumberedFilter> getNextPossibleValues(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> 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<NumberedFilter> getNextPossibleValues(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters, String key, String orderingProperty)
throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
return AccountingPersistenceBackendQueryFactory.getInstance().getNextPossibleValues(clz, temporalConstraint,
filters, key, orderingProperty);
}
*/
/* *
* {@inheritDoc}
*/
/*
@Override
public SortedSet<NumberedFilter> getNextPossibleValuesWithMap(Class<? extends AggregatedRecord<?, ?>> clz,
TemporalConstraint temporalConstraint, List<Filter> filters, String key, String orderingProperty)
throws Exception {
return AccountingPersistenceBackendQueryFactory.getInstance().getNextPossibleValuesWithMap(clz,
temporalConstraint, filters, key, orderingProperty);
}
*/
/**
* {@inheritDoc}
*/
@Override @Override
public void close() throws Exception { public void close() throws Exception {
AccountingPersistenceBackendQueryFactory.getInstance().close(); AccountingPersistenceBackendQueryFactory.getInstance().close();
} }
/**
* {@inheritDoc}
*/
@Override @Override
public void prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) throws Exception { public void prepareConnection(AccountingPersistenceBackendQueryConfiguration configuration) throws Exception {
throw new InvalidActivityException(); throw new InvalidActivityException();
@ -297,14 +242,6 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
key, limit); key, limit);
} }
@Override
public JSONObject getUsageValue(Class<? extends AggregatedRecord<?, ?>> clz, TemporalConstraint temporalConstraint,
Filter applicant) throws Exception {
return AccountingPersistenceBackendQueryFactory.getInstance().getUsageValue(clz, temporalConstraint, applicant);
}
@Override @Override
public List<UsageValue> getUsageValueQuotaTotal(List<UsageValue> listUsage) throws Exception { public List<UsageValue> getUsageValueQuotaTotal(List<UsageValue> listUsage) throws Exception {
@ -348,17 +285,16 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
return got; return got;
} }
@Override
public String getRecord(String recordId, String type) throws Exception { public String getRecord(String recordId, String type) throws Exception {
String record = AccountingPersistenceBackendQueryFactory.getInstance().getRecord(recordId, type); String record = AccountingPersistenceBackendQueryFactory.getInstance().getRecord(recordId, type);
return record; return record;
} }
@Override @Override
public SortedSet<String> getSpaceProvidersIds() throws Exception { public SortedSet<String> getSpaceProvidersIds() throws Exception {
SortedSet<String> providersId = AccountingPersistenceBackendQueryFactory.getInstance().getSpaceProvidersIds(); SortedSet<String> providersId = AccountingPersistenceBackendQueryFactory.getInstance().getSpaceProvidersIds();
return providersId; return providersId;
} }
@Override @Override
@ -388,7 +324,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
} }
public SortedMap<Calendar, Long> padMapStorage(SortedMap<Calendar, Long> unpaddedData, protected SortedMap<Calendar, Long> padMapStorage(SortedMap<Calendar, Long> unpaddedData,
TemporalConstraint temporalConstraint) throws Exception { TemporalConstraint temporalConstraint) throws Exception {
SortedSet<Calendar> sequence = temporalConstraint.getCalendarSequence(); SortedSet<Calendar> sequence = temporalConstraint.getCalendarSequence();
Long longValuePre = null; Long longValuePre = null;