Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.publisher.impl.service
Class PublisherServiceImpl

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.platform.publisher.impl.service.PublisherServiceImpl
All Implemented Interfaces:
PublisherService, RemotePublicationTreeManager, Adaptable, Component, Extensible

public class PublisherServiceImpl
extends DefaultComponent
implements PublisherService, RemotePublicationTreeManager

POJO implementation of the publisher service Implements both PublisherService and RemotePublicationTreeManager.

Author:
tiry

Field Summary
static String FACTORY_EP
           
static String TREE_CONFIG_EP
           
static String TREE_EP
           
static String VALIDATORS_RULE_EP
           
 
Fields inherited from interface org.nuxeo.ecm.platform.publisher.api.PublisherService
DOMAIN_NAME_KEY
 
Constructor Summary
PublisherServiceImpl()
           
 
Method Summary
 void activate(ComponentContext context)
          Activates the component.
 void applicationStarted(ComponentContext context)
          Notify the component that Nuxeo Framework finished starting all Nuxeo bundles.
 boolean canManagePublishing(String sid, PublishedDocument publishedDocument)
          Returns true if the current user can manage the publishing of the given published document, ie.
 boolean canPublishTo(String sid, PublicationNode publicationNode)
          Returns true if the current user can publish to the specified publicationNode, false otherwise.
 boolean canUnpublish(String sid, PublishedDocument publishedDocument)
          Returns true if the current user can unpublish the given publishedDocument, false otherwise.
 List<String> getAvailablePublicationTree()
           
 Map<String,String> getAvailablePublicationTrees()
          Returns a Map with tree name as key and tree title as value.
 List<PublishedDocument> getChildrenDocuments(PublicationNode node)
           
 List<PublicationNode> getChildrenNodes(PublicationNode node)
           
 List<PublishedDocument> getExistingPublishedDocument(String sid, DocumentLocation docLoc)
           
static int getLiveTreeCount()
           
 PublicationNode getNodeByPath(String sid, String path)
           
 Map<String,String> getParametersFor(String treeConfigName)
           
 PublicationNode getParent(PublicationNode node)
           
 PublicationTree getPublicationTree(String treeName, CoreSession coreSession, Map<String,String> params)
           
 PublicationTree getPublicationTree(String treeName, CoreSession coreSession, Map<String,String> params, DocumentModel currentDocument)
           
 PublicationTree getPublicationTreeFor(DocumentModel doc, CoreSession coreSession)
           
 List<PublishedDocument> getPublishedDocumentInNode(PublicationNode node)
           
static PublicationTree getTreeBySid(String sid)
           
 boolean hasValidationTask(String sid, PublishedDocument publishedDocument)
           
 Map<String,String> initRemoteSession(String treeConfigName, Map<String,String> params)
           
 boolean isPublicationNode(String sid, DocumentModel documentModel)
          Returns true if the given documentModel is a PublicationNode of the current tree, false otherwise.
 boolean isPublishedDocument(DocumentModel documentModel)
           
 PublishedDocument publish(DocumentModel doc, PublicationNode targetNode)
           
 PublishedDocument publish(DocumentModel doc, PublicationNode targetNode, Map<String,String> params)
           
 void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
           
 void registerTreeConfigFor(DocumentModel domain)
           
 void release(String sid)
           
 void setCurrentDocument(String sid, DocumentModel currentDocument)
          Sets the current document on which the tree will be based, if needed.
 void unpublish(DocumentModel doc, PublicationNode targetNode)
           
 void unpublish(String sid, PublishedDocument publishedDocument)
           
 void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
           
 void unRegisterTreeConfigFor(DocumentModel domain)
           
 void validatorPublishDocument(String sid, PublishedDocument publishedDocument, String comment)
          A validator (the current user) approves the publication.
 void validatorRejectPublication(String sid, PublishedDocument publishedDocument, String comment)
          A validator (the current user) rejects the publication.
 PublicationNode wrapToPublicationNode(DocumentModel documentModel, CoreSession coreSession)
           
 PublicationNode wrapToPublicationNode(String sid, DocumentModel documentModel)
          Returns a PublicationNode for the current tree built on the given documentModel.
 PublishedDocument wrapToPublishedDocument(String sid, DocumentModel documentModel)
           
 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
deactivate, getAdapter, registerExtension, unregisterExtension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TREE_EP

public static final String TREE_EP
See Also:
Constant Field Values

TREE_CONFIG_EP

public static final String TREE_CONFIG_EP
See Also:
Constant Field Values

VALIDATORS_RULE_EP

public static final String VALIDATORS_RULE_EP
See Also:
Constant Field Values

FACTORY_EP

public static final String FACTORY_EP
See Also:
Constant Field Values
Constructor Detail

PublisherServiceImpl

public PublisherServiceImpl()
Method Detail

applicationStarted

public void applicationStarted(ComponentContext context)
                        throws Exception
Description copied from interface: Component
Notify the component that Nuxeo Framework finished starting all Nuxeo bundles.

Specified by:
applicationStarted in interface Component
Overrides:
applicationStarted in class DefaultComponent
Throws:
Exception

activate

public void activate(ComponentContext context)
              throws Exception
Description copied from interface: Component
Activates the component.

This method is called by the runtime when a component is activated.

Specified by:
activate in interface Component
Overrides:
activate in class DefaultComponent
Parameters:
context - the runtime context
Throws:
Exception - if an error occurs during activation

getLiveTreeCount

public static int getLiveTreeCount()

getTreeBySid

public static PublicationTree getTreeBySid(String sid)

registerContribution

public void registerContribution(Object contribution,
                                 String extensionPoint,
                                 ComponentInstance contributor)
                          throws Exception
Overrides:
registerContribution in class DefaultComponent
Throws:
Exception

unregisterContribution

public void unregisterContribution(Object contribution,
                                   String extensionPoint,
                                   ComponentInstance contributor)
                            throws Exception
Overrides:
unregisterContribution in class DefaultComponent
Throws:
Exception

getAvailablePublicationTree

public List<String> getAvailablePublicationTree()
Specified by:
getAvailablePublicationTree in interface PublisherService

getAvailablePublicationTrees

public Map<String,String> getAvailablePublicationTrees()
Description copied from interface: PublisherService
Returns a Map with tree name as key and tree title as value.

Specified by:
getAvailablePublicationTrees in interface PublisherService

getPublicationTree

public PublicationTree getPublicationTree(String treeName,
                                          CoreSession coreSession,
                                          Map<String,String> params)
                                   throws ClientException,
                                          PublicationTreeNotAvailable
Specified by:
getPublicationTree in interface PublisherService
Throws:
ClientException
PublicationTreeNotAvailable

getPublicationTree

public PublicationTree getPublicationTree(String treeName,
                                          CoreSession coreSession,
                                          Map<String,String> params,
                                          DocumentModel currentDocument)
                                   throws ClientException,
                                          PublicationTreeNotAvailable
Specified by:
getPublicationTree in interface PublisherService
Throws:
ClientException
PublicationTreeNotAvailable

initRemoteSession

public Map<String,String> initRemoteSession(String treeConfigName,
                                            Map<String,String> params)
                                     throws Exception
Specified by:
initRemoteSession in interface RemotePublicationTreeManager
Throws:
Exception

release

public void release(String sid)
Specified by:
release in interface RemotePublicationTreeManager

publish

public PublishedDocument publish(DocumentModel doc,
                                 PublicationNode targetNode)
                          throws ClientException
Specified by:
publish in interface PublisherService
Specified by:
publish in interface RemotePublicationTreeManager
Throws:
ClientException

publish

public PublishedDocument publish(DocumentModel doc,
                                 PublicationNode targetNode,
                                 Map<String,String> params)
                          throws ClientException
Specified by:
publish in interface PublisherService
Specified by:
publish in interface RemotePublicationTreeManager
Throws:
ClientException

unpublish

public void unpublish(DocumentModel doc,
                      PublicationNode targetNode)
               throws ClientException
Specified by:
unpublish in interface PublisherService
Specified by:
unpublish in interface RemotePublicationTreeManager
Throws:
ClientException

unpublish

public void unpublish(String sid,
                      PublishedDocument publishedDocument)
               throws ClientException
Specified by:
unpublish in interface RemotePublicationTreeManager
Throws:
ClientException

getChildrenDocuments

public List<PublishedDocument> getChildrenDocuments(PublicationNode node)
                                             throws ClientException
Specified by:
getChildrenDocuments in interface RemotePublicationTreeManager
Throws:
ClientException

getChildrenNodes

public List<PublicationNode> getChildrenNodes(PublicationNode node)
                                       throws ClientException
Specified by:
getChildrenNodes in interface RemotePublicationTreeManager
Throws:
ClientException

getParent

public PublicationNode getParent(PublicationNode node)
Specified by:
getParent in interface RemotePublicationTreeManager

getNodeByPath

public PublicationNode getNodeByPath(String sid,
                                     String path)
                              throws ClientException
Specified by:
getNodeByPath in interface RemotePublicationTreeManager
Throws:
ClientException

getExistingPublishedDocument

public List<PublishedDocument> getExistingPublishedDocument(String sid,
                                                            DocumentLocation docLoc)
                                                     throws ClientException
Specified by:
getExistingPublishedDocument in interface RemotePublicationTreeManager
Throws:
ClientException

getPublishedDocumentInNode

public List<PublishedDocument> getPublishedDocumentInNode(PublicationNode node)
                                                   throws ClientException
Specified by:
getPublishedDocumentInNode in interface RemotePublicationTreeManager
Throws:
ClientException

setCurrentDocument

public void setCurrentDocument(String sid,
                               DocumentModel currentDocument)
                        throws ClientException
Description copied from interface: RemotePublicationTreeManager
Sets the current document on which the tree will be based, if needed. Can be useful for some implementations that need to know on which document the user is.

Specified by:
setCurrentDocument in interface RemotePublicationTreeManager
currentDocument - the current document
Throws:
ClientException

validatorPublishDocument

public void validatorPublishDocument(String sid,
                                     PublishedDocument publishedDocument,
                                     String comment)
                              throws ClientException
Description copied from interface: RemotePublicationTreeManager
A validator (the current user) approves the publication.

Specified by:
validatorPublishDocument in interface RemotePublicationTreeManager
publishedDocument - the current published document that will be approved
Throws:
ClientException

validatorRejectPublication

public void validatorRejectPublication(String sid,
                                       PublishedDocument publishedDocument,
                                       String comment)
                                throws ClientException
Description copied from interface: RemotePublicationTreeManager
A validator (the current user) rejects the publication.

Specified by:
validatorRejectPublication in interface RemotePublicationTreeManager
publishedDocument - the currently published document that will be rejected
Throws:
ClientException

canPublishTo

public boolean canPublishTo(String sid,
                            PublicationNode publicationNode)
                     throws ClientException
Description copied from interface: RemotePublicationTreeManager
Returns true if the current user can publish to the specified publicationNode, false otherwise.

Specified by:
canPublishTo in interface RemotePublicationTreeManager
Returns:
true if the current user can publish to the specified publicationNode, false otherwise.
Throws:
ClientException

canUnpublish

public boolean canUnpublish(String sid,
                            PublishedDocument publishedDocument)
                     throws ClientException
Description copied from interface: RemotePublicationTreeManager
Returns true if the current user can unpublish the given publishedDocument, false otherwise.

Specified by:
canUnpublish in interface RemotePublicationTreeManager
Returns:
true if the current user can unpublish the given publishedDocument, false otherwise.
Throws:
ClientException

canManagePublishing

public boolean canManagePublishing(String sid,
                                   PublishedDocument publishedDocument)
                            throws ClientException
Description copied from interface: RemotePublicationTreeManager
Returns true if the current user can manage the publishing of the given published document, ie. approve or reject the document.

Specified by:
canManagePublishing in interface RemotePublicationTreeManager
Throws:
ClientException

isPublishedDocument

public boolean isPublishedDocument(DocumentModel documentModel)
Specified by:
isPublishedDocument in interface PublisherService

getPublicationTreeFor

public PublicationTree getPublicationTreeFor(DocumentModel doc,
                                             CoreSession coreSession)
                                      throws ClientException
Specified by:
getPublicationTreeFor in interface PublisherService
Throws:
ClientException

hasValidationTask

public boolean hasValidationTask(String sid,
                                 PublishedDocument publishedDocument)
                          throws ClientException
Specified by:
hasValidationTask in interface RemotePublicationTreeManager
Throws:
ClientException

wrapToPublishedDocument

public PublishedDocument wrapToPublishedDocument(String sid,
                                                 DocumentModel documentModel)
                                          throws ClientException
Specified by:
wrapToPublishedDocument in interface RemotePublicationTreeManager
Throws:
ClientException

isPublicationNode

public boolean isPublicationNode(String sid,
                                 DocumentModel documentModel)
                          throws ClientException
Description copied from interface: RemotePublicationTreeManager
Returns true if the given documentModel is a PublicationNode of the current tree, false otherwise.

Specified by:
isPublicationNode in interface RemotePublicationTreeManager
Throws:
ClientException

wrapToPublicationNode

public PublicationNode wrapToPublicationNode(String sid,
                                             DocumentModel documentModel)
                                      throws ClientException
Description copied from interface: RemotePublicationTreeManager
Returns a PublicationNode for the current tree built on the given documentModel.

Specified by:
wrapToPublicationNode in interface RemotePublicationTreeManager
Throws:
ClientException - if the given documentModel cannot be a PublicationNode.

wrapToPublicationNode

public PublicationNode wrapToPublicationNode(DocumentModel documentModel,
                                             CoreSession coreSession)
                                      throws ClientException,
                                             PublicationTreeNotAvailable
Specified by:
wrapToPublicationNode in interface PublisherService
Throws:
ClientException
PublicationTreeNotAvailable

registerTreeConfigFor

public void registerTreeConfigFor(DocumentModel domain)
                           throws ClientException
Throws:
ClientException

unRegisterTreeConfigFor

public void unRegisterTreeConfigFor(DocumentModel domain)

getParametersFor

public Map<String,String> getParametersFor(String treeConfigName)
Specified by:
getParametersFor in interface PublisherService

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.