Question


Tech Mahindra
CA
Last activity: 18 Jul 2017 10:16 EDT
SOAP Service - Dynamically Create Cases for Different Work Pools ( rulesets not available in Service AccessGroup)
I have SOAP Service which can not have authentication enabled due to Consumers are not ready to change.
Based on some attribute in the incoming SOAP Request, can i update current rulesets to create work objects for different work pools ?
I already have the required rulesets but how to update Current Rulesetlist before creating the case ? Any thoughts
***Updated by moderator: Lochan to close post***
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution


Tech Mahindra
CA
Found a way...! this should do it
ClipboardProperty ruleSetCp;
ruleSetCp = tools.findPage("TempAppPage").getProperty("pyRuleSetList");
int aAction = tools.getAuthorizationHandle().UPDATE_REPLACE;
try
{
final com.pega.pegarules.priv.authorization.PegaAuthorization authorization = (com.pega.pegarules.priv.authorization.PegaAuthorization)tools.getThread().getAuthorization();
boolean status = authorization.setRuleSets(tools, aAction, ruleSetCp);
oLog.infoForced("Rulesets update : " + status);
}
catch (PRSecurityException prsEx) {}
Please comment if there any other thoughts...!


Pegasystems
IN
The agents currently do this by changing the accessgroup. You can refer to SYSTEM-QUEUE-SERVICELEVEL!ESTABLISHCONTEXT activity to see how the accessgroup is altered.


Tech Mahindra
CA
I have been trying to use the following in my service activity with no luck
com.pega.pegarules.priv.authorization.PegaAuthorization auth = (com.pega.pegarules.priv.authorization.PegaAuthorization) tools.getAuthorizationHandle();
String strAccessGroup = auth.replaceAccessGroupToUse(tools, myStepPage.getString(".pyAccessGroup"));
The above code doesn't work for requestors of type App, only works for btach requstors.
com.pega.pegarules.priv.authorization.PegaAuthorization auth = (com.pega.pegarules.priv.authorization.PegaAuthorization) tools.getAuthorizationHandle();
String strAccessGroup = auth.setActiveAccessGroupToUse(tools, myStepPage.getString(".pyAccessGroup"));
i belive its not setting the provided accessgroup, because i see JAVA code executing properly
** Failed to find a 'RULE-OBJ-FLOW' with the name 'TESTFLOW' that applies to 'XXXXX-Work-Test'. There were 2 rules with this name in the rulebase, but none matched this request. The 2 rules named 'TESTFLOW' defined in the rulebase are: 1 related to applies-to class 'XXXXX-Work-Test', but were defined in rulesets which are not in your rulesetlist: 'SSG:01-01-01'. 1 unrelated to applies-to class 'XXXXX-Work-Test', for example: 'PegaPDFS-Work-testCasetype'. Current RulesetList:
{bunch of rulesets for the Service requestor }
1) Where is the Current RulesetList picked up from pxRequestor or pxThread
I have been trying to use the following in my service activity with no luck
com.pega.pegarules.priv.authorization.PegaAuthorization auth = (com.pega.pegarules.priv.authorization.PegaAuthorization) tools.getAuthorizationHandle();
String strAccessGroup = auth.replaceAccessGroupToUse(tools, myStepPage.getString(".pyAccessGroup"));
The above code doesn't work for requestors of type App, only works for btach requstors.
com.pega.pegarules.priv.authorization.PegaAuthorization auth = (com.pega.pegarules.priv.authorization.PegaAuthorization) tools.getAuthorizationHandle();
String strAccessGroup = auth.setActiveAccessGroupToUse(tools, myStepPage.getString(".pyAccessGroup"));
i belive its not setting the provided accessgroup, because i see JAVA code executing properly
** Failed to find a 'RULE-OBJ-FLOW' with the name 'TESTFLOW' that applies to 'XXXXX-Work-Test'. There were 2 rules with this name in the rulebase, but none matched this request. The 2 rules named 'TESTFLOW' defined in the rulebase are: 1 related to applies-to class 'XXXXX-Work-Test', but were defined in rulesets which are not in your rulesetlist: 'SSG:01-01-01'. 1 unrelated to applies-to class 'XXXXX-Work-Test', for example: 'PegaPDFS-Work-testCasetype'. Current RulesetList:
{bunch of rulesets for the Service requestor }
1) Where is the Current RulesetList picked up from pxRequestor or pxThread
2) will we able to update that list run time ?
Any thoughts ? appreciate your help
Thanks
Naveen
Accepted Solution


Tech Mahindra
CA
Found a way...! this should do it
ClipboardProperty ruleSetCp;
ruleSetCp = tools.findPage("TempAppPage").getProperty("pyRuleSetList");
int aAction = tools.getAuthorizationHandle().UPDATE_REPLACE;
try
{
final com.pega.pegarules.priv.authorization.PegaAuthorization authorization = (com.pega.pegarules.priv.authorization.PegaAuthorization)tools.getThread().getAuthorization();
boolean status = authorization.setRuleSets(tools, aAction, ruleSetCp);
oLog.infoForced("Rulesets update : " + status);
}
catch (PRSecurityException prsEx) {}
Please comment if there any other thoughts...!


Pegasystems
US
Hi,
Regarding the code you posted, which I repeat below, how are you actually setting up your "TempAppPage" ? We tried to suggest your code to our customer, and they aren't clear on that question. Our customer is in a "JMS MDB Requestor session (container managed)" context. Thanks. /Eric
ClipboardProperty ruleSetCp;
ruleSetCp = tools.findPage("TempAppPage").getProperty("pyRuleSetList");
int aAction = tools.getAuthorizationHandle().UPDATE_REPLACE;
try
{
final com.pega.pegarules.priv.authorization.PegaAuthorization authorization = (com.pega.pegarules.priv.authorization.PegaAuthorization)tools.getThread().getAuthorization();
boolean status = authorization.setRuleSets(tools, aAction, ruleSetCp);
oLog.infoForced("Rulesets update : " + status);
}
catch (PRSecurityException prsEx) {}


Tech Mahindra
CA
Hello Eric,
Our requirement is something, We have many Rule-Applications deployed on same PEGA instance, we wanted to create a generic service to create / update cases for all the applications with out having their rulesets in servie accessgroup.
for that building a rulesetstack dynamically based on the input parameter
Here TempAppPage is just a page to hold ruleset stack which will be fed to below code to refresh the requestor ruleset stack
final com.pega.pegarules.priv.authorization.PegaAuthorization authorization = (com.pega.pegarules.priv.authorization.PegaAuthorization)tools.getThread().getAuthorization();
boolean status = authorization.setRuleSets(tools, aAction, ruleSetCp);
Instead of using the above code you call Code-Security.SetRulesets which will do the same thing.
Hope this helps
Cheers
Naveen


Naveen/Eric,
I have a similar requirement and I used the above snippet(for a JMS Service).. However it is still considering the static AG specified in the service package..Does the above snippet work well only for batch requestors?
Do we have a way to make it work for APP Requestor as well?


Tech Mahindra
CA
I think for app requestors you can try the below.
auth.setActiveAccessGroup(tools.getThread(), AG);
let me know.


I tried it..However it didn't work.. I passed the 2nd parameter as a string(AG Name)..
Do we have access to the authorization package classes and methods? I looked at the engine APIs and I couldn't find this package in the help.


Tech Mahindra
CA
don't think its available in the engine API. Check this activity
System-Queue-ServiceLevel.EstablishContext


Used the replaceAccessGroup method available in the above activity(System-Queue-ServiceLevel.EstablishContext) and got the below exception..
** Invalid requestor type APP; only BATCH requestors are supported by this method.


Pegasystems Inc.
US
Can you provide screenshots for the ServicePage used by the soap service.
Please include all tabs
It may be that there is a conflict regards pooling and a context switch.


This is a JMS Service and the AG is initialized in the Service package data instance.