Class AbstractThreadedObjectIteratorTask<ItemType>
- java.lang.Object
-
- sailpoint.task.AbstractTaskExecutor
-
- com.identityworksllc.iiq.common.task.AbstractThreadedTask<ItemType>
-
- com.identityworksllc.iiq.common.task.AbstractThreadedObjectIteratorTask<ItemType>
-
- Type Parameters:
ItemType
- the type of object being iterated over
- All Implemented Interfaces:
PrivateContextObjectConsumer<ItemType>
,sailpoint.object.BaseExecutor
,sailpoint.object.TaskExecutor
public abstract class AbstractThreadedObjectIteratorTask<ItemType> extends AbstractThreadedTask<ItemType>
A more advancedAbstractThreadedTask
that implements a “do this to these” pattern.The task will retrieve its list of items via a rule, script, flat file, or search filter. Subclasses are still responsible for implementing the
AbstractThreadedTask.threadExecute(SailPointContext, Map, Object)
method.A ‘retrievalType’ must be specified that is one of rule, script, sql, file, connector, provided, or filter, along with the appropriate arguments for that type of retrieval.
The other arguments are the ones expected by
BasicObjectRetriever
. See that class for details.If the output of your retrieval is not the type you want passed to your threadExecute, you must override
convertObject(Object)
and return the appropriately translated object. This class assumes that the output of convertObject is the correct type. Returning a value of the incorrect type will result in ClassCastExceptions.If you only want to support a subset of outputs, you may override
supportsRetrievalType(RetrievalType)
and return false for those you do not want to support.Subclasses must invoke super.parseArgs() if they override it to extract their own inputs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractThreadedObjectIteratorTask.CloseableIteratorWrapper
Proxy to convert a Closeable iterator into an iteratorclass
AbstractThreadedObjectIteratorTask.ResultTransformingIterator
Wraps the output iterators for transformation purposes.
-
Field Summary
-
Fields inherited from class com.identityworksllc.iiq.common.task.AbstractThreadedTask
beforeExecutionHook, context, executor, failureCounter, log, successCounter, taskResult, taskSchedule, terminated, threadCount
-
-
Constructor Summary
Constructors Constructor Description AbstractThreadedObjectIteratorTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ItemType
convertObject(Object input)
Converts the input to the expected type T.protected Iterator<ItemType>
getObjectIterator(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> args)
Gets the iterator over the given object typeprotected ObjectRetriever<ItemType>
getObjectRetriever(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> args)
Gets the ObjectRetriever associated with this task executionprotected boolean
isTerminated()
Termination indicator to be used by the subclassesprotected void
parseArgs(sailpoint.object.Attributes<String,Object> args)
Parses the task arguments, determining the retrieval type and its argumentsprotected boolean
supportsRetrievalType(com.identityworksllc.iiq.common.task.BasicObjectRetriever.RetrievalType type)
This method should return false if this task executor does not want to support the given retrieval type.-
Methods inherited from class com.identityworksllc.iiq.common.task.AbstractThreadedTask
addTerminationHandler, afterBatch, beforeBatch, createBatchIterator, execute, getBatchSize, getExecutor, markFailure, markSuccess, prepareExecutor, setBeforeExecutionHook, setFailureMarker, setSuccessMarker, setWorkerCreator, submitAndWait, terminate, threadExecute
-
-
-
-
Constructor Detail
-
AbstractThreadedObjectIteratorTask
public AbstractThreadedObjectIteratorTask()
-
-
Method Detail
-
convertObject
protected ItemType convertObject(Object input)
Converts the input to the expected type T.By default, this just returns the input as-is. If you know what you’re doing, you can leave this implementation intact, but you probably want to convert things.
If the result is null, the object will be ignored.
- Parameters:
input
- The input- Returns:
- The output object
-
getObjectIterator
protected Iterator<ItemType> getObjectIterator(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> args) throws sailpoint.tools.GeneralException
Gets the iterator over the given object type- Specified by:
getObjectIterator
in classAbstractThreadedTask<ItemType>
- Parameters:
context
- Sailpoint contextargs
- The task arguments- Returns:
- The iterator of items retrieved from whatever source
- Throws:
sailpoint.tools.GeneralException
- if any failures occur
-
getObjectRetriever
protected ObjectRetriever<ItemType> getObjectRetriever(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> args) throws sailpoint.tools.GeneralException
Gets the ObjectRetriever associated with this task execution- Parameters:
context
- The context of the object retrieverargs
- The arguments to the task- Returns:
- The object retriever
- Throws:
sailpoint.tools.GeneralException
- if any failure occurs
-
isTerminated
protected final boolean isTerminated()
Termination indicator to be used by the subclasses- Returns:
- True if this task has been terminated
-
parseArgs
protected void parseArgs(sailpoint.object.Attributes<String,Object> args) throws Exception
Parses the task arguments, determining the retrieval type and its arguments- Overrides:
parseArgs
in classAbstractThreadedTask<ItemType>
- Parameters:
args
- The task arguments- Throws:
Exception
- if any failures occur parsing the arguments
-
supportsRetrievalType
protected boolean supportsRetrievalType(com.identityworksllc.iiq.common.task.BasicObjectRetriever.RetrievalType type)
This method should return false if this task executor does not want to support the given retrieval type.- Parameters:
type
- The type of the retrieval
-
-