Class ModelContextImpl
- java.lang.Object
-
- no.priv.bang.modeling.modelstore.backend.ModelContextImpl
-
- All Implemented Interfaces:
ModelContext
public class ModelContextImpl extends Object implements ModelContext
-
-
Field Summary
Fields Modifier and Type Field Description private DateFactory
dateFactory
private Set<Propertyset>
embeddedAspects
protected UUID
metadataId
private Modelstore
modelstore
private Map<UUID,Propertyset>
propertysets
-
Constructor Summary
Constructors Constructor Description ModelContextImpl()
ModelContextImpl(Modelstore modelstore)
-
Method Summary
All Methods Instance Methods Concrete 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
.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.(package private) Set<Propertyset>
followInheritanceChain(Propertyset aspect)
Date
getLastmodifieddate(Propertyset propertyset)
Get the last modified date and time of a propertyset.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
.private void
loadEmbeddedAspects()
void
logError(String message, Object fileOrStream, Exception e)
Log an error situation that resulted in a caught exception.void
merge(ModelContext otherContext)
String
toString()
-
-
-
Field Detail
-
metadataId
protected final UUID metadataId
-
propertysets
private Map<UUID,Propertyset> propertysets
-
embeddedAspects
private Set<Propertyset> embeddedAspects
-
modelstore
private Modelstore modelstore
-
dateFactory
private DateFactory dateFactory
-
-
Constructor Detail
-
ModelContextImpl
public ModelContextImpl()
-
ModelContextImpl
public ModelContextImpl(Modelstore modelstore)
-
-
Method Detail
-
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
-
createList
public ValueList createList()
Description copied from interface:ModelContext
Create a new emptyValueList
.- Specified by:
createList
in interfaceModelContext
- Returns:
- a
ValueList
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
-
loadEmbeddedAspects
private void loadEmbeddedAspects()
-
followInheritanceChain
Set<Propertyset> followInheritanceChain(Propertyset aspect)
-
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
- 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
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
-
-