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.io.Serializable;
22 import java.util.Set;
23
24 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
25
26 /**
27 * An <code>OperationContext</code> object defines the filtering, paging and
28 * caching of an operation.
29 */
30 public interface OperationContext extends Serializable {
31
32 /**
33 * Returns the current filter.
34 *
35 * @return a set of <em>query names</em>
36 */
37 Set<String> getFilter();
38
39 /**
40 * Sets the current filter.
41 *
42 * @param propertyFilter
43 * a set of <em>query names</em>
44 */
45 void setFilter(Set<String> propertyFilter);
46
47 /**
48 * Sets the current filter.
49 *
50 * @param propertyFilter
51 * a comma separated string of <em>query names</em> or "*" for
52 * all properties or {@code null} to let the repository determine
53 * a set of properties
54 */
55 void setFilterString(String propertyFilter);
56
57 /**
58 * Returns the filter extended by cmis:objectId, cmis:objectTypeId and
59 * cmis:baseTypeId.
60 */
61 String getFilterString();
62
63 /**
64 * Sets if secondary type properties should be loaded.
65 *
66 * @cmis 1.1
67 */
68 void setLoadSecondaryTypeProperties(boolean load);
69
70 /**
71 * Returns is secondary type properties should be loaded.
72 *
73 * @cmis 1.1
74 */
75 boolean loadSecondaryTypeProperties();
76
77 /**
78 * Returns if allowable actions should returned.
79 */
80 boolean isIncludeAllowableActions();
81
82 /**
83 * Sets if allowable actions should returned.
84 */
85 void setIncludeAllowableActions(boolean include);
86
87 /**
88 * Returns if ACLs should returned.
89 */
90 boolean isIncludeAcls();
91
92 /**
93 * Sets if ACLs should returned.
94 */
95 void setIncludeAcls(boolean include);
96
97 /**
98 * Returns which relationships should be returned.
99 */
100 IncludeRelationships getIncludeRelationships();
101
102 /**
103 * Sets which relationships should be returned.
104 */
105 void setIncludeRelationships(IncludeRelationships include);
106
107 /**
108 * Returns if policies should returned.
109 */
110 boolean isIncludePolicies();
111
112 /**
113 * Sets if policies should returned.
114 */
115 void setIncludePolicies(boolean include);
116
117 /**
118 * Returns the current rendition filter. (See CMIS spec
119 * "2.2.1.2.4.1 Rendition Filter Grammar")
120 *
121 * @return a set of rendition filter terms
122 */
123 Set<String> getRenditionFilter();
124
125 /**
126 * Sets the current rendition filter. (See CMIS spec
127 * "2.2.1.2.4.1 Rendition Filter Grammar")
128 *
129 * @param renditionFilter
130 * a set of rendition filter terms
131 */
132 void setRenditionFilter(Set<String> renditionFilter);
133
134 /**
135 * Sets the current rendition filter. (See CMIS spec
136 * "2.2.1.2.4.1 Rendition Filter Grammar")
137 *
138 * @param renditionFilter
139 * a comma separated list of rendition filter terms
140 */
141 void setRenditionFilterString(String renditionFilter);
142
143 /**
144 * Returns the current rendition filter. (See CMIS spec
145 * "2.2.1.2.4.1 Rendition Filter Grammar")
146 *
147 * @return a comma separated list of rendition filter terms
148 */
149 String getRenditionFilterString();
150
151 /**
152 * Returns if path segments should returned.
153 */
154 boolean isIncludePathSegments();
155
156 /**
157 * Sets if path segments should returned.
158 */
159 void setIncludePathSegments(boolean include);
160
161 /**
162 * Returns the order by rule for operations that return lists.
163 *
164 * @return a comma-separated list of <em>query names</em> and the ascending
165 * modifier "ASC" or the descending modifier "DESC" for each query
166 * name
167 */
168 String getOrderBy();
169
170 /**
171 * Sets the order by rule for operations that return lists.
172 *
173 * @param orderBy
174 * a comma-separated list of <em>query names</em> and the
175 * ascending modifier "ASC" or the descending modifier "DESC" for
176 * each query name
177 */
178 void setOrderBy(String orderBy);
179
180 /**
181 * Return if caching is enabled.
182 */
183 boolean isCacheEnabled();
184
185 /**
186 * Enables or disables the cache.
187 */
188 void setCacheEnabled(boolean cacheEnabled);
189
190 /**
191 * Returns a key for this OperationContext object that is used for caching.
192 */
193 String getCacheKey();
194
195 /**
196 * Set the max number of items per batch for operations that return lists.
197 *
198 * This option does not restrict the number of returned items. To retrieve
199 * an excerpt (page) of a list, see {@link ItemIterable#getPage(int)}.
200 *
201 * @param maxItemsPerPage
202 * max number of items (must be positive)
203 */
204 void setMaxItemsPerPage(int maxItemsPerPage);
205
206 /**
207 * Returns the current max number of items per batch.
208 */
209 int getMaxItemsPerPage();
210 }