CQ5 modify event fired on page delete | Community
Skip to main content
laks_it
October 16, 2015
Solved

CQ5 modify event fired on page delete

  • October 16, 2015
  • 4 replies
  • 1501 views

Hi there!

I'm trying to use CQ5 workflow to control my resources (page in particular). 
I want to start different scripts on different events (Add/Delete/Modify). I have registered a launcher on each event.
When I delete a page anyway both the delete and modify events get fired and so both the script run. I can't understand how to exclude the modify event on delete.

Thanks for any advice

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by WillMc1

When the delete event is fired the resource will unfortunately be gone.  There is no capability in workflow launchers to start a workflow on a node being deleted and have it execute before the node is gone.

As for the modification event firing when a node is deleted --> are you sure there are no nodes being modified before the delete occurs?  What is the payload of the workflow for the modified event?

Providing details on how you've configured the launchers, what the payloads are for the workflows started, and what actions in the repository were taken to make these workflows fire might help.  Also what version are you running?

thanks,

Will

4 replies

smacdonald2008
Level 10
October 16, 2015

Are you using a javax.jcr.observation.ObservationManager to setup your event handler? If you setup the event using this API, you can specify which event the handler should respond to using Event. For example - this responds to a new node:

// Setup the event handler to respond to a new claim under content/claim.... 
 observationManager = session.getWorkspace().getObservationManager();
 final String[] types = { "nt:unstructured","sling:Folder" };
 final String path = "/content/claim"; // define the path
 observationManager.addEventListener(this, Event.NODE_ADDED, path, true, null, types, false);
 log.info("Observing property changes to {} nodes under {}", Arrays.asList(types), path);

laks_it
laks_itAuthor
October 16, 2015

I'm working directly on the workflow CQ5 console (http://localhost:4502/libs/cq/workflow/content/console.html). I've defined 3 models (which use 3 .ecma scripts) and 3 different launcher (one for each event).

The firts issue is that on the delete event also the modifcation is fired. The latter (I've just discovered this one) is that when the delete event is fired the resource is no longer available: I'm guessing if there's a way to catch the event before the effective deleting.

WillMc1Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

When the delete event is fired the resource will unfortunately be gone.  There is no capability in workflow launchers to start a workflow on a node being deleted and have it execute before the node is gone.

As for the modification event firing when a node is deleted --> are you sure there are no nodes being modified before the delete occurs?  What is the payload of the workflow for the modified event?

Providing details on how you've configured the launchers, what the payloads are for the workflows started, and what actions in the repository were taken to make these workflows fire might help.  Also what version are you running?

thanks,

Will

smacdonald2008
Level 10
October 16, 2015

You are using a higher level event model. The ObservationManager monitors at the JCR level. I will ask our Workflow Eng member to look at this one.