Class PlanBuilder
- java.lang.Object
-
- com.identityworksllc.iiq.common.PlanBuilder
-
public class PlanBuilder extends Object
A fluent builder for provisioning plans, especially useful for quickly writing rules or test cases.Import the methods from this class statically and begin with one of the plan() methods. The builder model will enforce only calling appropriate operations in any given context.
The interfaces nested within this class will be used to implement a chain of modifiers to the ‘current’ object.
Example:
ProvisioningPlan plan = PlanBuilder.plan(existingLink, removeAllValues(existingLink, "emails"), attribute("firstName", set("John")));This results in a ProvisioningPlan containing an AccountRequest to modify the given account. The AccountRequest contains AttributeRequests to remove all existing values from ‘email’ and to set the ‘firstName’ attribute to ‘John’.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePlanBuilder.AccountRequestModifierCan modify the given account requeststatic interfacePlanBuilder.AnyModifierCan be used in any contextstatic interfacePlanBuilder.AttributeRequestModifierCan modify the given attribute requeststatic interfacePlanBuilder.ExistingLinkModifierInterface for modifying existing links, can be passed to the Link plan() method for better fluencystatic interfacePlanBuilder.OperationModifierHandles the case of a string parameter to operation()static interfacePlanBuilder.PlanModifierCan modify the given provisioning plan
-
Constructor Summary
Constructors Constructor Description PlanBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PlanBuilder.PlanModifieraccount(PlanBuilder.AccountRequestModifier... modifiers)returns a plan modifier that adds an account request to the planstatic PlanBuilder.AccountRequestModifierapplication(String application)Returns an AccountRequestModifier that sets the application on the account requeststatic PlanBuilder.AnyModifierargument(String name, Object value)Returns a modifier for any object that adds an argument to the object’sargumentsMap.static PlanBuilder.AccountRequestModifierattribute(String name, PlanBuilder.AttributeRequestModifier... modifiers)Creates a modifier to add an AttributeRequest to the AccountRequeststatic PlanBuilder.PlanModifieridentity(String idOrName)Creates a plan modifier that sets the identity on the plan to the identity with the given name or IDstatic PlanBuilder.PlanModifieridentity(sailpoint.object.Identity identity)Sets the identity on the plan to the given identitystatic PlanBuilder.AccountRequestModifiernativeIdentity(String ni)Creates an AccountRequestModifier that sets the native identity on the account requeststatic PlanBuilder.OperationModifieroperation(String op)Creates an OperationModifier that sets the operation on the account request or attribute requeststatic PlanBuilder.AccountRequestModifieroperation(sailpoint.object.ProvisioningPlan.AccountRequest.Operation operation)Creates an AccountRequestModifier that sets the operation on the account requeststatic PlanBuilder.AttributeRequestModifieroperation(sailpoint.object.ProvisioningPlan.Operation operation)Creates an AttributeRequestModifier that sets the operation on the attribute requeststatic sailpoint.object.ProvisioningPlanplan(PlanBuilder.PlanModifier... planModifiers)Creates a provisioning plan based on the given modifiers.static sailpoint.object.ProvisioningPlanplan(sailpoint.object.Link toModify, PlanBuilder.ExistingLinkModifier... modifiers)Creates a provisioning plan based on the given link and any modifiers.static PlanBuilder.AccountRequestModifierremoveAllValues(sailpoint.object.Link existing, String field)Generates a complex AccountRequestModifier that removes all existing values from the given fieldstatic PlanBuilder.AttributeRequestModifierset(Object value)Shortcut for ‘operation(“Set”), value(value)’static PlanBuilder.AttributeRequestModifiervalue(Object... values)Adds the given value(s) to the Plan.
-
-
-
Constructor Detail
-
PlanBuilder
public PlanBuilder()
-
-
Method Detail
-
account
public static PlanBuilder.PlanModifier account(PlanBuilder.AccountRequestModifier... modifiers)
returns a plan modifier that adds an account request to the plan- Parameters:
modifiers- Any modifiers to apply to the account request- Returns:
- The plan modifier
-
application
public static PlanBuilder.AccountRequestModifier application(String application)
Returns an AccountRequestModifier that sets the application on the account request- Parameters:
application- The application name- Returns:
- The AccountRequestModifier
-
argument
public static PlanBuilder.AnyModifier argument(String name, Object value)
Returns a modifier for any object that adds an argument to the object’sargumentsMap.This method works on plans, requests, and attributes.
- Parameters:
name- The argument namevalue- The argument value- Returns:
- The modifier
-
attribute
public static PlanBuilder.AccountRequestModifier attribute(String name, PlanBuilder.AttributeRequestModifier... modifiers)
Creates a modifier to add an AttributeRequest to the AccountRequest- Parameters:
name- The name of the attributemodifiers- Any modifiers to apply to the attribute request- Returns:
- the resulting modifier implementation
-
identity
public static PlanBuilder.PlanModifier identity(sailpoint.object.Identity identity)
Sets the identity on the plan to the given identity- Parameters:
identity- The identity to set- Returns:
- A plan modifier that changes the plan Identity
-
identity
public static PlanBuilder.PlanModifier identity(String idOrName) throws sailpoint.tools.GeneralException
Creates a plan modifier that sets the identity on the plan to the identity with the given name or ID- Parameters:
idOrName- The identity name or ID- Returns:
- The plan modifier
- Throws:
sailpoint.tools.GeneralException- if the identity cannot be found
-
nativeIdentity
public static PlanBuilder.AccountRequestModifier nativeIdentity(String ni)
Creates an AccountRequestModifier that sets the native identity on the account request- Parameters:
ni- The native identity to set- Returns:
- The AccountRequestModifier
-
operation
public static PlanBuilder.OperationModifier operation(String op)
Creates an OperationModifier that sets the operation on the account request or attribute request- Parameters:
op- The operation to set, as a string- Returns:
- The OperationModifier
-
operation
public static PlanBuilder.AttributeRequestModifier operation(sailpoint.object.ProvisioningPlan.Operation operation)
Creates an AttributeRequestModifier that sets the operation on the attribute request- Parameters:
operation- The operation to set- Returns:
- The AttributeRequestModifier
-
operation
public static PlanBuilder.AccountRequestModifier operation(sailpoint.object.ProvisioningPlan.AccountRequest.Operation operation)
Creates an AccountRequestModifier that sets the operation on the account request- Parameters:
operation- The operation to set- Returns:
- The AccountRequestModifier
-
plan
public static sailpoint.object.ProvisioningPlan plan(sailpoint.object.Link toModify, PlanBuilder.ExistingLinkModifier... modifiers) throws sailpoint.tools.GeneralException
Creates a provisioning plan based on the given link and any modifiers.This method is one of the entry points to the PlanBuilder.
- Parameters:
toModify- The link to modifymodifiers- Any modifiers to apply to the plan or account request- Returns:
- The resulting plan
- Throws:
sailpoint.tools.GeneralException- if anything goes wrong
-
plan
public static sailpoint.object.ProvisioningPlan plan(PlanBuilder.PlanModifier... planModifiers) throws sailpoint.tools.GeneralException
Creates a provisioning plan based on the given modifiers.This method is one of the entry points to the PlanBuilder.
- Parameters:
planModifiers- Any modifiers to apply to the plan- Returns:
- The resulting plan
- Throws:
sailpoint.tools.GeneralException- if anything goes wrong
-
removeAllValues
public static PlanBuilder.AccountRequestModifier removeAllValues(sailpoint.object.Link existing, String field)
Generates a complex AccountRequestModifier that removes all existing values from the given field- Parameters:
existing- The Link from which to extract existing valuesfield- The field to remove values from- Returns:
- The AccountRequestModifier
-
set
public static PlanBuilder.AttributeRequestModifier set(Object value)
Shortcut for ‘operation(“Set”), value(value)’- Parameters:
value- The value to set in the attribute request- Returns:
- The AttributeRequestModifier
-
value
public static PlanBuilder.AttributeRequestModifier value(Object... values)
Adds the given value(s) to the Plan.If only one value is passed, it will be added as a single value. If value() is called more than once, if more than one value is passed, or if the attribute request already has a value, it will be transformed into a list and merged.
- Parameters:
values- The values- Returns:
- The input
-
-