Class LensElementContext<O extends ObjectType>
- java.lang.Object
-
- com.evolveum.midpoint.model.impl.lens.LensElementContext<O>
-
- All Implemented Interfaces:
ModelElementContext<O>
,DebugDumpable
,Serializable
,Cloneable
- Direct Known Subclasses:
LensFocusContext
,LensProjectionContext
public abstract class LensElementContext<O extends ObjectType> extends Object implements ModelElementContext<O>, Cloneable
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description LensElementContext(@NotNull Class<O> objectTypeClass, LensContext<? extends ObjectType> lensContext)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.model.api.context.ModelElementContext
getArchetype, getSecondaryDelta, isAdd, isDelete, setSecondaryDelta
-
-
-
-
Constructor Detail
-
LensElementContext
public LensElementContext(@NotNull @NotNull Class<O> objectTypeClass, LensContext<? extends ObjectType> lensContext)
-
-
Method Detail
-
getIteration
public int getIteration()
-
setIteration
public void setIteration(int iteration)
-
getIterationToken
public String getIterationToken()
-
setIterationToken
public void setIterationToken(String iterationToken)
-
getSynchronizationIntent
public SynchronizationIntent getSynchronizationIntent()
Description copied from interface:ModelElementContext
Initial intent regarding the account. It indicated what the initiator of the operation WANTS TO DO with the context. If set to null then the decision is left to "the engine". Null is also a typical value when the context is created. It may be pre-set under some circumstances, e.g. if an account is being unlinked.- Specified by:
getSynchronizationIntent
in interfaceModelElementContext<O extends ObjectType>
-
setSynchronizationIntent
public void setSynchronizationIntent(SynchronizationIntent synchronizationIntent)
-
getLensContext
public LensContext<? extends ObjectType> getLensContext()
-
getNotNullPrismContext
protected PrismContext getNotNullPrismContext()
-
getObjectTypeClass
public Class<O> getObjectTypeClass()
- Specified by:
getObjectTypeClass
in interfaceModelElementContext<O extends ObjectType>
-
represents
public boolean represents(Class<?> type)
-
getPrismContext
public PrismContext getPrismContext()
-
getObjectOld
public PrismObject<O> getObjectOld()
- Specified by:
getObjectOld
in interfaceModelElementContext<O extends ObjectType>
-
setObjectOld
public void setObjectOld(PrismObject<O> objectOld)
- Specified by:
setObjectOld
in interfaceModelElementContext<O extends ObjectType>
-
getObjectCurrent
public PrismObject<O> getObjectCurrent()
- Specified by:
getObjectCurrent
in interfaceModelElementContext<O extends ObjectType>
-
setObjectCurrent
public void setObjectCurrent(PrismObject<O> objectCurrent)
-
getObjectAny
public PrismObject<O> getObjectAny()
- Specified by:
getObjectAny
in interfaceModelElementContext<O extends ObjectType>
-
setLoadedObject
public void setLoadedObject(PrismObject<O> object)
Sets current and possibly also old object. This method is used with freshly loaded object. The object is set as current object. If the old object was not initialized yet (and if it should be initialized) then the object is also set as old object.
-
getObjectNew
public PrismObject<O> getObjectNew()
- Specified by:
getObjectNew
in interfaceModelElementContext<O extends ObjectType>
-
setObjectNew
public void setObjectNew(PrismObject<O> objectNew)
- Specified by:
setObjectNew
in interfaceModelElementContext<O extends ObjectType>
-
getPrimaryDelta
public ObjectDelta<O> getPrimaryDelta()
- Specified by:
getPrimaryDelta
in interfaceModelElementContext<O extends ObjectType>
-
hasPrimaryDelta
public boolean hasPrimaryDelta()
-
getFixedPrimaryDelta
public ObjectDelta<O> getFixedPrimaryDelta()
As getPrimaryDelta() but caters for the possibility that an object already exists. So, if the primary delta is ADD and object already exists, it should be changed somehow, e.g. to MODIFY delta or to null. Actually, the question is what to do with the attribute values if changed to MODIFY. (a) Should they become REPLACE item deltas? (b) ADD ones? (c) Or should we compute a difference from objectCurrent to objectToAdd, hoping that secondary deltas will re-add everything that might be unknowingly removed by this step? (d) Or should we simply ignore ADD delta altogether, hoping that it was executed so it need not be repeated? And, should not we report AlreadyExistingException instead? It seems that (c) i.e. reverting back to objectToAdd is not a good idea at all. For example, this may erase linkRefs for good. For the time being let us proceed with (d), i.e. ignoring such a delta. TODO is this OK???? [med]- Returns:
-
setPrimaryDelta
public void setPrimaryDelta(ObjectDelta<O> primaryDelta)
- Specified by:
setPrimaryDelta
in interfaceModelElementContext<O extends ObjectType>
-
addPrimaryDelta
public void addPrimaryDelta(ObjectDelta<O> delta) throws SchemaException
- Specified by:
addPrimaryDelta
in interfaceModelElementContext<O extends ObjectType>
- Throws:
SchemaException
-
swallowToPrimaryDelta
public void swallowToPrimaryDelta(ItemDelta<?,?> itemDelta) throws SchemaException
- Throws:
SchemaException
-
swallowToSecondaryDelta
public abstract void swallowToSecondaryDelta(ItemDelta<?,?> itemDelta) throws SchemaException
- Throws:
SchemaException
-
swallowToDelta
public ObjectDelta<O> swallowToDelta(ObjectDelta<O> originalDelta, ItemDelta<?,?> propDelta) throws SchemaException
- Throws:
SchemaException
-
getAllDeltas
public abstract Collection<ObjectDelta<O>> getAllDeltas()
Returns collection of all deltas that this element context contains. This is a nice method to use if we want to inspect all deltas (e.g. look for a changed item) but we want to avoid the overhead of merging all the deltas together.
-
getPendingObjectPolicyStateModifications
@NotNull public @NotNull List<ItemDelta<?,?>> getPendingObjectPolicyStateModifications()
-
clearPendingObjectPolicyStateModifications
public void clearPendingObjectPolicyStateModifications()
-
addToPendingObjectPolicyStateModifications
public void addToPendingObjectPolicyStateModifications(ItemDelta<?,?> modification)
-
getPendingAssignmentPolicyStateModifications
@NotNull public @NotNull Map<AssignmentSpec,List<ItemDelta<?,?>>> getPendingAssignmentPolicyStateModifications()
-
clearPendingAssignmentPolicyStateModifications
public void clearPendingAssignmentPolicyStateModifications()
-
addToPendingAssignmentPolicyStateModifications
public void addToPendingAssignmentPolicyStateModifications(@NotNull @NotNull AssignmentType assignment, @NotNull @NotNull PlusMinusZero mode, @NotNull @NotNull ItemDelta<?,?> modification)
-
isModify
public boolean isModify()
-
getOperation
@NotNull public @NotNull SimpleOperationName getOperation()
-
getExecutedDeltas
@NotNull public @NotNull List<LensObjectDeltaOperation<O>> getExecutedDeltas()
- Specified by:
getExecutedDeltas
in interfaceModelElementContext<O extends ObjectType>
-
markExecutedDeltasAudited
public void markExecutedDeltasAudited()
-
addToExecutedDeltas
public void addToExecutedDeltas(LensObjectDeltaOperation<O> executedDelta)
-
getDelta
public ObjectDelta<O> getDelta() throws SchemaException
Returns user delta, both primary and secondary (merged together). The returned object is (kind of) immutable. Changing it may do strange things (but most likely the changes will be lost).- Specified by:
getDelta
in interfaceModelElementContext<O extends ObjectType>
- Throws:
SchemaException
-
getFixedDelta
public ObjectDelta<O> getFixedDelta() throws SchemaException
- Throws:
SchemaException
-
wasAddExecuted
public <F extends FocusType> boolean wasAddExecuted()
-
getObjectDeltaObject
public abstract ObjectDeltaObject<O> getObjectDeltaObject() throws SchemaException
- Throws:
SchemaException
-
getOid
public String getOid()
- Specified by:
getOid
in interfaceModelElementContext<O extends ObjectType>
-
determineOid
public String determineOid()
-
setOid
public void setOid(String oid)
Sets oid to the field but also to the deltas (if applicable).
-
getObjectDefinition
public PrismObjectDefinition<O> getObjectDefinition()
-
isFresh
public boolean isFresh()
-
setFresh
public void setFresh(boolean isFresh)
-
getPolicyRules
@NotNull public @NotNull Collection<EvaluatedPolicyRule> getPolicyRules()
Description copied from interface:ModelElementContext
Returns all policy rules that apply to this object - even those that were not triggered. The policy rules are compiled from all the applicable sources (target, meta-roles, etc.)- Specified by:
getPolicyRules
in interfaceModelElementContext<O extends ObjectType>
-
addPolicyRule
public void addPolicyRule(EvaluatedPolicyRule policyRule)
-
clearPolicyRules
public void clearPolicyRules()
-
triggerRule
public void triggerRule(@NotNull @NotNull EvaluatedPolicyRule rule, Collection<EvaluatedPolicyRuleTrigger<?>> triggers)
-
getPolicySituations
@NotNull public @NotNull Collection<String> getPolicySituations()
-
getSecurityPolicy
public SecurityPolicyType getSecurityPolicy()
Returns security policy applicable to the object. This means security policy applicable directory to focus or projection. It will NOT return global security policy.
-
setSecurityPolicy
public void setSecurityPolicy(SecurityPolicyType securityPolicy)
-
getCredentialsPolicy
public CredentialsPolicyType getCredentialsPolicy()
-
recompute
public void recompute() throws SchemaException, ConfigurationException
-
checkConsistence
public void checkConsistence()
-
checkConsistence
public void checkConsistence(String contextDesc)
-
checkConsistence
protected void checkConsistence(ObjectDelta<O> delta, boolean requireOid, String contextDesc)
-
isRequireSecondaryDeltaOid
protected boolean isRequireSecondaryDeltaOid()
-
checkConsistence
protected void checkConsistence(PrismObject<O> object, String elementDesc, String contextDesc)
-
cleanup
public abstract void cleanup()
Cleans up the contexts by removing some of the working state.
-
normalize
public void normalize()
-
adopt
public void adopt(PrismContext prismContext) throws SchemaException
- Throws:
SchemaException
-
clone
public abstract LensElementContext<O> clone(LensContext<? extends ObjectType> lensContext)
-
cloneDelta
protected ObjectDelta<O> cloneDelta(ObjectDelta<O> thisDelta)
-
retrieveFromLensElementContextType
public void retrieveFromLensElementContextType(LensElementContextType lensElementContextType, Task task, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException
-
fixProvisioningTypeInDelta
protected void fixProvisioningTypeInDelta(ObjectDelta<O> delta, Objectable object, Task task, OperationResult result)
-
checkEncrypted
public void checkEncrypted()
-
operationMatches
public boolean operationMatches(ChangeTypeType operation)
-
getElementDefaultDesc
protected abstract String getElementDefaultDesc()
-
getElementDesc
protected String getElementDesc()
-
getDebugDumpTitle
protected String getDebugDumpTitle()
-
getHumanReadableName
public abstract String getHumanReadableName()
-
getObjectReadVersion
public String getObjectReadVersion()
-
getObjectCurrentOrOld
public PrismObject<O> getObjectCurrentOrOld()
-
isOfType
public boolean isOfType(Class<?> aClass)
- Specified by:
isOfType
in interfaceModelElementContext<O extends ObjectType>
-
deleteSecondaryDeltas
public abstract void deleteSecondaryDeltas()
-
deltaBuilder
public S_ItemEntry deltaBuilder() throws SchemaException
- Throws:
SchemaException
-
forEachObject
public void forEachObject(Consumer<PrismObject<O>> consumer)
-
forEachDelta
public void forEachDelta(Consumer<ObjectDelta<O>> consumer)
-
finishBuild
public void finishBuild()
-
-