Class AbstractSearchIterativeTaskPartExecution<O extends ObjectType,TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>,PE extends AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>,RH extends AbstractSearchIterativeItemProcessor<O,TH,TE,PE,RH>>
- java.lang.Object
-
- com.evolveum.midpoint.repo.common.task.AbstractIterativeTaskPartExecution<PrismObject<O>,TH,TE,PE,RH>
-
- com.evolveum.midpoint.repo.common.task.AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>
-
- Direct Known Subclasses:
AbstractIterativeModelTaskPartExecution
public abstract class AbstractSearchIterativeTaskPartExecution<O extends ObjectType,TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>,PE extends AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>,RH extends AbstractSearchIterativeItemProcessor<O,TH,TE,PE,RH>> extends AbstractIterativeTaskPartExecution<PrismObject<O>,TH,TE,PE,RH>
Single execution of a given search-iterative task part. Takes care of preparing and issuing the search query. *TODO finish cleanup*
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<O>
objectType
Object type provided when counting and retrieving objects.protected ObjectQuery
query
Object query specifying what objects to process.protected Collection<SelectorOptions<GetOperationOptions>>
searchOptions
Options to be used during counting and searching.protected Boolean
useRepository
Whether we want to use repository directly when counting/searching.protected @Nullable WorkBucketType
workBucket
Current bucket that is being processed.-
Fields inherited from class com.evolveum.midpoint.repo.common.task.AbstractIterativeTaskPartExecution
bucketStatistics, coordinator, itemProcessor, localCoordinatorTask, logger, reportingOptions, runResult, taskExecution, taskHandler
-
-
Constructor Summary
Constructors Constructor Description AbstractSearchIterativeTaskPartExecution(TE taskExecution)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkRawAuthorization(Task task, OperationResult result)
protected Integer
countObjects(OperationResult opResult)
Used to count objects using model or any similar higher-level interface.protected int
countObjectsInRepository(OperationResult opResult)
protected Function<ItemPath,ItemDefinition<?>>
createItemDefinitionProvider()
Returns a provider of definitions for runtime items (e.g.protected Function<ItemPath,ItemDefinition<?>>
createItemDefinitionProviderForAttributes(ObjectClassComplexTypeDefinition objectClass)
protected ObjectQuery
createQuery(OperationResult opResult)
Handler parameter may be used to pass task instance state between the calls.protected @NotNull ObjectQuery
createQueryFromTask()
Ready-made implementation of createQuery - gets and parses objectQuery extension property.protected ObjectQuery
createQueryFromTaskIfExists()
protected Collection<SelectorOptions<GetOperationOptions>>
createSearchOptions(OperationResult opResult)
protected Collection<SelectorOptions<GetOperationOptions>>
createSearchOptionsFromTask()
protected ResultHandler<O>
createSearchResultHandler()
Passes all objects found into the processing coordinator.protected @NotNull ObjectPreprocessor<O>
createShadowFetchingPreprocessor()
protected @NotNull Class<O>
determineObjectType()
protected @NotNull ErrorHandlingStrategyExecutor.Action
getDefaultErrorAction()
protected ExpressionProfile
getExpressionProfile()
PrismContext
getPrismContext()
SchemaService
getSchemaService()
Collection<SelectorOptions<GetOperationOptions>>
getSearchOptions()
TH
getTaskHandler()
protected TaskManager
getTaskManager()
protected Class<O>
getTypeFromTask()
protected boolean
modelProcessingAvailable()
protected void
prepareItemSource(OperationResult opResult)
Prepares the item source.protected ObjectQuery
preProcessQuery(ObjectQuery query, OperationResult opResult)
Pre-processing query (e.g.protected void
processItems(OperationResult opResult)
Starts the item source (e.g.boolean
providesTracingAndDynamicProfiling()
protected boolean
requiresDirectRepositoryAccess(OperationResult opResult)
Returns true if the task processing requires direct access to the repository "by design".protected void
searchIterative(OperationResult opResult)
Used to search using model or any similar higher-level interface.protected void
searchIterativeInRepository(OperationResult opResult)
protected void
setExpectedTotal(OperationResult opResult)
Computes expected total and sets the value in the task.protected void
setRequiresDirectRepositoryAccess()
-
Methods inherited from class com.evolveum.midpoint.repo.common.task.AbstractIterativeTaskPartExecution
createItemProcessor, ensureNoWorkerThreads, finish, getContextDescription, getExpectedParts, getLogger, getPartNumber, getPartStartTimestamp, getPartUri, getProcessShortName, getProcessShortNameCapitalized, getReportingOptions, getRootTask, getRootTaskOid, getStartTimeMillis, getTaskExecution, heartbeat, initialize, isMultithreaded, isSimulate, run, setContextDescription, setExpectedParts, setPartNumber, setPartUri, setProcessShortNameCapitalized
-
-
-
-
Field Detail
-
workBucket
@Nullable protected final @Nullable WorkBucketType workBucket
Current bucket that is being processed. It is used to narrow the search query.
-
objectType
protected Class<O extends ObjectType> objectType
Object type provided when counting and retrieving objects. Set up inprepareItemSource(OperationResult)
. Never null after initialization.
-
query
protected ObjectQuery query
Object query specifying what objects to process. Set up inprepareItemSource(OperationResult)
.
-
searchOptions
protected Collection<SelectorOptions<GetOperationOptions>> searchOptions
Options to be used during counting and searching. Set up inprepareItemSource(OperationResult)
. Never null after initialization.
-
useRepository
protected Boolean useRepository
Whether we want to use repository directly when counting/searching. Set up inprepareItemSource(OperationResult)
. Can be "built-in" in the task (seerequiresDirectRepositoryAccess
), or requested explicitly by the user. In the latter case the raw authorization is checked. Note that this flag is really used only ifmodelProcessingAvailable()
is true. Never null after initialization.
-
-
Constructor Detail
-
AbstractSearchIterativeTaskPartExecution
public AbstractSearchIterativeTaskPartExecution(TE taskExecution)
-
-
Method Detail
-
prepareItemSource
protected void prepareItemSource(OperationResult opResult) throws TaskException, CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException
Description copied from class:AbstractIterativeTaskPartExecution
Prepares the item source. E.g. for search-iterative tasks we prepare object type, query, and options here.- Overrides:
prepareItemSource
in classAbstractIterativeTaskPartExecution<PrismObject<O extends ObjectType>,TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>,PE extends AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>,RH extends AbstractSearchIterativeItemProcessor<O,TH,TE,PE,RH>>
- Throws:
TaskException
CommunicationException
ObjectNotFoundException
SchemaException
SecurityViolationException
ConfigurationException
ExpressionEvaluationException
ObjectAlreadyExistsException
-
setExpectedTotal
protected void setExpectedTotal(OperationResult opResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException, ObjectAlreadyExistsException
Description copied from class:AbstractIterativeTaskPartExecution
Computes expected total and sets the value in the task. E.g. for search-iterative tasks we count the objects here. TODO reconsider- Overrides:
setExpectedTotal
in classAbstractIterativeTaskPartExecution<PrismObject<O extends ObjectType>,TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>,PE extends AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>,RH extends AbstractSearchIterativeItemProcessor<O,TH,TE,PE,RH>>
- Throws:
CommunicationException
ObjectNotFoundException
SchemaException
SecurityViolationException
ConfigurationException
ExpressionEvaluationException
ObjectAlreadyExistsException
-
checkRawAuthorization
protected void checkRawAuthorization(Task task, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
-
createShadowFetchingPreprocessor
@NotNull protected @NotNull ObjectPreprocessor<O> createShadowFetchingPreprocessor()
-
createItemDefinitionProvider
protected Function<ItemPath,ItemDefinition<?>> createItemDefinitionProvider()
Returns a provider of definitions for runtime items (e.g. attributes) that are needed in bucket filters. To be implemented in subclasses that work with resource objects.
-
createItemDefinitionProviderForAttributes
protected final Function<ItemPath,ItemDefinition<?>> createItemDefinitionProviderForAttributes(ObjectClassComplexTypeDefinition objectClass)
-
countObjects
protected Integer countObjects(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.
-
countObjectsInRepository
protected final int countObjectsInRepository(OperationResult opResult) throws SchemaException
- Throws:
SchemaException
-
processItems
protected void processItems(OperationResult opResult) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException
Description copied from class:AbstractIterativeTaskPartExecution
Starts the item source (e.g. searchObjectsIterative call or synchronize call) and begins processing items generated by it. Returns when the source finishes. For example: - for search-based tasks, this call returns immediately after the search is over ... TODO ok? - for live sync task, this returns after all changes were fetched and acknowledged, and the resulting token was written - for async update task, this returns also after all changes were fetched and acknowledged and confirmed to the source- Specified by:
processItems
in classAbstractIterativeTaskPartExecution<PrismObject<O extends ObjectType>,TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>,PE extends AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>,RH extends AbstractSearchIterativeItemProcessor<O,TH,TE,PE,RH>>
- Throws:
CommunicationException
ObjectNotFoundException
SchemaException
SecurityViolationException
ConfigurationException
ExpressionEvaluationException
-
searchIterative
protected void searchIterative(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.
-
searchIterativeInRepository
protected final void searchIterativeInRepository(OperationResult opResult) throws SchemaException
- Throws:
SchemaException
-
modelProcessingAvailable
protected boolean modelProcessingAvailable()
-
preProcessQuery
protected ObjectQuery preProcessQuery(ObjectQuery query, OperationResult opResult) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException
Pre-processing query (e.g. evaluate expressions).
-
createQuery
protected ObjectQuery createQuery(OperationResult opResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException, SecurityViolationException
Handler parameter may be used to pass task instance state between the calls.
-
createSearchOptions
protected Collection<SelectorOptions<GetOperationOptions>> createSearchOptions(OperationResult opResult)
-
requiresDirectRepositoryAccess
protected boolean requiresDirectRepositoryAccess(OperationResult opResult)
Returns true if the task processing requires direct access to the repository "by design". In such cases, the "raw" authorization is not checked. The default implementation relies on the value of the corresponding field. In theory, subclasses can plug their own "dynamic" implementation here.
-
setRequiresDirectRepositoryAccess
protected void setRequiresDirectRepositoryAccess()
-
createQueryFromTask
@NotNull protected @NotNull ObjectQuery createQueryFromTask() throws SchemaException
Ready-made implementation of createQuery - gets and parses objectQuery extension property.- Throws:
SchemaException
-
createSearchOptionsFromTask
protected Collection<SelectorOptions<GetOperationOptions>> createSearchOptionsFromTask()
-
createQueryFromTaskIfExists
protected final ObjectQuery createQueryFromTaskIfExists() throws SchemaException
- Throws:
SchemaException
-
getExpressionProfile
protected ExpressionProfile getExpressionProfile()
-
getPrismContext
public PrismContext getPrismContext()
-
getSchemaService
public SchemaService getSchemaService()
-
getTaskManager
protected TaskManager getTaskManager()
-
getTaskHandler
@NotNull public TH getTaskHandler()
-
createSearchResultHandler
protected final ResultHandler<O> createSearchResultHandler()
Passes all objects found into the processing coordinator. (Which processes them directly or queues them for the worker threads.)
-
providesTracingAndDynamicProfiling
public boolean providesTracingAndDynamicProfiling()
- Specified by:
providesTracingAndDynamicProfiling
in classAbstractIterativeTaskPartExecution<PrismObject<O extends ObjectType>,TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>,PE extends AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>,RH extends AbstractSearchIterativeItemProcessor<O,TH,TE,PE,RH>>
- Returns:
- True if this task execution should periodically write traces, according to relevant task extension items. It is also used to drive dynamic profiling (which is going to be deprecated).
-
getDefaultErrorAction
protected @NotNull ErrorHandlingStrategyExecutor.Action getDefaultErrorAction()
- Specified by:
getDefaultErrorAction
in classAbstractIterativeTaskPartExecution<PrismObject<O extends ObjectType>,TH extends AbstractTaskHandler<TH,TE>,TE extends AbstractTaskExecution<TH,TE>,PE extends AbstractSearchIterativeTaskPartExecution<O,TH,TE,PE,RH>,RH extends AbstractSearchIterativeItemProcessor<O,TH,TE,PE,RH>>
- Returns:
- Default error action if no policy is specified or if no policy entry matches.
-
getSearchOptions
public Collection<SelectorOptions<GetOperationOptions>> getSearchOptions()
-
-