KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jcr > version > Version


1 /*
2  * $Id: Version.java,v 1.2 2004/07/24 00:16:24 benjmestrallet Exp $
3  *
4  * Copyright 2002-2004 Day Management AG, Switzerland.
5  *
6  * Licensed under the Day RI License, Version 2.0 (the "License"),
7  * as a reference implementation of the following specification:
8  *
9  * Content Repository API for Java Technology, revision 0.12
10  * <http://www.jcp.org/en/jsr/detail?id=170>
11  *
12  * You may not use this file except in compliance with the License.
13  * You may obtain a copy of the License files at
14  *
15  * http://www.day.com/content/en/licenses/day-ri-license-2.0
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24 package javax.jcr.version;
25
26 import javax.jcr.*;
27 import java.util.*;
28
29 /**
30  * A <code>Version</code> object wraps an <code>nt:version</code> node. It
31  * provides convenient access to version information.
32  */

33 public interface Version {
34
35   /**
36    * Returns the version name of this version. This corresponds to the value
37    * of the <code>jcr:versionName</code> property in the <code>nt:version</code>
38    * node that represents this version.
39    *
40    * @return the version name
41    * @throws RepositoryException if an error occurs.
42    */

43   public String JavaDoc getVersionName() throws RepositoryException;
44
45   /**
46    * Returns the version date of this version. This corresponds to the value
47    * of the <code>jcr:versionDate</code> property in the <code>nt:version</code>
48    * node that represents this version.
49    *
50    * @return a <code>Calendar</code> object
51    * @throws RepositoryException if an error occurs.
52    */

53   public Calendar getVersionDate() throws RepositoryException;
54
55   /**
56    * Returns the version labels of this version. This corresponds to the
57    * values of the <code>jcr:versionName</code> property in the
58    * <code>nt:version<code> node that represents this version.
59    *
60    * @return a string array
61    * @throws RepositoryException if an error occurs.
62    */

63   public String JavaDoc[] getVersionLabels() throws RepositoryException;
64
65   /**
66    * Returns the version labels of this version. This corresponds to the
67    * values of the <code>jcr:versionLabels</code> multi-value property in the
68    * <code>nt:version</code> node that represents this version.
69    *
70    * @param label a version label
71    * @throws RepositoryException if an error occurs.
72    */

73   public void addVersionLabel(String JavaDoc label) throws RepositoryException;
74
75   /**
76    * Removes the specified label from among the labels of this version. This
77    * corresponds to removing a value from the <code>jcr:versionLabels</code>
78    * multi-value property in the <code>nt:version</code> node that represents
79    * this version.
80    *
81    * @param label a version label
82    * @throws RepositoryException if an error occurs.
83    */

84   public void removeVersionLabel(String JavaDoc label) throws RepositoryException;
85
86   /**
87    * Returns the successor versions of this version. This corresponds to
88    * returning all the <code>nt:version</code> nodes referenced by the
89    * <code>jcr:successors</code> multi-value property in the
90    * <code>nt:version</code> node that represents this version.
91    *
92    * @return a <code>Version</code> array.
93    * @throws RepositoryException if an error occurs.
94    */

95   public Version[] getSuccessors() throws RepositoryException;
96
97   /**
98    * Returns the predecessor versions of this version. This corresponds to
99    * returning all the <code>nt:version</code> nodes whose
100    * <code>jcr:successors</code> property includes a reference to the
101    * <code>nt:version</code> node that represents this version.
102    *
103    * @return a <code>Version</code> array.
104    * @throws RepositoryException if an error occurs.
105    */

106   public Version[] getPredecessors() throws RepositoryException;
107
108   /**
109    * Adds the specified <code>v</code> as a successor of this version.
110    * This is used to create a “merge” within the version graph (not to be
111    * confused with the <code>Node.merge</code> method which operates on
112    * workspace nodes). A workspace <code>Node.merge<code> may be used to
113    * produce the appropriate node to be checked-in and then added as a
114    * successor to more than one existing version, using this <code>addSuccessor</code> method,
115    * thus performing both the semantic and the version graph parts of the
116    * full “merge” operation.
117    * <p/>
118    * This method corresponds to adding a reference to an <code>nt:version</code>
119    * node to the <code>jcr:successors</code> multi-value property of the
120    * <code>nt:version</code> node that represents this version.
121    * If <code>v<code> is not already in the same version history as
122    * this node or if adding <code>v<code> as a successor would create a
123    * cycle in the version history then an <code>VersionException</code> is thrown.
124    *
125    * @param v a <code>Version</code> object.
126    * @throws RepositoryException if an error occurs.
127    */

128   public void addSuccessor(Version v) throws VersionException, RepositoryException;
129
130   /**
131    * Removes <code>v</code> from the successors of this version. This
132    * method corresponds to removing a reference to an <code>nt:version</code>
133    * node from the <code>jcr:successors</code> multi-value property of the
134    * <code>nt:version</code> node that represents this version. If
135    * <code>v</code> is not currently a direct successor of this node then an
136    * <code>VersionException</code> is thrown.
137    *
138    * @param v a <code>Version</code> object.
139    * @throws RepositoryException if an error occurs.
140    */

141   public void removeSuccessor(Version v) throws VersionException, RepositoryException;
142 }
143
Popular Tags