accounting-lib/src/main/java/org/gcube/accounting/datamodel/implementations/aggregated/ServiceUsageRecord.java

66 lines
1.9 KiB
Java

/**
*
*/
package org.gcube.accounting.datamodel.implementations.aggregated;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.gcube.accounting.datamodel.AggregatedUsageRecord;
import org.gcube.accounting.datamodel.decorators.AggregatedField;
import org.gcube.accounting.datamodel.validations.annotations.ValidInteger;
import org.gcube.accounting.exception.InvalidValueException;
/**
* @author Luca Frosini (ISTI - CNR) http://www.lucafrosini.com/
*
*/
public class ServiceUsageRecord extends org.gcube.accounting.datamodel.implementations.ServiceUsageRecord implements AggregatedUsageRecord<ServiceUsageRecord> {
/**
* Generated Serial Version UID
*/
private static final long serialVersionUID = 6387584974618335623L;
@ValidInteger @AggregatedField
protected static final String INVOCATION_COUNT = "invocationCount";
@ValidInteger @AggregatedField
protected static final String AVERAGE_INVOCATION_COUNT = "averageInvocationTime";
public ServiceUsageRecord(){
super();
this.resourceProperties.put(AGGREGATED, true);
}
public ServiceUsageRecord(Map<String, Serializable> properties) throws InvalidValueException{
super(properties);
this.resourceProperties.put(AGGREGATED, true);
}
public String getInvocationCount() {
return (String) this.resourceProperties.get(INVOCATION_COUNT);
}
public void setInvocationCount(String invocationCount) throws InvalidValueException {
setResourceProperty(INVOCATION_COUNT, invocationCount);
}
public String getAverageInvocationTime() {
return (String) this.resourceProperties.get(AVERAGE_INVOCATION_COUNT);
}
public void setAverageInvocationTime(String averageInvocationTime) throws InvalidValueException {
setResourceProperty(AVERAGE_INVOCATION_COUNT, averageInvocationTime);
}
/**
* {@inheritDoc}
*/
@Override
public List<ServiceUsageRecord> aggregate(List<ServiceUsageRecord> records) {
// TODO
throw new UnsupportedOperationException();
}
}