07-17-2013 07:22 PM
executeImpl(Action, NodeRef)
method, the NodeRef is null, when it's supposed to be an actual NodeRef to the node being acted upon.
public class FormActionExecuter extends ActionExecuterAbstractBase {
private ContentService contentService;
private NodeService nodeService;
public static final String PARAM_OTHER_DOC = "other-doc";
public void setContentService(ContentService contentService) {
this.contentService = contentService;
}
public void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
@Override
protected void addParameterDefinitions(List<ParameterDefinition> paramList) {
paramList.add(new ParameterDefinitionImpl(PARAM_OTHER_DOC, DataTypeDefinition.NODE_REF, true, getParamDisplayLabel(PARAM_OTHER_DOC)));
}
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
if (!nodeService.exists(actionedUponNodeRef)) // <– IllegalArgumentException HERE
return;
NodeRef other = (NodeRef) action.getParameterValue(PARAM_OTHER_DOC);
String content1 = contentService.getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT).getContentString();
String content2 = contentService.getReader(other, ContentModel.PROP_CONTENT).getContentString();
action.setParameterValue(PARAM_RESULT, Integer.valueOf(computeLevenshteinDistance(content1, content2)));
}
}
<beans>
<bean id="org-form-bean" class="org.example.FormActionExecuter" parent="action-executer">
<property name="contentService">
<ref bean="ContentService" />
</property>
<property name="nodeService">
<ref bean="NodeService" />
</property>
</bean>
</beans>
<alfresco-config>
<config evaluator="string-compare" condition="org-form-bean">
<forms>
<form>
<field-visibility>
<show id="other-doc" />
</field-visibility>
<appearance>
<field id="other-doc" label="Document to be compared"/>
</appearance>
</form>
</forms>
</config>
<config evaluator="string-compare" condition="DocLibActions">
<actions>
<action id="org-form" type="javascript" label="Test form">
<param name="function">onActionFormDialog</param>
<param name="itemKind">action</param>
<param name="itemId">org-form-bean</param>
<param name="mode">edit</param>
<param name="successMessage">Works!</param>
<param name="failureMessage">Fail…</param>
</action>
</actions>
<actionGroups>
<actionGroup id="folder-browse">
<action index="102" id="org-form" />
</actionGroup>
<actionGroup id="document-browse">
<action index="102" id="org-form" />
</actionGroup>
</actionGroups>
</config>
</alfresco-config>
02-03-2015 04:30 AM
<param name="function">onActionSimpleRepoAction</param>
. It works, I am able to use the actionedUponNodeRef
inside the executeImpl(Action, NodeRef)
method.<param name="function">onActionFormDialog</param>
. The form shows up, the parameters are passed correctly, but actionedUponNodeRef
is null
in executeImpl(Action, NodeRef)
.02-04-2015 05:03 AM
05-12-2015 11:29 AM
<param name="destination">{node.nodeRef}</param>
<action id="org-form" type="javascript" label="Test form">
<param name="function">onActionFormDialog</param>
<param name="itemKind">action</param>
<param name="itemId">org-form-bean</param>
<param name="destination">{node.nodeRef}</param>
<param name="mode">edit</param>
<param name="successMessage">Works!</param>
<param name="failureMessage">Fail…</param>
</action>
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.