We have 3 environments that are setup as follows:
enviornment1 ---> stagingEnvironment actualTestEnvironment
| ^
| |
| |
|______________________________________________|
Run a "Move To Staging" workflow to replicate content from "environment1"to "stagingEnvironment"
After our partners review it and accept it, they run another workflow to get it to "actualTestEnvironment"
Run a "Move To Test" workflow to replicate content from "environment1" to "actualTestEnvironment"
I've configured a Launcher to run as follows:
Event Type: Node removed
Nodetype: cq:Page
Globbing: /content(/.*)
Condition: none
Workflow: Delete from Staging
Description: Delete from Staging
Enabled: true
Run Modes: author, publish
Delete from Stating workflow
-----------------------------
start -> Delete Node -> stop
Create a page - works fine
1. Run "Move to Staging" workflow - Works fine
2. Run "Move to Test" workflow - works fine
3. Delete the page - the "Delete from Staging" workflow runs behind the scenes - works fine
All things work and the pages are removed in all environments
Issue:
1. Run "Move to Staging" workflow - Works fine
2. Delete the page - the "Delete from Staging" workflow runs behind the scenes - FAILS
NOTE: The "Move to Test" workflow is not executed because there may be a problem and the user does not want it to go to the next environment.
When the "Delete from Staging" workflow runs (upon page deletion - step 2 above), it tries to delete from the "actualTestEnvironment" and fails, so it does not proceed to try and delete from "stagingEnvironment" ... I'm not sure WHY???
How can I get the Workflow to continue to try to delete in all environments when it cannot find the page in one of them.
Any and all help here is appreciated.
Thanks,
-Dean
Solved! Go to Solution.
Views
Replies
Total Likes
All,
Thank you so much for your help. I was able to resolve using the following in a process step.
~ try {
Session session = workflowSession.adaptTo(Session.class);
WorkflowData data = workItem.getWorkflowData();
String pagePath = null;
String type = data.getPayloadType();
log.debug("DeletePageFromStagingProcess - type: " + type);
pagePath = (String) data.getPayload();
log.debug("DeletePageFromStagingProcess - pagePath: " + pagePath);
if (pagePath != null) {
ReplicationOptions opts = new ReplicationOptions();
opts.setSuppressStatusUpdate(true);
opts.setSuppressVersions(true);
opts.setFilter(new AgentIdFilter(PREVIEW_AGENT_ID));
replicator.replicate(session, ReplicationActionType.DELETE, pagePath, opts);
log.debug("Page {} was deleted", pagePath);
} else {
log.warn("Cannot delete page because it is null: " + pagePath);
}
} catch (ReplicationException e) {
throw new WorkflowException(e);
}
Thanks Again for ALL of your great help/suggestions.
-Dean
Views
Replies
Total Likes
Are you using out of the box steps in your workflow or a custom workflow step?
You may want to explore using a custom step to delete content. That is, If you want to try and advanced the workflow when a page is not available to delete - you may have to write a custom step and build in logic to advance the workflow - even thought the payload is not available to delete. That way - your workflow will still advance without throwing an exception.
Views
Replies
Total Likes
so if I understand correctly, 'Delete from staging' is also trying to delete from the actualTestEnvironment' and is failing. is that right ?
firstly, we need to see why is it trying to delete from actualTestEnvironment where is has to delete only from the staging.
Views
Replies
Total Likes
scmacdonald2008,
I'm using OOB Delete Node to delete the page. I'm not sure how to go about deleting that node manually in each environment.
Views
Replies
Total Likes
bsloki,
Yes, that seems to be correct. I'm not sure why it's trying to delete from both environments. Ideally, it would try to delete from both and if it's not there it would just skip it and go to the next environment.
-Dean
Views
Replies
Total Likes
Dean,
Delete Node - is it a custom process step ?? you might have to look exactly what it is doing there.
Views
Replies
Total Likes
All,
Thank you so much for your help. I was able to resolve using the following in a process step.
~ try {
Session session = workflowSession.adaptTo(Session.class);
WorkflowData data = workItem.getWorkflowData();
String pagePath = null;
String type = data.getPayloadType();
log.debug("DeletePageFromStagingProcess - type: " + type);
pagePath = (String) data.getPayload();
log.debug("DeletePageFromStagingProcess - pagePath: " + pagePath);
if (pagePath != null) {
ReplicationOptions opts = new ReplicationOptions();
opts.setSuppressStatusUpdate(true);
opts.setSuppressVersions(true);
opts.setFilter(new AgentIdFilter(PREVIEW_AGENT_ID));
replicator.replicate(session, ReplicationActionType.DELETE, pagePath, opts);
log.debug("Page {} was deleted", pagePath);
} else {
log.warn("Cannot delete page because it is null: " + pagePath);
}
} catch (ReplicationException e) {
throw new WorkflowException(e);
}
Thanks Again for ALL of your great help/suggestions.
-Dean
Views
Replies
Total Likes
Excellent code - that is what i was thinking when i stated a custom step. Nice work!
Views
Replies
Total Likes
Views
Likes
Replies