Search This Blog

Monday, December 2, 2019

Figuring out how to work with getOp or getOperation

The classes ProvisioningPlan.AccountRequest and ProvisioningPlan.AttributeRequest have operations associated with them.  Here's how to query and use them.  This might be updated as I gather more info.

AccountRequest actually has two flavors:

sailpoint.object.ProvisioningPlan.AccountRequest
sailpoint.integration.ProvisioningPlan.AccountRequest

The former is used internally for building and requesting, the latter is passed into IntegrationConfig classes.

Starting with the former, it has the following operation method:

sailpoint.object.ProvisioningPlan.AccountRequest.Operation getOperation()
This returns an enum one of the following:

Create
Delete
Disable
Enable
Lock
Modify
Unlock

Unless there is an account type request, most of the time this will be Modify, for modifying data or adding or removing entitlements.  Two easy ways to deal with this are:

if (AccountRequest.Operation.Enable == acctReq.getOperation()) {

This defends against an NPE

and the less preferred

if("Enable".equals(acctReq.getOperation().valueOf()) {

For the AttributeRequests, that class does not have its own getOperation method, it inherits the following method from sailpoint.object.ProvisioningPlan.GenericRequest:

sailpoint.object.ProvisioningPlan.Operation getOp()

This returns an enum one of the following:
Add
Remove
Retain
Revoke
Set

You will most likely see Add, Remove, and Set and can use:

if (ProvisioningPlan.Operation.Add == attrReq.getOp()) {

or the less preferred:

if ("Add".equals(attrReq.getOp().valueOf())) {

For sailpoint.integration.ProvisioningPlan.AccountRequest the following method is provided:

String getOperation()
Which returns the valueOf for one of the ProvisioningPlanAccountRequest.Operation constants

and for sailpoint.integration.ProvisioningPlan.AttributeRequest the following method is provided:

String getOperation()
Which returns the valueOf for one of the ProvisioningPlan.Operation constants.


No comments:

Post a Comment