I want to send an email notification wen a page is activated, but there are also modifications since the last activation.
For now, we have implemented an event handler that detects the ACTIVATE events.
Is there a way to check if the page has also been modified since the last activation?
Thanks
Solved! Go to Solution.
Views
Replies
Total Likes
You can keep a custom property to track activation date, now when ever you are activating a page, compare last modified property and custom property ( last activation date). If last modified is greater than last activate date, it means page has been modified and then update this property with new activation date.
Views
Replies
Total Likes
You can read the cq:lastmodifieddate date property of that page stored in jcr:content
Views
Replies
Total Likes
How will that help me? if I activate the same page twice, the last modification date stays the same, while the activation date changes, so my event handler is triggered. How do i know that the modified date changed between two activations?
Views
Replies
Total Likes
Use getPath() to check which property gets changes and add PROPERTY_CHANGED changed event on the node path
if cq:lastmodified changes, getPath() will return something similar to path will be [node path]/cq:lastmodified
http://www.day.com/specs/jsr170/javadocs/jcr-1.0/javax/jcr/observation/Event.html#getPath()
Views
Replies
Total Likes
But the event i'm listening to is the activate event, not the PROPERTY_CHANGED event. I need to detect the activation events in order to trigger notification emails.
Views
Replies
Total Likes
You can keep a custom property to track activation date, now when ever you are activating a page, compare last modified property and custom property ( last activation date). If last modified is greater than last activate date, it means page has been modified and then update this property with new activation date.
Views
Replies
Total Likes