Generalised flters
This commit is contained in:
parent
bbd53c2005
commit
c70970cf24
|
@ -84,9 +84,10 @@ public class AccountingPersistenceQueryPostgreSQL implements AccountingPersisten
|
|||
this.contexts = contexts;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void setFilters(Collection<Filter> filters) {
|
||||
this.filters = filters;
|
||||
public void setFilters(Collection<? extends Filter> filters) {
|
||||
this.filters = (Collection<Filter>) filters;
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
@ -56,7 +56,7 @@ public class Query extends PostgreSQLQuery {
|
|||
this.temporalConstraint = temporalConstraint;
|
||||
}
|
||||
|
||||
public void setFilters(Collection<Filter> filters) {
|
||||
public void setFilters(Collection<? extends Filter> filters) {
|
||||
this.filters = new HashMap<>();
|
||||
if(filters!=null && filters.size()>0) {
|
||||
for(Filter filter : filters) {
|
||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.accounting.analytics.persistence.postgresql;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
@ -26,6 +27,7 @@ import org.gcube.accounting.analytics.persistence.AccountingPersistenceQuery;
|
|||
import org.gcube.accounting.datamodel.UsageRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedJobUsageRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedServiceUsageRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageStatusRecord;
|
||||
import org.gcube.accounting.datamodel.aggregation.AggregatedStorageUsageRecord;
|
||||
import org.gcube.accounting.datamodel.basetypes.AbstractStorageUsageRecord.DataType;
|
||||
import org.gcube.accounting.utility.postgresql.RecordToDBMapping;
|
||||
|
@ -218,6 +220,14 @@ public class AccountingPersistenceQueryPostgreSQLTest extends ContextTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gcTest() throws Exception {
|
||||
accountingPersistenceQueryPostgreSQL.setRequestedRecords(AggregatedStorageStatusRecord.class);
|
||||
Collection<NumberedFilter> myFilters = accountingPersistenceQueryPostgreSQL.getFilterValues(AggregatedStorageStatusRecord.DATA_TYPE);
|
||||
accountingPersistenceQueryPostgreSQL.setFilters(myFilters);
|
||||
accountingPersistenceQueryPostgreSQL.getTimeSeries();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTopValues() throws DuplicatedKeyFilterException, KeyException, ValueException, Exception {
|
||||
String orderingProperty = AccountingPersistenceQuery.getDefaultOrderingProperties(AggregatedServiceUsageRecord.class);
|
||||
|
|
Loading…
Reference in New Issue