diff -r 240e17fc24f5 nuxeo-platform-default-config/src/main/resources/process/parallel-review.xml --- a/nuxeo-platform-default-config/src/main/resources/process/parallel-review.xml Sun Oct 31 14:44:21 2010 +0100 +++ b/nuxeo-platform-default-config/src/main/resources/process/parallel-review.xml Tue Nov 02 12:31:02 2010 +0100 @@ -61,6 +61,8 @@ + diff -r 240e17fc24f5 nuxeo-platform-default-config/src/main/resources/process/validation-review.xml --- a/nuxeo-platform-default-config/src/main/resources/process/validation-review.xml Sun Oct 31 14:44:21 2010 +0100 +++ b/nuxeo-platform-default-config/src/main/resources/process/validation-review.xml Tue Nov 02 12:31:02 2010 +0100 @@ -75,6 +75,8 @@ + diff -r a498fc6f149e nuxeo-platform-jbpm/nuxeo-platform-jbpm-core/src/main/java/org/nuxeo/ecm/platform/jbpm/core/helper/ProcessEndNotificationHandler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nuxeo-platform-jbpm/nuxeo-platform-jbpm-core/src/main/java/org/nuxeo/ecm/platform/jbpm/core/helper/ProcessEndNotificationHandler.java Tue Nov 02 12:33:12 2010 +0100 @@ -0,0 +1,53 @@ +package org.nuxeo.ecm.platform.jbpm.core.helper; + +import java.util.Set; +import java.util.HashSet; +import java.io.Serializable; + +import org.jbpm.graph.exe.ExecutionContext; +import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.CoreSession; +import org.nuxeo.ecm.core.api.DocumentModel; +import org.nuxeo.ecm.core.api.NuxeoPrincipal; +import org.nuxeo.ecm.core.event.EventProducer; +import org.nuxeo.ecm.core.event.impl.DocumentEventContext; +import org.nuxeo.ecm.platform.jbpm.AbstractJbpmHandlerHelper; +import org.nuxeo.ecm.platform.jbpm.JbpmEventNames; +import org.nuxeo.ecm.platform.jbpm.JbpmService; +import org.nuxeo.ecm.platform.jbpm.VirtualTaskInstance; +import org.nuxeo.runtime.api.Framework; + +public class ProcessEndNotificationHandler extends AbstractJbpmHandlerHelper { + + private static final long serialVersionUID = 1L; + + @Override + public void execute(ExecutionContext executionContext) throws Exception { + this.executionContext = executionContext; + if (nuxeoHasStarted()) { + DocumentModel documentModel = (DocumentModel) getTransientVariable(JbpmService.VariableName.document + .name()); + NuxeoPrincipal principal = (NuxeoPrincipal) getTransientVariable(JbpmService.VariableName.principal + .name()); + + String initiator = getInitiator(); + CoreSession coreSession = getCoreSession(principal); + if (coreSession == null || documentModel == null) { + return; + } + EventProducer eventProducer; + try { + eventProducer = Framework.getService(EventProducer.class); + } catch (Exception e) { + throw new ClientException(e); + } + DocumentEventContext ctx = new DocumentEventContext(coreSession, + principal, documentModel); + ctx.setProperty("recipients", new String[] { initiator }); + ctx.setComment(""); + eventProducer + .fireEvent(ctx.newEvent(JbpmEventNames.WORKFLOW_ENDED)); + closeCoreSession(coreSession); + } + } +}