AnsweredAssumed Answered

create a custom java-action

Question asked by mirtunis on Jan 11, 2015
Latest reply on Jan 12, 2015 by mitpatoliya
Hi all ,
I need return a value from a custom action , so i write the action executer class ,here is the code :

public class AddAspectActionExecuter extends ActionExecuterAbstractBase{
   public static String PARAM_RESULT = "result";
   //private BeanFactory beanFactory ;
   @Override
   protected void executeImpl(Action ruleAction, NodeRef nodeRef) {
      ruleAction.setParameterValue(PARAM_RESULT, "helllloooooooooo");
   }
   @Override
   protected void addParameterDefinitions(List<ParameterDefinition> arg0) {
      // TODO Auto-generated method stub   
   }
}


I compile it and i put the JAR in Alfresco\tomcat\webapps\alfresco\WEB-INF\lib
and i configure the action in Spring in the file rule-context.xml here is the code:
<blockcode>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN 2.0//EN'
  'http://www.springframework.org/dtd/spring-beans-2.0.dtd'>
<beans>
<bean id="add-aspect" class="org.alfresco.repo.action.executer.AddAspectActionExecuter" parent="action-executer">
</bean>
</beans>
</blockcode>

i put the file (rule-context.xml) in Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension.

When i try this code in javascript :
<javascript>
var actionOne = actions.create("add-aspect");
print(actionOne.parameters["PARAM_RESULT"]);
</javascript>
the return is null
Maybe I've missed something?
any idea???

Thanks in advance.

Outcomes