Class BasicObjectRetriever<ItemType>
- java.lang.Object
-
- com.identityworksllc.iiq.common.task.BasicObjectRetriever<ItemType>
-
- Type Parameters:
ItemType
-
- All Implemented Interfaces:
ObjectRetriever<ItemType>
public class BasicObjectRetriever<ItemType> extends Object implements ObjectRetriever<ItemType>
Implements a reusable implementation ofObjectRetriever
for use with any number of scheduled tasks.This class takes the following input arguments in its constructor:
- values: If the input type is ‘provided’, these values will be interpreted as the raw input.
- retrievalSql: A single-column SQL query that will produce a list of strings. The first column must be a string. Other columns will be ignored.
- retrievalSqlClass: If specified, the single-column result from the query will be used as an ID look up the object with this type
- retrievalConnector: The name of an Application; the iteration will be over a list of ResourceObjects as though an aggregation is running
- retrievalFile: The fully qualified name of an existing, readable text file. Each line will be passed as a List of Strings to convertObject. If a delimiter is specified, the List will contain each delimited element. If not, the list will contain the entire line.
- retrievalFileDelimiter: If specified, the file will be interpreted as a CSV; each line as a List will be passed to threadExecute
- retrievalFileClass: If specified, the file will be interpreted as a CSV and the first column will be interpreted as an ID or name of this class type.
- retrievalRule: The name of a Rule that will produce an Iterator over the desired objects
- retrievalScript: The source of a Script that will produce an Iterator over the desired objects
- retrievalFilter: A Filter string combined with retrievalFilterClass to do a search in SailPoint
- retrievalFilterClass: The class name to search with the retrievalFilter
You are expected to provide a
TransformingIterator
supplier that will convert from the output type listed below to the desired type. If your TransformingIterator does not produce the correct output, it is likely that you will run into ClassCastExceptions. That is beyond the scope of this class.Default object types if you do not convert them afterwards are:
‘provided’: String
‘sql’: If a class is specified, instances of that class. If not, strings.
‘connector’: ResourceObject
‘file’: List of Strings
‘rule’ and ‘script’: Arbitrary. You are expected to return the right data type from your rule. You may return an IncrementalObjectIterator, an Iterator, an Iterable, or any other object (which will be wrapped in a singleton list).
‘filter’: An object of the specified filter class, or Identity if one is not specified. The iterator will wrap an IncrementalObjectIterator so that not all objects are loaded into memory at once.
If you are using this class in a context that can be interrupted (e.g., in a job), you will need to provide a way for this class to register a “termination handler” by calling
setTerminationRegistrar(Consumer)
. Your termination logic MUST invoke any callbacks registered with your consumer.
-
-
Constructor Summary
Constructors Constructor Description BasicObjectRetriever(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> arguments, Function<Iterator<?>,TransformingIterator<Object,ItemType>> transformerConstructor, sailpoint.object.TaskResult taskResult)
Constructs a new Basic object retriever
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<ItemType>
getObjectIterator(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> arguments)
Gets the object iterator, which will be an instance ofTransformingIterator
to convert whatever are the inputs.com.identityworksllc.iiq.common.task.BasicObjectRetriever.RetrievalType
getRetrievalType()
Gets the retrieval typeboolean
hasRetrievalClass()
Returns true if the retriever is configured with a retrieval class appropriate for the retrieval type, otherwise returns false.void
setTerminationRegistrar(Consumer<Functions.GenericCallback> registar)
Sets the termination registrar object
-
-
-
Constructor Detail
-
BasicObjectRetriever
public BasicObjectRetriever(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> arguments, Function<Iterator<?>,TransformingIterator<Object,ItemType>> transformerConstructor, sailpoint.object.TaskResult taskResult) throws sailpoint.tools.GeneralException
Constructs a new Basic object retriever- Parameters:
context
- The Sailpoint context to use for searchingarguments
- The arguments to the task (or other)transformerConstructor
- The callback that creates a transforming iteratortaskResult
- The task result, or null- Throws:
sailpoint.tools.GeneralException
- if any failures occur
-
-
Method Detail
-
getObjectIterator
public Iterator<ItemType> getObjectIterator(sailpoint.api.SailPointContext context, sailpoint.object.Attributes<String,Object> arguments) throws sailpoint.tools.GeneralException
Gets the object iterator, which will be an instance ofTransformingIterator
to convert whatever are the inputs.See the class Javadoc for information about what the default return types from each query method are.
- Specified by:
getObjectIterator
in interfaceObjectRetriever<ItemType>
- Parameters:
context
- The context to use during queryingarguments
- Any additional query arguments- Returns:
- An iterator over the retrieved objects
- Throws:
sailpoint.tools.GeneralException
- if any failures occur
-
hasRetrievalClass
public boolean hasRetrievalClass()
Returns true if the retriever is configured with a retrieval class appropriate for the retrieval type, otherwise returns false.- Returns:
- True if a retrieval class is present
-
getRetrievalType
public com.identityworksllc.iiq.common.task.BasicObjectRetriever.RetrievalType getRetrievalType()
Gets the retrieval type- Returns:
- The retrieval type
-
setTerminationRegistrar
public void setTerminationRegistrar(Consumer<Functions.GenericCallback> registar)
Sets the termination registrar object- Specified by:
setTerminationRegistrar
in interfaceObjectRetriever<ItemType>
- Parameters:
registar
- The termination registrar object
-
-