cancel
Showing results for 
Search instead for 
Did you mean: 

Creating custom evaluator in alfresco 4

g_rathod
Star Contributor
Star Contributor
Hi,
I need to create custom evaluator in alfresco enterprise 4 (documentLibrary folder action).
If there is specific type of folder then only show this action else not.

I followed below steps but its not much useful.

1) share-documentlibrary-config.xml

<action id="folder-assign-workflow" type="javascript" label="actions.folder.assign-workflow">
               <param name="function">onActionAssignWorkflow</param>
               <evaluator>evaluator.doclib.action.customDraftBased</evaluator>
          </action>

 
 <actionGroup id="folder-browse">
               <action index="261" id="folder-assign-workflow" icon="folder-edit-properties" label="Start Custom Workflow"/>
         </actionGroup>


2)  slingshot-documentlibrary-context.xml

 <bean id="evaluator.doclib.action.customDraftBased" class="com.clms.web.evaluator.CustomDraftBasedEvaluator" />

3) CustomDraftBasedEvaluator.java

public class ClmsDraftBasedEvaluator extends BaseEvaluator {

   @Override
   public boolean evaluate(JSONObject jsonObject) {
      System.out.println("*** JSONObject  ::" + jsonObject);
      return true;
   }

}

It will not showing me my custom action. I tried keeping action and actionGroup inside share-config-custom.xml  action appears but at that time evaluator did not work.

Any help on this appreciated.
11 REPLIES 11

g_rathod
Star Contributor
Star Contributor
Hi acarpine,

I can run my custom evaluator class (my new java class) , for that its important you copy your webapps/alfresco/WEB-INF/lib   jar file to  share/WEB-INF/lib.

How can we get NodeRef on which evaluator is written? any idea? we have jsonObject which gives here type, but for NodeRef need to check deeply.

g_rathod
Star Contributor
Star Contributor
Hi acarpine,

Your solution is here.
http://alfrescocms.blogspot.in/2012/03/create-new-evaluator-in-documentlibrary.html

rate helpful if you think.