KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > service > cmr > repository > CopyService


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.repository;
18
19 import org.alfresco.service.namespace.QName;
20
21 /**
22  * Node operations service interface.
23  * <p>
24  * This interface provides methods to copy nodes within and across workspaces and to
25  * update the state of a node, with that of another node, within and across workspaces.
26  *
27  * @author Roy Wetherall
28  */

29 public interface CopyService
30 {
31     /**
32      * Creates a copy of the given node.
33      * <p>
34      * If the new node resides in a different workspace the new node will
35      * have the same id.
36      * <p>
37      * If the new node resides in the same workspace then
38      * the new node will have the Copy aspect applied to it which will
39      * reference the origional node.
40      * <p>
41      * The aspects applied to source node will also be applied to destination node
42      * and all the property value will be duplicated accordingly. This is with the
43      * exception of the aspects that have been marked as having 'Non-Transferable State'.
44      * In this case the aspect will be applied to the copy, but the properties will take
45      * on the default values.
46      * <p>
47      * Child associations are copied onto the destination node. If the child of
48      * copied association is not present in the destination workspace the child
49      * association is not copied. This is unless is has been specfied that the
50      * children of the source node should also be copied.
51      * <p>
52      * Target associations are copied to the destination node. If the target of the
53      * association is not present in the destination workspace then the association is
54      * not copied.
55      * <p>
56      * Source association are not copied.
57      *
58      * @param sourceNodeRef the node reference used as the source of the copy
59      * @param destinationParent the intended parent of the new node
60      * @param destinationAssocTypeQName the type of the new child assoc
61      * @param destinationQName the qualified name of the child association from the
62      * parent to the new node
63      *
64      * @return the new node reference
65      */

66     public NodeRef copy(
67             NodeRef sourceNodeRef,
68             NodeRef destinationParent,
69             QName destinationAssocTypeQName,
70             QName destinationQName,
71             boolean copyChildren);
72     
73     /**
74      * By default children of the source node are not copied.
75      *
76      * @see NodeCopyService#copy(NodeRef, NodeRef, QName, QName, boolean)
77      *
78      * @param sourceNodeRef the node reference used as the source of the copy
79      * @param destinationParent the intended parent of the new node
80      * @param destinationAssocTypeQName the type of the new child assoc
81      * @param destinationQName the qualified name of the child association from the
82      * parent to the new node
83      * @return the new node reference
84      */

85     public NodeRef copy(
86             NodeRef sourceNodeRef,
87             NodeRef destinationParent,
88             QName destinationAssocTypeQName,
89             QName destinationQName);
90     
91     /**
92      * Copies the state of one node on top of another.
93      * <p>
94      * The state of destination node is overlayed with the state of the
95      * source node. Any conflicts are resolved by setting the state to
96      * that of the source node.
97      * <p>
98      * If data (for example an association) does not exist on the source
99      * node, but does exist on the detination node this data is NOT deleted
100      * from the destination node.
101      * <p>
102      * Child associations and target associations are updated on the destination
103      * based on the current state of the source node.
104      * <p>
105      * If the node that either a child or target association points to on the source
106      * node is not present in the destinations workspace then the association is not
107      * updated to the destination node.
108      * <p>
109      * All aspects found on the source node are applied to the destination node where
110      * missing. The properties of the apects are updated accordingly except in the case
111      * where the aspect has been marked as having 'Non-Transferable State'. In this case
112      * aspect properties will take on the values already assigned to them in the
113      * destination node.
114      *
115      * @param sourceNodeRef the source node reference
116      * @param destinationNodeRef the destination node reference
117      */

118     public void copy(NodeRef sourceNodeRef, NodeRef destinationNodeRef);
119 }
120
Popular Tags