Multiple entitlement Remove Error

so here in my Request parser rule . if i try to remove multiple Entitlement it giving error.

  Log log = LogFactory.getLog("com.cof.rap.rule.Direct BranchRule");

  log.info("Enter COF Direct Branch Request Parser Rule");

  Map geteEableDisableObject(SailPointContext context,String id, List items,String status)

  {

    Map additionalParameters = new HashMap();

    Map jsonRequest = new HashMap();

    QueryOptions qo = new QueryOptions();

    List columns= new ArrayList();

    Attributes attLink = null;

    Identity identity = null;

    Iterator itlink = null;

    String appName = "Direct Branch";

    List rolelist=new ArrayList();

    List rolesToRemove=new ArrayList();
    
    Custom custom = context.getObjectByName(Custom.class,"COF FS Least Access Entitlements");

    try {

      columns.add("attributes");

      qo.addFilter(sailpoint.object.Filter.eq("nativeIdentity",id));

      qo.addFilter(sailpoint.object.Filter.eq("application.name",appName));

      itlink = context.search(Link.class, qo, columns);

 

      while(itlink.hasNext())

      {

        Object[] objLink= (Object[]) itlink.next();

        attLink= (Attributes) objLink[0];

      }

      rolelist =attLink.get("roles");
      
      if("active".equalsIgnoreCase(status))

      {

 

        if(items != null  && !(items.isEmpty()))

        {

 

          for(Item item:items)

          {

            String roleoperation=item.getOperation().toString();

 

            if("roles".equals(item.getName()) && roleoperation.equals("Add"))

            {

              rolelist.add(item.getValue()); // Add role to the list

 

              additionalParameters.put("Roles",rolelist);

              additionalParameters.put("eid",id);
              
              } 

            else if("roles".equals(item.getName()) && roleoperation.equals("Remove"))

 

            { 

                    rolelist.remove(item.getValue()); 

 

              additionalParameters.put("Roles",rolelist);

              additionalParameters.put("eid",id);

 

            }

  
          }

 

        }
        
        }

      else if("delete".equalsIgnoreCase(status))

      {

 

        additionalParameters.put("eid",id);

      }

 

      //additionalParameters.put("status",status);

                     log.error("printing additionalParameters "+additionalParameters);

 

      jsonRequest.put("additionalParameters", additionalParameters);

    } catch (GeneralException e) 

    {

      throw new ConnectorException("Error on getting the Link object");

    }

    return jsonRequest;

  }
  
  if(operation.equals(AccountRequest.Operation.Create))

  {

    log.debug("Inside COF Direct Branch Request Parser Rule:Create operation");

    Map additionalParameters = new HashMap();

    String eid =null;

    FsEntity entity= new FsEntity();

    if(items != null  && !(items.isEmpty()))

    {

      List rolelist=new ArrayList();

 

      for(int i = 0;i<=items.size()-1;i++)

      {

        Item item = items.get(i); 

        if("fullName".equalsIgnoreCase(item.getName()))

        {

          entity.setFullName((String) item.getValue());

        }

 

        else if("email".equalsIgnoreCase(item.getName()))

        {

          entity.setEmail((String) item.getValue());

        }

        else if("EID".equalsIgnoreCase(item.getName()))

        {

          eid  = item.getValue().toUpperCase();

          entity.setEid(eid);
          
          }

        else if("firstName".equals(item.getName()))

        {

          additionalParameters.put("firstName", item.getValue());

        } 

        else if("lastName".equals(item.getName()))

        {

          additionalParameters.put("lastName", item.getValue());

        } 

        else if("roles".equalsIgnoreCase(item.getName()))

        {

          if (item.getValue() instanceof String) {

            rolelist.add(item.getValue()); // Add role to the list

          } else {

            additionalParameters.put("Roles", item.getValue()); // Handle non-string roles directly

          }

        }

      }
      if (!rolelist.isEmpty()) {

        additionalParameters.put("Roles", rolelist);

      }

      additionalParameters.put("status","active");

      entity.setPassword("invalid");

      entity.setAdditionalParameters(additionalParameters);

      log.debug("COF Direct Branch Request Parser Rule:Create:jsonRequest:"+JsonUtil.getJson(entity));

      log.info("Exit COF Direct Branch Request Parser Rule");

      return JsonUtil.getJson(entity);

    }

    else

    {

      return null;

    }

  }
  else  if(operation.equals(AccountRequest.Operation.Modify))

  {

    log.debug("Inside COF Direct Branch Request Parser Rule:Modify operation");

    Map jsonRequest = new HashMap();

    jsonRequest=geteEableDisableObject(context,id,items,"active");

    log.debug("COF Direct Branch Request Parser Rule:Modify:jsonRequest:"+JsonUtil.getJson(jsonRequest));

    log.info("Exit COF Direct Branch Request Parser Rule");

    return JsonUtil.getJson(jsonRequest);

 

  }
  else if(operation.equals(AccountRequest.Operation.Delete))

  {

    log.debug("Inside COF Direct Branch Request Parser Rule:Delete operation");

    Map jsonRequest = new HashMap();

    jsonRequest=geteEableDisableObject(context,id,null,"delete");

    log.debug("COF Direct Branch Request Parser Rule:Disable:jsonRequest:"+JsonUtil.getJson(jsonRequest));

    log.info("Exit COF Direct Branch Request Parser Rule");

    return JsonUtil.getJson(jsonRequest);

  }

 

Error updating user


i just need to fix remove operation part

Hi @autorun6464 ,

Could you please provide more details like when are getting this? while doing what? and what error you are getting? attach some logs if possibles. Please explain bit more about your issue.

Error updating user … and it just print the user agent

Hi,

I believe this is used in JDBC connector rule. Confirm please.

We would like to know where the ‘items’ is coming and give us some idea about where the this is running and when are you getting this error.