KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > coci > CheckOutCheckInService


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.service.cmr.coci;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.alfresco.service.cmr.repository.NodeRef;
23 import org.alfresco.service.namespace.QName;
24
25
26 /**
27  * Version operations service interface
28  *
29  * @author Roy Wetherall
30  */

31 public interface CheckOutCheckInService
32 {
33     /**
34      * Checks out the given node placing a working copy in the destination specified.
35      * <p>
36      * When a node is checked out a read-only lock is placed on the origional node and
37      * a working copy is placed in the destination specified.
38      * <p>
39      * The copy aspect is applied to the working copy so that the origional node can be
40      * identified.
41      * <p>
42      * The working copy aspect is applied to the working copy so that it can be identified
43      * as the working copy of a checked out node.
44      * <p>
45      * The working copy node reference is returned to the caller.
46      *
47      * @param nodeRef a reference to the node to checkout
48      * @param destinationParentNodeRef the destination node reference for the working
49      * copy
50      * @param destinationAssocTypeQName the destination child assoc type for the working
51      * copy
52      * @param destinationAssocQName the destination child assoc qualified name for
53      * the working copy
54      * @return node reference to the created working copy
55      */

56     public NodeRef checkout(
57             NodeRef nodeRef,
58             NodeRef destinationParentNodeRef,
59             QName destinationAssocTypeQName,
60             QName destinationAssocQName);
61     
62     /**
63      * Checks out the working copy of the node into the same parent node with the same child
64      * associations details.
65      *
66      * @see CheckOutCheckInService#checkout(NodeRef, NodeRef, QName, QName)
67      *
68      * @param nodeRef a reference to the node to checkout
69      * @return a node reference to the created working copy
70      */

71     public NodeRef checkout(NodeRef nodeRef);
72     
73     /**
74      * Checks in the working node specified.
75      * <p>
76      * When a working copy is checked in the current state of the working copy is copyied to the
77      * origional node. This will include any content updated in the working node.
78      * <p>
79      * If version properties are provided the origional node will be versioned and updated accordingly.
80      * <p>
81      * If a content Url is provided it will be used to update the content of the working node before the
82      * checkin opertaion takes place.
83      * <p>
84      * Once the operation has completed the read lock applied to the origional node during checkout will
85      * be removed and the working copy of the node deleted from the repository, unless the operation is
86      * instructed to keep the origional node checked out. In which case the lock and the working copy will
87      * remain.
88      * <p>
89      * The node reference to the origional node is returned.
90      *
91      * @param workingCopyNodeRef the working copy node reference
92      * @param versionProperties the version properties. If null is passed then the origional node
93      * is NOT versioned during the checkin operation.
94      * @param contentUrl a content url that should be set on the working copy before
95      * the checkin opertation takes place. If null then the current working
96      * copy content is copied back to the origional node.
97      * @param keepCheckedOut indicates whether the node should remain checked out after the checkin
98      * has taken place. When the node remains checked out the working node
99      * reference remains the same.
100      * @return the node reference to the origional node, updated with the checked in
101      * state
102      */

103     public NodeRef checkin(
104             NodeRef workingCopyNodeRef,
105             Map JavaDoc<String JavaDoc,Serializable JavaDoc> versionProperties,
106             String JavaDoc contentUrl,
107             boolean keepCheckedOut);
108     
109     /**
110      * By default the checked in node is not keep checked in.
111      *
112      * @see VersionOperationsService#checkin(NodeRef, HashMap<String,Serializable>, String, boolean)
113      *
114      * @param workingCopyNodeRef the working copy node reference
115      * @param versionProperties the version properties. If null is passed then the origional node
116      * is NOT versioned during the checkin operation.
117      * @param contentUrl a content url that should be set on the working copy before
118      * the checkin opertation takes place. If null then the current working
119      * copy content is copied back to the origional node.
120      * @return the node reference to the origional node, updated with the checked in
121      * state
122      */

123     public NodeRef checkin(
124             NodeRef workingCopyNodeRef,
125             Map JavaDoc<String JavaDoc, Serializable JavaDoc> versionProperties,
126             String JavaDoc contentUrl);
127     
128     /**
129      * If no content url is specified then current content set on the working
130      * copy is understood to be current.
131      *
132      * @see VersionOperationsService#checkin(NodeRef, HashMap<String,Serializable>, String)
133      *
134      * @param workingCopyNodeRef the working copy node reference
135      * @param versionProperties the version properties. If null is passed then the origional node
136      * is NOT versioned during the checkin operation.
137      * @return the node reference to the origional node, updated with the checked in
138      * state
139      */

140     public NodeRef checkin(
141             NodeRef workingCopyNodeRef,
142             Map JavaDoc<String JavaDoc, Serializable JavaDoc> versionProperties);
143     
144     /**
145      * Cancels the checkout for a given working copy.
146      * <p>
147      * The read-only lock on the origional node is removed and the working copy is removed.
148      * <p>
149      * Note that all modification made to the working copy will be lost and the origional node
150      * will remiain unchanged.
151      * <p>
152      * A reference to the origional node reference is returned.
153      *
154      * @param workingCopyNodeRef the working copy node reference
155      * @return the origional node reference
156      */

157     public NodeRef cancelCheckout(NodeRef workingCopyNodeRef);
158     
159     /**
160      * Helper method to retrieve the working copy node reference for a checked out node.
161      * <p>
162      * A null node reference is returned if the node is not checked out.
163      *
164      * @param nodeRef a node reference
165      * @return the working copy node reference or null if none.
166      */

167     public NodeRef getWorkingCopy(NodeRef nodeRef);
168 }
169
Popular Tags