Class ModelContexts
- java.lang.Object
-
- no.priv.bang.modeling.modelstore.backend.ModelContexts
-
public class ModelContexts extends Object
Common code and constants forModelContext
implementations.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static UUID
metadataId
-
Constructor Summary
Constructors Modifier Constructor Description private
ModelContexts()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
addMissingPropertysetToContext(ModelContext context, UUID propertysetId, Propertyset propertyset)
private static Collection<UUID>
findPropertysetIds(Collection<Propertyset> propertysets)
static ModelContext
findWrappedModelContext(ModelContext modelcontext)
static void
merge(ModelContext context, ModelContext otherContext)
Merge twoModelContext
objects.
-
-
-
Field Detail
-
metadataId
static final UUID metadataId
-
-
Method Detail
-
findWrappedModelContext
public static ModelContext findWrappedModelContext(ModelContext modelcontext)
-
merge
public static void merge(ModelContext context, ModelContext otherContext)
Merge twoModelContext
objects. The merge results will be the first context. EachPropertyset
in the contexts will be merged separately. If a propertyset in otherContext doesn't exist in context it will be copied into context. The primitive values are immutable and will be reused. Complex properties and list properties will be copied to avoid thread synchronization issues.Propertyset
instances that exist in both contexts will result in the values of thePropertyset
instance in one context being copied into thePropertyset
instance in the other context. WhichPropertyset
is copied into and which is copied from, depends on the lastmodified time of thePropertyset
(newestPropertyset
is copied from and oldestPropertyset
is copied into, potentially overwriting properties with the same name). ForModelContext
implementations with no lastmodifiedtime information otherContext propertysets will be copied into context propertysets.- Parameters:
context
- the context that will contain the merge resultsotherContext
- the context that is merged into the other context, this context is unchanged after the merge
-
addMissingPropertysetToContext
private static void addMissingPropertysetToContext(ModelContext context, UUID propertysetId, Propertyset propertyset)
-
findPropertysetIds
private static Collection<UUID> findPropertysetIds(Collection<Propertyset> propertysets)
-
-