AnsweredAssumed Answered

Cannot find NodeService instance trying to reproduce Alfresco Wiki examples

Question asked by ardamose123 on Jul 11, 2013
Latest reply on Jul 15, 2013 by ardamose123
I was following the instructions in "Custom Actions" (http://wiki.alfresco.com/wiki/Custom_Actions). However, when I get to the
executeImpl(…)
method, Java cannot find the
this.nodeService
object.


public void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
   if (this.nodeService.exists(actionedUponNodeRef) == true) // <– nodeService undefined here
   {
      QName aspectQName = (QName)action.getParameterValue(PARAM_ASPECT_NAME);
      this.nodeService.addAspect(actionedUponNodeRef, aspectQName, null); // <– nodeService undefined here
   }
}


I reviewed the source code of
ActionExecuterAbstractBase
class, and found the
baseNodeService
field to be
private
, not
public
or even
protected
. It only has one setter and no getter. Since this class is part of Alfresco's core source code, I'd prefer not to mess up with it.

I'm currently using Alfresco 4.2.c SDK. Also, I'm working on a copy of the "SDK Basic AMP" project in the
samples
folder of said SDK. Project dependencies: JRE 6 and "SDK Alfresco Embedded" project.

Is there a way to make the code work without changing
ActionExecuterAbstractBase
code? Is there a workaround?

Thanks in advance!

Outcomes