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)";
<Query>
from IdentityRequestItem iri,IdentityRequest ir, Application app where iri.identityRequest = ir.id and iri.application = app.name and iri.operation = 'Add'
</Query>
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.