rules
Developer
Jahia 7.3
Jahia 8
Legacy
Call an action when a node is created or published
Question
A customer would like to know a way to call a Java Method when a Node is created or published.
Answer
A way to call a Java Method is with a rule, you can call an action when a node is created or published
===============================
- You can set a name to the action inside the spring xml file, something like this:
<bean class="com.mae.bureau.actualite.SendActualiteNotificationAction" name="actualiteNotificationAction"> <property name="name" value="actualiteNotificationAction"/> </bean>
- With the name of the action specified in the spring file, you can call it in the drools file, and use this consequence:
rule "Send notification when created actualite" ......... then Log "----- Before send notification when created an actualite" + node.getName() Execute the action "actualiteNotificationAction" now on the node Log "----- After send notification when created an actualite: " + node.getName() end ===============================