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.
31 * <p>
32 * See Domain Model 2.5
33 */
34 public interface Folder extends FileableCmisObject, FolderProperties {
35
36 TransientFolder getTransientFolder();
37
38 // object service
39
40 /**
41 * Creates a new document in this folder.
42 *
43 * @return the new document object or <code>null</code> if the parameter
44 * <code>context</code> was set to <code>null</code>
45 */
46 Document createDocument(Map<String, ?> properties, ContentStream contentStream, VersioningState versioningState,
47 List<Policy> policies, List<Ace> addAces, List<Ace> removeAces, OperationContext context);
48
49 /**
50 * Creates a new document in this folder.
51 *
52 * @return the new document object
53 */
54 Document createDocument(Map<String, ?> properties, ContentStream contentStream, VersioningState versioningState);
55
56 /**
57 * Creates a new document from a source document in this folder.
58 *
59 * @return the new document object or <code>null</code> if the parameter
60 * <code>context</code> was set to <code>null</code>
61 */
62 Document createDocumentFromSource(ObjectId source, Map<String, ?> properties, VersioningState versioningState,
63 List<Policy> policies, List<Ace> addAces, List<Ace> removeAces, OperationContext context);
64
65 /**
66 * Creates a new document from a source document in this folder.
67 *
68 * @return the new document object
69 */
70 Document createDocumentFromSource(ObjectId source, Map<String, ?> properties, VersioningState versioningState);
71
72 /**
73 * Creates a new subfolder in this folder.
74 *
75 * @return the new folder object or <code>null</code> if the parameter
76 * <code>context</code> was set to <code>null</code>
77 */
78 Folder createFolder(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
79 OperationContext context);
80
81 /**
82 * Creates a new subfolder in this folder.
83 *
84 * @return the new folder object
85 */
86 Folder createFolder(Map<String, ?> properties);
87
88 /**
89 * Creates a new policy in this folder.
90 *
91 * @return the new policy object or <code>null</code> if the parameter
92 * <code>context</code> was set to <code>null</code>
93 */
94 Policy createPolicy(Map<String, ?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces,
95 OperationContext context);
96
97 /**
98 * Creates a new policy in this folder.
99 *
100 * @return the new policy object
101 */
102 Policy createPolicy(Map<String, ?> properties);
103
104 /**
105 * Deletes this folder and all subfolders.
106 *
107 * @return a list of object ids which failed to be deleted
108 */
109 List<String> deleteTree(boolean allversions, UnfileObject unfile, boolean continueOnFailure);
110
111 // navigation service
112
113 /**
114 * Gets the folder tree starting with this folder.
115 */
116 List<Tree<FileableCmisObject>> getFolderTree(int depth);
117
118 /**
119 * Gets the folder tree starting with this folder using the given
120 * {@link OperationContext}.
121 */
122 List<Tree<FileableCmisObject>> getFolderTree(int depth, OperationContext context);
123
124 /**
125 * Gets the folder descendants starting with this folder.
126 */
127 List<Tree<FileableCmisObject>> getDescendants(int depth);
128
129 /**
130 * Gets the folder descendants starting with this folder using the given
131 * {@link OperationContext}.
132 */
133 List<Tree<FileableCmisObject>> getDescendants(int depth, OperationContext context);
134
135 /**
136 * Returns the children of this folder.
137 */
138 ItemIterable<CmisObject> getChildren();
139
140 /**
141 * Returns the children of this folder using the given
142 * {@link OperationContext}.
143 */
144 ItemIterable<CmisObject> getChildren(OperationContext context);
145
146 /**
147 * Returns if the folder is the root folder.
148 */
149 boolean isRootFolder();
150
151 /**
152 * Gets the parent folder object
153 *
154 * @return the parent folder object or <code>null</code> if the folder is
155 * the root folder.
156 */
157 Folder getFolderParent();
158
159 /**
160 * Returns the path of the folder.
161 */
162 String getPath();
163
164 /**
165 * Returns all checked out documents in this folder.
166 */
167 ItemIterable<Document> getCheckedOutDocs();
168
169 /**
170 * Returns all checked out documents in this folder using the given
171 * {@link OperationContext}.
172 */
173 ItemIterable<Document> getCheckedOutDocs(OperationContext context);
174 }