Class ModelContextRecordingMetadata
- java.lang.Object
-
- no.priv.bang.modeling.modelstore.backend.ModelContextRecordingMetadata
-
- All Implemented Interfaces:
ModelContext
,ModificationRecorder
public class ModelContextRecordingMetadata extends Object implements ModelContext, ModificationRecorder
-
-
Field Summary
Fields Modifier and Type Field Description private DateFactory
dateFactory
private DateFormat
dateFormat
private ModelContext
impl
private Map<UUID,Date>
lastmodifiedtime
private ValueCreator
valueCreator
-
Constructor Summary
Constructors Constructor Description ModelContextRecordingMetadata(ModelContext nonMetadataRecordingContext, DateFactory dateFactory, ValueCreator valueCreator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueList
createList()
Create a new emptyValueList
.private Propertyset
createMetadata()
Propertyset
createPropertyset()
Create a newPropertyset
instance that has no id and can be used as a complex property value of anotherPropertyset
.boolean
equals(Object obj)
Collection<Propertyset>
findObjectsOfAspect(Propertyset aspect)
Find all of thePropertyset
instances that have had a particular aspect applied to it.Propertyset
findPropertyset(UUID id)
Return aPropertyset
with aPropertyset.getId()
matching the argument.Date
getLastmodifieddate(Propertyset propertyset)
Get the last modified date and time of a propertyset.(package private) ModelContext
getWrappedModelContext()
int
hashCode()
Collection<Propertyset>
listAllAspects()
List all of thePropertyset
instances with ids that contain aspect descriptions in this context.Collection<Propertyset>
listAllPropertysets()
List all of thePropertyset
instances with ids, except for the aspects that is built into everyPropertyset
.void
logError(String message, Object fileOrStream, Exception e)
Log an error situation that resulted in a caught exception.void
merge(ModelContext otherContext)
void
modifiedPropertyset(Propertyset propertyset)
Set a timestamp for the propertyset given as an argument(package private) void
setLastmodifiedtimes(Propertyset metadata)
UUIDs of propertysets are the propertynames of the "lastmodifiedtimes" complex property.String
toString()
-
-
-
Field Detail
-
dateFormat
private final DateFormat dateFormat
-
impl
private ModelContext impl
-
dateFactory
private DateFactory dateFactory
-
valueCreator
private ValueCreator valueCreator
-
-
Constructor Detail
-
ModelContextRecordingMetadata
public ModelContextRecordingMetadata(ModelContext nonMetadataRecordingContext, DateFactory dateFactory, ValueCreator valueCreator)
-
-
Method Detail
-
setLastmodifiedtimes
void setLastmodifiedtimes(Propertyset metadata)
UUIDs of propertysets are the propertynames of the "lastmodifiedtimes" complex property. The values are strings containingDate
values from the propertyset's last modified date.- Parameters:
metadata
- aPropertyset
to extract saved last modified times from
-
getWrappedModelContext
ModelContext getWrappedModelContext()
-
createList
public ValueList createList()
Description copied from interface:ModelContext
Create a new emptyValueList
.- Specified by:
createList
in interfaceModelContext
- Returns:
- a
ValueList
instance
-
createPropertyset
public Propertyset createPropertyset()
Description copied from interface:ModelContext
Create a newPropertyset
instance that has no id and can be used as a complex property value of anotherPropertyset
.- Specified by:
createPropertyset
in interfaceModelContext
- Returns:
- a
Propertyset
instance
-
findPropertyset
public Propertyset findPropertyset(UUID id)
Description copied from interface:ModelContext
Return aPropertyset
with aPropertyset.getId()
matching the argument. If no matchingPropertyset
can be found a new one will be created, empty except for the id.- Specified by:
findPropertyset
in interfaceModelContext
- Parameters:
id
- aUUID
identifying aPropertyset
- Returns:
- a
Propertyset
matching the id argument
-
listAllPropertysets
public Collection<Propertyset> listAllPropertysets()
Description copied from interface:ModelContext
List all of thePropertyset
instances with ids, except for the aspects that is built into everyPropertyset
.- Specified by:
listAllPropertysets
in interfaceModelContext
- Returns:
- a collection of
Propertyset
instances
-
listAllAspects
public Collection<Propertyset> listAllAspects()
Description copied from interface:ModelContext
List all of thePropertyset
instances with ids that contain aspect descriptions in this context. Aspect definitons follow a structure similar to JSON schemas.- Specified by:
listAllAspects
in interfaceModelContext
- Returns:
- a collection of
Propertyset
instances containing aspect definitions.
-
findObjectsOfAspect
public Collection<Propertyset> findObjectsOfAspect(Propertyset aspect)
Description copied from interface:ModelContext
Find all of thePropertyset
instances that have had a particular aspect applied to it. If the aspect is a base object for other aspects, propertysets matching the child aspects will also be returned.- Specified by:
findObjectsOfAspect
in interfaceModelContext
- Parameters:
aspect
- the aspect to find propertysets matching- Returns:
- a collection of
Propertyset
instances
-
modifiedPropertyset
public void modifiedPropertyset(Propertyset propertyset)
Set a timestamp for the propertyset given as an argument- Specified by:
modifiedPropertyset
in interfaceModificationRecorder
- Parameters:
propertyset
- thePropertyset
to set a timestamp for
-
getLastmodifieddate
public Date getLastmodifieddate(Propertyset propertyset)
Description copied from interface:ModelContext
Get the last modified date and time of a propertyset.- Specified by:
getLastmodifieddate
in interfaceModelContext
- Specified by:
getLastmodifieddate
in interfaceModificationRecorder
- Parameters:
propertyset
- thePropertyset
to find the last modified time for- Returns:
- date and time of the last modification for the propertyset, or null if no modification date could be found
-
createMetadata
private Propertyset createMetadata()
-
merge
public void merge(ModelContext otherContext)
- Specified by:
merge
in interfaceModelContext
-
logError
public void logError(String message, Object fileOrStream, Exception e)
Description copied from interface:ModelContext
Log an error situation that resulted in a caught exception.- Specified by:
logError
in interfaceModelContext
- Parameters:
message
- a human readable message explaining where the error occurredfileOrStream
- a File or stream involved in the error, null if not relevante
- the exception caught by the code logging the error
-
-