Publication publication = envelope.getPublication();
DocumentBuilder builder = publication.getDocumentBuilder();
String url = builder.buildCanonicalUrl(publication, area, documentId, language);
Document document = builder.buildDocument(publication, url);
WorkflowFactory factory = WorkflowFactory.newInstance();
if (factory.hasWorkflow(document)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug(" Invoking workflow event");
}
SynchronizedWorkflowInstances instance = factory.buildSynchronizedInstance(document);
Situation situation = WorkflowHelper.buildSituation(objectModel);
Event[] events = instance.getExecutableEvents(situation);
Event event = null;
for (int i = 0; i < events.length; i++) {