Creating a Custom Report With HQL

In a Report, I am trying to add a query to get the entitlements but cannot feed it as a query.

                  List entitlements = new ArrayList();
                  
                  List entitlementList = new ArrayList();
                  entitlementList = args.getList("entitlements");

                  if((entitlementList != null) && (!entitlementList.isEmpty())){
                    
                    for (String entitlementMap : entitlementList)
                    {
                      IdentityItem ent = new IdentityItem();
                      ent.setApplication((String) entitlementMap.get("app"));
                      ent.setName((String) entitlementMap.get("attr"));
                      ent.setValue(entitlementMap.get("attrVal"));
                      entitlements.add(ent);
                    }
                  }

query += " and iri.value in (:entitlements)";

Its empty

Hi @fgholani,

I think this part is the queryScript. Before this you must define the main query and in queryScript you can add others critiria.

See my post, where I explain how to do: Report: How to modify and create custom report

<Query>

                from IdentityRequestItem iri,IdentityRequest ir, Application app where iri.identityRequest = ir.id and iri.application = app.name and iri.operation = 'Add'

              </Query>

The above is in query and the one in the main question is in queryscript

In iri.value you have the name of entitlement, so you need to pass a list of entitlement name.
You must modify your queryScript depends how you have in the argument entitlements.

If you already have a list of name, you can use it, like this:

Object ents = args.get("entitlements");
if (ents != null && !ents.isEmpty()){
  query +=  " and iri.value  in( :entitlements ) ";
}

also if you a list of id you can try to use iri.attributes.identityEntitlementId, but I dont know if it work, I never try.

PS There you are using a String like a Map:
image

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