2015-06-09 14:03:59 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
package org.gcube.accounting.datamodel.implementations.aggregated;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getInvocationCount() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(INVOCATION_COUNT);
|
2015-06-09 14:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setInvocationCount(String invocationCount) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(INVOCATION_COUNT, invocationCount);
|
2015-06-09 14:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getAverageInvocationTime() {
|
2015-06-09 14:54:14 +02:00
|
|
|
return (String) this.resourceProperties.get(AVERAGE_INVOCATION_COUNT);
|
2015-06-09 14:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setAverageInvocationTime(String averageInvocationTime) throws InvalidValueException {
|
2015-06-09 14:54:14 +02:00
|
|
|
setResourceProperty(AVERAGE_INVOCATION_COUNT, averageInvocationTime);
|
2015-06-09 14:03:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {@inheritDoc}
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public List<ServiceUsageRecord> aggregate(List<ServiceUsageRecord> records) {
|
|
|
|
// TODO implements
|
|
|
|
throw new UnsupportedOperationException();
|
|
|
|
}
|
|
|
|
}
|