Class LensContext<F extends ObjectType>
- java.lang.Object
-
- com.evolveum.midpoint.model.impl.lens.LensContext<F>
-
- All Implemented Interfaces:
ModelContext<F>
,DebugDumpable
,Serializable
,Cloneable
- Direct Known Subclasses:
LensContextPlaceholder
public class LensContext<F extends ObjectType> extends Object implements ModelContext<F>, Cloneable
- Author:
- semancik
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LensContext.ExportType
static class
LensContext.GetOrCreateProjectionContextResult
-
Field Summary
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description LensContext(@NotNull TaskExecutionMode taskExecutionMode)
LensContext(Class<F> focusClass, @NotNull TaskExecutionMode taskExecutionMode)
-
Method Summary
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.model.api.context.ModelContext
dumpAssignmentPolicyRules, dumpObjectPolicyRules, isSimulation
-
-
-
-
Constructor Detail
-
LensContext
public LensContext(@NotNull @NotNull TaskExecutionMode taskExecutionMode)
-
LensContext
public LensContext(Class<F> focusClass, @NotNull @NotNull TaskExecutionMode taskExecutionMode)
-
-
Method Detail
-
getOrCreateProjectionContext
@NotNull public static <F extends ObjectType> @NotNull LensContext.GetOrCreateProjectionContextResult getOrCreateProjectionContext(LensContext<F> context, ProjectionContextKey contextKey)
TODO not sure if this method should be here or inProjectionsLoadOperation
(that is currently the only client) The reason for being here is the similarity togetOrCreateProjectionContext(LensContext, ConstructionTargetKey, boolean)
and coupling withgetOrCreateProjectionContext(LensContext, HumanReadableDescribable, Supplier, Supplier)
.
-
getOrCreateProjectionContext
@NotNull public static <F extends ObjectType> @NotNull LensContext.GetOrCreateProjectionContextResult getOrCreateProjectionContext(LensContext<F> context, ConstructionTargetKey targetKey, boolean acceptReaping)
-
hasLowerOrderContext
public boolean hasLowerOrderContext(LensProjectionContext refProjCtx)
-
findLowerOrderContext
public LensProjectionContext findLowerOrderContext(LensProjectionContext refProjCtx)
-
getProvisioningService
public ProvisioningService getProvisioningService()
-
setTriggeringResourceOid
public void setTriggeringResourceOid(@NotNull @NotNull ResourceType triggeringResource)
-
getTriggeringResourceOid
@Nullable public @Nullable String getTriggeringResourceOid()
-
getRequestIdentifier
public String getRequestIdentifier()
- Specified by:
getRequestIdentifier
in interfaceModelContext<F extends ObjectType>
-
getItemProcessingIdentifier
public String getItemProcessingIdentifier()
-
setItemProcessingIdentifier
public void setItemProcessingIdentifier(String itemProcessingIdentifier)
-
getState
public ModelState getState()
- Specified by:
getState
in interfaceModelContext<F extends ObjectType>
-
setState
public void setState(ModelState state)
-
getFocusContext
public LensFocusContext<F> getFocusContext()
- Specified by:
getFocusContext
in interfaceModelContext<F extends ObjectType>
-
hasFocusContext
public boolean hasFocusContext()
-
getFocusContextRequired
@NotNull public @NotNull LensFocusContext<F> getFocusContextRequired()
- Specified by:
getFocusContextRequired
in interfaceModelContext<F extends ObjectType>
-
setFocusContext
public void setFocusContext(LensFocusContext<F> focusContext)
-
createFocusContext
public LensFocusContext<F> createFocusContext()
-
getOrCreateFocusContext
public LensFocusContext<F> getOrCreateFocusContext()
-
getOrCreateFocusContext
public LensFocusContext<F> getOrCreateFocusContext(Class<F> explicitFocusClass)
-
getProjectionContexts
@NotNull public @NotNull Collection<LensProjectionContext> getProjectionContexts()
- Specified by:
getProjectionContexts
in interfaceModelContext<F extends ObjectType>
-
getProjectionContextsIterator
public Iterator<LensProjectionContext> getProjectionContextsIterator()
-
addProjectionContext
public void addProjectionContext(@NotNull @NotNull LensProjectionContext projectionContext)
-
findProjectionContextByOid
public LensProjectionContext findProjectionContextByOid(@NotNull @NotNull String oid)
BEWARE! Before you call this method, please consider the fact that there may be more projection contexts matching given shadow OID.
-
findProjectionContextsByOid
@NotNull public @NotNull List<LensProjectionContext> findProjectionContextsByOid(@NotNull @NotNull String oid)
-
findProjectionContextByOidAndKey
public LensProjectionContext findProjectionContextByOidAndKey(@NotNull @NotNull String oid, @NotNull @NotNull ProjectionContextKey key)
TODO describe this and verify it's OK
-
findProjectionContextByKeyExact
public LensProjectionContext findProjectionContextByKeyExact(@NotNull @NotNull ProjectionContextKey key)
- Specified by:
findProjectionContextByKeyExact
in interfaceModelContext<F extends ObjectType>
-
findProjectionContexts
@NotNull public @NotNull Collection<LensProjectionContext> findProjectionContexts(@NotNull @NotNull ProjectionContextFilter filter)
- Specified by:
findProjectionContexts
in interfaceModelContext<F extends ObjectType>
-
findProjectionContext
@VisibleForTesting @Nullable public @Nullable LensProjectionContext findProjectionContext(@NotNull @NotNull ProjectionContextFilter filter)
-
findFirstNotCompletedProjectionContext
public LensProjectionContext findFirstNotCompletedProjectionContext(@NotNull @NotNull ConstructionTargetKey targetKey)
TODO TODO TODO Do not use this method (yet) Returns the projection context this construction should be applied to. There may be more matching ones. We return the one that is the next one to be evaluated (according to the waves/ordering). TODO What is more reliable - ordering or waves? Waves may not be computed, while order should be specified. We hope...
-
findFirstProjectionContext
public LensProjectionContext findFirstProjectionContext(@NotNull @NotNull ConstructionTargetKey targetKey, boolean acceptReaping)
TODO
-
getExplicitFocusTemplateOid
public String getExplicitFocusTemplateOid()
-
setExplicitFocusTemplateOid
public void setExplicitFocusTemplateOid(String explicitFocusTemplateOid)
-
getFocusTemplate
public ObjectTemplateType getFocusTemplate()
- Specified by:
getFocusTemplate
in interfaceModelContext<F extends ObjectType>
-
getSystemConfiguration
public PrismObject<SystemConfigurationType> getSystemConfiguration()
- Specified by:
getSystemConfiguration
in interfaceModelContext<F extends ObjectType>
-
getSystemConfigurationBean
public SystemConfigurationType getSystemConfigurationBean()
-
getInternalsConfiguration
public InternalsConfigurationType getInternalsConfiguration()
-
setSystemConfiguration
public void setSystemConfiguration(PrismObject<SystemConfigurationType> systemConfiguration)
-
updateSystemConfiguration
public void updateSystemConfiguration(OperationResult result) throws SchemaException
- Throws:
SchemaException
-
getAccountSynchronizationSettings
public ProjectionPolicyType getAccountSynchronizationSettings()
-
setAccountSynchronizationSettings
public void setAccountSynchronizationSettings(ProjectionPolicyType accountSynchronizationSettings)
-
getProjectionWave
public int getProjectionWave()
-
incrementProjectionWave
public void incrementProjectionWave()
-
resetProjectionWave
public void resetProjectionWave()
-
getExecutionWave
public int getExecutionWave()
-
computeMaxWaves
public int computeMaxWaves()
-
isFresh
public boolean isFresh()
-
setFresh
public void setFresh(boolean isFresh)
-
isRequestAuthorized
public boolean isRequestAuthorized()
-
rot
public void rot(String reason)
Makes the context and all sub-context non-fresh.
-
getChannel
public String getChannel()
- Specified by:
getChannel
in interfaceModelContext<F extends ObjectType>
-
setChannel
public void setChannel(String channelUri)
-
setChannel
public void setChannel(QName channelQName)
-
isDoReconciliationForAllProjections
public boolean isDoReconciliationForAllProjections()
-
setDoReconciliationForAllProjections
public void setDoReconciliationForAllProjections(boolean doReconciliationForAllProjections)
-
getEvaluatedAssignmentTriple
public DeltaSetTriple<EvaluatedAssignmentImpl<?>> getEvaluatedAssignmentTriple()
- Specified by:
getEvaluatedAssignmentTriple
in interfaceModelContext<F extends ObjectType>
-
getEvaluatedAssignmentsStream
@NotNull public @NotNull Stream<EvaluatedAssignmentImpl<?>> getEvaluatedAssignmentsStream()
- Specified by:
getEvaluatedAssignmentsStream
in interfaceModelContext<F extends ObjectType>
-
getNonNegativeEvaluatedAssignments
@NotNull public @NotNull Collection<EvaluatedAssignmentImpl<?>> getNonNegativeEvaluatedAssignments()
- Specified by:
getNonNegativeEvaluatedAssignments
in interfaceModelContext<F extends ObjectType>
-
getAllEvaluatedAssignments
@NotNull public @NotNull Collection<EvaluatedAssignmentImpl<?>> getAllEvaluatedAssignments()
- Specified by:
getAllEvaluatedAssignments
in interfaceModelContext<F extends ObjectType>
-
setEvaluatedAssignmentTriple
public void setEvaluatedAssignmentTriple(DeltaSetTriple<EvaluatedAssignmentImpl<?>> evaluatedAssignmentTriple)
-
getOptions
public ModelExecuteOptions getOptions()
- Specified by:
getOptions
in interfaceModelContext<F extends ObjectType>
-
setOptions
public void setOptions(ModelExecuteOptions options)
-
getPartialProcessingOptions
@NotNull public @NotNull PartialProcessingOptionsType getPartialProcessingOptions()
- Specified by:
getPartialProcessingOptions
in interfaceModelContext<F extends ObjectType>
-
getInspector
public ClockworkInspector getInspector()
-
setInspector
public void setInspector(ClockworkInspector inspector)
-
setLazyAuditRequest
public void setLazyAuditRequest(boolean lazyAuditRequest)
-
isRequestAudited
public boolean isRequestAudited()
-
isExecutionAudited
public boolean isExecutionAudited()
-
getStats
public LensContextStatsType getStats()
-
setStats
public void setStats(LensContextStatsType stats)
-
getRequestBusinessContext
public OperationBusinessContextType getRequestBusinessContext()
-
getAllChanges
public int getAllChanges()
Number of all changes. TODO reconsider this.- Specified by:
getAllChanges
in interfaceModelContext<F extends ObjectType>
-
hasAnyPrimaryChange
public boolean hasAnyPrimaryChange()
-
getPrimaryChanges
public Collection<ObjectDelta<? extends ObjectType>> getPrimaryChanges()
-
getExecutedDeltas
@NotNull public @NotNull Collection<ObjectDeltaOperation<? extends ObjectType>> getExecutedDeltas()
Returns all executed deltas, user and all accounts.
-
getUnauditedExecutedDeltas
@NotNull public @NotNull Collection<ObjectDeltaOperation<? extends ObjectType>> getUnauditedExecutedDeltas()
Returns all executed deltas, user and all accounts.
-
getRottenExecutedDeltas
@NotNull public @NotNull List<LensObjectDeltaOperation<?>> getRottenExecutedDeltas()
-
recompute
public void recompute() throws SchemaException
- Throws:
SchemaException
-
recomputeFocus
public void recomputeFocus() throws SchemaException
- Throws:
SchemaException
-
refreshAuxiliaryObjectClassDefinitions
public void refreshAuxiliaryObjectClassDefinitions() throws SchemaException, ConfigurationException
-
checkAbortRequested
public void checkAbortRequested()
-
checkConsistenceIfNeeded
public void checkConsistenceIfNeeded()
-
checkConsistence
public void checkConsistence()
-
createProjectionContext
public LensProjectionContext createProjectionContext(@NotNull @NotNull ProjectionContextKey key)
-
createDetachedProjectionContext
public LensProjectionContext createDetachedProjectionContext(@NotNull @NotNull ProjectionContextKey key)
-
getResource
public ResourceType getResource(String resourceOid)
Returns a resource with given OID. This is supposed to be efficient, taking the resource from the cache. It assumes the resource is in the cache.- See Also:
rememberResource(ResourceType)
-
rememberResource
public void rememberResource(ResourceType resource)
Puts resource in the cache for later use. The resource should be fetched from provisioning and have pre-parsed schemas. So the next time just reuse it without the other overhead.
-
cleanup
public void cleanup() throws SchemaException
Cleans up the contexts by removing some of the working state. The current wave number is retained. Otherwise it ends up in endless loop.- Throws:
SchemaException
-
normalize
public void normalize()
-
clone
public LensContext<F> clone()
-
getFocusClass
public Class<F> getFocusClass()
- Specified by:
getFocusClass
in interfaceModelContext<F extends ObjectType>
-
dump
public String dump(boolean showTriples)
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
debugDump
public String debugDump(int indent, boolean showTriples)
-
dumpAssignmentPolicyRules
public String dumpAssignmentPolicyRules(int indent, boolean alsoMessages)
- Specified by:
dumpAssignmentPolicyRules
in interfaceModelContext<F extends ObjectType>
-
dumpObjectPolicyRules
public String dumpObjectPolicyRules(int indent, boolean alsoMessages)
- Specified by:
dumpObjectPolicyRules
in interfaceModelContext<F extends ObjectType>
-
toBean
public LensContextType toBean() throws SchemaException
- Throws:
SchemaException
-
toBean
public LensContextType toBean(LensContext.ExportType exportType) throws SchemaException
'reduced' means - no full object values (focus, shadow).This mode is to be used for re-starting operation after primary-stage approval (here all data are re-loaded; maybe except for objectOld, but let's neglect it for the time being).
It is also to be used for the FINAL stage, where we need the context basically for information about executed deltas.
- Throws:
SchemaException
-
fromLensContextBean
public static <T extends ObjectType> LensContext<T> fromLensContextBean(LensContextType bean, Task task, OperationResult parentResult) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, ExpressionEvaluationException
-
setProgressListeners
public void setProgressListeners(Collection<ProgressListener> progressListeners)
-
reportProgress
public void reportProgress(ProgressInformation progress)
- Specified by:
reportProgress
in interfaceModelContext<F extends ObjectType>
-
getHistoricResourceObjects
public Collection<ProjectionContextKey> getHistoricResourceObjects()
- Specified by:
getHistoricResourceObjects
in interfaceModelContext<F extends ObjectType>
-
getSequenceCounter
public Long getSequenceCounter(String sequenceOid)
- Specified by:
getSequenceCounter
in interfaceModelContext<F extends ObjectType>
-
setSequenceCounter
public void setSequenceCounter(String sequenceOid, long counter)
- Specified by:
setSequenceCounter
in interfaceModelContext<F extends ObjectType>
-
getConflictingProjectionContexts
@NotNull public @NotNull List<LensProjectionContext> getConflictingProjectionContexts()
-
addConflictingProjectionContext
public void addConflictingProjectionContext(@NotNull @NotNull LensProjectionContext conflictingContext)
-
clearConflictingProjectionContexts
public void clearConflictingProjectionContexts()
-
hasExplosiveProjection
public boolean hasExplosiveProjection() throws SchemaException, ConfigurationException
-
getHookPreviewResultsMap
@NotNull public @NotNull Map<String,Collection<? extends Containerable>> getHookPreviewResultsMap()
- Specified by:
getHookPreviewResultsMap
in interfaceModelContext<F extends ObjectType>
-
addHookPreviewResults
public void addHookPreviewResults(String hookUri, Collection<? extends Containerable> results)
-
getHookPreviewResults
@NotNull public <T> @NotNull List<T> getHookPreviewResults(@NotNull @NotNull Class<T> clazz)
- Specified by:
getHookPreviewResults
in interfaceModelContext<F extends ObjectType>
-
getPolicyRuleEnforcerPreviewOutput
@Nullable public @Nullable PolicyRuleEnforcerPreviewOutputType getPolicyRuleEnforcerPreviewOutput()
- Specified by:
getPolicyRuleEnforcerPreviewOutput
in interfaceModelContext<F extends ObjectType>
-
setPolicyRuleEnforcerPreviewOutput
public void setPolicyRuleEnforcerPreviewOutput(PolicyRuleEnforcerPreviewOutputType policyRuleEnforcerPreviewOutput)
-
hasProjectionChange
public boolean hasProjectionChange() throws SchemaException, ConfigurationException
-
getGlobalSecurityPolicy
public SecurityPolicyType getGlobalSecurityPolicy()
-
setGlobalSecurityPolicy
public void setGlobalSecurityPolicy(SecurityPolicyType globalSecurityPolicy)
-
isPreview
public boolean isPreview()
- Specified by:
isPreview
in interfaceModelContext<F extends ObjectType>
-
setPreview
public void setPreview(boolean preview)
-
getOperationApprovedBy
@NotNull public @NotNull List<ObjectReferenceType> getOperationApprovedBy()
-
getTreeDeltas
@NotNull public @NotNull ObjectTreeDeltas<F> getTreeDeltas()
- Specified by:
getTreeDeltas
in interfaceModelContext<F extends ObjectType>
-
getPrivilegedExpressionProfile
public ExpressionProfile getPrivilegedExpressionProfile()
Expression profile to use for "privileged" operations, such as scripting hooks.- Specified by:
getPrivilegedExpressionProfile
in interfaceModelContext<F extends ObjectType>
-
getFocusConstraintsCheckingStrategy
public ConstraintsCheckingStrategyType getFocusConstraintsCheckingStrategy()
-
getProjectionConstraintsCheckingStrategy
public ConstraintsCheckingStrategyType getProjectionConstraintsCheckingStrategy()
-
getOperationQualifier
public String getOperationQualifier()
-
removeIgnoredContexts
public void removeIgnoredContexts()
-
isInPrimary
public boolean isInPrimary()
-
hasFocusOfType
public boolean hasFocusOfType(Class<? extends ObjectType> type)
-
primaryFocusItemDeltaExists
public boolean primaryFocusItemDeltaExists(ItemPath path)
-
deleteNonTransientComputationResults
public 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.) Used e.g. when restarting operation after being approved.
-
isExperimentalCodeEnabled
public boolean isExperimentalCodeEnabled()
-
getTaskTreeOid
public String getTaskTreeOid(Task task, OperationResult result)
- Specified by:
getTaskTreeOid
in interfaceModelContext<F extends ObjectType>
-
getFocusOdoAbsolute
public ObjectDeltaObject<F> getFocusOdoAbsolute()
-
isForcedFocusDelete
public boolean isForcedFocusDelete()
-
inspectProjectorStart
public void inspectProjectorStart()
-
inspectProjectorFinish
public void inspectProjectorFinish()
-
hasStarted
public boolean hasStarted()
-
setStartedIfNotYet
public void setStartedIfNotYet()
-
isDiscoveryChannel
public boolean isDiscoveryChannel()
-
markMatchingProjectionsBroken
public void markMatchingProjectionsBroken(@NotNull @NotNull ConstructionType construction, @NotNull @NotNull String resourceOid)
Resource OID should correspond to the construction. (However, it may be missing in the construction bean itself, e.g. if a filter is used there.)
-
getModelBeans
@NotNull public @NotNull ModelBeans getModelBeans()
-
getTaskExecutionMode
@NotNull public @NotNull TaskExecutionMode getTaskExecutionMode()
- Specified by:
getTaskExecutionMode
in interfaceModelContext<F extends ObjectType>
-
getShadowMetadataRecordingStrategy
public MetadataRecordingStrategyType getShadowMetadataRecordingStrategy()
-
-