package org.gcube.accounting.datamodel; import java.io.Serializable; import java.util.Calendar; import java.util.Date; import java.util.Map; import org.gcube.accounting.exception.InvalidValueException; public interface UsageRecord extends Comparable{ /** * Return the unique id for this {#UsageRecord} * @return {#UsageRecord} Unique ID */ public String getId(); /** * Set the unique id for this {#UsageRecord} * @param id {#UsageRecord} Unique ID * @throws InvalidValueException */ public void setId(String id) throws InvalidValueException; /** * Return the identity of the entity creating this {#UsageRecord} * @return Creator ID */ public String getCreatorId(); /** * Set the identity of the entity creating this {#UsageRecord} * @param creatorId Creator ID * @throws InvalidValueException */ public void setCreatorId(String creatorId) throws InvalidValueException; /** * Return the identity of the entity that consumed the resource * @return Consumer ID */ public String getConsumerId(); /** * Set the identity of the entity that consumed the resource * @param consumerId Consumer ID * @throws InvalidValueException */ public void setConsumerId(String consumerId) throws InvalidValueException; /** * Return the creation time for this {#UsageRecord} * @return the creation time for this {#UsageRecord} */ public Calendar getCreationTime(); /** * Set the creation time for this {#UsageRecord} * @param creationTime creation time * @throws InvalidValueException */ public void setCreationTime(Calendar creationTime) throws InvalidValueException; /** * Use {{@link #setCreationTime(Calendar)}} instead * @param createTime * @throws InvalidValueException */ @Deprecated public void setCreateTime(Date createTime) throws InvalidValueException; /** * Return the left end of the time interval covered by this {#UsageRecord} * @return Start Time */ public Calendar getStartTime(); /** * Set the left end of the time interval covered by this {#UsageRecord} * @param startTime Start Time * @throws InvalidValueException */ public void setStartTime(Calendar startTime) throws InvalidValueException; /** * Use {{@link #setStartTime(Calendar)}} instead * @param createTime * @throws InvalidValueException */ @Deprecated public void setStartTime(Date startTime) throws InvalidValueException; /** * Return the right end of the time interval covered by this {#UsageRecord} * @return End Time */ public Calendar getEndTime(); /** * Set the right end of the time interval covered by this {#UsageRecord} * @param endTime End Time * @throws InvalidValueException */ public void setEndTime(Calendar endTime) throws InvalidValueException; /** * Use {{@link #setEndTime(Calendar)}} instead * @param createTime * @throws InvalidValueException */ @Deprecated public void setEndTime(Date endTime) throws InvalidValueException; /** * Return the type of the {#UsageRecord}. * It is a alternative way of obj.getClass().getSimpleName() * @return Resource Type */ public String getUsageRecordType(); /** * Use {#getUsageRecordType} instead * @param resourceType * @return Usage Record Type */ @Deprecated public String getResourceType(); /** * This method is not valid due to Resource Type is derived by * the Usage Record Implementation class. The method is deprecated and * the implementations in known classes is a NoOperation. * @param resourceType */ @Deprecated public void setResourceType(String resourceType); /** * Return the accounting scope of the {#UsageRecord} * @return The Accounting scope of the {#UsageRecord} */ public String getResourceScope(); /** * Set the accounting scope of the {#UsageRecord} * @param scope The accounting scope of the {#UsageRecord} * @throws InvalidValueException */ public void setResourceScope(String scope) throws InvalidValueException; /** * Return the identity id of the accounting owner * @return The identity id of the accounting owner */ public String getResourceOwner(); /** * Set the identity id of the accounting owner * @param ownerID The identity id of the accounting owner * @throws InvalidValueException */ public void setResourceOwner(String ownerID) throws InvalidValueException; /** * Return the id of the usage record aggregating this * @return Aggregated Id */ public String getAggregatedId(); /** * Set the id of the usage record aggregating this * @param aggregatedId * @throws InvalidValueException */ public void setAggregatedId(String aggregatedId) throws InvalidValueException; /** * Return all resource-specific properties * @return */ public Map getResourceSpecificProperties(); /** * Set all resource-specific properties, replacing existing ones */ public void setResourceSpecificProperties(Map resourceSpecificProperties) throws InvalidValueException; /** * Return the value of the given resource-specific property * @param key * @return the value of the given resource-specific property */ public Serializable getResourceSpecificProperty(String key); /** * Set the value of the given resource-specific property * @param key * @param value */ public void setResourceSpecificProperty(String key, Serializable value) throws InvalidValueException; /** * The method is deprecated and the implementations in known classes * return Consumer ID * @return Consumer ID */ @Deprecated public String getFullyQualifiedConsumerId(); /** * The method is deprecated and the implementations in known classes is * a NoOperation. * @param fqcid Fully Qualified Consumer Id */ @Deprecated public void setFullyQualifiedConsumerId(String fqcid); /** * Validate the Resource Record * @throws InvalidValueException */ public void validate() throws InvalidValueException; }