accounting-lib/src/main/java/org/gcube/accounting/datamodel/UsageRecord.java

304 lines
8.4 KiB
Java

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<UsageRecord>{
public enum OperationResult {
SUCCESS, FAILED
}
/**
* 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;
/**
* Return the creation time for this {#UsageRecord}
* @return the creation time for this {#UsageRecord}
*/
@Deprecated
public Date getCreateTime();
/**
* 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;
*/
/**
* 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
*/
@Deprecated
public String getResourceOwner();
/**
* Set the identity id of the accounting owner
* @param ownerID The identity id of the accounting owner
* @throws InvalidValueException
*/
@Deprecated
public void setResourceOwner(String ownerID) throws InvalidValueException;
/**
* Return the id of the usage record aggregating this, null if this record
* has not been aggregated by any record.
* This method id deprecated. Use {@link #getAggregatedUsageRecordId()}
* instead.
* @return Aggregated Id The ID of the aggregation Record
*/
@Deprecated
public String getAggregatedId();
/**
* Set the id of the usage record aggregating this.
* This method id deprecated. Use {@link #setAggregatedUsageRecordId()}
* instead.
* @param aggregatedId The ID of the aggregation Record
* @throws InvalidValueException
*/
@Deprecated
public void setAggregatedId(String aggregatedId) throws InvalidValueException;
/**
* Return the id of the usage record aggregating this, null if this record
* has not been aggregated by any record.
* @return Aggregated Id The ID of the aggregation Record
*/
public String getAggregatedUsageRecordId();
/**
* Set the id of the usage record aggregating this
* @param aggregatedId The ID of the aggregation Record
* @throws InvalidValueException
*/
public void setAggregatedUsageRecordId(String aggregatedId) throws InvalidValueException;
/**
* Return all resource properties
* Use {@link #getResourceSpecificProperties()}
* @return a Map containing the properties
*/
@Deprecated
public Map<String, Serializable> getResourceSpecificProperties();
/**
* Set all resource properties, replacing existing ones
* Use {@link #setResourceSpecificProperties()}
*/
@Deprecated
public void setResourceSpecificProperties(Map<String, Serializable> resourceSpecificProperties) throws InvalidValueException;
/**
* Return all resource-specific properties
* @return a Map containing the properties
*/
public Map<String, Serializable> getResourceProperties();
/**
* Set all resource-specific properties, replacing existing ones
*/
public void setResourceProperties(Map<String, Serializable> resourceSpecificProperties) throws InvalidValueException;
/**
* Return the value of the given resource property.
* @param key the key of the requested property
* @return the value of the given resource property
*/
@Deprecated
public Serializable getResourceSpecificProperty(String key);
/**
* Set the value of the given resource property.
* If the key has the value of one of the predefined property, the value
* is validated.
* @param key the key of the requested property
* @param value the value of the given resource property
*/
@Deprecated
public void setResourceSpecificProperty(String key, Serializable value) throws InvalidValueException;
/**
* Return the value of the given resource property.
* @param key the key of the requested property
* @return the value of the given resource property
*/
public Serializable getResourceProperty(String key);
/**
* Set the value of the given resource property.
* If the key has the value of one of the predefined property, the value
* is validated.
* @param key the key of the requested property
* @param value the value of the given resource property
*/
public void setResourceProperty(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);
/**
* @return the Operation Result related to the accounted Usage Record
*/
public OperationResult getOperationResult();
/**
* Set the Operation Result related to the accounted Usage Record
* @param operationResult the Operation Result to set
* @throws InvalidValueException
*/
public void setOperationResult(OperationResult operationResult) throws InvalidValueException;
/**
* Validate the Resource Record
* @throws InvalidValueException
*/
public void validate() throws InvalidValueException;
}