Calling a Rule from anywhere either it's from any Rule, Work Flow, LCM Provisioning
Java Code
public void runRule(SailPointContext context) throws GeneralException{ Rule TestRule = context.getObject(Rule.class,"TestRule1"); HashMap ruleParam = new HashMap(); ruleParam.put("log",null); ruleParam.put("context",context); ruleParam.put("name","Vishal"); String name = (String) context.runRule(TestRule ,ruleParam); System.out.println("name : " + name); }
Rule :TestRule1
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd"> <Rule language="beanshell" name="TestRule1"> <Signature> <Inputs> <Argument name="log"> <Description> The log object associated with the SailPointContext. </Description> </Argument> <Argument name="context"> <Description> A sailpoint.api.SailPointContext object that can be used to query the database if necessary. </Description> </Argument> <Argument name="name"> <Description> name value from the place where this is called. </Description> </Argument> </Inputs> </Signature> <Source> return name + "Kejriwal"; </Source> </Rule>
Output
name : VishalKejriwal
No comments:
Post a Comment