View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.wcm.publication;
18  
19  import java.util.Map;
20  
21  import javax.jcr.Node;
22  
23  import org.exoplatform.services.ecm.publication.NotInPublicationLifecycleException;
24  
25  public interface WCMPublicationService {
26  
27    public static final String UPDATE_EVENT = "WCMPublicationService.event.updateState";
28  
29   /**
30    * Add a Web Publication Plugin to the service.
31    * The method caches all added plugins.
32    *
33    * @param p the plugin to add
34    */
35   public void addPublicationPlugin(WebpagePublicationPlugin p);
36  
37   /**
38    * Retrieves all added web page publication plugins.
39    * This method is notably used to enumerate possible lifecycles.
40    *
41    * @return the map of web page publication plugin
42    */
43    public Map<String, WebpagePublicationPlugin> getWebpagePublicationPlugins();
44  
45   /**
46    * Checks if is enrolled in wcm lifecycle.
47    *
48    * @param node the node
49    *
50    * @return true, if is enrolled in wcm lifecycle
51    *
52    * @throws NotInPublicationLifecycleException the not in publication lifecycle exception
53    * @throws Exception the exception
54    */
55    public boolean isEnrolledInWCMLifecycle(Node node) throws NotInPublicationLifecycleException,
56                                                      Exception;
57  
58   /**
59    * Enroll in a web page publication lifecycle. The method will be retrieve the
60    * web page publication lifecycle by lifecycle name and enroll to lifecycle
61    *
62    * @param node the node
63    * @param lifecycleName the lifecycle name
64    *
65    * @throws Exception the exception
66    */
67    public void enrollNodeInLifecycle(Node node, String lifecycleName) throws Exception;
68  
69   /**
70    * Enroll this node in the default publication lifecycle.
71    * Depending on implementation, the default lifecycle could be based on :
72    * - lifecycle per site (site provided as a parameter)
73    * - lifecycle per author (remoteUser provided as a parameter)
74    * - lifecycle per content type (based on the node primary nodetype or its jcr path)
75    *
76    * @param node
77    * @param siteName
78    * @param remoteUser
79    * @throws Exception
80    */
81    public void enrollNodeInLifecycle(Node node, String siteName, String remoteUser) throws Exception;
82  
83   /**
84    * Unsubcribe node from a lifecycle plugin. After unsubcribe, the node can enroll to other publication lifecycle
85    *
86    * @param node the node
87    *
88    * @throws NotInPublicationLifecycleException the not in publication lifecycle exception
89    * @throws Exception the exception
90    */
91    public void unsubcribeLifecycle(Node node) throws NotInPublicationLifecycleException, Exception;
92  
93    /**
94     * Called by create and edit listeners. It allows to update the lifecycle of
95     * the content depending of its current state.
96     *
97     * @see org.exoplatform.services.wcm.publication.listener.post.PostCreateContentEventListener
98     * @see org.exoplatform.services.wcm.publication.listener.post.PostEditContentEventListener
99     * @param node
100    * @param siteName
101    * @param remoteUser
102    * @throws Exception
103    */
104   public void updateLifecyleOnChangeContent(Node node, String siteName, String remoteUser) throws Exception;
105 
106   /**
107    * It allows to update the lifecycle of the content with a new state.
108    *
109    * @param node
110    * @param siteName
111    * @param remoteUser
112    * @param newState
113    * @throws Exception
114    */
115   public void updateLifecyleOnChangeContent(Node node,
116                                             String siteName,
117                                             String remoteUser,
118                                             String newState) throws Exception;
119 
120   /**
121    * returns the current state of the content.
122    * We consider the publication:currentState property mandatory in all lifecycles.
123    *
124    * @param node
125    * @return the revision state stored in publication:currentState property
126    */
127   public String getContentState(Node node) throws Exception ;
128 
129 }