Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
CommentService |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright 2011 The Kuali Foundation Licensed under the | |
3 | * Educational Community License, Version 2.0 (the "License"); you may | |
4 | * not use this file except in compliance with the License. You may | |
5 | * obtain a copy of the License at | |
6 | * | |
7 | * http://www.osedu.org/licenses/ECL-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, | |
10 | * software distributed under the License is distributed on an "AS IS" | |
11 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
12 | * or implied. See the License for the specific language governing | |
13 | * permissions and limitations under the License. | |
14 | */ | |
15 | ||
16 | package org.kuali.student.r2.core.comment.service; | |
17 | ||
18 | import org.kuali.rice.core.api.criteria.QueryByCriteria; | |
19 | import org.kuali.student.r2.common.dto.ContextInfo; | |
20 | import org.kuali.student.r2.common.dto.StatusInfo; | |
21 | import org.kuali.student.r2.common.dto.ValidationResultInfo; | |
22 | import org.kuali.student.r2.common.exceptions.AlreadyExistsException; | |
23 | import org.kuali.student.r2.common.exceptions.DataValidationErrorException; | |
24 | import org.kuali.student.r2.common.exceptions.DoesNotExistException; | |
25 | import org.kuali.student.r2.common.exceptions.InvalidParameterException; | |
26 | import org.kuali.student.r2.common.exceptions.MissingParameterException; | |
27 | import org.kuali.student.r2.common.exceptions.OperationFailedException; | |
28 | import org.kuali.student.r2.common.exceptions.PermissionDeniedException; | |
29 | import org.kuali.student.r2.common.exceptions.ReadOnlyException; | |
30 | import org.kuali.student.r2.common.exceptions.VersionMismatchException; | |
31 | import org.kuali.student.r2.common.util.constants.CommentServiceConstants; | |
32 | import org.kuali.student.r2.core.comment.dto.CommentInfo; | |
33 | import org.kuali.student.r2.core.comment.dto.TagInfo; | |
34 | ||
35 | import javax.jws.WebParam; | |
36 | import javax.jws.WebService; | |
37 | import javax.jws.soap.SOAPBinding; | |
38 | import java.util.List; | |
39 | ||
40 | /** | |
41 | * The Comment Service allows for the creation and management of user | |
42 | * comments and tags associated with other objects across the system. | |
43 | * | |
44 | * @Version 2.0 | |
45 | * @Author Sri komandur@uw.edu | |
46 | */ | |
47 | ||
48 | @WebService(name = "CommentService", targetNamespace = CommentServiceConstants.NAMESPACE) | |
49 | @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED) | |
50 | public interface CommentService { | |
51 | ||
52 | /** | |
53 | * Retrieves information about a comment. | |
54 | * | |
55 | * @param commentId comment identifier | |
56 | * @param contextInfo Context information containing the principalId and locale | |
57 | * information about the caller of service operation | |
58 | * @return information about a comment | |
59 | * @throws DoesNotExistException specified commentId not found | |
60 | * @throws InvalidParameterException invalid commentId | |
61 | * @throws MissingParameterException commentId, contextInfo not specified | |
62 | * @throws OperationFailedException unable to complete request | |
63 | * @throws PermissionDeniedException authorization failure | |
64 | */ | |
65 | public CommentInfo getComment(@WebParam(name = "commentId") String commentId, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
66 | ||
67 | /** | |
68 | * Retrieves a list of Comments corresponding to the | |
69 | * given list of Comment Ids | |
70 | * | |
71 | * @param commentIds list of Comments to be retrieved | |
72 | * @param contextInfo Context information containing the principalId and locale | |
73 | * information about the caller of service operation | |
74 | * @return list of Comment information | |
75 | * @throws DoesNotExistException an commentKey in list not found | |
76 | * @throws InvalidParameterException invalid commentKey | |
77 | * @throws MissingParameterException commentIds, contextInfo not specified | |
78 | * @throws OperationFailedException unable to complete request | |
79 | * @throws PermissionDeniedException authorization failure | |
80 | */ | |
81 | public List<CommentInfo> getCommentsByIds(@WebParam(name = "commentIds") List<String> commentIds, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
82 | ||
83 | /** | |
84 | * Retrieves a list of Comments of the specified type. | |
85 | * | |
86 | * @param commentTypeKey type to be retrieved | |
87 | * @param contextInfo Context information containing the principalId and locale | |
88 | * information about the caller of service operation | |
89 | * @return a list of Comment keys | |
90 | * @throws InvalidParameterException invalid commentTypeKey | |
91 | * @throws MissingParameterException commentTypeKey, contextInfo not specified | |
92 | * @throws OperationFailedException unable to complete request | |
93 | * @throws PermissionDeniedException authorization failure | |
94 | */ | |
95 | public List<String> getCommentIdsByType(@WebParam(name = "commentTypeKey") String commentTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
96 | ||
97 | /** | |
98 | * Retrieves comment information for a reference. The expected behavior is that if the caller is not authorized | |
99 | * to invoke the getCommentsByReferenceAndType operation, a PERMISSION_DENIED error is returned. | |
100 | * Assuming that the caller is authorized to invoke getCommentsByReferenceAndType, only comments that the caller | |
101 | * is authorized to view are included in the returned commentInfoList; comments that the caller is unauthorized | |
102 | * to view are filtered out of the return parameter. | |
103 | * | |
104 | * @param referenceId reference identifier | |
105 | * @param referenceTypeKey reference type | |
106 | * @param contextInfo Context information containing the principalId and locale | |
107 | * information about the caller of service operation | |
108 | * @return Comment information | |
109 | * @throws DoesNotExistException specified referenceId, referenceTypeKey not found | |
110 | * @throws InvalidParameterException invalid referenceId, referenceTypeKey | |
111 | * @throws MissingParameterException referenceId, referenceTypeKey, contextInfo not specified | |
112 | * @throws OperationFailedException unable to complete request | |
113 | * @throws PermissionDeniedException authorization failure | |
114 | */ | |
115 | public List<CommentInfo> getCommentsByReferenceAndType(@WebParam(name = "referenceId") String referenceId, @WebParam(name = "referenceTypeKey") String referenceTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
116 | ||
117 | /** | |
118 | * Searches for Comments based on the criteria and returns a list | |
119 | * of Comment identifiers which match the search criteria. | |
120 | * | |
121 | * @param criteria the search criteria | |
122 | * @param contextInfo Context information containing the principalId and locale | |
123 | * information about the caller of service operation | |
124 | * @return list of Comment Ids | |
125 | * @throws InvalidParameterException invalid parameter | |
126 | * @throws MissingParameterException criteria, contextInfo not specified | |
127 | * @throws OperationFailedException unable to complete request | |
128 | * @throws PermissionDeniedException authorization failure | |
129 | */ | |
130 | public List<String> searchForCommentIds(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
131 | ||
132 | /** | |
133 | * Searches for Comments based on the criteria and returns a list of | |
134 | * Comments which match the search criteria. | |
135 | * | |
136 | * @param criteria the search criteria | |
137 | * @param contextInfo Context information containing the principalId and locale | |
138 | * information about the caller of service operation | |
139 | * @return list of Comment information | |
140 | * @throws InvalidParameterException invalid parameter | |
141 | * @throws MissingParameterException criteria, contextInfo not specified | |
142 | * @throws OperationFailedException unable to complete request | |
143 | * @throws PermissionDeniedException authorization failure | |
144 | */ | |
145 | public List<CommentInfo> searchForComments(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
146 | ||
147 | /** | |
148 | * Adds a comment to a reference. | |
149 | * | |
150 | * @param referenceId identifier of reference | |
151 | * @param referenceTypeKey reference type | |
152 | * @param commentTypeKey comment type | |
153 | * @param commentInfo detailed information about the comment | |
154 | * @param contextInfo Context information containing the principalId and locale | |
155 | * information about the caller of service operation | |
156 | * @return detailed information about the comment | |
157 | * @throws DataValidationErrorException One or more values invalid for this operation | |
158 | * @throws DoesNotExistException Id or Key does not exist | |
159 | * @throws InvalidParameterException One or more parameters invalid | |
160 | * @throws MissingParameterException One or more parameters missing | |
161 | * @throws OperationFailedException unable to complete request | |
162 | * @throws PermissionDeniedException authorization failure | |
163 | * @throws ReadOnlyException attempted update of readonly data | |
164 | */ | |
165 | public CommentInfo createComment(@WebParam(name = "referenceId") String referenceId, @WebParam(name = "referenceTypeKey") String referenceTypeKey, @WebParam(name = "commentTypeKey") String commentTypeKey, @WebParam(name = "commentInfo") CommentInfo commentInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException; | |
166 | ||
167 | /** | |
168 | * Updates a comment for a reference. | |
169 | * | |
170 | * @param commentId comment identifier | |
171 | * @param commentInfo detailed information about the comment | |
172 | * @param contextInfo Context information containing the principalId and locale | |
173 | * information about the caller of service operation | |
174 | * @return detailed information about the comment | |
175 | * @throws DataValidationErrorException One or more values invalid for this operation | |
176 | * @throws DoesNotExistException comment does not exist | |
177 | * @throws InvalidParameterException One or more parameters invalid | |
178 | * @throws MissingParameterException commentId, commentInfo not specified | |
179 | * @throws OperationFailedException unable to complete request | |
180 | * @throws PermissionDeniedException authorization failure | |
181 | * @throws ReadOnlyException attempted update of readonly data | |
182 | * @throws VersionMismatchException The action was attempted on an out of date version. | |
183 | */ | |
184 | public CommentInfo updateComment(@WebParam(name = "commentId") String commentId, @WebParam(name = "commentInfo") CommentInfo commentInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, DoesNotExistException, VersionMismatchException, ReadOnlyException; | |
185 | ||
186 | /** | |
187 | * Removes a comment from a reference. | |
188 | * | |
189 | * @param commentId identifier of the comment | |
190 | * @param contextInfo Context information containing the principalId and locale | |
191 | * information about the caller of service operation | |
192 | * @return status of the operation (success, failed) | |
193 | * @throws DoesNotExistException commentId, referenceId does not exist | |
194 | * @throws InvalidParameterException One or more parameters invalid | |
195 | * @throws MissingParameterException commentId, contextInfo not specified | |
196 | * @throws OperationFailedException unable to complete request | |
197 | * @throws PermissionDeniedException authorization failure | |
198 | */ | |
199 | public StatusInfo deleteComment(@WebParam(name = "commentId") String commentId, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
200 | ||
201 | /** | |
202 | * Removes all comments associated with a single reference | |
203 | * | |
204 | * @param referenceId identifier of the reference | |
205 | * @param referenceTypeKey reference type | |
206 | * @param contextInfo Context information containing the principalId and locale | |
207 | * information about the caller of service operation | |
208 | * @return status of the operation (success, failed) | |
209 | * @throws DoesNotExistException referenceId does not exist | |
210 | * @throws InvalidParameterException One or more parameters invalid | |
211 | * @throws MissingParameterException referenceId, referenceTypeKey not specified | |
212 | * @throws OperationFailedException unable to complete request | |
213 | * @throws PermissionDeniedException authorization failure | |
214 | */ | |
215 | public StatusInfo deleteCommentsByReference(@WebParam(name = "referenceId") String referenceId, @WebParam(name = "referenceTypeKey") String referenceTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
216 | ||
217 | /** | |
218 | * Validates a comment. Depending on the value of validationType, this validation could be limited to tests on | |
219 | * just the current object and its directly contained sub-objects or expanded to perform all tests related | |
220 | * to this object. If an identifier is present for the comment (and/or one of its contained sub-objects) | |
221 | * and a record is found for that identifier, the validation checks if the comment can be shifted to the new | |
222 | * values. If an identifier is not present or a record cannot be found for the identifier, it is assumed that the | |
223 | * record does not exist and as such, the checks performed will be much shallower, typically mimicking those | |
224 | * performed by setting the validationType to the current object. | |
225 | * | |
226 | * @param validationTypeKey identifier of the extent of validation | |
227 | * @param commentInfo comment information to be tested | |
228 | * @param contextInfo Context information containing the principalId and locale | |
229 | * information about the caller of service operation | |
230 | * @return results from performing the validation | |
231 | * @throws DoesNotExistException validationTypeKey not found | |
232 | * @throws InvalidParameterException invalid validationTypeKey, commentInfo | |
233 | * @throws MissingParameterException validationTypeKey, commentInfo, contextInfo not specified | |
234 | * @throws OperationFailedException unable to complete request | |
235 | */ | |
236 | public List<ValidationResultInfo> validateComment(@WebParam(name = "validationTypeKey") String validationTypeKey, @WebParam(name = "commentInfo") CommentInfo commentInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException; | |
237 | ||
238 | /** | |
239 | * Retrieves information about a tag. | |
240 | * | |
241 | * @param tagId tag identifier | |
242 | * @param contextInfo Context information containing the principalId and locale | |
243 | * information about the caller of service operation | |
244 | * @return information about a tag | |
245 | * @throws DoesNotExistException specified tagId not found | |
246 | * @throws InvalidParameterException invalid tagId | |
247 | * @throws MissingParameterException tagId, contextInfo not specified | |
248 | * @throws OperationFailedException unable to complete request | |
249 | * @throws PermissionDeniedException authorization failure | |
250 | */ | |
251 | public TagInfo getTag(@WebParam(name = "tagId") String tagId, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
252 | ||
253 | ||
254 | /** | |
255 | * Retrieves a list of Tags corresponding to the | |
256 | * given list of Tag keys. | |
257 | * | |
258 | * @param tagIds list of Tags to be retrieved | |
259 | * @param contextInfo Context information containing the principalId and locale | |
260 | * information about the caller of service operation | |
261 | * @return list of Tag information for the given list of Tag Ids | |
262 | * @throws DoesNotExistException an tagKey in list not found | |
263 | * @throws InvalidParameterException invalid tagKey | |
264 | * @throws MissingParameterException tagIds, contextInfo not specified | |
265 | * @throws OperationFailedException unable to complete request | |
266 | * @throws PermissionDeniedException authorization failure | |
267 | */ | |
268 | public List<TagInfo> getTagsByIds(@WebParam(name = "tagIds") List<String> tagIds, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
269 | ||
270 | /** | |
271 | * Retrieves a list of Tags of the specified type. | |
272 | * | |
273 | * @param tagTypeKey type to be retrieved | |
274 | * @param contextInfo Context information containing the principalId and locale | |
275 | * information about the caller of service operation | |
276 | * @return a list of Tag Ids | |
277 | * @throws InvalidParameterException invalid tagTypeKey | |
278 | * @throws MissingParameterException tagTypeKey, contextInfo not specified | |
279 | * @throws OperationFailedException unable to complete request | |
280 | * @throws PermissionDeniedException authorization failure | |
281 | */ | |
282 | public List<String> getTagIdsByType(@WebParam(name = "tagTypeKey") String tagTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
283 | ||
284 | /** | |
285 | * Retrieves tag information for a reference. The expected behavior is that if the caller is not authorized | |
286 | * to invoke the getTags operation, a PERMISSION_DENIED error is returned. Assuming that the caller is authorized | |
287 | * to invoke getTags, only tags that the caller is authorized to view are included in the returned tagInfoList; | |
288 | * tags that the caller is unauthorized to view are filtered out of the return parameter. | |
289 | * | |
290 | * @param referenceId reference identifier | |
291 | * @param referenceTypeKey reference type | |
292 | * @param contextInfo Context information containing the principalId and locale | |
293 | * information about the caller of service operation | |
294 | * @return list of tag information for the given object ref id and type | |
295 | * @throws DoesNotExistException specified referenceId, referenceTypeKey not found | |
296 | * @throws InvalidParameterException invalid referenceId, referenceTypeKey | |
297 | * @throws MissingParameterException referenceId, referenceTypeKey, contextInfo not specified | |
298 | * @throws OperationFailedException unable to complete request | |
299 | * @throws PermissionDeniedException authorization failure | |
300 | */ | |
301 | public List<TagInfo> getTagsByReferenceAndType(@WebParam(name = "referenceId") String referenceId, @WebParam(name = "referenceTypeKey") String referenceTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
302 | ||
303 | /** | |
304 | * Searches for Tags based on the criteria and returns a list | |
305 | * of Tag identifiers which match the search criteria. | |
306 | * | |
307 | * @param criteria the search criteria | |
308 | * @param contextInfo Context information containing the principalId and locale | |
309 | * information about the caller of service operation | |
310 | * @return list of Tag Ids | |
311 | * @throws InvalidParameterException invalid parameter | |
312 | * @throws MissingParameterException criteria, contextInfo not specified | |
313 | * @throws OperationFailedException unable to complete request | |
314 | * @throws PermissionDeniedException authorization failure | |
315 | */ | |
316 | public List<String> searchForTagIds(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
317 | ||
318 | /** | |
319 | * Searches for Tags based on the criteria and returns a list of | |
320 | * Tags which match the search criteria. | |
321 | * | |
322 | * @param criteria the search criteria | |
323 | * @param contextInfo Context information containing the principalId and locale | |
324 | * information about the caller of service operation | |
325 | * @return list of Tag information | |
326 | * @throws InvalidParameterException invalid parameter | |
327 | * @throws MissingParameterException criteria, contextInfo not specified | |
328 | * @throws OperationFailedException unable to complete request | |
329 | * @throws PermissionDeniedException authorization failure | |
330 | */ | |
331 | public List<TagInfo> searchForTags(@WebParam(name = "criteria") QueryByCriteria criteria, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
332 | ||
333 | /** | |
334 | * Adds a tag to a reference. | |
335 | * | |
336 | * @param referenceId identifier of reference | |
337 | * @param referenceTypeKey reference type | |
338 | * @param tagInfo detailed information about the tag | |
339 | * @param contextInfo Context information containing the principalId and locale | |
340 | * information about the caller of service operation | |
341 | * @return detailed information about the tag | |
342 | * @throws DataValidationErrorException One or more values invalid for this operation | |
343 | * @throws DoesNotExistException Id or Key does not exist | |
344 | * @throws AlreadyExistsException tag of that namespace, predicate and value already exists for that | |
345 | * reference id | |
346 | * @throws InvalidParameterException One or more parameters invalid | |
347 | * @throws MissingParameterException referenceId, referenceTypeKey, tagInfo, contextInfo not specified | |
348 | * @throws OperationFailedException unable to complete request | |
349 | * @throws PermissionDeniedException authorization failure | |
350 | * @throws ReadOnlyException attempted update of readonly data | |
351 | */ | |
352 | public TagInfo createTag(@WebParam(name = "referenceId") String referenceId, @WebParam(name = "referenceTypeKey") String referenceTypeKey, @WebParam(name = "tagInfo") TagInfo tagInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, AlreadyExistsException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException; | |
353 | ||
354 | /** | |
355 | * Removes all tags associated with a single reference | |
356 | * | |
357 | * @param referenceId identifier of the reference | |
358 | * @param referenceTypeKey reference type | |
359 | * @param contextInfo Context information containing the principalId and locale | |
360 | * information about the caller of service operation | |
361 | * @return status of the operation (success, failed) | |
362 | * @throws DoesNotExistException tagId, referenceId does not exist | |
363 | * @throws InvalidParameterException One or more parameters invalid | |
364 | * @throws MissingParameterException referenceId, referenceTypeKey, contextInfo not specified | |
365 | * @throws OperationFailedException unable to complete request | |
366 | * @throws PermissionDeniedException authorization failure | |
367 | */ | |
368 | public StatusInfo deleteTagsByReference(@WebParam(name = "referenceId") String referenceId, @WebParam(name = "referenceTypeKey") String referenceTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
369 | ||
370 | /** | |
371 | * Removes a tag from all references to which it is linked. | |
372 | * | |
373 | * @param tagId identifier of the tag | |
374 | * @param contextInfo Context information containing the principalId and locale | |
375 | * information about the caller of service operation | |
376 | * @return status of the operation (success, failed) | |
377 | * @throws DoesNotExistException tagId does not exist | |
378 | * @throws InvalidParameterException One or more parameters invalid | |
379 | * @throws MissingParameterException tagId, contextInfo not specified | |
380 | * @throws OperationFailedException unable to complete request | |
381 | * @throws PermissionDeniedException authorization failure | |
382 | */ | |
383 | public StatusInfo deleteTag(@WebParam(name = "tagId") String tagId, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException; | |
384 | ||
385 | } |