cancel
Showing results for 
Search instead for 
Did you mean: 

Error implementing action executer and action handler

whippet
Champ in-the-making
Champ in-the-making
Hi,

I am hoping to get some guidance on implementing a Custom Action that changes the inline edit state of an uploaded document in a particular space.

Currently I have an action called “Create inline edit state”, which I am migrating from that works successfully in Afresco 1.2.

The condition is based on “mimetype” and I have an action to “change inline edit state” that shows up in the Run Action and Create Rule Wizards. IWithout defining an ActionHandler I am able to "set" this rule although nothing is really done as the main logic of my code is not executed.

When I then upload a document into the said directory with the "set" rule I get:


ERROR [org.alfresco.web.ui.common.Utils] A system error happened during the operation: Transaction didn't commit: A value for the mandatory parameter inline-edit has not been set on the rule item change-inline-edit
javax.transaction.RollbackException: Transaction didn't commit: A value for the mandatory parameter inline-edit has not been set on the rule item change-inline-edit


I believe it shows up as an action because I currently have defined in custom-action-services-context.xml a bean called <bean id="change-inline-edit" with:


<bean id="customActionsResourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
            <property name="resourceBundles">
                        <list>
                                    <value>alfresco.extension.messages.custom-action-config</value>
                        </list>
            </property>
   </bean>
And in custom-action-config.properties I have defined:

change-inline-edit.title
change-inline-edit.description

So far I know that the following method in my ActionExecuter class (which extends ActionExecuterAbstractBase) is accessed at startup:




protected void addParameterDefinitions(List<ParameterDefinition> paramList)
            {
                        logger.debug("got here !!");
                        paramList.add(new ParameterDefinitionImpl(PARAM_INLINE_EDIT, DataTypeDefinition.BOOLEAN, true, getParamDisplayLabel(PARAM_INLINE_EDIT)));
            }

However the method executeImpl is at no time accessed.

I have not followed the exact configuration document http://wiki.alfresco.com/wiki/Custom_Action_UI because I am unsure as to whether I should define an aspect like taggable since the aspect and property I am trying to change is defined in org.alresco.model.ContentModel:



// inlineeditable aspect
    static final QName ASPECT_INLINEEDITABLE = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "inlineeditable");
    static final QName PROP_EDITINLINE = QName.createQName(NamespaceService.APP_MODEL_1_0_URI, "editInline");

and I think is also found in applicationModel.xml as:



<aspect name="app:inlineeditable">
         <title>Inline Editable</title>
         <properties>
            <property name="app:editInline">
               <title>Edit Inline</title>
               <type>d:boolean</type>
            </property>
         </properties>
      </aspect>

Hence I do not have an equivalent tagsModel.xml with an aspect defined and I am hoping I can do something like:



if (this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_INLINEEDITABLE))
      

and:
            
this.nodeService.setProperty(actionedUponNodeRef, ContentModel.PROP_EDITINLINE, inlineEdit);


If I do need this please can someone let me know. (I'd assume it would gain be of boolean type.)

If the above is useable/ callable and I am not required to define the equivalent of taggable as per the tag model example, what then would be the equivalent of me inserting into web-client-config-custom.xml the equivalent of:


<config evaluator="aspect-name" condition="tag:taggable">
   <property-sheet>
      <show-property name="tag:tags" />
   </property-sheet>
</config>


I am currently using:

<config evaluator="aspect-name" condition="app:inlineeditable">
   <property-sheet>
      <show-property name="app:editInline"/>
   </property-sheet>
</config>

but I don't think it has any use.

I was also wondering if I need to do anything around implementing an ActionHandler?


I did fumble to put together an ActionHandler based on the TagActionHandler example, although I am not sure how I'll require this (I know it can forward to my JSP page when setting up the rule).

I gather its purpose is to collect required parameters when setting up the rule ??

(This would be useful to know since I shall be developing some custom actions that will require a more custom input fields).

Without an ActionHandler is it possibly to perhaps check if the node is true or false for having the “inline editable” aspect and then acting accordingly or will this true or false value come from an ActionHandler ?



With an ActionHandler I do not get as far as creating a rule and I get the following :



javax.faces.FacesException: Cannot get value for expression '#{DocumentDetailsBean.name}'
caused by:
org.apache.jasper.JasperException: Cannot get value for expression '#{DocumentDetailsBean.name}'
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{DocumentDetailsBean.name}'
caused by:
javax.faces.el.EvaluationException: com.evolvedthought.alfresco.bean.DocumentDetailsBean
caused by:
javax.faces.el.EvaluationException: Bean: com.evolvedthought.alfresco.bean.DocumentDetailsBean, property: name
caused by:
java.lang.reflect.InvocationTargetException
caused by:
java.lang.NullPointerException

Hide Details

javax.faces.FacesException: Cannot get value for expression '#{DocumentDetailsBean.name}'
at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)



Thanks,

Paul
2 REPLIES 2

gavinc
Champ in-the-making
Champ in-the-making
Hi,

Between 1.2 and 1.4 a new wizard framework was added. As part of this change the NewRuleWizard was overhauled and replaced by CreateRuleWizard.

If you are adding a new custom action you now only need to implement the code for the action, the wizard does not need to be customised.

In your example below, the first error is occurring as you have obviously setup the action to expect a mandatory parameter but you haven't put the UI in place to setup the parameter value.

You're right, the inline edit aspect and property are already present so you don't need to set any of this up, all you need to do in your action is to add the aspect if required, and then set the "app:editInline" property value to true.

If you want this to always be true then you don't really need any UI and you therefore don't need a manadatory parameter on your action defintion, in fact you won't need a parameter at all!

Hope this helps.

whippet
Champ in-the-making
Champ in-the-making
Thanks very much, this indeed helps and this now works !!