git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@133157 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9e3bed0bbb
commit
477110f05b
|
@ -0,0 +1,93 @@
|
|||
package org.gcube.accounting.analytics;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* @author Alessandro Pieve (ISTI - CNR) alessandro.pieve@isti.cnr.it
|
||||
*
|
||||
*/
|
||||
public class Filters {
|
||||
|
||||
|
||||
protected List<Filter> filters;
|
||||
protected Double d;
|
||||
protected String orderingProperty;
|
||||
|
||||
public Filters(){}
|
||||
|
||||
public Filters(List<Filter> filters, Number n, String orderingProperty) {
|
||||
super();
|
||||
this.filters=filters;
|
||||
this.d = n.doubleValue();
|
||||
this.orderingProperty = orderingProperty;
|
||||
}
|
||||
|
||||
public List<Filter> getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(List<Filter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public Double getD() {
|
||||
return d;
|
||||
}
|
||||
|
||||
public void setD(Double d) {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
public String getOrderingProperty() {
|
||||
return orderingProperty;
|
||||
}
|
||||
|
||||
public void setOrderingProperty(String orderingProperty) {
|
||||
this.orderingProperty = orderingProperty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((d == null) ? 0 : d.hashCode());
|
||||
result = prime * result + ((filters == null) ? 0 : filters.hashCode());
|
||||
result = prime
|
||||
* result
|
||||
+ ((orderingProperty == null) ? 0 : orderingProperty.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Filters other = (Filters) obj;
|
||||
if (d == null) {
|
||||
if (other.d != null)
|
||||
return false;
|
||||
} else if (!d.equals(other.d))
|
||||
return false;
|
||||
if (filters == null) {
|
||||
if (other.filters != null)
|
||||
return false;
|
||||
} else if (!filters.equals(other.filters))
|
||||
return false;
|
||||
if (orderingProperty == null) {
|
||||
if (other.orderingProperty != null)
|
||||
return false;
|
||||
} else if (!orderingProperty.equals(other.orderingProperty))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Filters [filters=" + filters + ", d=" + d
|
||||
+ ", orderingProperty=" + orderingProperty + "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -3,12 +3,14 @@
|
|||
*/
|
||||
package org.gcube.accounting.analytics.persistence;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.SortedMap;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Filters;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
|
@ -165,6 +167,29 @@ public interface AccountingPersistenceBackendQuery {
|
|||
throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* Return a JsonObject with value
|
||||
* e.g.for StorageUsageRecord {Storage:["dataVolume":1860328,"operationCount":4115]}
|
||||
* e.g. for ServiceUsageRcord {NameService1:["operationCount":1651624],NameService2:["operationCount":1651624],}
|
||||
* e.g. for TaskUsageRcord {NameTask1:["operationCount":1651624],NameTask1:["operationCount":1651624],}
|
||||
* @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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.TreeMap;
|
|||
import javax.activity.InvalidActivityException;
|
||||
|
||||
import org.gcube.accounting.analytics.Filter;
|
||||
import org.gcube.accounting.analytics.Filters;
|
||||
import org.gcube.accounting.analytics.Info;
|
||||
import org.gcube.accounting.analytics.NumberedFilter;
|
||||
import org.gcube.accounting.analytics.TemporalConstraint;
|
||||
|
@ -283,5 +284,17 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
|||
return AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
.getUsageValue(clz, temporalConstraint, applicant);
|
||||
}
|
||||
|
||||
/*New task for quota*/
|
||||
@Override
|
||||
public List<Filters> getUsageValueQuota(Class<? extends AggregatedRecord<?, ?>> clz,
|
||||
TemporalConstraint temporalConstraint, List<Filters> listUsage)
|
||||
throws Exception {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue