refs #200: Create accouting-lib library

https://support.d4science.org/issues/200
Fixing data model

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/accounting/accounting-lib@115427 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2015-06-18 14:30:42 +00:00
parent 6aa2f23d8f
commit d7a09966bc
1 changed files with 12 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import org.gcube.accounting.datamodel.deprecationmanagement.annotations.Deprecat
import org.gcube.accounting.datamodel.validations.annotations.NotEmpty;
import org.gcube.accounting.datamodel.validations.annotations.ValidIP;
import org.gcube.accounting.datamodel.validations.annotations.ValidInteger;
import org.gcube.accounting.datamodel.validations.annotations.ValidLong;
import org.gcube.accounting.exception.InvalidValueException;
/**
@ -48,6 +49,9 @@ public class ServiceUsageRecord extends BasicUsageRecord implements SingleUsageR
@RequiredField @NotEmpty
public static final String SERVICE_NAME = "serviceName";
@RequiredField @ValidLong
public static final String DURATION = "duration";
public ServiceUsageRecord(){
super();
}
@ -87,6 +91,7 @@ public class ServiceUsageRecord extends BasicUsageRecord implements SingleUsageR
public void setRefVM(String refVM) throws InvalidValueException {
setResourceProperty(REF_VM, refVM);
}
/*
protected String getDomain() {
return (String) this.resourceProperties.get(DOMAIN);
@ -129,4 +134,11 @@ public class ServiceUsageRecord extends BasicUsageRecord implements SingleUsageR
setResourceProperty(SERVICE_NAME, serviceName);
}
public Long getDuration() {
return (Long) this.resourceProperties.get(DURATION);
}
public void setAverageInvocationTime(Long duration) throws InvalidValueException {
setResourceProperty(DURATION, duration);
}
}