View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.chemistry.opencmis.client.api;
20  
21  import java.util.List;
22  import java.util.Map;
23  
24  import org.apache.chemistry.opencmis.commons.data.Ace;
25  import org.apache.chemistry.opencmis.commons.data.ContentStream;
26  import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
27  import org.apache.chemistry.opencmis.commons.enums.VersioningState;
28  
29  /**
30   * CMIS folder interface.
31   * 
32   * @cmis 1.0
33   */
34  public interface Folder extends FileableCmisObject, FolderProperties {
35  
36      /**
37       * Returns the object type as a folder type.
38       * 
39       * @return the folder type
40       * 
41       * @throws ClassCastException
42       *             if the object type is not a folder type
43       * 
44       * @cmis 1.0
45       */
46      FolderType getFolderType();
47  
48      // object service
49  
50      /**
51       * Creates a new document in this folder.
52       * 
53       * The stream in {@code contentStream} is consumed but not closed by this
54       * method.
55       * 
56       * @return the new document object or {@code null} if the parameter
57       *         {@code context} was set to {@code null}
58       * 
59       * @cmis 1.0
60       */
61      Document createDocument(Map<String, ?> properties, ContentStream contentStream, VersioningState versioningState,
62              List<Policy> policies, List<Ace> addAces, List<Ace> removeAces, OperationContext context);
63  
64      /**
65       * Creates a new document in this folder.
66       * 
67       * The stream in {@code contentStream} is consumed but not closed by this
68       * method.
69       * 
70       * @return the new document object
71       * 
72       * @cmis 1.0
73       */
74      Document createDocument(Map<String, ?> properties, ContentStream contentStream, VersioningState versioningState);
75  
76      /**
77       * Creates a new document from a source document in this folder.
78       * 
79       * @return the new document object or {@code null} if the parameter
80       *         {@code context} was set to {@code null}
81       * 
82       * @cmis 1.0
83       */
84      Document createDocumentFromSource(ObjectId source, Map<String, ?> properties, VersioningState versioningState,
85              List<Policy> policies, List<Ace> addAces, List<Ace> removeAces, OperationContext context);
86  
87      /**
88       * Creates a new document from a source document in this folder.
89       * 
90       * @return the new document object
91       * 
92       * @cmis 1.0
93       */
94      Document createDocumentFromSource(ObjectId source, Map<String, ?> properties, VersioningState versioningState);
95  
96      /**
97       * Creates a new subfolder in this folder.
98       * 
99       * @return the new folder object or {@code null} if the parameter
100      *         {@code context} was set to {@code null}
101      * 
102      * @cmis 1.0
103      */
104     Folder createFolder(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
105             OperationContext context);
106 
107     /**
108      * Creates a new subfolder in this folder.
109      * 
110      * @return the new folder object
111      * 
112      * @cmis 1.0
113      */
114     Folder createFolder(Map<String, ?> properties);
115 
116     /**
117      * Creates a new policy in this folder.
118      * 
119      * @return the new policy object or {@code null} if the parameter
120      *         {@code context} was set to {@code null}
121      * 
122      * @cmis 1.0
123      */
124     Policy createPolicy(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
125             OperationContext context);
126 
127     /**
128      * Creates a new item in this folder.
129      * 
130      * @return the new item object
131      * 
132      * @cmis 1.1
133      */
134     Item createItem(Map<String, ?> properties);
135 
136     /**
137      * Creates a new item in this folder.
138      * 
139      * @return the new item object or {@code null} if the parameter
140      *         {@code context} was set to {@code null}
141      * 
142      * @cmis 1.1
143      */
144     Item createItem(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
145             OperationContext context);
146 
147     /**
148      * Creates a new policy in this folder.
149      * 
150      * @return the new policy object
151      * 
152      * @cmis 1.0
153      */
154     Policy createPolicy(Map<String, ?> properties);
155 
156     /**
157      * Deletes this folder and all subfolders.
158      * 
159      * @return a list of object IDs which failed to be deleted
160      * 
161      * @cmis 1.0
162      */
163     List<String> deleteTree(boolean allversions, UnfileObject unfile, boolean continueOnFailure);
164 
165     // navigation service
166 
167     /**
168      * Gets the folder tree starting with this folder.
169      * 
170      * @cmis 1.0
171      */
172     List<Tree<FileableCmisObject>> getFolderTree(int depth);
173 
174     /**
175      * Gets the folder tree starting with this folder using the given
176      * {@link OperationContext}.
177      * 
178      * @cmis 1.0
179      */
180     List<Tree<FileableCmisObject>> getFolderTree(int depth, OperationContext context);
181 
182     /**
183      * Gets the folder descendants starting with this folder.
184      * 
185      * @cmis 1.0
186      */
187     List<Tree<FileableCmisObject>> getDescendants(int depth);
188 
189     /**
190      * Gets the folder descendants starting with this folder using the given
191      * {@link OperationContext}.
192      * 
193      * @cmis 1.0
194      */
195     List<Tree<FileableCmisObject>> getDescendants(int depth, OperationContext context);
196 
197     /**
198      * Returns the children of this folder.
199      * 
200      * @cmis 1.0
201      */
202     ItemIterable<CmisObject> getChildren();
203 
204     /**
205      * Returns the children of this folder using the given
206      * {@link OperationContext}.
207      * 
208      * @cmis 1.0
209      */
210     ItemIterable<CmisObject> getChildren(OperationContext context);
211 
212     /**
213      * Returns if the folder is the root folder.
214      * 
215      * @return {@code true} if the folder is the root folder, {@code false}
216      *         otherwise
217      * 
218      * @cmis 1.0
219      */
220     boolean isRootFolder();
221 
222     /**
223      * Gets the parent folder object.
224      * 
225      * @return the parent folder object or {@code null} if the folder is the
226      *         root folder.
227      * 
228      * @cmis 1.0
229      */
230     Folder getFolderParent();
231 
232     /**
233      * Returns the path of the folder.
234      * 
235      * @return the absolute folder path
236      * 
237      * @cmis 1.0
238      */
239     String getPath();
240 
241     /**
242      * Returns all checked out documents in this folder.
243      * 
244      * @cmis 1.0
245      */
246     ItemIterable<Document> getCheckedOutDocs();
247 
248     /**
249      * Returns all checked out documents in this folder using the given
250      * {@link OperationContext}.
251      * 
252      * @cmis 1.0
253      */
254     ItemIterable<Document> getCheckedOutDocs(OperationContext context);
255 }