View Javadoc

1   /*
2    * Copyright 2000-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.portals.graffito;
17  
18  import org.apache.portals.graffito.exception.CmsInstantiateException;
19  import org.apache.portals.graffito.exception.ContentManagementException;
20  import org.apache.portals.graffito.model.Document;
21  import org.apache.portals.graffito.model.HistoryElement;
22  
23  
24  /***
25   * <P>CMS Version Service Interface</P>
26   *
27   * This service maintains document versions and history.
28   * The version number is composed of a Major & minor section like the following structure : "majorNum.minorNum"
29   * Later we will add branch management with content merge, content comparaison, ...
30   * 
31   * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
32   * 
33   * @version $Id: ContentVersionService.java,v 1.1 2004/12/22 21:16:12 christophe Exp $
34   */
35  public interface ContentVersionService 
36  {  
37     /***
38      * Get the last history element associated to an uri
39      * 
40      * @param uri The uri assigned to the document
41      * 
42      * @return The last history element
43      * @exception ContentManagementException when it is impossible to get the history
44      */ 
45     public HistoryElement getHistory(String uri)  throws ContentManagementException;;
46     
47     /***
48      * Get the history element associated to a specific document (version)
49      * 
50      * @param document The document for which the history element is required
51      * 
52      * @return The last history element
53      * @exception ContentManagementException when it is impossible to get the history
54      */
55     public HistoryElement getHistory(Document document) throws ContentManagementException;
56     
57     /***
58      * Create a new major version for a Document. 
59      * @param uri The document uri
60      * @return The new version document
61      * @throws CmsInstantiateException
62      */
63     public Document createMajorVersion(String uri) throws CmsInstantiateException;
64    
65     /***
66      * Create a new minor version for a Document. 
67      * @param uri The document uri
68      * @return The new version document
69      * @throws CmsInstantiateException
70      */   
71     public Document createMinorVersion(String uri) throws CmsInstantiateException;
72     
73     /***
74      * Add a new version in the Document history
75      * @param uri The uri for wich the history has to be modified
76      * @param previousDocument The previous document before the new one to add
77      * @param newDocument The new document to insert into the history
78      * @throws CmsInstantiateException
79      */
80     void addInHistory(String uri, Document previousDocument, Document newDocument) throws CmsInstantiateException;
81  }