Class DefaultPropagationManager
- java.lang.Object
-
- org.apache.syncope.core.provisioning.java.propagation.DefaultPropagationManager
-
- All Implemented Interfaces:
PropagationManager
@Transactional(rollbackFor=java.lang.Throwable.class) public class DefaultPropagationManager extends Object implements PropagationManager
Manage the data propagation to external resources.
-
-
Field Summary
Fields Modifier and Type Field Description protected AnyUtilsFactory
anyUtilsFactory
protected ConnObjectUtils
connObjectUtils
protected DerAttrHandler
derAttrHandler
protected EntityFactory
entityFactory
protected static Logger
LOG
protected MappingManager
mappingManager
protected ExternalResourceDAO
resourceDAO
protected VirSchemaDAO
virSchemaDAO
-
Fields inherited from interface org.apache.syncope.core.provisioning.api.propagation.PropagationManager
MANDATORY_MISSING_ATTR_NAME, MANDATORY_NULL_OR_EMPTY_ATTR_NAME
-
-
Constructor Summary
Constructors Constructor Description DefaultPropagationManager(VirSchemaDAO virSchemaDAO, ExternalResourceDAO resourceDAO, EntityFactory entityFactory, ConnObjectUtils connObjectUtils, MappingManager mappingManager, DerAttrHandler derAttrHandler, AnyUtilsFactory anyUtilsFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<PropagationTaskInfo>
createTasks(Any<?> any, String password, boolean changePwd, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs)
Create propagation tasks.List<PropagationTaskInfo>
createTasks(Realm realm, PropagationByResource<String> propByRes, Collection<String> excludedResources)
Create the needed tasks for the realm for each resource associated, unless inexcludedResources
.List<PropagationTaskInfo>
getCreateTasks(AnyTypeKind kind, String key, Boolean enable, PropagationByResource<String> propByRes, Collection<Attr> vAttrs, Collection<String> excludedResources)
Create the tasks for every associated resource, unless inexcludedResources
.protected List<PropagationTaskInfo>
getCreateTasks(Any<?> any, String password, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
List<PropagationTaskInfo>
getDeleteTasks(AnyTypeKind kind, String key, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<String> excludedResources)
Create the delete tasks from each resource associated, unless inexcludedResources
.protected List<PropagationTaskInfo>
getDeleteTasks(Any<?> any, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<String> excludedResources)
List<PropagationTaskInfo>
getUpdateTasks(AnyUR anyUR, AnyTypeKind kind, String key, boolean changePwd, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
Create the update tasks on each resource associated, unless inexcludedResources
.protected List<PropagationTaskInfo>
getUpdateTasks(AnyUR anyUR, Any<?> any, String password, boolean changePwd, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
List<PropagationTaskInfo>
getUserCreateTasks(String key, String password, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
Create the user tasks for every associated resource, unless inexcludedResources
.List<PropagationTaskInfo>
getUserUpdateTasks(UserWorkflowResult<Pair<UserUR,Boolean>> wfResult)
Create the update tasks for the user on each resource associated; propagate password update only to requested resources.List<PropagationTaskInfo>
getUserUpdateTasks(UserWorkflowResult<Pair<UserUR,Boolean>> wfResult, boolean changePwd, Collection<String> excludedResources)
Create the update tasks for the user on each resource associated, unless inexcludedResources
.protected boolean
isOrdinaryForAttrForDelta(Attribute attr)
Checks whether the given attribute shall be treated as an ordinary attribute or not, for purpose of building AttributeDelta instances.PropagationTaskInfo
newTask(DerAttrHandler derAttrHandler, Any<?> any, ExternalResource resource, ResourceOperation operation, Provision provision, Stream<Item> mappingItems, Pair<String,Set<Attribute>> preparedAttrs)
Map<Pair<String,String>,Set<Attribute>>
prepareAttrs(AnyTypeKind kind, String key, String password, boolean changePwd, Boolean enable, Collection<String> excludedResources)
Prepare attributes for propagation.Map<Pair<String,String>,Set<Attribute>>
prepareAttrs(Realm realm)
Prepare attributes for propagation.List<PropagationTaskInfo>
setAttributeDeltas(List<PropagationTaskInfo> tasks, Map<Pair<String,String>,Set<Attribute>> beforeAttrs)
Enrich the provided tasks with attribute deltas.
-
-
-
Field Detail
-
LOG
protected static final Logger LOG
-
virSchemaDAO
protected final VirSchemaDAO virSchemaDAO
-
resourceDAO
protected final ExternalResourceDAO resourceDAO
-
entityFactory
protected final EntityFactory entityFactory
-
connObjectUtils
protected final ConnObjectUtils connObjectUtils
-
mappingManager
protected final MappingManager mappingManager
-
derAttrHandler
protected final DerAttrHandler derAttrHandler
-
anyUtilsFactory
protected final AnyUtilsFactory anyUtilsFactory
-
-
Constructor Detail
-
DefaultPropagationManager
public DefaultPropagationManager(VirSchemaDAO virSchemaDAO, ExternalResourceDAO resourceDAO, EntityFactory entityFactory, ConnObjectUtils connObjectUtils, MappingManager mappingManager, DerAttrHandler derAttrHandler, AnyUtilsFactory anyUtilsFactory)
-
-
Method Detail
-
getCreateTasks
public List<PropagationTaskInfo> getCreateTasks(AnyTypeKind kind, String key, Boolean enable, PropagationByResource<String> propByRes, Collection<Attr> vAttrs, Collection<String> excludedResources)
Description copied from interface:PropagationManager
Create the tasks for every associated resource, unless inexcludedResources
.- Specified by:
getCreateTasks
in interfacePropagationManager
- Parameters:
kind
- any type kindkey
- any keyenable
- whether any should be enabled or notpropByRes
- operation to be performed per resourcevAttrs
- virtual attributes to be setexcludedResources
- external resources performing not to be considered for propagation- Returns:
- list of propagation tasks
-
getUserCreateTasks
public List<PropagationTaskInfo> getUserCreateTasks(String key, String password, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
Description copied from interface:PropagationManager
Create the user tasks for every associated resource, unless inexcludedResources
.- Specified by:
getUserCreateTasks
in interfacePropagationManager
- Parameters:
key
- user keypassword
- to be setenable
- whether user must be enabled or notpropByRes
- operation to be performed per resourcepropByLinkedAccount
- operation to be performed for linked accountsvAttrs
- virtual attributes to be setexcludedResources
- external resources not to be considered for propagation- Returns:
- list of propagation tasks
-
getCreateTasks
protected List<PropagationTaskInfo> getCreateTasks(Any<?> any, String password, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
-
getUpdateTasks
public List<PropagationTaskInfo> getUpdateTasks(AnyUR anyUR, AnyTypeKind kind, String key, boolean changePwd, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
Description copied from interface:PropagationManager
Create the update tasks on each resource associated, unless inexcludedResources
.- Specified by:
getUpdateTasks
in interfacePropagationManager
- Parameters:
anyUR
- update requestkind
- any type kindkey
- any keychangePwd
- whether password should be included for propagation attributes or notenable
- whether any should be enabled or not, may be null to leave unchangedpropByRes
- operation to be performed per resourcepropByLinkedAccount
- operation to be performed for linked accountsvAttrs
- virtual attributes to be setexcludedResources
- external resource keys not to be considered for propagation- Returns:
- list of propagation tasks
-
getUserUpdateTasks
public List<PropagationTaskInfo> getUserUpdateTasks(UserWorkflowResult<Pair<UserUR,Boolean>> wfResult, boolean changePwd, Collection<String> excludedResources)
Description copied from interface:PropagationManager
Create the update tasks for the user on each resource associated, unless inexcludedResources
.- Specified by:
getUserUpdateTasks
in interfacePropagationManager
- Parameters:
wfResult
- user to be propagated (and info associated), as per result from workflowchangePwd
- whether password should be included for propagation attributes or notexcludedResources
- external resources not to be considered for propagation- Returns:
- list of propagation tasks
-
getUserUpdateTasks
public List<PropagationTaskInfo> getUserUpdateTasks(UserWorkflowResult<Pair<UserUR,Boolean>> wfResult)
Description copied from interface:PropagationManager
Create the update tasks for the user on each resource associated; propagate password update only to requested resources.- Specified by:
getUserUpdateTasks
in interfacePropagationManager
- Parameters:
wfResult
- user to be propagated (and info associated), as per result from workflow- Returns:
- list of propagation tasks
-
getUpdateTasks
protected List<PropagationTaskInfo> getUpdateTasks(AnyUR anyUR, Any<?> any, String password, boolean changePwd, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs, Collection<String> excludedResources)
-
getDeleteTasks
public List<PropagationTaskInfo> getDeleteTasks(AnyTypeKind kind, String key, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<String> excludedResources)
Description copied from interface:PropagationManager
Create the delete tasks from each resource associated, unless inexcludedResources
.- Specified by:
getDeleteTasks
in interfacePropagationManager
- Parameters:
kind
- any type kindkey
- any keypropByRes
- operation to be performed per resourcepropByLinkedAccount
- operation to be performed for linked accountsexcludedResources
- external resource keys not to be considered for propagation- Returns:
- list of propagation tasks
-
getDeleteTasks
protected List<PropagationTaskInfo> getDeleteTasks(Any<?> any, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<String> excludedResources)
-
newTask
public PropagationTaskInfo newTask(DerAttrHandler derAttrHandler, Any<?> any, ExternalResource resource, ResourceOperation operation, Provision provision, Stream<Item> mappingItems, Pair<String,Set<Attribute>> preparedAttrs)
- Specified by:
newTask
in interfacePropagationManager
-
createTasks
protected List<PropagationTaskInfo> createTasks(Any<?> any, String password, boolean changePwd, Boolean enable, PropagationByResource<String> propByRes, PropagationByResource<Pair<String,String>> propByLinkedAccount, Collection<Attr> vAttrs)
Create propagation tasks.- Parameters:
any
- to be provisionedpassword
- clear text password to be provisionedchangePwd
- whether password should be included for propagation attributes or notenable
- whether user must be enabled or notpropByRes
- operation to be performed per resourcepropByLinkedAccount
- operation to be performed on linked accountsvAttrs
- virtual attributes to be set- Returns:
- list of propagation tasks created
-
createTasks
public List<PropagationTaskInfo> createTasks(Realm realm, PropagationByResource<String> propByRes, Collection<String> excludedResources)
Description copied from interface:PropagationManager
Create the needed tasks for the realm for each resource associated, unless inexcludedResources
.- Specified by:
createTasks
in interfacePropagationManager
- Parameters:
realm
- realmpropByRes
- operation to be performed per resourceexcludedResources
- external resource keys not to be considered for propagation- Returns:
- list of propagation tasks
-
prepareAttrs
@Transactional(readOnly=true, propagation=REQUIRES_NEW) public Map<Pair<String,String>,Set<Attribute>> prepareAttrs(AnyTypeKind kind, String key, String password, boolean changePwd, Boolean enable, Collection<String> excludedResources)
Description copied from interface:PropagationManager
Prepare attributes for propagation.- Specified by:
prepareAttrs
in interfacePropagationManager
- Parameters:
kind
- any type kindkey
- any keypassword
- to be set (for users)changePwd
- whether password should be included for propagation attributes or not (for users)enable
- whether any should be enabled or not, may be null to leave unchangedexcludedResources
- external resource keys not to be considered for propagation- Returns:
- map with prepared attributes per External Resource
-
prepareAttrs
@Transactional(readOnly=true, propagation=REQUIRES_NEW) public Map<Pair<String,String>,Set<Attribute>> prepareAttrs(Realm realm)
Description copied from interface:PropagationManager
Prepare attributes for propagation.- Specified by:
prepareAttrs
in interfacePropagationManager
- Parameters:
realm
- realm- Returns:
- map with prepared attributes per External Resource
-
isOrdinaryForAttrForDelta
protected boolean isOrdinaryForAttrForDelta(Attribute attr)
Checks whether the given attribute shall be treated as an ordinary attribute or not, for purpose of building AttributeDelta instances.- Parameters:
attr
- ConnId attibute- Returns:
- whether the condition is matched or not
-
setAttributeDeltas
public List<PropagationTaskInfo> setAttributeDeltas(List<PropagationTaskInfo> tasks, Map<Pair<String,String>,Set<Attribute>> beforeAttrs)
Description copied from interface:PropagationManager
Enrich the provided tasks with attribute deltas.- Specified by:
setAttributeDeltas
in interfacePropagationManager
- Parameters:
tasks
- propagation tasksbeforeAttrs
- attribute values before update- Returns:
- enriched propagation tasks
-
-