public abstract class BasicUsageRecord extends Object implements UsageRecord, Serializable
UsageRecord.OperationResult| Modifier and Type | Field and Description |
|---|---|
protected static String |
AGGREGATED |
protected static String |
AGGREGATED_USAGE_RECORD_ID |
protected Set<String> |
aggregatedFields |
protected Set<String> |
computedFields |
static String |
CONSUMER_ID |
static String |
CREATION_TIME |
static String |
CREATOR_ID |
protected static String |
END_TIME |
static String |
ID |
static String |
OPERATION_RESULT |
protected Set<String> |
requiredFields |
static String |
RESOURCE_SCOPE |
protected Map<String,Serializable> |
resourceProperties
resource-specific properties
|
protected static String |
START_TIME |
protected static String |
USAGE_RECORD_TYPE |
protected Map<String,List<FieldAction>> |
validation |
| Constructor and Description |
|---|
BasicUsageRecord() |
BasicUsageRecord(Map<String,Serializable> properties) |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(UsageRecord usageRecord)
Compare this UsageRecord instance with the one provided as argument
|
String |
getAggregatedUsageRecordId()
Return the id of the usage record aggregating this, null if this record
has not been aggregated by any record.
|
protected static Class<? extends UsageRecord> |
getClass(String usageRecordName,
boolean aggregated) |
String |
getConsumerId()
Return the identity of the entity that consumed the resource
|
Calendar |
getCreationTime()
Return the creation time for this {#UsageRecord}
|
String |
getCreatorId()
Return the identity of the entity creating this {#UsageRecord}
|
protected Calendar |
getEndTimeAsCalendar()
Return the right end of the time interval covered by this {#UsageRecord}
|
String |
getId()
Return the unique id for this {#UsageRecord}
|
UsageRecord.OperationResult |
getOperationResult() |
Map<String,Serializable> |
getResourceProperties()
Return all resource-specific properties.
|
Serializable |
getResourceProperty(String key)
Return the value of the given resource property.
|
String |
getResourceScope()
Return the accounting scope of the {#UsageRecord}
|
protected Calendar |
getStartTimeAsCalendar()
Return the left end of the time interval covered by this {#UsageRecord}
|
static UsageRecord |
getUsageRecord(Map<String,Serializable> usageRecordMap)
This method use the resourceType value contained in the Map to instance
the right UsageRecord class and return it.
|
protected void |
initializeValidation() |
void |
setAggregatedUsageRecordId(String aggregatedId)
Set the id of the usage record aggregating this
|
void |
setConsumerId(String consumerId)
Set the identity of the entity that consumed the resource
|
void |
setCreationTime(Calendar creationTime)
Set the creation time for this {#UsageRecord}
|
void |
setCreatorId(String creatorId)
Set the identity of the entity creating this {#UsageRecord}
|
protected void |
setEndTime(Calendar endTime)
Set the right end of the time interval covered by this {#UsageRecord}
|
void |
setId(String id)
Set the unique id for this {#UsageRecord}
|
void |
setOperationResult(UsageRecord.OperationResult operationResult)
Set the Operation Result related to the accounted Usage Record
|
void |
setResourceProperties(Map<String,Serializable> properties)
Set all resource-specific properties, replacing existing ones
|
void |
setResourceProperty(String key,
Serializable value)
Set the value of the given resource property.
|
void |
setResourceScope(String scope)
Set the accounting scope of the {#UsageRecord}
|
protected void |
setStartTime(Calendar startTime)
Set the left end of the time interval covered by this {#UsageRecord}
|
protected Calendar |
timestampStringToCalendar(long millis) |
String |
toString() |
void |
validate()
Validate the Resource Record
|
protected Serializable |
validateField(String key,
Serializable serializable) |
protected void |
validateProperties(Map<String,Serializable> properties) |
public static final String ID
public static final String CREATOR_ID
public static final String CONSUMER_ID
public static final String CREATION_TIME
protected static final String START_TIME
protected static final String END_TIME
protected static final String USAGE_RECORD_TYPE
public static final String RESOURCE_SCOPE
protected static final String AGGREGATED
protected static final String AGGREGATED_USAGE_RECORD_ID
public static final String OPERATION_RESULT
protected Map<String,Serializable> resourceProperties
protected Map<String,List<FieldAction>> validation
public BasicUsageRecord()
public BasicUsageRecord(Map<String,Serializable> properties) throws InvalidValueException
InvalidValueExceptionprotected void initializeValidation()
public String getId()
getId in interface UsageRecordpublic void setId(String id) throws InvalidValueException
setId in interface UsageRecordid - {#UsageRecord} Unique IDInvalidValueExceptionpublic String getCreatorId()
getCreatorId in interface UsageRecordpublic void setCreatorId(String creatorId) throws InvalidValueException
setCreatorId in interface UsageRecordcreatorId - Creator IDInvalidValueExceptionpublic String getConsumerId()
getConsumerId in interface UsageRecordpublic void setConsumerId(String consumerId) throws InvalidValueException
setConsumerId in interface UsageRecordconsumerId - Consumer IDInvalidValueExceptionprotected Calendar timestampStringToCalendar(long millis)
public Calendar getCreationTime()
getCreationTime in interface UsageRecordpublic void setCreationTime(Calendar creationTime) throws InvalidValueException
setCreationTime in interface UsageRecordcreationTime - creation timeInvalidValueExceptionprotected Calendar getStartTimeAsCalendar()
protected void setStartTime(Calendar startTime) throws InvalidValueException
startTime - Start TimeInvalidValueExceptionprotected Calendar getEndTimeAsCalendar()
protected void setEndTime(Calendar endTime) throws InvalidValueException
endTime - End TimeInvalidValueExceptionpublic String getResourceScope()
getResourceScope in interface UsageRecordpublic void setResourceScope(String scope) throws InvalidValueException
setResourceScope in interface UsageRecordscope - The accounting scope of the {#UsageRecord}InvalidValueExceptionpublic String getAggregatedUsageRecordId()
getAggregatedUsageRecordId in interface UsageRecordpublic void setAggregatedUsageRecordId(String aggregatedId) throws InvalidValueException
setAggregatedUsageRecordId in interface UsageRecordaggregatedId - The ID of the aggregation RecordInvalidValueExceptionpublic Map<String,Serializable> getResourceProperties()
getResourceProperties in interface UsageRecordpublic void setResourceProperties(Map<String,Serializable> properties) throws InvalidValueException
setResourceProperties in interface UsageRecordInvalidValueExceptionpublic Serializable getResourceProperty(String key)
getResourceProperty in interface UsageRecordkey - the key of the requested propertypublic void setResourceProperty(String key, Serializable value) throws InvalidValueException
setResourceProperty in interface UsageRecordkey - the key of the requested propertyvalue - the value of the given resource propertyInvalidValueExceptionprotected Serializable validateField(String key, Serializable serializable) throws InvalidValueException
InvalidValueExceptionprotected void validateProperties(Map<String,Serializable> properties) throws InvalidValueException
InvalidValueExceptionpublic void validate()
throws InvalidValueException
validate in interface UsageRecordInvalidValueExceptionpublic UsageRecord.OperationResult getOperationResult()
getOperationResult in interface UsageRecordpublic void setOperationResult(UsageRecord.OperationResult operationResult) throws InvalidValueException
setOperationResult in interface UsageRecordoperationResult - the Operation Result to setInvalidValueExceptionpublic int compareTo(UsageRecord usageRecord)
compareTo in interface Comparable<UsageRecord>usageRecord - the Usage Record to compareprotected static Class<? extends UsageRecord> getClass(String usageRecordName, boolean aggregated) throws ClassNotFoundException
ClassNotFoundExceptionpublic static UsageRecord getUsageRecord(Map<String,Serializable> usageRecordMap) throws Exception
usageRecordMap - Exception - if failsCopyright © 2015. All Rights Reserved.