Class AbstractRecord
java.lang.Object
org.gcube.documentstore.records.implementation.AbstractRecord
- All Implemented Interfaces:
Serializable,Comparable<Record>,Record
- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,List<FieldAction>> protected static final Stringprotected static final Stringprotected Map<String,Serializable> resource-specific propertiesprotected Map<String,List<FieldAction>> Fields inherited from interface org.gcube.documentstore.records.Record
RECORD_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidintCompare this Record instance with the one provided as argumentprotected voidcomputeField(String key) getAllFields(Class<?> type) Return the instant when thisRecordwas created.protected CalendarReturn the right end of the time interval covered by this Recordprotected longReturn the right end of the time interval covered by this RecordgetId()Return the unique id for thisRecordprotected intReturn all resource-specific properties.Return the value of the given resource property.protected CalendarReturn the left end of the time interval covered by this Recordprotected longReturn the left end of the time interval covered by this Recordprotected voidinit()Initialize variableprotected voidprotected BooleanvoidRemove a property from Record.protected voidsetAggregated(Boolean aggregate) Set the boolean aggregate by this RecordvoidsetCreationTime(Calendar creationTime) The CreationTime is automatically created by the implementation Class.protected voidsetEndTime(Calendar endTime) Set the right end of the time interval covered by this RecordvoidThe ID SHOULD be automatically created by the implementation Class.protected voidsetOperationCount(int operationCount) voidsetResourceProperties(Map<String, ? extends Serializable> properties) Set all resource-specific properties, replacing existing onesvoidsetResourceProperty(String key, Serializable value) Set the value of the given resource property.protected voidsetStartTime(Calendar startTime) Set the left end of the time interval covered by this Recordstatic CalendartimestampToCalendar(long millis) toString()voidvalidate()Validate the Resource Record.protected SerializablevalidateField(String key, Serializable value) protected Map<String,? extends Serializable> validateProperties(Map<String, ? extends Serializable> properties) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.gcube.documentstore.records.Record
getRecordType
-
Field Details
-
ID
- See Also:
-
CREATION_TIME
- See Also:
-
resourceProperties
resource-specific properties -
validation
-
computation
-
requiredFields
-
computedFields
-
aggregatedFields
-
-
Constructor Details
-
AbstractRecord
public AbstractRecord() -
AbstractRecord
- Throws:
InvalidValueException
-
-
Method Details
-
getAllFields
-
initializeValidation
protected void initializeValidation() -
getQuerableKeys
- Specified by:
getQuerableKeysin interfaceRecord- Returns:
- Querable Keys as SortedSet
- Throws:
Exception
-
cleanExtraFields
protected void cleanExtraFields() -
init
protected void init()Initialize variable -
getRequiredFields
- Specified by:
getRequiredFieldsin interfaceRecord- Returns:
- a Set containing the keys of required fields The returned Set MUST be a copy of the internal representation. Any modification to the returned Set MUST not affect the object
-
getComputedFields
- Specified by:
getComputedFieldsin interfaceRecord- Returns:
- a Set containing the keys of computed fields The returned Set MUST be a copy of the internal representation. Any modification to the returned Set MUST not affect the object
-
getAggregatedFields
-
getId
Return the unique id for thisRecord -
setId
The ID SHOULD be automatically created by the implementation Class. Set the ID only if you really know what you are going to do. Set the unique id for thisRecord- Specified by:
setIdin interfaceRecord- Parameters:
id- Unique ID- Throws:
InvalidValueException
-
timestampToCalendar
-
getCreationTime
Return the instant when thisRecordwas created.- Specified by:
getCreationTimein interfaceRecord- Returns:
- the creation time for this
Record
-
setCreationTime
The CreationTime is automatically created by the implementation Class. Set the CreationTime only if you really know what you are going to do. Set the instant when thisRecordwas created.- Specified by:
setCreationTimein interfaceRecord- Parameters:
creationTime- Creation Time- Throws:
InvalidValueException
-
getResourceProperties
Return all resource-specific properties. The returned Map is a copy of the internal representation. Any modification to the returned Map MUST not affect the object- Specified by:
getResourcePropertiesin interfaceRecord- Returns:
- a Map containing the properties
-
setResourceProperties
public void setResourceProperties(Map<String, ? extends Serializable> properties) throws InvalidValueExceptionSet all resource-specific properties, replacing existing ones- Specified by:
setResourcePropertiesin interfaceRecord- Throws:
InvalidValueException
-
getResourceProperty
Return the value of the given resource property.- Specified by:
getResourcePropertyin interfaceRecord- Parameters:
key- the key of the requested property- Returns:
- the value of the given resource property
-
removeResourceProperty
Description copied from interface:RecordRemove a property from Record. This API is intended for intern use only.- Specified by:
removeResourcePropertyin interfaceRecord- Parameters:
key- the key of the requested property to remove
-
setResourceProperty
Set the value of the given resource property. If the key has the value of one of the predefined property, the value is validated.- Specified by:
setResourcePropertyin interfaceRecord- Parameters:
key- the key of the requested propertyvalue- the value of the given resource property- Throws:
InvalidValueException
-
setEndTime
Set the right end of the time interval covered by this Record- Parameters:
endTime- End Time- Throws:
InvalidValueException
-
getEndTimeInMillis
protected long getEndTimeInMillis()Return the right end of the time interval covered by this Record- Returns:
- End Time
-
getEndTimeAsCalendar
Return the right end of the time interval covered by this Record- Returns:
- End Time
-
getOperationCount
protected int getOperationCount() -
setOperationCount
- Throws:
InvalidValueException
-
getStartTimeInMillis
protected long getStartTimeInMillis()Return the left end of the time interval covered by this Record- Returns:
- Start Time
-
getStartTimeAsCalendar
Return the left end of the time interval covered by this Record- Returns:
- Start Time
-
setStartTime
Set the left end of the time interval covered by this Record- Parameters:
startTime- Start Time- Throws:
InvalidValueException
-
setAggregated
Set the boolean aggregate by this Record- Parameters:
aggregate-- Throws:
InvalidValueException
-
isAggregated
-
validateField
- Throws:
InvalidValueException
-
computeField
- Throws:
InvalidValueException
-
validateProperties
protected Map<String,? extends Serializable> validateProperties(Map<String, ? extends Serializable> properties) throws InvalidValueException- Throws:
InvalidValueException
-
validate
Validate the Resource Record. The validation check if all the Required Field are set and has valid value.- Specified by:
validatein interfaceRecord- Throws:
InvalidValueException
-
toString
-
compareTo
Compare this Record instance with the one provided as argument- Specified by:
compareToin interfaceComparable<Record>- Parameters:
record- the Record to compare- Returns:
- 0 is and only if the Record provided as parameter contains all and ONLY the parameters contained in this instance. If the number of parameters differs, the methods return the difference between the number of parameter in this instance and the ones in the Record provided as parameter. If the size is the same but the Record provided as parameter does not contains all parameters in this instance, -1 is returned.
-