Although the adapter does not support before and after actions, it does support running actions using the runResourceAction Provision Workflow Service. You can write a SmartRoles action in javascript or BeanShell, and it can call the SmartRoles APIs to perform custom behavior as part of a workflow. Input to the action script is contained in a Map object named actionContext. The actionContext Map contains the following:
Key |
Value |
---|---|
action |
String describing the type of action being run. Currently, this action can only be run. |
adapter |
Contains a reference to the com.waveset.adapter.SmartRolesResourceAdapter instance. |
additionalArgs |
A Map containing any additional arguments passed in to the runResourceAction Provision Workflow Service call. |
result |
Reference to the WavesetResult that is returned from the runResourceAction Provision Workflow Service call. |
session |
Reference to a SmartRoles IOMSession instance. The session is created using the administrator and password defined in the SmartRoles resource. |
trace |
Reference to the com.sun.idm.logging.trace.Trace instance associated with the com.waveset.adapter.SmartRolesResourceAdapter class. You can use this to output trace messages for use in debugging the action script. |
The following ResourceAction XML is an example of a BeanShell action. (Set the actionType to JAVASCRIPT for a javascript action.) This action script takes an argument named user (retrieved from the additionalArgs Map) and searches the SmartRoles repository for one or more Person objects with a LOGON_ID that matches the value in the user argument. The string representation of each matching Person is then returned in the WavesetResult in the ACTION_RC ResultItem.
<?xml version=’1.0’ encoding=’UTF-8’?> <!DOCTYPE ResourceAction PUBLIC ’waveset.dtd’ ’waveset.dtd’> <!-- MemberObjectGroups="#ID#Top"--> <ResourceAction createDate=’1148443502593’> <ResTypeAction restype=’SmartRoles’ timeout=’0’ actionType=’BEANSHELL’> <act> import bridgestream.core.*; import bridgestream.util.*; import bridgestream.temporal.person.*; import java.util.*; import com.waveset.object.*; IOMSession session = actionContext.get("session"); OMEngine engine = OMEngine.getInstance(session); String user = actionContext.get("additionalArgs").get("user"); UTNameValuePair[] criteria = new UTNameValuePair[] { new UTNameValuePair ("LOGON_ID", user) }; UTTimestamp time = UTTimestamp.getSystemTimestamp(); List list = session.search("PERSON", criteria, time, null, null); Iterator iter = list.iterator(); StringBuffer buf = new StringBuffer(); while (iter.hasNext()) { ENPerson person = (ENPerson)iter.next(); buf.append(person.toString()); buf.append("\n\n"); } WavesetResult result = actionContext.get("result"); result.addResult("ACTION_RC", buf.toString()); </act> </ResTypeAction> <MemberObjectGroups> <ObjectRef type=’ObjectGroup’ id=’#ID#Top’ name=’Top’/> </MemberObjectGroups> </ResourceAction>