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
Lens context for a computation element - a focus or a projection.
- Author:
- semancik
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceLensElementContext.DeltaModifier<O extends Objectable>Currently, just a single-use interface formodifyPrimaryDelta(DeltaModifier)method.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final @NotNull LensContext<? extends ObjectType>Link to the parent context.Fields inherited from interface com.evolveum.midpoint.util.DebugDumpableINDENT_STRING
- 
Constructor SummaryConstructorsConstructorDescriptionLensElementContext(@NotNull Class<O> objectTypeClass, @NotNull LensContext<? extends ObjectType> lensContext) 
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddToExecutedDeltas(LensObjectDeltaOperation<O> executedDelta) voidaddToPendingAssignmentPolicyStateModifications(@NotNull AssignmentType assignment, @NotNull PlusMinusZero mode, @NotNull ItemDelta<?, ?> modification) voidaddToPendingObjectPolicyStateModifications(ItemDelta<?, ?> modification) voidaddToPrimaryDelta(ObjectDelta<O> delta) Adds (merges) a delta into primary delta.voidadopt(PrismContext prismContext) final voidabstract voidcheckConsistence(String contextDesc) voidabstract voidcleanup()Cleans up the contexts by removing some of the working state.voidClears the current state, e.g. when determining that the object does not exist anymore.voidvoidRemoves results of any previous computations from the context.voidforEachDelta(Consumer<ObjectDelta<O>> consumer) voidforEachObject(Consumer<PrismObject<O>> consumer) @NotNull Collection<String>Returns object delta valid for the current clockwork click.protected abstract Stringprotected String@NotNull EvaluatedPolicyStatements@NotNull List<LensObjectDeltaOperation<O>>getExecutedDeltas(int wave) abstract @NotNull Stringint@NotNull LensContext<? extends ObjectType>@NotNull Collection<String>Returns OIDs of event marks determined for this focus/projection context.@NotNull ModelContext<?>"Current" state of the object i.e. the one that was present when the current clockwork click started.@Nullable PrismObject<O>@Nullable PrismObject<O>@NotNull PrismObject<O>@NotNull PrismObjectDefinition<O>Expected state of the object after application of currentDelta i.e. item deltas computed during current projection: objectCurrent + currentDelta = objectNew.@Nullable PrismObject<O>@NotNull PrismObject<O>@NotNull PrismObject<O>"Old" state of the object i.e. the one that was present when the clockwork started.@NotNull Collection<EvaluatedPolicyRuleImpl>Returns all policy rules that apply to this object - even those that were not triggered.getOid()@NotNull SimpleOperationNameReturns a characterization of current operation (add, delete, modify).@NotNull Map<AssignmentSpec,List<ItemDelta<?, ?>>> getPolicyRuleCounter(String policyRuleIdentifier) Returns secondary delta for the current clockwork click.Returns security policy applicable to the object.abstract PrismObject<O>The best estimate how the object looked like before the simulated operation.Returns object delta comprising both primary delta and (all) secondary deltas, merged together.intgetTemporaryContainerId(@NotNull ItemPath itemPath) booleanhasEffectiveMark(@NotNull String oid) Returnstrueif the object (focus or projection) has given mark.voidinitializeElementState(String oid, PrismObject<O> objectOld, PrismObject<O> objectCurrent, ObjectDelta<O> primaryDelta) Initializes the state of the element: sets old/current state and primary delta, clears the secondary delta.abstract booleanisAdd()Be cautious when using this method forLensProjectionContext.abstract booleanisDelete()See also limitations forisAdd().booleanisFresh()booleanisModifiedInCurrentDelta(@NotNull ItemPath path) For limitations please seeObjectDelta.hasRelatedDelta(ItemPath).booleanisModify()TODO description See also limitations forisAdd().booleanvoidmodifyPrimaryDelta(LensElementContext.DeltaModifier<O> modifier) Modifies the primary delta.voidModifies the secondary delta.voidbooleanoperationMatches(ChangeTypeType operation) voidreplaceOldAndCurrentObject(String oid, PrismObject<O> objectOld, PrismObject<O> objectCurrent) Replaces OID, old, and current object state.booleanrepresents(Class<?> type) voidresolveTemporaryContainerIds(ObjectDelta<O> objectDelta) voidrestoreElementState(@NotNull RememberedElementState<O> rememberedState) voidrot()voidsetCurrentObject(@Nullable PrismObject<O> objectCurrent) Updates the current object.voidsetCurrentObjectAndOid(@NotNull PrismObject<O> object) Used to update current object and also the OID.voidvoidsetEvaluatedPolicyStatements(@NotNull EvaluatedPolicyStatements evaluatedPolicyStatements) voidsetFresh(boolean fresh) voidsetInitialObject(@NotNull PrismObject<O> object) Sets the value of an object that should be present on the clockwork start: both objectCurrent and objectOld.voidsetIteration(int iteration) voidsetIterationToken(String iterationToken) abstract voidsetLoadedObject(@NotNull PrismObject<O> object) Sets current and possibly also old object.voidsetObjectPolicyRules(Collection<EvaluatedPolicyRuleImpl> policyRules) voidSets OID of the new object but also to the deltas (if applicable).voidsetPolicyRuleCounter(String policyRuleIdentifier, int value) voidsetPrimaryDelta(ObjectDelta<O> primaryDelta) Assumes clockwork was not started.voidsetPrimaryDeltaAfterStart(ObjectDelta<O> primaryDelta) Sets the primary delta.voidsetSecurityPolicy(SecurityPolicyType securityPolicy) voidsimulateDeltaExecution(@NotNull ObjectDelta<O> delta) Updates the state to reflect that a delta was "executed" in simulation mode.voidswallowToPrimaryDelta(ItemDelta<?, ?> itemDelta) Adds an item delta to primary delta.voidswallowToSecondaryDelta(ItemDelta<?, ?> itemDelta) voidswallowToSecondaryDelta(Collection<? extends ItemDelta<?, ?>> itemDeltas) voidswallowToSecondaryDeltaUnchecked(ItemDelta<?, ?> itemDelta) booleanMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.evolveum.midpoint.util.DebugDumpabledebugDump, debugDump, debugDumpLazily, debugDumpLazilyMethods inherited from interface com.evolveum.midpoint.model.api.context.ModelElementContextgetArchetype, getArchetypes, getObjectAny, getObjectAnyRequired, getObjectOldOrCurrent, getSummarySecondaryDelta
- 
Field Details- 
lensContextLink to the parent context.
 
- 
- 
Constructor Details- 
LensElementContextpublic LensElementContext(@NotNull @NotNull Class<O> objectTypeClass, @NotNull @NotNull LensContext<? extends ObjectType> lensContext) 
 
- 
- 
Method Details- 
getLensContext
- 
getModelContext- Specified by:
- getModelContextin interface- ModelElementContext<O extends ObjectType>
 
- 
getObjectTypeClass- Specified by:
- getObjectTypeClassin interface- ModelElementContext<O extends ObjectType>
- Returns:
- Type of object represented by this context. It is declared when context is created, so the actual type of the object can be its subtype. (Although this is quite unusual.)
 
- 
getObjectDefinition
- 
represents
- 
isOfType- Specified by:
- isOfTypein interface- ModelElementContext<O extends ObjectType>
- Returns:
- True if the declared or actual object type is a subtype of aClass.
 
- 
getIterationpublic int getIteration()
- 
setIterationpublic void setIteration(int iteration) 
- 
getIterationToken
- 
setIterationToken
- 
getOid- Specified by:
- getOidin interface- ModelElementContext<O extends ObjectType>
- Returns:
- OID of the object. If not determined yet, it is obtained from available sources, like object old, current, new, or primary delta.
 
- 
getObjectOldDescription copied from interface:ModelElementContext"Old" state of the object i.e. the one that was present when the clockwork started. It can be present on the beginning or filled-in during projector execution by the context loaded. This value is used as an "old state" for resource object mappings (in constructions or resources), persona mappings, notifications, policy rules, and so on.- Specified by:
- getObjectOldin interface- ModelElementContext<O extends ObjectType>
 
- 
getStateBeforeSimulatedOperationThe best estimate how the object looked like before the simulated operation. (Tricky for projections.)
- 
getObjectCurrentDescription copied from interface:ModelElementContext"Current" state of the object i.e. the one that was present when the current clockwork click started. It is typically filled-in by the context loader. For projections, it is usually the same as the "old" state, as they are not updated iteratively but only once per clockwork run. This value used as an "old state" for focus mappings (in object template or assigned ones). INVARIANT: For LensProjectionContext the `shadowLifecycleState` must be present on this object (if the object is not null).- Specified by:
- getObjectCurrentin interface- ModelElementContext<O extends ObjectType>
 
- 
getObjectCurrentRequired
- 
getObjectNewDescription copied from interface:ModelElementContextExpected state of the object after application of currentDelta i.e. item deltas computed during current projection: objectCurrent + currentDelta = objectNew.- Specified by:
- getObjectNewin interface- ModelElementContext<O extends ObjectType>
 
- 
getObjectNewRequired
- 
getObjectNewOrCurrentOrOld- Specified by:
- getObjectNewOrCurrentOrOldin interface- ModelElementContext<O extends ObjectType>
- Returns:
- The first non-null object of these: new, current, old. (Or null of all of them all null.)
 
- 
getObjectCurrentOrNew
- 
getObjectNewOrCurrentRequired
- 
getObjectCurrentOrOld
- 
getPrimaryDelta- Specified by:
- getPrimaryDeltain interface- ModelElementContext<O extends ObjectType>
- Returns:
- Primary delta i.e. one that the caller specified that has to be executed.
 
- 
getSecondaryDeltaDescription copied from interface:ModelElementContextReturns secondary delta for the current clockwork click. The caller MUST NOT modify returned object in any way.- Specified by:
- getSecondaryDeltain interface- ModelElementContext<O extends ObjectType>
 
- 
getCurrentDeltaDescription copied from interface:ModelElementContextReturns object delta valid for the current clockwork click. It is either primary delta merged with the current secondary delta (if primary delta was not applied yet), or simply current secondary delta. The returned object is (kind of) immutable. Changing it may do strange things, but most likely the changes will be lost.- Specified by:
- getCurrentDeltain interface- ModelElementContext<O extends ObjectType>
 
- 
getSummaryDeltaDescription copied from interface:ModelElementContextReturns object delta comprising both primary delta and (all) secondary deltas, 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:
- getSummaryDeltain interface- ModelElementContext<O extends ObjectType>
 
- 
getSummaryExecutedDelta- Throws:
- SchemaException
 
- 
isModifiedInCurrentDeltaFor limitations please seeObjectDelta.hasRelatedDelta(ItemPath).
- 
getObjectReadVersion
- 
setOidSets OID of the new object but also to the deltas (if applicable).
- 
setInitialObjectSets the value of an object that should be present on the clockwork start: both objectCurrent and objectOld. Assumes that clockwork has not started yet.
- 
setLoadedObjectSets 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 should be initialized, then the object is also set as old object. Should be used only from the context loader!
- 
setCurrentObjectUpdates the current object. Should be called only from the context loader.
- 
clearCurrentObjectpublic void clearCurrentObject()Clears the current state, e.g. when determining that the object does not exist anymore. Should be used only from the context loader.
- 
setCurrentObjectAndOidUsed to update current object and also the OID. (In cases when the OID might have changed as well.) Should be called only from the context loader.
- 
replaceOldAndCurrentObjectpublic void replaceOldAndCurrentObject(String oid, PrismObject<O> objectOld, PrismObject<O> objectCurrent) Replaces OID, old, and current object state. Deltas (primary, secondary) are kept untouched. Currently used when doing some magic with resolving conflicts while iterating during the projection of projections. Very dangerous! Use at your own risk!
- 
setPrimaryDeltaAssumes clockwork was not started.- Specified by:
- setPrimaryDeltain interface- ModelElementContext<O extends ObjectType>
 
- 
setPrimaryDeltaAfterStartSets the primary delta. Does not check for clockwork not being started, so use with care! TODO The check should be perhaps reduced to "context was not yet used" in the future.
- 
addToPrimaryDeltaAdds (merges) a delta into primary delta. Use with care! (This method is 100% safe only when the clockwork has not started.)- Specified by:
- addToPrimaryDeltain interface- ModelElementContext<O extends ObjectType>
- Throws:
- SchemaException
 
- 
swallowToPrimaryDeltaAdds an item delta to primary delta. Dangerous. DO NOT USE unless you know what you are doing. Used from tests and from some scripting hooks.- Throws:
- SchemaException
 
- 
modifyPrimaryDeltaModifies the primary delta. Treats cases of delta being null or immutable. Dangerous! Primary delta is generally supposed to be immutable. Use with utmost care!- Throws:
- SchemaException
 
- 
modifySecondaryDeltapublic void modifySecondaryDelta(LensElementContext.DeltaModifier<O> modifier) throws SchemaException Modifies the secondary delta. Do not use! It is a hacking tool only.- Throws:
- SchemaException
 
- 
setEstimatedOldValuesInPrimaryDelta- Throws:
- SchemaException
 
- 
swallowToSecondaryDeltapublic void swallowToSecondaryDelta(Collection<? extends ItemDelta<?, ?>> itemDeltas) throws SchemaException- Throws:
- SchemaException
 
- 
swallowToSecondaryDeltaUnchecked
- 
swallowToSecondaryDelta- Throws:
- SchemaException
 
- 
initializeElementStatepublic void initializeElementState(String oid, PrismObject<O> objectOld, PrismObject<O> objectCurrent, ObjectDelta<O> primaryDelta) Initializes the state of the element: sets old/current state and primary delta, clears the secondary delta. Use with care!
- 
rememberElementState
- 
restoreElementState
- 
getPendingObjectPolicyStateModifications
- 
clearPendingPolicyStateModificationspublic void clearPendingPolicyStateModifications()
- 
addToPendingObjectPolicyStateModifications
- 
setEvaluatedPolicyStatementspublic void setEvaluatedPolicyStatements(@NotNull @NotNull EvaluatedPolicyStatements evaluatedPolicyStatements) 
- 
getEvaluatedPolicyStatements
- 
getPendingAssignmentPolicyStateModifications@NotNull public @NotNull Map<AssignmentSpec,List<ItemDelta<?, getPendingAssignmentPolicyStateModifications()?>>> 
- 
addToPendingAssignmentPolicyStateModificationspublic void addToPendingAssignmentPolicyStateModifications(@NotNull @NotNull AssignmentType assignment, @NotNull @NotNull PlusMinusZero mode, @NotNull @NotNull ItemDelta<?, ?> modification) 
- 
getPolicyRuleCounter
- 
setPolicyRuleCounter
- 
getObjectPolicyRulesDescription copied from interface:ModelElementContextReturns 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:
- getObjectPolicyRulesin interface- ModelElementContext<O extends ObjectType>
 
- 
setObjectPolicyRules
- 
isAddpublic abstract boolean isAdd()Be cautious when using this method forLensProjectionContext. The projection may be called into existence because a construction is assigned - i.e., no primary delta exists in this case. But the policy decision can also be null: untilActivationProcessor.processProjectionsActivation(LensContext, String, XMLGregorianCalendar, Task, OperationResult)is started - e.g. during the whole focus projection! See also MID-8569. Other problems: If there's no focus, then we don't compute theLensProjectionContext.synchronizationPolicyDecisionat all. See MID-8608 and its fix. It is very unclear and should be clarified.- Specified by:
- isAddin interface- ModelElementContext<O extends ObjectType>
 
- 
isDeletepublic abstract boolean isDelete()See also limitations forisAdd().- Specified by:
- isDeletein interface- ModelElementContext<O extends ObjectType>
 
- 
isModifypublic boolean isModify()TODO description See also limitations forisAdd().
- 
getOperationReturns a characterization of current operation (add, delete, modify).
- 
operationMatches
- 
getExecutedDeltas- Specified by:
- getExecutedDeltasin interface- ModelElementContext<O extends ObjectType>
- Returns:
- List of all executed deltas (in fact, ObjectDeltaOperationobjects).
 
- 
getExecutedDeltas
- 
addToExecutedDeltas
- 
wasAddExecutedpublic boolean wasAddExecuted()
- 
setupLastChangeExecutionResult
- 
simulateDeltaExecutionUpdates the state to reflect that a delta was "executed" in simulation mode.- Throws:
- SchemaException
 
- 
isFreshpublic boolean isFresh()
- 
setFreshpublic void setFresh(boolean fresh) 
- 
rotpublic void rot()
- 
deleteNonTransientComputationResultspublic void deleteNonTransientComputationResults()Removes results of any previous computations from the context. (Expecting that transient values are not present. So deals only with non-transient ones. Currently this means deletion of secondary deltas.)
- 
cleanuppublic abstract void cleanup()Cleans up the contexts by removing some of the working state. TODO describe more precisely, see alsorot(),LensFocusContext.updateDeltasAfterExecution(), andLensContext.updateAfterExecution()
- 
getSecurityPolicyReturns security policy applicable to the object. This means security policy applicable directory to focus or projection. It will NOT return global security policy.
- 
setSecurityPolicy
- 
getCredentialsPolicy
- 
normalizepublic void normalize()
- 
adopt- Throws:
- SchemaException
 
- 
checkEncryptedpublic void checkEncrypted()
- 
forEachObject
- 
forEachDelta
- 
getElementDefaultDesc
- 
getElementDesc
- 
getHumanReadableName
- 
checkConsistencepublic final void checkConsistence()
- 
checkConsistence
- 
getTemporaryContainerId
- 
resolveTemporaryContainerIds- Throws:
- SchemaException
 
- 
getMatchingEventMarksOidsDescription copied from interface:ModelElementContextReturns OIDs of event marks determined for this focus/projection context.- Specified by:
- getMatchingEventMarksOidsin interface- ModelElementContext<O extends ObjectType>
 
- 
getAllConsideredEventMarksOids
- 
getItemChangeApplicationModeConfiguration@NotNull public @NotNull ItemChangeApplicationModeConfiguration getItemChangeApplicationModeConfiguration() throws SchemaException, ConfigurationException
- 
hasEffectiveMarkDescription copied from interface:ModelElementContextReturnstrueif the object (focus or projection) has given mark. BEWARE! It relies on marks being present in the current state of the object, i.e. does not look at marks that are eventually computed during the current operation. Experimental.- Specified by:
- hasEffectiveMarkin interface- ModelElementContext<O extends ObjectType>
 
 
-