I need to call an external class when an update is made to the document in the folder. The rule will execute a javascript.
I would like to know or read about how to make this class call by javascript.
If it is possible?
Can someone help me?
Folder rules can invoke Java classes that are instances of ActionExecuterAbstractBase. That means you can write your own Java class and make a call to any other class on the classpath.
Folder rules can also execute JavaScript. That's because there is a Java class that extends ActionExecuterAbstractBase that knows how to run JavaScript.
So, your first option is to write a Java class, extend ActionExecuterBase, and call your class from there.
But you said you want to call JavaScript and your JavaScript is going to call a class. That's kind of "the long way around" but it's perfectly fine. In that case, you'll need to write a Java class that is a scope processor extension. Basically it just exposes your Java class to JavaScript. That class can call the other Java class that is on the classpath, and because it is a scope processor extension, it will be exposed as a root variable in Alfresco's server-side JavaScript.
All that's left to do at that point is set up your folder rule, use the "Execute Script" action, and point to your server-side JavaScript that makes the call to your new root variable.
Many thanks Jeff.
Would you have any examples or reference books for me to take as a basis?
For I am extremely new to this scenario.
Thanks
My actions tutorial shows how to write an action, but I do not show how to do the processor extension.
However, the ACL Templates add-on that I maintain on behalf of one of my clients has an example of this. The AclTemplateServiceScopedObject class exposes the Java-based ACL Template Service to JavaScript.
Thanks Jeff.
Very helpful and helped a lot.
BS
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.