com.evolveum.midpoint.model
Class SyncContext

java.lang.Object
  extended by com.evolveum.midpoint.model.SyncContext
All Implemented Interfaces:
DebugDumpable, Dumpable

public class SyncContext
extends java.lang.Object
implements Dumpable, DebugDumpable

Synchronization context that is passed inside the model as the change is processed through several stages.

The context contains complete information about the change that relates to a user. It container user, accounts that belongs, belonged or should belong to the user, deltas, old a new values for all the objects. This information is assembled and transformed as the context is passed through individual stages of model processing.

It also contains policies (e.g. user template), channel and similar information. This can be used to customize processing per-request.

Author:
Radovan Semancik

Field Summary
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
SyncContext()
           
 
Method Summary
 void addAccountSyncContext(ResourceAccountType rat, AccountSyncContext accountSyncContext)
           
 void addPrimaryUserDelta(ObjectDelta<UserType> userDelta)
           
 AccountSyncContext createAccountSyncContext(ResourceAccountType rat)
          Creates new empty account sync context and adds it to this context.
 java.lang.String debugDump()
          Show the content of the object intended for diagnostics by system administrator.
 java.lang.String debugDump(int indent)
           
 java.lang.String dump()
          Show the content of the object intended for diagnostics by developer.
 java.util.Collection<AccountSyncContext> getAccountContexts()
           
 AccountSyncContext getAccountSyncContext(ResourceAccountType rat)
           
 AccountSynchronizationSettingsType getAccountSynchronizationSettings()
           
 java.util.Collection<ObjectDelta<?>> getAllChanges()
          Returns all changes, user and all accounts.
 PropertyDelta getAssignmentDelta()
          Returns delta of user assignments, both primary and secondary (merged together).
 AssignmentPolicyEnforcementType getAssignmentPolicyEnforcementType()
          Returns one aspect from the synchronization settings (with respect to default value).
 java.lang.String getChannel()
           
 RefinedAccountDefinition getRefinedAccountDefinition(ResourceAccountType rat, SchemaRegistry schemaRegistry)
          Returns refined account definition for specified account type.
 RefinedResourceSchema getRefinedResourceSchema(ResourceAccountType rat, SchemaRegistry schemaRegistry)
          Returns refined resource schema for specified account type.
 ResourceType getResource(ResourceAccountType rat)
          Returns a resource for specified account type.
 ObjectDelta<UserType> getUserDelta()
          Returns user delta, both primary and secondary (merged together).
 MidPointObject<UserType> getUserNew()
           
 MidPointObject<UserType> getUserOld()
           
 ObjectDelta<UserType> getUserPrimaryDelta()
           
 ObjectDelta<UserType> getUserSecondaryDelta()
           
 UserTemplateType getUserTemplate()
           
 UserType getUserTypeOld()
           
 boolean isDoReconciliationForAllAccounts()
           
 void recomputeAccountsNew()
          Recompute new account state.
 void recomputeNew()
          Recompute new user state and new account states.
 void recomputeUserNew()
          Recompute new user state.
 void rememberResource(ResourceType resourceType)
          Puts resource in the cache for later use.
 void rememberResources(java.util.Collection<ResourceType> resources)
          Puts resources in the cache for later use.
 void setAccountPrimaryDelta(ResourceAccountType rat, ObjectDelta<AccountShadowType> accountDelta)
           
 void setAccountSecondaryDelta(ResourceAccountType rat, ObjectDelta<AccountShadowType> accountDelta)
           
 void setAccountSynchronizationSettings(AccountSynchronizationSettingsType accountSynchronizationSettings)
           
 void setChannel(java.lang.String channel)
           
 void setDoReconciliationForAllAccounts(boolean doReconciliationForAllAccounts)
           
 void setUserNew(MidPointObject<UserType> userNew)
           
 void setUserOid(java.lang.String oid)
           
 void setUserOld(MidPointObject<UserType> userOld)
           
 void setUserPrimaryDelta(ObjectDelta<UserType> userPrimaryDelta)
           
 void setUserSecondaryDelta(ObjectDelta<UserType> userSecondaryDelta)
           
 void setUserTemplate(UserTemplateType userTemplate)
           
 void setUserTypeOld(UserType userTypeOld)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncContext

public SyncContext()
Method Detail

getUserTypeOld

public UserType getUserTypeOld()

setUserTypeOld

public void setUserTypeOld(UserType userTypeOld)

getUserOld

public MidPointObject<UserType> getUserOld()

setUserOld

public void setUserOld(MidPointObject<UserType> userOld)

getUserNew

public MidPointObject<UserType> getUserNew()

setUserNew

public void setUserNew(MidPointObject<UserType> userNew)

getUserPrimaryDelta

public ObjectDelta<UserType> getUserPrimaryDelta()

setUserPrimaryDelta

public void setUserPrimaryDelta(ObjectDelta<UserType> userPrimaryDelta)

getUserSecondaryDelta

public ObjectDelta<UserType> getUserSecondaryDelta()

setUserSecondaryDelta

public void setUserSecondaryDelta(ObjectDelta<UserType> userSecondaryDelta)

getUserTemplate

public UserTemplateType getUserTemplate()

setUserTemplate

public void setUserTemplate(UserTemplateType userTemplate)

getChannel

public java.lang.String getChannel()

setChannel

public void setChannel(java.lang.String channel)

getAccountSynchronizationSettings

public AccountSynchronizationSettingsType getAccountSynchronizationSettings()

setAccountSynchronizationSettings

public void setAccountSynchronizationSettings(AccountSynchronizationSettingsType accountSynchronizationSettings)

isDoReconciliationForAllAccounts

public boolean isDoReconciliationForAllAccounts()

setDoReconciliationForAllAccounts

public void setDoReconciliationForAllAccounts(boolean doReconciliationForAllAccounts)

getAssignmentPolicyEnforcementType

public AssignmentPolicyEnforcementType getAssignmentPolicyEnforcementType()
Returns one aspect from the synchronization settings (with respect to default value). TODO: maybe this is redundant?


getAccountContexts

public java.util.Collection<AccountSyncContext> getAccountContexts()

addAccountSyncContext

public void addAccountSyncContext(ResourceAccountType rat,
                                  AccountSyncContext accountSyncContext)

setAccountPrimaryDelta

public void setAccountPrimaryDelta(ResourceAccountType rat,
                                   ObjectDelta<AccountShadowType> accountDelta)

setAccountSecondaryDelta

public void setAccountSecondaryDelta(ResourceAccountType rat,
                                     ObjectDelta<AccountShadowType> accountDelta)

getUserDelta

public ObjectDelta<UserType> getUserDelta()
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).


setUserOid

public void setUserOid(java.lang.String oid)

recomputeNew

public void recomputeNew()
Recompute new user state and new account states. It applies the deltas (both secondary and primary) to the old states (userOld, accountOld), creating a new state (userNew, accountNew).


recomputeUserNew

public void recomputeUserNew()
Recompute new user state. Assuming that oldUser is already set (or is null if it does not exist)


recomputeAccountsNew

public void recomputeAccountsNew()
Recompute new account state.


getAssignmentDelta

public PropertyDelta getAssignmentDelta()
Returns delta of user assignments, 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).


addPrimaryUserDelta

public void addPrimaryUserDelta(ObjectDelta<UserType> userDelta)

getRefinedResourceSchema

public RefinedResourceSchema getRefinedResourceSchema(ResourceAccountType rat,
                                                      SchemaRegistry schemaRegistry)
                                               throws SchemaException
Returns refined resource schema for specified account type. This is supposed to be efficient, taking the schema from the cache if possible. It assumes the resource is in the cache.

Throws:
SchemaException
See Also:
rememberResource(ResourceType)

getRefinedAccountDefinition

public RefinedAccountDefinition getRefinedAccountDefinition(ResourceAccountType rat,
                                                            SchemaRegistry schemaRegistry)
                                                     throws SchemaException
Returns refined account definition for specified account type. This is supposed to be efficient, taking the schema from the cache if possible. It assumes the resource is in the cache.

Throws:
SchemaException
See Also:
rememberResource(ResourceType)

getResource

public ResourceType getResource(ResourceAccountType rat)
Returns a resource for specified account type. This is supposed to be efficient, taking the resource from the cache. It assumes the resource is in the cache.

See Also:
rememberResource(ResourceType)

getAccountSyncContext

public AccountSyncContext getAccountSyncContext(ResourceAccountType rat)

rememberResources

public void rememberResources(java.util.Collection<ResourceType> resources)
Puts resources in the cache for later use. The resources should be fetched from provisioning and have pre-parsed schemas. So the next time just reuse them without the other overhead.


rememberResource

public void rememberResource(ResourceType resourceType)
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.


getAllChanges

public java.util.Collection<ObjectDelta<?>> getAllChanges()
Returns all changes, user and all accounts. Both primary and secondary changes are returned, but these are not merged. TODO: maybe it would be better to merge them.


createAccountSyncContext

public AccountSyncContext createAccountSyncContext(ResourceAccountType rat)
Creates new empty account sync context and adds it to this context.


debugDump

public java.lang.String debugDump()
Description copied from interface: DebugDumpable
Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.

Specified by:
debugDump in interface DebugDumpable
Returns:
content of the object intended for diagnostics by system administrator.

dump

public java.lang.String dump()
Description copied from interface: Dumpable
Show the content of the object intended for diagnostics by developer. The content may be multi-line, in case of hierarchical objects it may be intended. The use of this method may not be efficient. It is not supposed to be used in normal operation. However, it is very useful in tests or in case of dumping objects in severe error situations.

Specified by:
dump in interface Dumpable
Returns:
content of the object intended for diagnostics.

debugDump

public java.lang.String debugDump(int indent)
Specified by:
debugDump in interface DebugDumpable


Copyright © 2012 evolveum. All Rights Reserved.