Class ImportAccountsFromResourceTaskHandler
- java.lang.Object
-
- com.evolveum.midpoint.repo.common.task.AbstractSearchIterativeTaskHandler<O,H>
-
- com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeModelTaskHandler<ShadowType,SynchronizeAccountResultHandler>
-
- com.evolveum.midpoint.model.impl.importer.ImportAccountsFromResourceTaskHandler
-
- All Implemented Interfaces:
TaskHandler
,WorkBucketAwareTaskHandler
@Component public class ImportAccountsFromResourceTaskHandler extends AbstractSearchIterativeModelTaskHandler<ShadowType,SynchronizeAccountResultHandler>
Task handler for "Import from resource" task. The import task will search for all the accounts on a specific resource. It will pretend that all the accounts were just created and notify other components (mode) using the ResourceObjectChangeListener interface. This will efficiently result in importing all the accounts. Depending on the sync policy, appropriate user objects may be created, accounts may be linked to existing users, etc. The handler will execute the import in background. It is using Task Manager for that purpose, so the Task Manager instance needs to be injected. Most of the "import" action is actually done in the callbacks from provisioning searchObjectsIterative() operation. The import task may be executed on a different node (as usual for async tasks).- Author:
- Radovan Semancik
- See Also:
TaskHandler
,ResourceObjectChangeListener
-
-
Field Summary
Fields Modifier and Type Field Description static String
HANDLER_URI
-
Fields inherited from class com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeModelTaskHandler
expressionFactory, modelObjectResolver, securityEnforcer, systemObjectCache
-
Fields inherited from class com.evolveum.midpoint.repo.common.task.AbstractSearchIterativeTaskHandler
prismContext, repositoryService
-
-
Constructor Summary
Constructors Constructor Description ImportAccountsFromResourceTaskHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SynchronizeAccountResultHandler
createHandler(TaskPartitionDefinitionType partition, TaskRunResult runResult, RunningTask coordinatorTask, OperationResult opResult)
protected ObjectQuery
createQuery(SynchronizeAccountResultHandler handler, TaskRunResult runResult, Task task, OperationResult opResult)
Handler parameter may be used to pass task instance state between the calls.protected Collection<SelectorOptions<GetOperationOptions>>
createSearchOptions(SynchronizeAccountResultHandler resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
String
getCategoryName(Task task)
Returns a category name for a given task.protected Function<ItemPath,ItemDefinition<?>>
getIdentifierDefinitionProvider(Task localCoordinatorTask, OperationResult opResult)
protected Class<? extends ObjectType>
getType(Task task)
boolean
importSingleShadow(String shadowOid, Task task, OperationResult parentResult)
Imports a single shadow.void
launch(ResourceType resource, QName objectclass, Task task, OperationResult parentResult)
Launch an import.-
Methods inherited from class com.evolveum.midpoint.model.impl.util.AbstractSearchIterativeModelTaskHandler
checkRawAuthorization, countObjects, getExecuteOptionsFromTask, preProcessQuery, resolveObjectRef, searchIterative
-
Methods inherited from class com.evolveum.midpoint.repo.common.task.AbstractSearchIterativeTaskHandler
createQueryFromTask, createQueryFromTaskIfExists, createSearchOptionsFromTask, finish, getDefaultChannel, getExpressionProfile, getIterationMethodFromTask, getObjectQueryTypeFromTask, getObjectQueryTypeFromTaskObjectRef, getPrismContext, getRepositoryService, getStatisticsCollectionStrategy, getTaskManager, getTaskName, getTaskOperationPrefix, getTypeFromTask, getUseRepositoryDirectlyFromTask, heartbeat, initializeRun, isEnableActionsExecutedStatistics, isEnableIterationStatistics, isEnableSynchronizationStatistics, isLogFinishInfo, isPreserveStatistics, logPreviousResultIfNeeded, refreshStatus, requiresDirectRepositoryAccess, run, setEnableActionsExecutedStatistics, setEnableIterationStatistics, setEnableSynchronizationStatistics, setLogFinishInfo, setPreserveStatistics
-
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.task.api.TaskHandler
getCategoryNames
-
Methods inherited from interface com.evolveum.midpoint.task.api.WorkBucketAwareTaskHandler
getObjectQueryTypeFromTaskExtension, onNoMoreBuckets, run, run
-
-
-
-
Field Detail
-
HANDLER_URI
public static final String HANDLER_URI
- See Also:
- Constant Field Values
-
-
Method Detail
-
launch
public void launch(ResourceType resource, QName objectclass, Task task, OperationResult parentResult)
Launch an import. Calling this method will start import in a new thread, possibly on a different node.
-
createHandler
protected SynchronizeAccountResultHandler createHandler(TaskPartitionDefinitionType partition, TaskRunResult runResult, RunningTask coordinatorTask, OperationResult opResult)
- Specified by:
createHandler
in classAbstractSearchIterativeTaskHandler<ShadowType,SynchronizeAccountResultHandler>
-
getIdentifierDefinitionProvider
protected Function<ItemPath,ItemDefinition<?>> getIdentifierDefinitionProvider(Task localCoordinatorTask, OperationResult opResult)
-
getType
protected Class<? extends ObjectType> getType(Task task)
- Specified by:
getType
in classAbstractSearchIterativeTaskHandler<ShadowType,SynchronizeAccountResultHandler>
-
createSearchOptions
protected Collection<SelectorOptions<GetOperationOptions>> createSearchOptions(SynchronizeAccountResultHandler resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
- Overrides:
createSearchOptions
in classAbstractSearchIterativeTaskHandler<ShadowType,SynchronizeAccountResultHandler>
-
createQuery
protected ObjectQuery createQuery(SynchronizeAccountResultHandler handler, TaskRunResult runResult, Task task, OperationResult opResult)
Description copied from class:AbstractSearchIterativeTaskHandler
Handler parameter may be used to pass task instance state between the calls.- Overrides:
createQuery
in classAbstractSearchIterativeTaskHandler<ShadowType,SynchronizeAccountResultHandler>
-
getCategoryName
public String getCategoryName(Task task)
Description copied from interface:TaskHandler
Returns a category name for a given task. In most cases, the name would be independent of concrete task.- Parameters:
task
- a task, whose category is to be determined; if getCategoryNames() returns null, this method has to accept null value as this parameter, and return the (one) category name that it gives to all tasks- Returns:
- a user-understandable name, like "LiveSync" or "Workflow"
-
importSingleShadow
public boolean importSingleShadow(String shadowOid, Task task, OperationResult parentResult) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException
Imports a single shadow. Synchronously. The task is NOT switched to background by default.
-
-