Issue while validating the before provisioning rule - Can't find where the exact issue is

Hi Experts,

We are trying to write the BeforeProvisioning rule to mitigate on the issue. We wrote the code try to validate using rule validator. While trying to validate the rule we encountered with the error below,

Errors: (1)
Line 25 - [LintProcessor(0)] Could not parse line, check to ensure line is syntatically correct. Error: Encountered “=” at line 25, column 80. Error occured between lines 12 and 25

Not sure what is the issue with the line 25…

Here is the full code,

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="BeforeProvisioningRule_eDir-2" type="BeforeProvisioning">
  <Description>This rule is to set the groupMembership and securityEquals attributes at the eDirectory target system.</Description>
  <Source><![CDATA[

	import sailpoint.object.*;
    import java.util.*;
	import sailpoint.object.ProvisioningPlan;
	import sailpoint.object.ProvisioningPlan.AccountRequest;
	import sailpoint.object.ProvisioningPlan.AttributeRequest;
    import sailpoint.object.ProvisioningPlan.AccountRequest.Operation;
	import sailpoint.object.ProvisioningPlan.Operation;

	log.debug("PLAN BEFORE MODIFICATION************************" + plan);
	//Fetching target name from the plan since this rule only needs to run for eDirectory
	//String targetName = plan.getSourceName();
	//log.debug("SOURCE NAME FROM PLAN******************" + targetName);
	//Checking if the target is eDirectory
	//if(targetName.contains("eDirectory"))
	if (provisioningPlan != null)
	{
		for (AccountRequest accReq : Util.iterate(provisioningPlan.getAccountRequests()))
		{
            if(accReq.getString("provisioningTarget") == "eDirectory DEV v3.1")
			{
				log.debug("INSIDE EXECUTION LOGIC FOR EDIRECTORY******************");
				List<AttributeRequest> oldAttributeRequestList = new ArrayList<>();
				List<AttributeRequest> newAttributeRequestList = new ArrayList<>();
				List<AccountRequest> newAccountRequestList = new ArrayList<>();
				List<AccountRequest> oldAccountRequestList = plan.getAccountRequests();

				for (AccountRequest accountRequest : oldAccountRequestList)
				{
					Object valueObject = accountRequest.getAttributeRequest("groups");
					oldAttributeRequestList.addAll(accountRequest.getAttributeRequests());
					for(AttributeRequest attributeRequest : oldAttributeRequestList)
					{
						String attributeName = attributeRequest.getName();
						//Assigning value of "groups" attribute to "groupMembership" & "securityEquals" attributes
						if(attributeName.equals("groupMembership") || attributeName.equals("securityEquals"))
						{
							//Handling the case of multiple entitlements/access profiles selected for a user
							if(valueObject instanceof Collection)
							{
								log.debug("MULTIPLE ENTITLEMENTS SELECTED FOR USER******************");
								List valueList = (ArrayList) valueObject;
								log.debug("ENTITLEMENT VALUES SELECTED FOR USER******************" + valueList);
								attributeRequest.setValue(valueList);
							//Handling the case of single entitlement/access profile selected for a user
							}
							else if(valueObject instanceof String)
							{
								log.debug("SINGLE ENTITLEMENT SELECTED FOR USER******************");
								String valueString = (String) valueObject;
								log.debug("ENTITLEMENT VALUE SELECTED FOR USER******************" + valueString);
								attributeRequest.setValue(valueString);
							}
						}
						//Adding all modified and unmodified AttributeRequests to a list to later update AccountRequest
						newAttributeRequestList.add(attributeRequest);
					}
					//Adding modified AttributeRequest list to the AccountRequest to later modify the plan
					accountRequest.setAttributeRequests(newAttributeRequestList);
					newAccountRequestList.add(accountRequest);
				}
				//existing plan modified with updated AccountRequests
				plan.setAccountRequests(newAccountRequestList);
				log.debug("PLAN AFTER MODIFICATION************************" + plan);
			}
		}
	}
 ]]>
  </Source>
</Rule>

Tried multiples times but can’t find where the issue exactly… Any help would be much appreciated!!

1 Like

List<AttributeRequest> oldAttributeRequestList = new ArrayList<>();

For SailPoint don’t use generics in your code. Always remove it and use it as :

List oldAttributeRequestList = new ArrayList();

1 Like

Hi @Arshad,

Yes. When I change to as you mentioned it was working…

Appreciated. Thanks!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.