Changed PublishEventProcessor so that it correctly updates the Publishing Status on the PublishingEvent node.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29042 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
N Smith
2011-07-14 15:41:11 +00:00
parent bfa8a8c4ff
commit 6bbd3b1684
2 changed files with 14 additions and 2 deletions

View File

@@ -48,6 +48,7 @@ import javax.annotation.Resource;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.service.cmr.publishing.MutablePublishingPackage; import org.alfresco.service.cmr.publishing.MutablePublishingPackage;
import org.alfresco.service.cmr.publishing.PublishingEvent;
import org.alfresco.service.cmr.publishing.PublishingPackage; import org.alfresco.service.cmr.publishing.PublishingPackage;
import org.alfresco.service.cmr.publishing.PublishingService; import org.alfresco.service.cmr.publishing.PublishingService;
import org.alfresco.service.cmr.publishing.StatusUpdate; import org.alfresco.service.cmr.publishing.StatusUpdate;
@@ -355,8 +356,15 @@ public class PublishEventActionTest extends AbstractPublishingIntegrationTest
assertNotNull(eventId); assertNotNull(eventId);
NodeRef eventNode = new NodeRef(eventId); NodeRef eventNode = new NodeRef(eventId);
assertTrue(nodeService.exists(eventNode)); assertTrue(nodeService.exists(eventNode));
Serializable eventStatus = nodeService.getProperty(eventNode, PublishingModel.PROP_PUBLISHING_EVENT_STATUS);
assertEquals(PublishingEvent.Status.SCHEDULED.name(), eventStatus);
action.executeImpl(null, eventNode); action.executeImpl(null, eventNode);
// Check Status has changed to COMPLETE
eventStatus = nodeService.getProperty(eventNode, PublishingModel.PROP_PUBLISHING_EVENT_STATUS);
assertEquals(PublishingEvent.Status.COMPLETE.name(), eventStatus);
return eventNode; return eventNode;
} }

View File

@@ -65,10 +65,12 @@ public class PublishingEventProcessor
public void processEventNode(NodeRef eventNode) public void processEventNode(NodeRef eventNode)
{ {
ParameterCheck.mandatory("actionedUponNodeRef", eventNode); ParameterCheck.mandatory("eventNode", eventNode);
try try
{ {
behaviourFilter.disableAllBehaviours(); behaviourFilter.disableAllBehaviours();
String inProgressStatus = PublishingEvent.Status.IN_PROGRESS.name();
nodeService.setProperty(eventNode, PublishingModel.PROP_PUBLISHING_EVENT_STATUS, inProgressStatus);
PublishingEvent event = eventHelper.getPublishingEvent(eventNode); PublishingEvent event = eventHelper.getPublishingEvent(eventNode);
NodeRef environment = eventHelper.getEnvironmentNodeForPublishingEvent(eventNode); NodeRef environment = eventHelper.getEnvironmentNodeForPublishingEvent(eventNode);
String channelName = event.getChannelName(); String channelName = event.getChannelName();
@@ -81,6 +83,8 @@ public class PublishingEventProcessor
{ {
publishEvent(channel, event); publishEvent(channel, event);
updateStatus(channel, environment, event.getStatusUpdate()); updateStatus(channel, environment, event.getStatusUpdate());
String completedStatus = PublishingEvent.Status.COMPLETE.name();
nodeService.setProperty(eventNode, PublishingModel.PROP_PUBLISHING_EVENT_STATUS, completedStatus);
} }
} }
finally finally