07-30-2010 05:31 AM
<task-node name="Read">
<task name="my:read">
<assignment class="com.workflow.handler.MyAssignmentHandler" />
<event type="task-create">
(…)
</event>
</task>
</task-node>
public class MyAssignmentHandler implements AssignmentHandler {
public void assign(Assignable assignable, ExecutionContext ec) throws Exception {
NodeService nodeservice = (NodeService) FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "NodeService");
JBPMNodeList assigneesNode = (JBPMNodeList) ec.getContextInstance().getVariable("bpm_assignees");
String[] pooledActors = new String[assigneesNode.size()];
for (int i = 0; i < assigneesNode.size(); i++) {
Map<QName, Serializable> contextProps = new HashMap<QName, Serializable>();
contextProps = nodeservice.getProperties(assigneesNode.get(i).getNodeRef());
pooledActors[i] = (String)contextProps.get(ContentModel.PROP_USERNAME);
}
assignable.setPooledActors(pooledActors);
}
}
/**
* Convert Alfresco authority to actor id
*
* @param authority
* @return actor id
*/
private String mapAuthorityToName(ScriptNode authority, boolean allowGroup)
{
String name = null;
QName type = authority.getQNameType();
[b]
if (dictionaryService.isSubClass(type, ContentModel.TYPE_PERSON))
{
name = (String)authority.getProperties().get(ContentModel.PROP_USERNAME);
}[/b]
else if (allowGroup && dictionaryService.isSubClass(type, ContentModel.TYPE_AUTHORITY_CONTAINER))
{
name = authorityDAO.getAuthorityName(authority.getNodeRef());
}
else if (type.equals(ContentModel.TYPE_AUTHORITY))
{
name = authorityDAO.getAuthorityName(authority.getNodeRef());
}
return name;
}
07-30-2010 05:56 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.