use of org.alfresco.web.ui.common.component.UIGenericPicker in project acs-community-packaging by Alfresco.
the class ReassignWorkItemDialog method finishImpl.
@Override
protected String finishImpl(FacesContext context, String outcome) throws Exception {
if (logger.isDebugEnabled())
logger.debug("Reassigning work item with id: " + this.workItemId);
UIComponent picker = context.getViewRoot().findComponent("dialog:dialog-body:user-picker");
if (picker != null && picker instanceof UIGenericPicker) {
UIGenericPicker userPicker = (UIGenericPicker) picker;
String[] user = userPicker.getSelectedResults();
if (user != null && user.length > 0) {
// create a map to hold the new owner property then update the task
String userName = user[0];
Map<QName, Serializable> params = new HashMap<QName, Serializable>(1);
params.put(ContentModel.PROP_OWNER, userName);
this.getWorkflowService().updateTask(this.workItemId, params, null, null);
} else {
if (logger.isWarnEnabled())
logger.warn("Failed to find selected user, reassign was unsuccessful");
}
} else {
if (logger.isWarnEnabled())
logger.warn("Failed to find user-picker component, reassign was unsuccessful");
}
if (logger.isDebugEnabled())
logger.debug("Reassigning work item with id: " + this.workItemId);
return outcome;
}
Aggregations