Class ThreadedRuleRunner
- java.lang.Object
-
- sailpoint.task.AbstractTaskExecutor
-
- com.identityworksllc.iiq.common.task.AbstractThreadedTask<ItemType>
-
- com.identityworksllc.iiq.common.task.AbstractThreadedObjectIteratorTask<Object>
-
- com.identityworksllc.iiq.common.task.ThreadedRuleRunner
-
- All Implemented Interfaces:
PrivateContextObjectConsumer<Object>,sailpoint.object.BaseExecutor,sailpoint.object.TaskExecutor
public class ThreadedRuleRunner extends AbstractThreadedObjectIteratorTask<Object>
A threaded task executor to run an iterator rule or script.The rule or script will be invoked in parallel for each of the objects returned by the iterator query. The object will be passed as ‘object’ to Beanshell.
NOTE that if you are iterating over a very large set of Sailpoint objects, it will be vastly more efficient to return a string ID from your object retriever and then look up each object in the iterator rule or script. This will also avoid problems with multiple contexts acting on the same object. The task option ‘extractReferences’ will do this for you automatically and is true by default.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.identityworksllc.iiq.common.task.AbstractThreadedObjectIteratorTask
AbstractThreadedObjectIteratorTask.CloseableIteratorWrapper, AbstractThreadedObjectIteratorTask.ResultTransformingIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected sailpoint.object.RuleafterBatchRuleAn optional rule to run after the batchprotected sailpoint.object.ScriptafterBatchScriptAn optional script to run after the batchprotected sailpoint.object.RulebeforeBatchRuleAn optional rule to run before the batchprotected sailpoint.object.ScriptbeforeBatchScriptAn optional script to run prior to the batchprotected Map<String,Object>extraArgumentsJSON argumentsprotected sailpoint.object.RuleiteratorRuleThe iterator rule, if specifiedprotected sailpoint.object.ScriptiteratorScriptThe iterator script, if specifiedprotected ThreadLocal<Map<String,Object>>threadStateThe state that is shared between each item in a batch-
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 ThreadedRuleRunner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterBatch(sailpoint.api.SailPointContext threadContext)Invoked by the worker thread after each batchvoidbeforeBatch(sailpoint.api.SailPointContext threadContext)Invoked by the worker thread before each batchprotected ObjectconvertObject(Object input)If the extract reference flag is set, and this is a SailPointObject, transforms it into aReferenceobject instead.protected voidparseArgs(sailpoint.object.Attributes<String,Object> args)Extracts the arguments passed to this task.ObjectthreadExecute(sailpoint.api.SailPointContext threadContext, Map<String,Object> parameters, Object obj)Executes this rule or script against the given object-
Methods inherited from class com.identityworksllc.iiq.common.task.AbstractThreadedObjectIteratorTask
getObjectIterator, getObjectRetriever, isTerminated, supportsRetrievalType
-
Methods inherited from class com.identityworksllc.iiq.common.task.AbstractThreadedTask
addTerminationHandler, afterCompletion, createBatchIterator, execute, getBatchSize, getExecutor, markFailure, markSuccess, prepareExecutor, setBeforeExecutionHook, setFailureMarker, setSuccessMarker, setWorkerCreator, submitAndWait, terminate
-
-
-
-
Field Detail
-
afterBatchRule
protected sailpoint.object.Rule afterBatchRule
An optional rule to run after the batch
-
afterBatchScript
protected sailpoint.object.Script afterBatchScript
An optional script to run after the batch
-
beforeBatchRule
protected sailpoint.object.Rule beforeBatchRule
An optional rule to run before the batch
-
beforeBatchScript
protected sailpoint.object.Script beforeBatchScript
An optional script to run prior to the batch
-
iteratorRule
protected sailpoint.object.Rule iteratorRule
The iterator rule, if specified
-
iteratorScript
protected sailpoint.object.Script iteratorScript
The iterator script, if specified
-
extraArguments
protected Map<String,Object> extraArguments
JSON arguments
-
threadState
protected ThreadLocal<Map<String,Object>> threadState
The state that is shared between each item in a batch
-
-
Constructor Detail
-
ThreadedRuleRunner
public ThreadedRuleRunner()
-
-
Method Detail
-
afterBatch
public void afterBatch(sailpoint.api.SailPointContext threadContext) throws sailpoint.tools.GeneralException
Invoked by the worker thread after each batch- Overrides:
afterBatchin classAbstractThreadedTask<Object>- Parameters:
threadContext- The context for this thread- Throws:
sailpoint.tools.GeneralException- if anything fails
-
beforeBatch
public void beforeBatch(sailpoint.api.SailPointContext threadContext) throws sailpoint.tools.GeneralException
Invoked by the worker thread before each batch- Overrides:
beforeBatchin classAbstractThreadedTask<Object>- Parameters:
threadContext- The context for this thread- Throws:
sailpoint.tools.GeneralException- if anything fails
-
convertObject
protected Object convertObject(Object input)
If the extract reference flag is set, and this is a SailPointObject, transforms it into aReferenceobject instead.This will make everything enormously more efficient and avoid weird issues with Hibernate context.
- Overrides:
convertObjectin classAbstractThreadedObjectIteratorTask<Object>- Parameters:
input- The input- Returns:
- The reference, or the original object
-
parseArgs
protected void parseArgs(sailpoint.object.Attributes<String,Object> args) throws Exception
Extracts the arguments passed to this task.This is the ONLY place that you ought to use the parent context.
- Overrides:
parseArgsin classAbstractThreadedObjectIteratorTask<Object>- Parameters:
args- The arguments to read- Throws:
Exception- if there are any failures during parsing
-
threadExecute
public Object threadExecute(sailpoint.api.SailPointContext threadContext, Map<String,Object> parameters, Object obj) throws sailpoint.tools.GeneralException
Executes this rule or script against the given object- Specified by:
threadExecutein interfacePrivateContextObjectConsumer<Object>- Specified by:
threadExecutein classAbstractThreadedTask<Object>- Parameters:
threadContext- The context created for this specific threadparameters- The parameters created for this threadobj- The input object for this thread- Returns:
- Always null (no meaningful result)
- Throws:
sailpoint.tools.GeneralException- if any failures occur
-
-