Class AbstractSearchIterativeTaskHandler<O extends ObjectType,H extends AbstractSearchIterativeResultHandler<O>>
- java.lang.Object
-
- com.evolveum.midpoint.repo.common.task.AbstractSearchIterativeTaskHandler<O,H>
-
- All Implemented Interfaces:
TaskHandler
,WorkBucketAwareTaskHandler
- Direct Known Subclasses:
AbstractSearchIterativeModelTaskHandler
public abstract class AbstractSearchIterativeTaskHandler<O extends ObjectType,H extends AbstractSearchIterativeResultHandler<O>> extends Object implements WorkBucketAwareTaskHandler
- Author:
- semancik
-
-
Field Summary
Fields Modifier and Type Field Description protected PrismContext
prismContext
protected RepositoryService
repositoryService
protected TaskManager
taskManager
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSearchIterativeTaskHandler(String taskName, String taskOperationPrefix)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkRawAuthorization(Task task, OperationResult result)
protected <O extends ObjectType>
IntegercountObjects(Class<O> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> queryOptions, Task coordinatorTask, OperationResult opResult)
Used to count objects using model or any similar higher-level interface.protected abstract H
createHandler(TaskPartitionDefinitionType partition, TaskRunResult runResult, RunningTask coordinatorTask, OperationResult opResult)
protected ObjectQuery
createQuery(H handler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
Handler parameter may be used to pass task instance state between the calls.protected ObjectQuery
createQueryFromTask(H handler, TaskRunResult runResult, Task task, OperationResult opResult)
Ready-made implementation of createQuery - gets and parses objectQuery extension property.protected ObjectQuery
createQueryFromTaskIfExists(H handler, TaskRunResult runResult, Task task, OperationResult opResult)
protected Collection<SelectorOptions<GetOperationOptions>>
createSearchOptions(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
protected Collection<SelectorOptions<GetOperationOptions>>
createSearchOptionsFromTask(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
protected void
finish(H handler, TaskRunResult runResult, RunningTask task, OperationResult opResult)
protected String
getDefaultChannel()
protected ExpressionProfile
getExpressionProfile()
protected Function<ItemPath,ItemDefinition<?>>
getIdentifierDefinitionProvider(Task localCoordinatorTask, OperationResult opResult)
protected IterationMethodType
getIterationMethodFromTask(Task task)
protected QueryType
getObjectQueryTypeFromTask(Task task)
protected QueryType
getObjectQueryTypeFromTaskObjectRef(Task task)
protected PrismContext
getPrismContext()
protected RepositoryService
getRepositoryService()
StatisticsCollectionStrategy
getStatisticsCollectionStrategy()
protected TaskManager
getTaskManager()
protected String
getTaskName()
protected String
getTaskOperationPrefix()
protected abstract Class<? extends ObjectType>
getType(Task task)
protected Class<? extends ObjectType>
getTypeFromTask(Task task, Class<? extends ObjectType> defaultType)
protected Boolean
getUseRepositoryDirectlyFromTask(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
Long
heartbeat(Task task)
protected boolean
initializeRun(H handler, TaskRunResult runResult, Task task, OperationResult opResult)
Used to properly initialize the "run", which is kind of task instance.boolean
isEnableActionsExecutedStatistics()
boolean
isEnableIterationStatistics()
boolean
isEnableSynchronizationStatistics()
boolean
isLogFinishInfo()
boolean
isPreserveStatistics()
static void
logPreviousResultIfNeeded(Task task, TaskWorkBucketProcessingResult previousRunResult, Trace logger)
protected ObjectQuery
preProcessQuery(ObjectQuery query, Task coordinatorTask, OperationResult opResult)
Pre-processing query (e.g.void
refreshStatus(Task task)
protected boolean
requiresDirectRepositoryAccess(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
TaskWorkBucketProcessingResult
run(RunningTask localCoordinatorTask, WorkBucketType workBucket, TaskPartitionDefinitionType partition, TaskWorkBucketProcessingResult previousRunResult)
protected <O extends ObjectType>
voidsearchIterative(Class<O> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> searchOptions, ResultHandler<O> resultHandler, Task coordinatorTask, OperationResult opResult)
Used to search using model or any similar higher-level interface.void
setEnableActionsExecutedStatistics(boolean enableActionsExecutedStatistics)
void
setEnableIterationStatistics(boolean enableIterationStatistics)
void
setEnableSynchronizationStatistics(boolean enableSynchronizationStatistics)
void
setLogFinishInfo(boolean logFinishInfo)
void
setPreserveStatistics(boolean preserveStatistics)
-
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
getCategoryName, getCategoryNames
-
Methods inherited from interface com.evolveum.midpoint.task.api.WorkBucketAwareTaskHandler
getObjectQueryTypeFromTaskExtension, onNoMoreBuckets, run, run
-
-
-
-
Field Detail
-
taskManager
@Autowired protected TaskManager taskManager
-
repositoryService
@Autowired @Qualifier("cacheRepositoryService") protected RepositoryService repositoryService
-
prismContext
@Autowired protected PrismContext prismContext
-
-
Method Detail
-
isLogFinishInfo
public boolean isLogFinishInfo()
-
isPreserveStatistics
public boolean isPreserveStatistics()
-
isEnableIterationStatistics
public boolean isEnableIterationStatistics()
-
setEnableIterationStatistics
public void setEnableIterationStatistics(boolean enableIterationStatistics)
-
isEnableSynchronizationStatistics
public boolean isEnableSynchronizationStatistics()
-
setEnableSynchronizationStatistics
public void setEnableSynchronizationStatistics(boolean enableSynchronizationStatistics)
-
isEnableActionsExecutedStatistics
public boolean isEnableActionsExecutedStatistics()
-
setEnableActionsExecutedStatistics
public void setEnableActionsExecutedStatistics(boolean enableActionsExecutedStatistics)
-
setPreserveStatistics
public void setPreserveStatistics(boolean preserveStatistics)
-
setLogFinishInfo
public void setLogFinishInfo(boolean logFinishInfo)
-
getTaskName
protected String getTaskName()
-
getTaskOperationPrefix
protected String getTaskOperationPrefix()
-
getTaskManager
protected TaskManager getTaskManager()
-
getRepositoryService
protected RepositoryService getRepositoryService()
-
getPrismContext
protected PrismContext getPrismContext()
-
getStatisticsCollectionStrategy
@NotNull public StatisticsCollectionStrategy getStatisticsCollectionStrategy()
- Specified by:
getStatisticsCollectionStrategy
in interfaceTaskHandler
-
run
public TaskWorkBucketProcessingResult run(RunningTask localCoordinatorTask, WorkBucketType workBucket, TaskPartitionDefinitionType partition, TaskWorkBucketProcessingResult previousRunResult)
- Specified by:
run
in interfaceWorkBucketAwareTaskHandler
-
checkRawAuthorization
protected void checkRawAuthorization(Task task, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
getDefaultChannel
protected String getDefaultChannel()
-
getIdentifierDefinitionProvider
protected Function<ItemPath,ItemDefinition<?>> getIdentifierDefinitionProvider(Task localCoordinatorTask, OperationResult opResult)
-
countObjects
protected <O extends ObjectType> Integer countObjects(Class<O> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> queryOptions, Task coordinatorTask, OperationResult opResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException
Used to count objects using model or any similar higher-level interface. Defaults to repository count.
-
searchIterative
protected <O extends ObjectType> void searchIterative(Class<O> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> searchOptions, ResultHandler<O> resultHandler, Task coordinatorTask, OperationResult opResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException
Used to search using model or any similar higher-level interface. Defaults to search using repository.
-
preProcessQuery
protected ObjectQuery preProcessQuery(ObjectQuery query, Task coordinatorTask, OperationResult opResult) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException
Pre-processing query (e.g. evaluate expressions).
-
finish
protected void finish(H handler, TaskRunResult runResult, RunningTask task, OperationResult opResult) throws SchemaException
- Throws:
SchemaException
-
heartbeat
public Long heartbeat(Task task)
- Specified by:
heartbeat
in interfaceTaskHandler
-
refreshStatus
public void refreshStatus(Task task)
- Specified by:
refreshStatus
in interfaceTaskHandler
-
createQuery
protected ObjectQuery createQuery(H handler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult) throws SchemaException
Handler parameter may be used to pass task instance state between the calls.- Throws:
SchemaException
-
createSearchOptions
protected Collection<SelectorOptions<GetOperationOptions>> createSearchOptions(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
-
requiresDirectRepositoryAccess
protected boolean requiresDirectRepositoryAccess(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
-
getType
protected abstract Class<? extends ObjectType> getType(Task task)
-
createHandler
protected abstract H createHandler(TaskPartitionDefinitionType partition, TaskRunResult runResult, RunningTask coordinatorTask, OperationResult opResult) throws SchemaException, SecurityViolationException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException
-
initializeRun
protected boolean initializeRun(H handler, TaskRunResult runResult, Task task, OperationResult opResult)
Used to properly initialize the "run", which is kind of task instance. The result handler is already created at this stage. Therefore this method may be used to "enrich" the result handler with some instance-specific data.
-
createQueryFromTask
@NotNull protected ObjectQuery createQueryFromTask(H handler, TaskRunResult runResult, Task task, OperationResult opResult) throws SchemaException
Ready-made implementation of createQuery - gets and parses objectQuery extension property.- Throws:
SchemaException
-
createSearchOptionsFromTask
protected Collection<SelectorOptions<GetOperationOptions>> createSearchOptionsFromTask(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
-
getUseRepositoryDirectlyFromTask
protected Boolean getUseRepositoryDirectlyFromTask(H resultHandler, TaskRunResult runResult, Task coordinatorTask, OperationResult opResult)
-
createQueryFromTaskIfExists
protected ObjectQuery createQueryFromTaskIfExists(H handler, TaskRunResult runResult, Task task, OperationResult opResult) throws SchemaException
- Throws:
SchemaException
-
getObjectQueryTypeFromTaskObjectRef
protected QueryType getObjectQueryTypeFromTaskObjectRef(Task task)
-
getIterationMethodFromTask
protected IterationMethodType getIterationMethodFromTask(Task task)
-
getTypeFromTask
protected Class<? extends ObjectType> getTypeFromTask(Task task, Class<? extends ObjectType> defaultType)
-
logPreviousResultIfNeeded
public static void logPreviousResultIfNeeded(Task task, TaskWorkBucketProcessingResult previousRunResult, Trace logger)
-
getExpressionProfile
protected ExpressionProfile getExpressionProfile()
-
-