Search in sources :

Example 6 with UIGenericPicker

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;
}
Also used : Serializable(java.io.Serializable) HashMap(java.util.HashMap) QName(org.alfresco.service.namespace.QName) UIComponent(javax.faces.component.UIComponent) UIGenericPicker(org.alfresco.web.ui.common.component.UIGenericPicker)

Aggregations

UIGenericPicker (org.alfresco.web.ui.common.component.UIGenericPicker)6 Serializable (java.io.Serializable)2 HashMap (java.util.HashMap)2 UIComponent (javax.faces.component.UIComponent)2 QName (org.alfresco.service.namespace.QName)2 FacesException (javax.faces.FacesException)1 UISelectOne (javax.faces.component.UISelectOne)1 MethodBinding (javax.faces.el.MethodBinding)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 UserAuthorityDetails (org.alfresco.web.bean.groups.GroupsDialog.UserAuthorityDetails)1