git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-analytics@134162 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4f90c54f62
commit
ece86afce3
|
@ -5,27 +5,27 @@ import java.util.List;
|
|||
* @author Alessandro Pieve (ISTI - CNR) alessandro.pieve@isti.cnr.it
|
||||
*
|
||||
*/
|
||||
public class Filters {
|
||||
public class FiltersValue {
|
||||
|
||||
|
||||
protected List<Filter> filters;
|
||||
protected Double d;
|
||||
protected String orderingProperty;
|
||||
|
||||
public Filters(){}
|
||||
public FiltersValue(){}
|
||||
|
||||
public Filters(List<Filter> filters, Number n, String orderingProperty) {
|
||||
public FiltersValue(List<Filter> filters, Number n, String orderingProperty) {
|
||||
super();
|
||||
this.filters=filters;
|
||||
this.d = n.doubleValue();
|
||||
this.orderingProperty = orderingProperty;
|
||||
}
|
||||
|
||||
public List<Filter> getFilters() {
|
||||
public List<Filter> getFiltersValue() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(List<Filter> filters) {
|
||||
public void setFiltersValue(List<Filter> filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class Filters {
|
|||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Filters other = (Filters) obj;
|
||||
FiltersValue other = (FiltersValue) obj;
|
||||
if (d == null) {
|
||||
if (other.d != null)
|
||||
return false;
|
||||
|
@ -86,8 +86,10 @@ public class Filters {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Filters [filters=" + filters + ", d=" + d
|
||||
return "FiltersValue [filters=" + filters + ", d=" + d
|
||||
+ ", orderingProperty=" + orderingProperty + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -13,16 +13,13 @@ import java.util.SortedSet;
|
|||
import java.util.TimeZone;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*
|
||||
*/
|
||||
public class TemporalConstraint {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TemporalConstraint.class);
|
||||
|
||||
|
||||
private static final String UTC_TIME_ZONE = "UTC";
|
||||
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
package org.gcube.accounting.analytics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
|
||||
public class UsageServiceValue extends UsageValue {
|
||||
|
||||
|
||||
protected Class<? extends AggregatedUsageRecord<?, ?>> clz;
|
||||
protected TemporalConstraint temporalConstraint;
|
||||
protected List<FiltersValue> filtersValue;
|
||||
protected String identifier;
|
||||
protected Double d;
|
||||
protected String orderingProperty;
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public Double getD() {
|
||||
return d;
|
||||
}
|
||||
|
||||
public void setD(Double d) {
|
||||
this.d = d;
|
||||
}
|
||||
public TemporalConstraint getTemporalConstraint() {
|
||||
if (temporalConstraint!=null)
|
||||
return temporalConstraint;
|
||||
else
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public String getOrderingProperty() {
|
||||
return orderingProperty;
|
||||
}
|
||||
|
||||
public void setOrderingProperty(String orderingProperty) {
|
||||
this.orderingProperty = orderingProperty;
|
||||
}
|
||||
public void setTemporalConstraint(TemporalConstraint temporalConstraint) {
|
||||
this.temporalConstraint = temporalConstraint;
|
||||
}
|
||||
|
||||
public Class<? extends AggregatedUsageRecord<?, ?>> getClz() {
|
||||
return clz;
|
||||
}
|
||||
|
||||
public void setClz(String context,Class<? extends AggregatedUsageRecord<?, ?>> clz) {
|
||||
this.clz = clz;
|
||||
}
|
||||
|
||||
public UsageServiceValue(){}
|
||||
|
||||
public UsageServiceValue(String context,String identifier,Class<? extends AggregatedUsageRecord<?, ?>> clz,TemporalConstraint temporalConstraint,List<FiltersValue> filtersValue){
|
||||
super();
|
||||
this.context=context;
|
||||
this.filtersValue=filtersValue;
|
||||
this.clz=clz;
|
||||
this.temporalConstraint=temporalConstraint;
|
||||
this.identifier=identifier;
|
||||
|
||||
}
|
||||
|
||||
public List<FiltersValue> getFiltersValue() {
|
||||
return filtersValue;
|
||||
}
|
||||
|
||||
public void setFiltersValue(List<FiltersValue> filtersValue) {
|
||||
this.filtersValue = filtersValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContext() {
|
||||
return this.context;
|
||||
}
|
||||
@Override
|
||||
public void setContext(String context) {
|
||||
this.context=context;
|
||||
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UsageServiceValue [clz=" + clz + ", temporalConstraint="
|
||||
+ temporalConstraint + ", filtersValue=" + filtersValue
|
||||
+ ", identifier=" + identifier + ", d=" + d
|
||||
+ ", orderingProperty=" + orderingProperty + ", context="
|
||||
+ context + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,28 +1,40 @@
|
|||
package org.gcube.accounting.analytics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
/**
|
||||
* Object for calculate quota
|
||||
*
|
||||
*
|
||||
* @author pieve
|
||||
*
|
||||
*/
|
||||
public class TotalFilters {
|
||||
protected Class<? extends AggregatedUsageRecord<?, ?>> clz;
|
||||
protected TemporalConstraint temporalConstraint;
|
||||
protected List<Filters> totalFilters;
|
||||
|
||||
|
||||
public class UsageStorageValue extends UsageValue {
|
||||
protected Class<? extends AggregatedUsageRecord<?, ?>> clz;
|
||||
protected TemporalConstraint temporalConstraint;
|
||||
protected String identifier;
|
||||
protected Double d;
|
||||
protected String orderingProperty;
|
||||
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
public TemporalConstraint getTemporalConstraint() {
|
||||
return temporalConstraint;
|
||||
if (temporalConstraint!=null)
|
||||
return temporalConstraint;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setTemporalConstraint(TemporalConstraint temporalConstraint) {
|
||||
|
@ -37,58 +49,42 @@ public class TotalFilters {
|
|||
this.clz = clz;
|
||||
}
|
||||
|
||||
public TotalFilters(){}
|
||||
public UsageStorageValue(){}
|
||||
|
||||
public TotalFilters(String identifier,Class<? extends AggregatedUsageRecord<?, ?>> clz,TemporalConstraint temporalConstraint,List<Filters> totalFilters){
|
||||
|
||||
public UsageStorageValue(String context,String identifier,Class<? extends AggregatedUsageRecord<?, ?>> clz){
|
||||
super();
|
||||
this.totalFilters=totalFilters;
|
||||
this.context=context;
|
||||
this.clz=clz;
|
||||
this.temporalConstraint=temporalConstraint;
|
||||
this.identifier=identifier;
|
||||
|
||||
}
|
||||
|
||||
public List<Filters> getTotalFilters() {
|
||||
return totalFilters;
|
||||
public UsageStorageValue(String context,String identifier,Class<? extends AggregatedUsageRecord<?, ?>> clz,TemporalConstraint temporalConstraint){
|
||||
super();
|
||||
this.context=context;
|
||||
this.identifier=identifier;
|
||||
this.clz=clz;
|
||||
this.temporalConstraint=temporalConstraint;
|
||||
|
||||
}
|
||||
|
||||
public void setTotalFilters(List<Filters> totalFilters) {
|
||||
this.totalFilters = totalFilters;
|
||||
@Override
|
||||
public String getContext() {
|
||||
return this.context;
|
||||
}
|
||||
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
@Override
|
||||
public void setContext(String context) {
|
||||
this.context=context;
|
||||
|
||||
}
|
||||
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
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 String toString() {
|
||||
return "TotalFilters [clz=" + clz + ", temporalConstraint="
|
||||
+ temporalConstraint + ", totalFilters=" + totalFilters
|
||||
+ ", identifier=" + identifier + ", d=" + d
|
||||
+ ", orderingProperty=" + orderingProperty + "]";
|
||||
return "UsageStorageValue [clz=" + clz + ", temporalConstraint="
|
||||
+ temporalConstraint + ", identifier=" + identifier + ", d="
|
||||
+ d + ", orderingProperty=" + orderingProperty
|
||||
+ ", context=" + context
|
||||
+ "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package org.gcube.accounting.analytics;
|
||||
|
||||
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
|
||||
/**
|
||||
* Object for calculate quota
|
||||
*
|
||||
*
|
||||
* @author pieve
|
||||
*
|
||||
*/
|
||||
public abstract class UsageValue {
|
||||
protected Class<? extends AggregatedUsageRecord<?, ?>> clz;
|
||||
protected TemporalConstraint temporalConstraint;
|
||||
//protected List<FiltersValue> filtersValue;
|
||||
protected String identifier;
|
||||
protected Double d;
|
||||
protected String orderingProperty;
|
||||
protected String context;
|
||||
|
||||
public UsageValue(){}
|
||||
public abstract Class<? extends AggregatedUsageRecord<?, ?>> getClz();
|
||||
public abstract String getIdentifier();
|
||||
public abstract Double getD();
|
||||
public abstract String getOrderingProperty();
|
||||
public abstract TemporalConstraint getTemporalConstraint();
|
||||
public abstract String getContext();
|
||||
|
||||
public abstract void setOrderingProperty(String orderingProperty);
|
||||
public abstract void setD(Double d);
|
||||
public abstract void setContext(String context);
|
||||
|
||||
|
||||
}
|
|
@ -9,11 +9,10 @@ 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;
|
||||
import org.gcube.accounting.analytics.TotalFilters;
|
||||
import org.gcube.accounting.analytics.UsageValue;
|
||||
import org.gcube.accounting.analytics.exception.DuplicatedKeyFilterException;
|
||||
import org.gcube.accounting.analytics.exception.KeyException;
|
||||
import org.gcube.accounting.analytics.exception.ValueException;
|
||||
|
@ -235,8 +234,8 @@ public interface AccountingPersistenceBackendQuery {
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<TotalFilters> getUsageValueQuotaTotal(
|
||||
List<TotalFilters> listUsage)
|
||||
public List<UsageValue> getUsageValueQuotaTotal(
|
||||
List<UsageValue> listUsage)
|
||||
throws Exception;
|
||||
|
||||
|
||||
|
|
|
@ -15,11 +15,10 @@ 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;
|
||||
import org.gcube.accounting.analytics.TotalFilters;
|
||||
import org.gcube.accounting.analytics.UsageValue;
|
||||
import org.gcube.accounting.analytics.exception.DuplicatedKeyFilterException;
|
||||
import org.gcube.accounting.analytics.exception.KeyException;
|
||||
import org.gcube.accounting.analytics.exception.ValueException;
|
||||
|
@ -288,7 +287,7 @@ public class AccountingPersistenceQuery implements AccountingPersistenceBackendQ
|
|||
|
||||
|
||||
@Override
|
||||
public List<TotalFilters> getUsageValueQuotaTotal( List<TotalFilters> listUsage)
|
||||
public List<UsageValue> getUsageValueQuotaTotal( List<UsageValue> listUsage)
|
||||
throws Exception {
|
||||
|
||||
return AccountingPersistenceBackendQueryFactory.getInstance()
|
||||
|
|
Loading…
Reference in New Issue