Removed Environment from the Publishing Foundation API.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@28957 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
N Smith
2011-07-12 14:41:36 +00:00
parent 8e3b855dea
commit db158066a0
23 changed files with 164 additions and 311 deletions

View File

@@ -34,7 +34,6 @@ import org.alfresco.model.ContentModel;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.publishing.PublishingService;
import org.alfresco.service.cmr.publishing.channels.ChannelType;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -90,7 +89,7 @@ public abstract class AbstractPublishingIntegrationTest extends BaseSpringTest
SiteVisibility.PUBLIC);
this.docLib = siteService.createContainer(siteId, SiteService.DOCUMENT_LIBRARY, ContentModel.TYPE_FOLDER, null);
this.environment = (EnvironmentImpl) factory.createEnvironmentObject(siteId, PublishingService.LIVE_ENVIRONMENT_NAME);
this.environment = (EnvironmentImpl) factory.createEnvironmentObject(siteId);
this.queue = (PublishingQueueImpl) environment.getPublishingQueue();
}

View File

@@ -165,15 +165,9 @@ public class ChannelServiceImpl implements ChannelService
NodeRef channelNode = channelHelper.createChannelNode(channelContainer, channelType, name, actualProps);
Channel channel = channelHelper.buildChannelObject(channelNode, this);
// Now create the corresponding channel nodes in each of the
// configured environments
// FIXME: BJR: 20110506: Should we provide a means for supplying
// separate properties for each environment?
Map<String, NodeRef> environments = environmentHelper.getEnvironments(siteId);
for (NodeRef environment : environments.values())
{
channelHelper.addChannelToEnvironment(environment, channel, actualProps);
}
// Now create the corresponding channel nodes in the environment
NodeRef environment = environmentHelper.getEnvironment(siteId);
channelHelper.addChannelToEnvironment(environment, channel, actualProps);
return channel;
}
@@ -313,8 +307,8 @@ public class ChannelServiceImpl implements ChannelService
private Set<NodeRef> getAllChannelContainers(String siteId)
{
Set<NodeRef> containers = new HashSet<NodeRef>();
Map<String, NodeRef> environments = environmentHelper.getEnvironments(siteId);
containers.addAll(environments.values());
NodeRef environment = environmentHelper.getEnvironment(siteId);
containers.add(environment);
NodeRef editorialContainer = getChannelContainer(siteId);
if(editorialContainer!=null)
{

View File

@@ -19,11 +19,6 @@
package org.alfresco.repo.publishing;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -92,12 +87,9 @@ public class ChannelServiceImplIntegratedTest extends AbstractPublishingIntegrat
assertEquals(channelName, channel.getName());
assertTrue(nodeService.exists(channel.getNodeRef()));
Map<String, NodeRef> environments = environmentHelper.getEnvironments(siteId);
assertTrue(environments.size() > 0);
for (NodeRef envNodeRef : environments.values())
{
assertNotNull(nodeService.getChildByName(envNodeRef, ContentModel.ASSOC_CONTAINS, channelName));
}
NodeRef environmentNode = environmentHelper.getEnvironment(siteId);
assertNotNull(environmentNode);
assertNotNull(nodeService.getChildByName(environmentNode, ContentModel.ASSOC_CONTAINS, channelName));
}
@Test
@@ -110,12 +102,9 @@ public class ChannelServiceImplIntegratedTest extends AbstractPublishingIntegrat
List<Channel> channels = channelService.getChannels(siteId);
assertTrue(channels.isEmpty());
Map<String, NodeRef> environments = environmentHelper.getEnvironments(siteId);
assertTrue(environments.size() > 0);
for (NodeRef envNodeRef : environments.values())
{
assertNull(nodeService.getChildByName(envNodeRef, ContentModel.ASSOC_CONTAINS, channelName));
}
NodeRef environmentNode = environmentHelper.getEnvironment(siteId);
assertNotNull(environmentNode);
assertNull(nodeService.getChildByName(environmentNode, ContentModel.ASSOC_CONTAINS, channelName));
}
@Test
@@ -131,13 +120,10 @@ public class ChannelServiceImplIntegratedTest extends AbstractPublishingIntegrat
assertEquals(1, channels.size());
Channel channel = channels.get(0);
assertEquals(newChannelName, channel.getName());
Map<String, NodeRef> environments = environmentHelper.getEnvironments(siteId);
assertTrue(environments.size() > 0);
for (NodeRef envNodeRef : environments.values())
{
assertNull(nodeService.getChildByName(envNodeRef, ContentModel.ASSOC_CONTAINS, channelName));
assertNotNull(nodeService.getChildByName(envNodeRef, ContentModel.ASSOC_CONTAINS, newChannelName));
}
NodeRef environmentNode = environmentHelper.getEnvironment(siteId);
assertNotNull(environmentNode);
assertNull(nodeService.getChildByName(environmentNode, ContentModel.ASSOC_CONTAINS, channelName));
assertNotNull(nodeService.getChildByName(environmentNode, ContentModel.ASSOC_CONTAINS, newChannelName));
}
@Test

View File

@@ -19,9 +19,6 @@
package org.alfresco.repo.publishing;
import java.util.List;
import org.alfresco.service.cmr.publishing.Environment;
/**
* @author Brian
@@ -29,7 +26,5 @@ import org.alfresco.service.cmr.publishing.Environment;
*/
public interface EnvironmentFactory
{
Environment createEnvironmentObject(String siteId, String environmentName);
List<Environment> createEnvironmentObjects(String siteId);
EnvironmentImpl createEnvironmentObject(String siteId);
}

View File

@@ -40,7 +40,6 @@ import org.alfresco.service.cmr.publishing.NodePublishStatusPublished;
import org.alfresco.service.cmr.publishing.NodePublishStatusPublishedAndOnQueue;
import org.alfresco.service.cmr.publishing.PublishingEvent;
import org.alfresco.service.cmr.publishing.PublishingEvent.Status;
import org.alfresco.service.cmr.publishing.PublishingService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -59,6 +58,11 @@ import org.alfresco.util.ParameterCheck;
*/
public class EnvironmentHelper
{
/**
* The name of the live environment. This environment is always available.
*/
private static final String LIVE_ENVIRONMENT_NAME = "live";
private static final String ENVIRONMENT_CONTAINER_NAME = "environments";
private static final Set<QName> PUBLISHING_QUEUE_TYPE = new HashSet<QName>();
private Set<QName> environmentNodeTypes;
@@ -122,29 +126,11 @@ public class EnvironmentHelper
this.channelHelper = channelHelper;
}
public Map<String, NodeRef> getEnvironments(String siteId)
{
Map<String, NodeRef> results = new TreeMap<String, NodeRef>();
NodeRef environmentContainer = getEnvironmentContainer(siteId);
List<ChildAssociationRef> envAssocs = nodeService.getChildAssocs(environmentContainer,
getEnvironmentNodeTypes());
for (ChildAssociationRef envAssoc : envAssocs)
{
NodeRef environment = envAssoc.getChildRef();
String name = (String) nodeService.getProperty(environment, ContentModel.PROP_NAME);
results.put(name, environment);
}
return results;
}
public NodeRef getEnvironment(String siteId, String name)
public NodeRef getEnvironment(String siteId)
{
ParameterCheck.mandatory("siteId", siteId);
ParameterCheck.mandatory("name", name);
NodeRef environmentContainer = getEnvironmentContainer(siteId);
return nodeService.getChildByName(environmentContainer, ContentModel.ASSOC_CONTAINS, name);
return nodeService.getChildByName(environmentContainer, ContentModel.ASSOC_CONTAINS, LIVE_ENVIRONMENT_NAME);
}
public NodeRef getPublishingQueue(NodeRef environment)
@@ -201,9 +187,9 @@ public class EnvironmentHelper
// Also create the default live environment
Map<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, PublishingService.LIVE_ENVIRONMENT_NAME);
props.put(ContentModel.PROP_NAME, LIVE_ENVIRONMENT_NAME);
nodeService.createNode(environmentContainer, ContentModel.ASSOC_CONTAINS, QName.createQName(
NamespaceService.CONTENT_MODEL_1_0_URI, PublishingService.LIVE_ENVIRONMENT_NAME),
NamespaceService.CONTENT_MODEL_1_0_URI, LIVE_ENVIRONMENT_NAME),
PublishingModel.TYPE_ENVIRONMENT, props);
}
return environmentContainer;
@@ -220,22 +206,22 @@ public class EnvironmentHelper
{
if(lastEvent != null)
{
return new NodePublishStatusPublishedAndOnQueue(node, environment, channelName, queuedEvent, lastEvent);
return new NodePublishStatusPublishedAndOnQueue(node, channelName, queuedEvent, lastEvent);
}
else
{
return new NodePublishStatusOnQueue(node, environment, channelName, queuedEvent);
return new NodePublishStatusOnQueue(node, channelName, queuedEvent);
}
}
else
{
if(lastEvent != null)
{
return new NodePublishStatusPublished(node, environment, channelName, lastEvent);
return new NodePublishStatusPublished(node, channelName, lastEvent);
}
else
{
return new NodePublishStatusNotPublished(node, environment, channelName);
return new NodePublishStatusNotPublished(node, channelName);
}
}
}

View File

@@ -19,15 +19,8 @@
package org.alfresco.repo.publishing;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
import java.util.Map;
import javax.annotation.Resource;
import org.alfresco.service.cmr.publishing.PublishingService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.junit.Test;
@@ -47,21 +40,10 @@ public class EnvironmentHelperTest extends AbstractPublishingIntegrationTest
environmentHelper = (EnvironmentHelper) getApplicationContext().getBean("environmentHelper");
}
@Test
public void testGetEnvironments() throws Exception
{
Map<String, NodeRef> environments = environmentHelper.getEnvironments(siteId);
assertTrue(environments.size() == 1);
NodeRef liveEnvironment = environments.get(PublishingService.LIVE_ENVIRONMENT_NAME);
assertNotNull(liveEnvironment);
assertTrue(nodeService.exists(liveEnvironment));
assertEquals(PublishingModel.TYPE_ENVIRONMENT, nodeService.getType(liveEnvironment));
}
@Test
public void testGetEnvironmentByName() throws Exception
{
NodeRef liveEnvironment = environmentHelper.getEnvironment(siteId, PublishingService.LIVE_ENVIRONMENT_NAME);
NodeRef liveEnvironment = environmentHelper.getEnvironment(siteId);
assertNotNull(liveEnvironment);
assertTrue(nodeService.exists(liveEnvironment));
assertEquals(PublishingModel.TYPE_ENVIRONMENT, nodeService.getType(liveEnvironment));
@@ -70,7 +52,7 @@ public class EnvironmentHelperTest extends AbstractPublishingIntegrationTest
@Test
public void testGetPublishingQueue() throws Exception
{
NodeRef liveEnvironment = environmentHelper.getEnvironment(siteId, PublishingService.LIVE_ENVIRONMENT_NAME);
NodeRef liveEnvironment = environmentHelper.getEnvironment(siteId);
NodeRef publishingQueue = environmentHelper.getPublishingQueue(liveEnvironment);
assertNotNull(publishingQueue);
assertTrue(nodeService.exists(publishingQueue));

View File

@@ -22,13 +22,9 @@ package org.alfresco.repo.publishing;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.alfresco.service.cmr.publishing.Environment;
import org.alfresco.service.cmr.publishing.NodePublishStatus;
import org.alfresco.service.cmr.publishing.PublishingEvent;
import org.alfresco.service.cmr.publishing.PublishingEventFilter;
import org.alfresco.service.cmr.publishing.PublishingQueue;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -37,13 +33,12 @@ import org.alfresco.service.cmr.repository.NodeRef;
* @author Nick Smith
*
*/
public class EnvironmentImpl implements Environment
public class EnvironmentImpl
{
private PublishingQueueFactory publishingQueueFactory;
private NodeRef nodeRef;
private String id;
private EnvironmentHelper environmentHelper;
private PublishingEventHelper publishingEventHelper;
/**
* {@inheritDoc}
@@ -78,15 +73,6 @@ public class EnvironmentImpl implements Environment
return id;
}
/**
* {@inheritDoc}
*/
public List<PublishingEvent> getPublishingEvents(PublishingEventFilter filter)
{
NodeRef queue = environmentHelper.getPublishingQueue(nodeRef);
return publishingEventHelper.findPublishingEvents(queue, filter);
}
/**
* {@inheritDoc}
*/
@@ -95,14 +81,6 @@ public class EnvironmentImpl implements Environment
return publishingQueueFactory.createPublishingQueueObject(nodeRef);
}
/**
* {@inheritDoc}
*/
public PublishingEventFilter createPublishingEventFilter()
{
return new PublishingEventFilterImpl();
}
public NodeRef getNodeRef()
{
return nodeRef;
@@ -133,12 +111,4 @@ public class EnvironmentImpl implements Environment
this.environmentHelper = environmentHelper;
}
/**
* @param publishingEventHelper the publishingEventHelper to set
*/
public void setPublishingEventHelper(PublishingEventHelper publishingEventHelper)
{
this.publishingEventHelper = publishingEventHelper;
}
}

View File

@@ -19,8 +19,6 @@
package org.alfresco.repo.publishing;
import static junit.framework.Assert.assertEquals;
import java.util.Calendar;
import java.util.Map;
@@ -79,7 +77,6 @@ public class EnvironmentImplTest extends AbstractPublishingIntegrationTest
private void checkNodeStatus(NodeRef node, Status expStatus, Map<NodeRef, NodePublishStatus> results)
{
NodePublishStatus nodeStatus = results.get(node);
assertEquals(environment, nodeStatus.getEnvironment());
assertEquals(node, nodeStatus.getNodeRef());
assertEquals(expStatus, nodeStatus.getStatus());
}

View File

@@ -19,11 +19,14 @@
package org.alfresco.repo.publishing;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;
import org.alfresco.service.cmr.publishing.Environment;
import org.alfresco.service.cmr.publishing.NodePublishStatus;
import org.alfresco.service.cmr.publishing.PublishingEvent;
import org.alfresco.service.cmr.publishing.PublishingQueue;
import org.alfresco.service.cmr.publishing.PublishingService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.util.ParameterCheck;
@@ -36,6 +39,7 @@ import org.alfresco.util.ParameterCheck;
public class PublishServiceImpl implements PublishingService
{
public static final String NAME = "publishingService";
private EnvironmentFactory environmentFactory;
private PublishingEventHelper publishingEventHelper;
@@ -55,24 +59,6 @@ public class PublishServiceImpl implements PublishingService
this.publishingEventHelper = publishingEventHelper;
}
/**
*
* {@inheritDoc}
*/
public Environment getEnvironment(String siteId, String environmentName)
{
return environmentFactory.createEnvironmentObject(siteId, environmentName);
}
/**
*
* {@inheritDoc}
*/
public List<Environment> getEnvironments(String siteId)
{
return environmentFactory.createEnvironmentObjects(siteId);
}
/**
*
* {@inheritDoc}
@@ -91,13 +77,58 @@ public class PublishServiceImpl implements PublishingService
return publishingEventHelper.getPublishingEvent(id);
}
/* (non-Javadoc)
* @see org.alfresco.service.cmr.publishing.PublishingService#cancelPublishingEvent(java.lang.String)
*/
@Override
/**
* {@inheritDoc}
*/
public void cancelPublishingEvent(String id)
{
ParameterCheck.mandatory("id", id);
publishingEventHelper.cancelEvent(id);
}
/**
* {@inheritDoc}
*/
public PublishingQueue getPublishingQueue(String siteId)
{
EnvironmentImpl environment = getEnvironment(siteId);
if(environment!=null)
{
return environment.getPublishingQueue();
}
return null;
}
/**
* {@inheritDoc}
*/
public Map<NodeRef, NodePublishStatus> checkPublishStatus(String siteId, String channelName,
Collection<NodeRef> nodes)
{
EnvironmentImpl environment = getEnvironment(siteId);
if(environment !=null )
{
return environment.checkPublishStatus(channelName, nodes);
}
return Collections.emptyMap();
}
/**
* {@inheritDoc}
*/
public Map<NodeRef, NodePublishStatus> checkPublishStatus(String siteId, String channelName, NodeRef... nodes)
{
EnvironmentImpl environment = getEnvironment(siteId);
if(environment !=null )
{
return environment.checkPublishStatus(channelName, nodes);
}
return Collections.emptyMap();
}
private EnvironmentImpl getEnvironment(String siteId)
{
return environmentFactory.createEnvironmentObject(siteId);
}
}

View File

@@ -34,12 +34,10 @@ import org.alfresco.repo.security.authentication.AuthenticationComponent;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.publishing.Environment;
import org.alfresco.service.cmr.publishing.MutablePublishingPackage;
import org.alfresco.service.cmr.publishing.PublishingEvent;
import org.alfresco.service.cmr.publishing.PublishingPackageEntry;
import org.alfresco.service.cmr.publishing.PublishingQueue;
import org.alfresco.service.cmr.publishing.PublishingService;
import org.alfresco.service.cmr.publishing.channels.Channel;
import org.alfresco.service.cmr.publishing.channels.ChannelType;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -79,6 +77,7 @@ public class PublishingIntegratedTest extends BaseSpringTest
/**
* @throws java.lang.Exception
*/
@Override
@Before
public void onSetUp() throws Exception
{
@@ -119,8 +118,7 @@ public class PublishingIntegratedTest extends BaseSpringTest
NamespaceService.CONTENT_MODEL_1_0_URI, Integer.toString(i)), ContentModel.TYPE_CONTENT).getChildRef());
}
Environment liveEnvironment = publishingService.getEnvironment(siteId, PublishingService.LIVE_ENVIRONMENT_NAME);
PublishingQueue liveQueue = liveEnvironment.getPublishingQueue();
PublishingQueue liveQueue = publishingService.getPublishingQueue(siteId);
MutablePublishingPackage publishingPackage = liveQueue.createPublishingPackage();
publishingPackage.addNodesToPublish(nodes);
@@ -153,9 +151,7 @@ public class PublishingIntegratedTest extends BaseSpringTest
nodes.add(nodeService.createNode(channel.getNodeRef(), ContentModel.ASSOC_CONTAINS, QName.createQName(
NamespaceService.CONTENT_MODEL_1_0_URI, Integer.toString(i)), ContentModel.TYPE_CONTENT).getChildRef());
}
Environment liveEnvironment = publishingService.getEnvironment(siteId, PublishingService.LIVE_ENVIRONMENT_NAME);
PublishingQueue liveQueue = liveEnvironment.getPublishingQueue();
PublishingQueue liveQueue = publishingService.getPublishingQueue(siteId);
MutablePublishingPackage publishingPackage = liveQueue.createPublishingPackage();
publishingPackage.addNodesToPublish(nodes);

View File

@@ -19,12 +19,7 @@
package org.alfresco.repo.publishing;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.alfresco.repo.transfer.manifest.TransferManifestNodeFactory;
import org.alfresco.service.cmr.publishing.Environment;
import org.alfresco.service.cmr.publishing.PublishingQueue;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.version.VersionService;
@@ -77,10 +72,9 @@ public class PublishingObjectFactory implements EnvironmentFactory, PublishingQu
/* (non-Javadoc)
* @see org.alfresco.repo.publishing.EnvironmentFactory#createEnvironmentObject(java.lang.String, java.lang.String)
*/
@Override
public Environment createEnvironmentObject(String siteId, String environmentName)
public EnvironmentImpl createEnvironmentObject(String siteId)
{
NodeRef node = environmentHelper.getEnvironment(siteId, environmentName);
NodeRef node = environmentHelper.getEnvironment(siteId);
return createEnvironmentFromNode(node);
}
@@ -88,45 +82,27 @@ public class PublishingObjectFactory implements EnvironmentFactory, PublishingQu
* @param node
* @return
*/
private Environment createEnvironmentFromNode(NodeRef node)
private EnvironmentImpl createEnvironmentFromNode(NodeRef node)
{
EnvironmentImpl environment = new EnvironmentImpl();
environment.setNodeRef(node);
environment.setPublishingQueueFactory(this);
environment.setEnvironmentHelper(environmentHelper);
environment.setPublishingEventHelper(publishingEventHelper);
return environment;
}
/* (non-Javadoc)
* @see org.alfresco.repo.publishing.EnvironmentFactory#createEnvironmentObjects(java.lang.String)
*/
@Override
public List<Environment> createEnvironmentObjects(String siteId)
{
Map<String,NodeRef> environmentMap = environmentHelper.getEnvironments(siteId);
List<Environment> environments = new ArrayList<Environment>(environmentMap.size());
for (NodeRef node : environmentMap.values())
{
environments.add(createEnvironmentFromNode(node));
}
return environments;
}
/* (non-Javadoc)
* @see org.alfresco.repo.publishing.PublishingQueueFactory#createPublishingQueueObject(java.lang.String, java.lang.String)
*/
@Override
public PublishingQueue createPublishingQueueObject(String siteId, String environmentName)
public PublishingQueue createPublishingQueueObject(String siteId)
{
NodeRef environmentNode = environmentHelper.getEnvironment(siteId, environmentName);
NodeRef environmentNode = environmentHelper.getEnvironment(siteId);
return createPublishingQueueObject(environmentNode);
}
/* (non-Javadoc)
* @see org.alfresco.repo.publishing.PublishingQueueFactory#createPublishingQueueObject(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public PublishingQueue createPublishingQueueObject(NodeRef environmentNodeRef)
{
NodeRef queueNode = environmentHelper.getPublishingQueue(environmentNodeRef);

View File

@@ -28,7 +28,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
*/
public interface PublishingQueueFactory
{
PublishingQueue createPublishingQueueObject(String siteId, String environmentName);
PublishingQueue createPublishingQueueObject(String siteId);
PublishingQueue createPublishingQueueObject(NodeRef environmentNodeRef);
}

View File

@@ -22,10 +22,13 @@ package org.alfresco.repo.publishing;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.transfer.manifest.TransferManifestNodeFactory;
import org.alfresco.service.cmr.publishing.MutablePublishingPackage;
import org.alfresco.service.cmr.publishing.PublishingEvent;
import org.alfresco.service.cmr.publishing.PublishingEventFilter;
import org.alfresco.service.cmr.publishing.PublishingPackage;
import org.alfresco.service.cmr.publishing.PublishingQueue;
import org.alfresco.service.cmr.publishing.StatusUpdate;
@@ -119,4 +122,20 @@ public class PublishingQueueImpl implements PublishingQueue
{
this.versionService = versionService;
}
/**
* {@inheritDoc}
*/
public List<PublishingEvent> getPublishingEvents(PublishingEventFilter filter)
{
return publishingEventHelper.findPublishingEvents(nodeRef, filter);
}
/**
* {@inheritDoc}
*/
public PublishingEventFilter createPublishingEventFilter()
{
return new PublishingEventFilterImpl();
}
}

View File

@@ -29,13 +29,11 @@ import org.alfresco.service.cmr.repository.NodeRef;
public abstract class BaseNodePublishStatus implements NodePublishStatus
{
private final NodeRef nodeRef;
private final Environment environment;
private final String channelName;
public BaseNodePublishStatus(NodeRef nodeRef, Environment environment, String channelName)
public BaseNodePublishStatus(NodeRef nodeRef, String channelName)
{
this.nodeRef = nodeRef;
this.environment = environment;
this.channelName = channelName;
}
@@ -47,14 +45,6 @@ public abstract class BaseNodePublishStatus implements NodePublishStatus
return nodeRef;
}
/**
* {@inheritDoc}
*/
public Environment getEnvironment()
{
return environment;
}
/**
* {@inheritDoc}
*/

View File

@@ -1,69 +0,0 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.service.cmr.publishing;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* An interface that describes a publishing environment.
* @author Brian
*
*/
public interface Environment
{
/**
* Retrieve the identifier of this publishing environment
* @return The identifier of this publishing environment
*/
String getId();
/**
* Retrieve the publishing queue associated with this publishing environment
* @return A PublishingQueue object corresponding tho this environment's publishing queue
*/
PublishingQueue getPublishingQueue();
/**
* Discover the publishing status of each of the specified nodes
* @param channelName TODO
* @param nodes The identifiers of the nodes whose publishing status is being sought
* @return A map associating a NodePublishStatus object with each of the supplied NodeRef objects
*/
Map<NodeRef,NodePublishStatus> checkPublishStatus(String channelName, Collection<NodeRef> nodes);
Map<NodeRef,NodePublishStatus> checkPublishStatus(String channelName, NodeRef... nodes);
/**
* Retrieve a list of publishing events associated with this publishing environment, filtering them using the
* supplied PublishingEventFilter object (optional - may be <code>null</code>)
* @param filter The filter that is to be applied to the publishing events on this environment
* @return A list of PublishingEvent objects representing the publishing events that matched the supplied filter on this publishing environment
*/
List<PublishingEvent> getPublishingEvents(PublishingEventFilter filter);
/**
* A factory method that creates a {@link PublishingEventFilter} object.
* @return a new {@link PublishingEventFilter}.
*/
PublishingEventFilter createPublishingEventFilter();
}

View File

@@ -23,7 +23,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
/**
* @author Brian
*
* @author Nick Smith
*/
public interface NodePublishStatus
{
@@ -35,11 +35,5 @@ public interface NodePublishStatus
Status getStatus();
/**
* Obtain the environment related to this status
* @return
*/
Environment getEnvironment();
String getChannelName();
}

View File

@@ -27,15 +27,14 @@ import org.alfresco.service.cmr.repository.NodeRef;
*/
public class NodePublishStatusNotPublished extends BaseNodePublishStatus
{
/**
* @param node
* @param environment
* @param channelName TODO
*/
public NodePublishStatusNotPublished(NodeRef node, Environment environment, String channelName)
public NodePublishStatusNotPublished(NodeRef node, String channelName)
{
super(node, environment, channelName);
super(node, channelName);
}
/**

View File

@@ -30,9 +30,9 @@ public class NodePublishStatusOnQueue extends BaseNodePublishStatus
{
private final PublishingEvent queuedEvent;
public NodePublishStatusOnQueue(NodeRef nodeRef, Environment environment, String channelName, PublishingEvent queuedEvent)
public NodePublishStatusOnQueue(NodeRef nodeRef, String channelName, PublishingEvent queuedEvent)
{
super(nodeRef, environment, channelName);
super(nodeRef, channelName);
this.queuedEvent =queuedEvent;
}

View File

@@ -30,9 +30,9 @@ public class NodePublishStatusPublished extends BaseNodePublishStatus
private final PublishingEvent lastEvent;
public NodePublishStatusPublished(NodeRef node, Environment environment, String channelName, PublishingEvent lastEvent)
public NodePublishStatusPublished(NodeRef node, String channelName, PublishingEvent lastEvent)
{
super(node, environment, channelName);
super(node, channelName);
this.lastEvent = lastEvent;
}

View File

@@ -38,10 +38,10 @@ public class NodePublishStatusPublishedAndOnQueue extends BaseNodePublishStatus
* @param queuedPublishingEvent The next scheduled {@link PublishingEvent} on the {@link PublishingQueue}
* @param latestPublishingEvent The last {@link PublishingEvent} to successfully publish the node.
*/
public NodePublishStatusPublishedAndOnQueue(NodeRef nodeRef, Environment environment,
String channelName, PublishingEvent queuedPublishingEvent, PublishingEvent latestPublishingEvent)
public NodePublishStatusPublishedAndOnQueue(NodeRef nodeRef, String channelName,
PublishingEvent queuedPublishingEvent, PublishingEvent latestPublishingEvent)
{
super(nodeRef, environment, channelName);
super(nodeRef, channelName);
this.queuedPublishingEvent = queuedPublishingEvent;
this.latestPublishingEvent = latestPublishingEvent;
}

View File

@@ -21,6 +21,7 @@ package org.alfresco.service.cmr.publishing;
import java.util.Calendar;
import java.util.Collection;
import java.util.List;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -47,5 +48,17 @@ public interface PublishingQueue
*/
String scheduleNewEvent(PublishingPackage publishingPackage, String channelName, Calendar schedule, String comment, StatusUpdate statusUpdate);
/**
* Retrieve a list of publishing events associated with this publishing environment, filtering them using the
* supplied PublishingEventFilter object (optional - may be <code>null</code>)
* @param filter The filter that is to be applied to the publishing events on this environment
* @return A list of PublishingEvent objects representing the publishing events that matched the supplied filter on this publishing environment
*/
List<PublishingEvent> getPublishingEvents(PublishingEventFilter filter);
/**
* A factory method that creates a {@link PublishingEventFilter} object.
* @return a new {@link PublishingEventFilter}.
*/
PublishingEventFilter createPublishingEventFilter();
}

View File

@@ -18,35 +18,14 @@
*/
package org.alfresco.service.cmr.publishing;
import java.util.List;
import java.util.Collection;
import java.util.Map;
import org.alfresco.service.cmr.repository.NodeRef;
public interface PublishingService
{
/**
* The name of the live environment. This environment is always available.
*/
public static final String LIVE_ENVIRONMENT_NAME = "live";
/**
* Retrieve a list of all the target publishing environments defined on the
* specified Share site
*
* @param siteId
* The identifier of the Share site
* @return
*/
List<Environment> getEnvironments(String siteId);
/**
* Retrieve the named publishing environment on the specified Share site
*
* @param siteId
* The identifier of the Share site
* @param environmentName
* The name of the required publishing environment
* @return
*/
Environment getEnvironment(String siteId, String environmentName);
/**
* Retrieve the publishing event that has the specified identifier
@@ -67,4 +46,20 @@ public interface PublishingService
* @param id The identifier of the publishing event that is to be cancelled.
*/
void cancelPublishingEvent(String id);
/**
* Retrieve the publishing queue associated with this publishing environment
* @return A PublishingQueue object corresponding tho this environment's publishing queue
*/
PublishingQueue getPublishingQueue(String siteId);
/**
* Discover the publishing status of each of the specified nodes
* @param channelName TODO
* @param nodes The identifiers of the nodes whose publishing status is being sought
* @return A map associating a NodePublishStatus object with each of the supplied NodeRef objects
*/
Map<NodeRef,NodePublishStatus> checkPublishStatus(String siteId, String channelName, Collection<NodeRef> nodes);
Map<NodeRef,NodePublishStatus> checkPublishStatus(String siteId, String channelName, NodeRef... nodes);
}