cancel
Showing results for 
Search instead for 
Did you mean: 

how to define action only for a specific document type

ribz33
Champ on-the-rise
Champ on-the-rise
Hi,

i want to see "start workflow" icon only for a specific content type (for instance for my:mydocument), not all my contents types, is there a way to configure that on web client ?
2 REPLIES 2

davidc
Star Contributor
Star Contributor
An enhancement was checked-in very recently to support "type" based UI actions.  This may well provide the capability you're looking for.

ribz33
Champ on-the-rise
Champ on-the-rise
Thx but i had found, i decide to make my own WorkflowEvaluator and its working like a charm Smiley Happy

To help other peps that is my code :

import javax.faces.context.FacesContext;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.web.action.ActionEvaluator;
import org.alfresco.web.app.servlet.FacesHelper;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.service.namespace.QName;

public class WorkflowEvaluator implements ActionEvaluator {
   
    public static final QName MY_TYPE = QName.createQName("my.documents.model", "mydocument");
   
   public WorkflowEvaluator()
    {
    }

    public boolean evaluate(Node node)
    {
        boolean res = false;
      
        if(node.getType().isMatch(MY_TYPE) )
            res = true;
        return res;
    }
}

and i had this in my web-client-config-custom :

      <config>
       <actions>      
         <action id="start_workflow">
            <label-id>start_workflow</label-id>
            <image>/images/icons/new_workflow.gif</image>
            <evaluator>com.myapplication.evaluator.WorkflowEvaluator</evaluator>
            <action>wizard:startWorkflow</action>
            <action-listener>#{WizardManager.setupParameters}</action-listener>
            <params>
               <param name="item-to-workflow">#{actionContext.id}</param>
            </params>
         </action>
      </actions>
   </config>