Task Assignment adapter is used to acertain the user/group to whom the process task should be assigned in a provisioning workflow. Task Assignment adapters are in use Jupiter onwards only.
Example to use a Task Assignment Adapter:
- Login into Java client with an admin user
- Move to Resource Management -> Resource Objects
- Create a resource object
- Move to Process Management -> Process Definition
- Create a provisioning process for the above resource object
- Create a new task in the above process and save
- Move to Development Tools -> Adapter Factory
- Enter valid adapter name, description and select “Task Assignment ” as adapter type
- Save the adapter
- Verify in the variable list tab that 2 default adapter return variables are created
- In the Adapter Tasks tab, click on Assign to add a task to the adapter. Select to add a java task
- In the API source, select the appropriate jar (eg. newtask.jar). Also select appropriate Methods and save the task.
- Add two java tasks to the above adapter:
- For first select method as getType and map the variables as “Output variable” -> Adapter Variable -> Return Variable for key type. Map the second variable to a literal “User/Group” and the third variable to anything.
- For second select method as getKey and map the variables as “Output variable” -> Adapter Variable -> Return Variable for key. Map the second variable to a user/group key and the third variable to anything.
- For first select method as getType and map the variables as “Output variable” -> Adapter Variable -> Return Variable for key type. Map the second variable to a literal “User/Group” and the third variable to anything.
- Save and compile the adapter
- Move to Process Management -> Process Definition and query for the process created in step 5
- Double click to invoke the edit task dialog for the task created in step 6 and move to the assignment tab
- Double click on the Target type lookup field and select either User/Group
- In the adapter lookup field, select the adapter created in step 9.
- After making an adapter association, select the row and click on Map button
- Map the adapter return variables to task information and save
- Now provision the resource object to a user/organization
<Expected Result>
Verify that the tasks (Approval/Provisioning) get assigned to appropriate users as mapped in the adapter.
Other things to test:
- Provision to organization
- Check for both approval and provisioning processes
- Login with appropriate user and complete the assigned task
To create a task assignment adapter we need to create two methods one returning the return type either a user or a group and then one to return the key.This can be explained as follows:
ReplyDeletepublic String getApprovalGroupKey(String location){
// build the group name from location
String groupName = location + " "+"Admins";
System.out.println("groupName " + groupName);
long returnValue = 0;
String sReturnVal=null;
// find the group with group name as groupName
HashMap grpAttrMap = new HashMap();
grpAttrMap.put("Groups.Group Name",groupName);
try {
tcResultSet grp = groupOpr.findGroups(grpAttrMap);
if(grp.getRowCount() > 0){
System.out.println("-------");
// group with group name groupName was found. Return
// the key of that group
String[] str=grp.getColumnNames();
System.out.println(str[0]+"-----");
returnValue=grp.getLongValue("Groups.Key");
sReturnVal=new Long(returnValue).toString();
//returnValue = grp.getLongValue(groupName);
System.out.println("returnValue if " + returnValue);
}else{
HashMap grpAttrMapSys = new HashMap();
grpAttrMapSys.put("Groups.Group Name","System Administrators");
tcResultSet grpSys = groupOpr.findGroups(grpAttrMapSys);
returnValue = grpSys.getLongValue("System Administrators");
sReturnVal=new Long(returnValue).toString();
System.out.println("returnValue else " + returnValue);
// find the “System Administrators” group and return the
// key for this group
}
} catch (tcAPIException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (tcColumnNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("---------Return Value"+sReturnVal);
return sReturnVal;
}
public String getType()
{
return "Group"; //for a user this value will be User.
}
how to assign the retrieved group key to the task assignment key?
ReplyDeleteHi,
ReplyDeleteOnce you create a task assignment adapter and map it the respective process the group key will be assigned to the respective assignment. The method above explains to get the group key and assign the same with the task assignment.
Thanks,
vishnu