Authors: Nishant Singhai and Ranvijay Singh
In IGI sometimes we need to configure the right lookup. From the Admin console we can create such lookups. Sometimes we need to create long list and continuously update it.
Here are the steps that can help to create such rightlooks in IGI.
- From the Admin console Configure- Rules create advance rule:
- Rule code snippet for reference:
when
eval( true )
then
logger.info("insertRightLookup -> Creating bean list");
RightsDAO dao = new RightsDAO(null);
dao.setConnection(true, "igacore", "lastModUser", "cod_oper", IdeasApplications.ACCESSGOVERNANCECORE.getName());
IRightsDirect rightsDirect = (IRightsDirect) DirectFactory.getDirectInterface(JndiNames.rightEJB);
Map<String, List<String>> map = new HashMap<>();
List<String> list = new ArrayList<String>();
list.add("A1");
list.add("A2");
map.put("P11", list);
list = new ArrayList<String>();
list.add("B1");
list.add("B2");
map.put("P22", list);
BeanList<RightsLookupBean> bl = new BeanList<>();
long myid = 1010;
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
String content = entry.getKey();
List<String> values = entry.getValue();
for (String value : values) {
RightsLookupBean rlb = new RightsLookupBean();
rlb.setId(myid++);
rlb.setContent(content);
rlb.setValue(value);
rlb.setInternalValue(value);
rlb.setDescription("description");
bl.add(rlb);
}
}
rightsDirect.insertRightsLookup(bl, dao);
dao.closeConnection();
Additional imports required in addition to standard imports:
import com.engiweb.profilemanager.common.bean.RightsLookupBean
import com.engiweb.pm.entity.BeanList
import com.ibm.igi.mapping.common.frontendbean.AttributePermValueBean
import com.engiweb.profilemanager.common.interfaces.IRightsDirect
import com.engiweb.profilemanager.backend.dao.rights.RightsDAO
- Once you setup the rule add it to rule flow:
- Create a new custom task from Task Planner and add the advanced rule.
Refer below screenshots:
In the scheduling tab you can choose to specify time when you would like to update the rightlookup list.