Interface ModelContext
-
- All Known Implementing Classes:
ModelContextImpl
,ModelContextRecordingMetadata
public interface ModelContext
A ModelContext is a reference to a set of interconnectedPropertyset
instances forming a model or several models. A ModelContext can be persisted with JsonPropertysetPersister#persist(java.io.File, ModelContext) and restored with JsonPropertysetPersister#restore(java.io.File, ModelContext). AModelContext
will keep track of the last modification time of eachPropertyset
and when merging two ModelContexts allPropertyset
s will be merged, and when merging eachPropertyset
, thePropertyset
with the newest modification date will win in case of conflict.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ValueList
createList()
Create a new emptyValueList
.Propertyset
createPropertyset()
Create a newPropertyset
instance that has no id and can be used as a complex property value of anotherPropertyset
.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.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)
-
-
-
Method Detail
-
createPropertyset
Propertyset createPropertyset()
Create a newPropertyset
instance that has no id and can be used as a complex property value of anotherPropertyset
.- Returns:
- a
Propertyset
instance
-
findPropertyset
Propertyset findPropertyset(UUID id)
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.- Parameters:
id
- aUUID
identifying aPropertyset
- Returns:
- a
Propertyset
matching the id argument
-
listAllPropertysets
Collection<Propertyset> listAllPropertysets()
List all of thePropertyset
instances with ids, except for the aspects that is built into everyPropertyset
.- Returns:
- a collection of
Propertyset
instances
-
listAllAspects
Collection<Propertyset> listAllAspects()
List all of thePropertyset
instances with ids that contain aspect descriptions in this context. Aspect definitons follow a structure similar to JSON schemas.- Returns:
- a collection of
Propertyset
instances containing aspect definitions.
-
findObjectsOfAspect
Collection<Propertyset> findObjectsOfAspect(Propertyset aspect)
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.- Parameters:
aspect
- the aspect to find propertysets matching- Returns:
- a collection of
Propertyset
instances
-
getLastmodifieddate
Date getLastmodifieddate(Propertyset propertyset)
Get the last modified date and time of a propertyset.- 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
-
merge
void merge(ModelContext otherContext)
-
logError
void logError(String message, Object fileOrStream, Exception e)
Log an error situation that resulted in a caught exception.- 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
-
-