AnsweredAssumed Answered

ScriptActionExecuter bug? Why 'script-ref' is mandatory?

Question asked by iblanco on Aug 19, 2010
Latest reply on Aug 23, 2010 by iblanco
Hi:
I have developed a Java Behaviour that execs an specified action. The bean allows defining the action name as well as the action parameters.
I'm configuring the behaviour to launch the "script" action, the one that, obviously, runs a script. The problem is that I don't want to use a script in the repository but in the classpath.

ScriptActionExecuter has a mandatory parameter called "script-ref" that AFAIK expects a node reference to the script file, but not such a thing as "script-location" accepting a classpath location instead of the reference. But, instead, it has a scriptLocation member that is documented as "Set the script location from Spring" and some logic in order to choose and exec based on the location or the reference.

So you can add an action just by defining a new bean that sets the ScriptLocation parameter properly and using its name as the action name, great. The problem arises when you try to execute the action, "script-ref"  is a mandatory argument so it fails. So my question is… Is this a bug ? Should ScriptActionExecuter be optional ? Maybe is just a matter of rewritting "addParameterDefinitions" method so that it doesn't add the parameter if ScriptLocation is set. Is there something I'm not aware of ?

Thanks.

By the way I overrided the problem just by providing a dummy script-ref value to the bean that uses the action:

       <property name="actionParameters">
          <map>
              <entry>
                  <key>
                      <value>script-ref</value>
                  </key>
                  <bean class="org.alfresco.service.cmr.repository.NodeRef">
                      <constructor-arg><value>a://b/c</value></constructor-arg>
                  </bean>
              </entry>
          </map>
       </property>

Outcomes