001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kew.api.document;
017
018import org.joda.time.DateTime;
019import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
020import org.kuali.rice.core.api.exception.RiceIllegalStateException;
021import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter;
022import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
023import org.kuali.rice.kew.api.KewApiConstants;
024import org.kuali.rice.kew.api.action.ActionRequest;
025import org.kuali.rice.kew.api.action.ActionTaken;
026import org.kuali.rice.kew.api.document.search.DocumentSearchCriteria;
027import org.kuali.rice.kew.api.document.search.DocumentSearchResults;
028import org.kuali.rice.kew.api.document.node.RouteNodeInstance;
029
030import javax.jws.WebMethod;
031import javax.jws.WebParam;
032import javax.jws.WebResult;
033import javax.jws.WebService;
034import javax.jws.soap.SOAPBinding;
035import javax.xml.bind.annotation.XmlElement;
036import javax.xml.bind.annotation.XmlElementWrapper;
037import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
038import java.math.BigDecimal;
039import java.util.List;
040import java.util.Map;
041
042/**
043 * TODO ... annotate for JAX-WS! 
044 * 
045 * @author Kuali Rice Team (rice.collab@kuali.org)
046 */
047@WebService(name = "workflowDocumentService", targetNamespace = KewApiConstants.Namespaces.KEW_NAMESPACE_2_0)
048@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
049public interface WorkflowDocumentService {
050
051    /**
052     * Gets a {@link Document} from a documentId.
053     *
054     * <p>
055     *   This method will return null if the Document does not exist.
056     * </p>
057     *
058     * @param documentId the unique id of the document to return
059     * @return the document with the passed in id value
060     * @throws RiceIllegalArgumentException if {@code documentId} is null
061     */
062    @WebMethod(operationName = "getDocument")
063    @WebResult(name = "document")
064        Document getDocument(@WebParam(name = "documentId") String documentId) throws RiceIllegalArgumentException;
065
066    /**
067     * Returns a boolean depending on if a {@link Document} exists with the specified documentId
068     *
069     * <p>
070     *   This method will return false if the responsibility does not exist.
071     * </p>
072     *
073     * @param documentId the unique id of the document to check for existence
074     * @return boolean value representative of whether the document exists
075     * @throws RiceIllegalArgumentException if {@code documentId} is null
076     */
077    @WebMethod(operationName = "doesDocumentExist")
078    @WebResult(name = "document")
079        boolean doesDocumentExist(@WebParam(name = "documentId") String documentId)
080            throws RiceIllegalArgumentException;
081
082    /**
083     * Gets {@link DocumentContent} from a documentId.
084     *
085     * <p>
086     *   This method will return null if the document does not exist.
087     * </p>
088     *
089     * @param documentId the unique id of the document content to return
090     * @return the documentContent with the passed in id value
091     * @throws RiceIllegalArgumentException if {@code documentId} is null
092     */
093    @WebMethod(operationName = "getDocumentContent")
094    @WebResult(name = "documentContent")
095        DocumentContent getDocumentContent(@WebParam(name = "documentId") String documentId)
096            throws RiceIllegalArgumentException;
097
098    /**
099     * Returns the name of the document type used by the document with the given id.
100     *
101     * @param documentId the id of the document for which to fetch the document type name, must not be null or blank
102     * @return the name of the document type for the document with the given id, will never return a null or blank value
103     * @throws RiceIllegalArgumentException if {@code documentId} is null or if the document id does not resolve to a
104     *         valid document from which a document type name can be fetched
105     *
106     * @since 2.4
107     */
108    @WebMethod(operationName = "getDocumentTypeName")
109    @WebResult(name = "documentTypeName")
110    String getDocumentTypeName(@WebParam(name = "documentId") String documentId) throws RiceIllegalArgumentException;
111
112    /**
113     * Gets a list of root ActionRequests for a given documentId
114     *
115     * @param documentId the unique id of a document
116     *
117     * @return the list of root ActionRequests for a given documentId
118     *
119     * @throws RiceIllegalArgumentException if {@code documentId} is null
120     */
121    @WebMethod(operationName = "getRootActionRequests")
122    @XmlElementWrapper(name = "rootActionRequests", required = true)
123    @XmlElement(name = "rootActionRequest", required = false)
124    @WebResult(name = "rootActionRequests")
125        List<ActionRequest> getRootActionRequests(@WebParam(name = "documentId") String documentId)
126            throws RiceIllegalArgumentException;
127    
128    /**
129     * Gets a list of ActionRequests which are pending for a given documentId
130     * 
131     * @since 2.1
132     * @param documentId the unique id of a document
133     * @return the list of pending ActionRequests for a given documentId
134     * @throws RiceIllegalArgumentException if {@code documentId} is null
135     */
136    @WebMethod(operationName = "getPendingActionRequests")
137    @XmlElementWrapper(name = "pendingActionRequests", required = true)
138    @XmlElement(name = "pendingActionRequest", required = false)
139    @WebResult(name = "pendingActionRequests")
140    List<ActionRequest> getPendingActionRequests(String documentId);
141
142    /**
143     * Gets a list of ActionRequests for a given documentId, nodeName and principalId
144     *
145     * @param documentId the unique id of a document
146     * @param nodeName the name of a RouteNode
147     * @param principalId the unique id of a principal
148     *
149     * @return the list of ActionRequests for a given documentId, nodeName, and principalId
150     *
151     * @throws RiceIllegalArgumentException if {@code documentId} is null
152     */
153    @WebMethod(operationName = "getActionRequestsForPrincipalAtNode")
154    @XmlElementWrapper(name = "actionRequests", required = true)
155    @XmlElement(name = "actionRequests", required = false)
156    @WebResult(name = "actionRequests")
157        List<ActionRequest> getActionRequestsForPrincipalAtNode(@WebParam(name = "documentId") String documentId,
158            @WebParam(name = "nodeName") String nodeName, @WebParam(name = "principalId") String principalId)
159            throws RiceIllegalArgumentException;
160
161    /**
162     * Gets a list of past {@link ActionTaken} of a {@link Document} with the given documentId
163     *
164     * @param documentId the unique id of a document
165     *
166     * @return the list of past ActionTakens for a given documentId
167     *
168     * @throws RiceIllegalArgumentException if {@code documentId} is null
169     */
170    @WebMethod(operationName = "getActionsTaken")
171    @XmlElementWrapper(name = "actionsTaken", required = true)
172    @XmlElement(name = "actionTaken", required = false)
173    @WebResult(name = "actionsTaken")
174        List<ActionTaken> getActionsTaken(@WebParam(name = "documentId") String documentId)
175            throws RiceIllegalArgumentException;
176
177    /**
178     * @deprecated mistaken operation name...use getActionsTaken instead
179     *
180     * @param documentId the unique id of a document
181     *
182     * @return the list of past ActionTakens for a given documentId
183     *
184     * @throws RiceIllegalArgumentException if {@code documentId} is null
185     */
186    @WebMethod(operationName = "getActionRequests")
187    @XmlElementWrapper(name = "actionsTaken", required = true)
188    @XmlElement(name = "actionTaken", required = false)
189    @WebResult(name = "actionsTaken")
190    @Deprecated
191    List<ActionTaken> _getActionsTaken(@WebParam(name = "documentId") String documentId)
192            throws RiceIllegalArgumentException;
193
194
195    /**
196    * Gets a list of all {@link ActionTaken} of a {@link Document} with the given documentId
197    *
198    * @since 2.0.2
199    *
200    * @param documentId the unique id of a document
201    *
202    * @return the list of ActionTakens (both current and not) for a given documentId
203    *
204    * @throws RiceIllegalArgumentException if {@code documentId} is null
205    */
206      @WebMethod(operationName = "getAllActionRequests")
207      @XmlElementWrapper(name = "actionsTaken", required = true)
208      @XmlElement(name = "actionTaken", required = false)
209      @WebResult(name = "actionsTaken")
210      List<ActionTaken> getAllActionsTaken(@WebParam(name = "documentId") String documentId)
211              throws RiceIllegalArgumentException;
212
213
214    /**
215     * Gets a {@link DocumentDetail} of a {@link Document} with the given documentTypeName and appId
216     *
217     * @param documentTypeName the name of the DocumentType
218     * @param appId the unique id of the application
219     *
220     * @return a {@link DocumentDetail} for with the given documentTypeName and appId
221     *
222     * @throws RiceIllegalArgumentException if {@code documentTypeName} is null
223     * @throws RiceIllegalArgumentException if {@code appId} is null
224     */
225    @WebMethod(operationName = "getDocumentDetailByAppId")
226    @WebResult(name = "documentDetail")
227    DocumentDetail getDocumentDetailByAppId(@WebParam(name = "documentTypeName") String documentTypeName,
228                                            @WebParam(name = "appId") String appId)
229            throws RiceIllegalArgumentException;
230
231    /**
232     * Gets a {@link DocumentDetail} of a {@link Document} with the given documentId
233     *
234     * @param documentId the unique id of the Document
235     *
236     * @return a {@link DocumentDetail} for with the given documentId
237     *
238     * @throws RiceIllegalArgumentException if {@code documentId} is null
239     */
240    @WebMethod(operationName = "getDocumentDetail")
241    @WebResult(name = "documentDetail")
242        DocumentDetail getDocumentDetail(@WebParam(name = "documentId") String documentId);
243
244
245    /**
246     * Gets a {@link RouteNodeInstance} with the given nodeInstanceId
247     *
248     * @param routeNodeInstanceId the unique id of the {@link RouteNodeInstance}
249     *
250     * @return a {@link DocumentDetail} for with the given documentId
251     *
252     * @throws RiceIllegalArgumentException if {@code nodeInstanceId} is null
253     */
254    @WebMethod(operationName = "getRouteNodeInstance")
255    @WebResult(name = "routeNodeInstance")
256        RouteNodeInstance getRouteNodeInstance(@WebParam(name = "routeNodeInstanceId") String routeNodeInstanceId)
257            throws RiceIllegalArgumentException;
258
259    /**
260     * Gets a value application document id of a {@link Document} with the given documentId
261     *
262     * @param documentId the unique id of the Document
263     *
264     * @return the value of the applicationDocumentId for the {@link Document} with the given documentId
265     *
266     * @throws RiceIllegalArgumentException if {@code documentId} is null
267     */
268    @WebMethod(operationName = "getApplicationDocumentId")
269    @WebResult(name = "applicationDocumentId")
270        String getApplicationDocumentId(@WebParam(name = "documentId") String documentId)
271            throws RiceIllegalArgumentException;
272
273    /**
274     * Gets a value application document status of a {@link org.kuali.rice.kew.api.document.Document} with the given documentId
275     *
276     * @param documentId the unique id of the Document
277     *
278     * @return the value of the applicationDocumentStatus for the {@link org.kuali.rice.kew.api.document.Document} with the given documentId
279     *
280     * @throws org.kuali.rice.core.api.exception.RiceIllegalArgumentException if {@code documentId} is null
281     */
282    @WebMethod(operationName = "getApplicationDocumentStatus")
283    @WebResult(name = "applicationDocumentStatus")
284    String getApplicationDocumentStatus(@WebParam(name = "documentId") String documentId)
285            throws RiceIllegalArgumentException;
286
287    /**
288     * Executes a search for workflow documents using the given criteria and as the principal with the given id.  Since
289     * documents can define security which permits access to view certain search results, the given principal id will
290     * be used when evaluating which documents should be filtered from the results because of lack of access.
291     *
292     * @param principalId the id of the principal to execute the search as, if this value is non-null then security
293     * filtering will be executed against the results, if it is null then no filtering will be performed
294     * @param criteria the criteria to use when executing the search
295     *
296     * @return the results of the search, this will never be null but may contain an empty list of results
297     *
298     * @throws RiceIllegalArgumentException if the given criteria is null
299     */
300    @WebMethod(operationName = "documentSearch")
301    @WebResult(name = "documentSearchResults")
302    DocumentSearchResults documentSearch(
303            @WebParam(name = "principalId") String principalId,
304            @WebParam(name = "criteria") DocumentSearchCriteria criteria)
305        throws RiceIllegalArgumentException;
306
307    /**
308     * Executes a search for workflow documents using the given criteria and as the principal with the given id.  Since
309     * documents can define security which permits access to view certain search results, the given principal id will
310     * be used when evaluating which documents should be filtered from the results because of lack of access.
311     *
312     * @param principalId the id of the principal to execute the search as, if this value is non-null then security
313     * filtering will be executed against the results, if it is null then no filtering will be performed
314     * @param criteria the criteria to use when executing the search
315     * @param boolean to represent whether the document search details should be saved to the users preferences
316     *
317     * @return the results of the search, this will never be null but may contain an empty list of results
318     *
319     * @throws RiceIllegalArgumentException if the given criteria is null
320     */
321    @WebMethod(operationName = "documentSearchSaveable")
322    @WebResult(name = "documentSearchResults")
323    DocumentSearchResults documentSearchSaveable(
324            @WebParam(name = "principalId") String principalId,
325            @WebParam(name = "criteria") DocumentSearchCriteria criteria,
326            @WebParam(name = "saveSearch") boolean saveSearch)
327            throws RiceIllegalArgumentException;
328
329    /**
330     * Gets a list of all {@link RouteNodeInstance} for a {@link Document} with the given documentId
331     *
332     * @param documentId the unique id of a Document
333     *
334     * @return the list of {@link RouteNodeInstance}s for the {@link Document} with the given documentId
335     *
336     * @throws RiceIllegalArgumentException if {@code documentId} is null
337     */
338    @WebMethod(operationName = "getRouteNodeInstances")
339    @XmlElementWrapper(name = "routeNodeInstances", required = true)
340    @XmlElement(name = "routeNodeInstance", required = false)
341    @WebResult(name = "routeNodeInstances")
342        List<RouteNodeInstance> getRouteNodeInstances(@WebParam(name = "documentId") String documentId)
343            throws RiceIllegalArgumentException;
344
345    /**
346     * Gets a list of active {@link RouteNodeInstance} for a {@link Document} with the given documentId
347     *
348     * @param documentId the unique id of a Document
349     *
350     * @return the list of active {@link RouteNodeInstance}s for the {@link Document} with the given documentId
351     *
352     * @throws RiceIllegalArgumentException if {@code documentId} is null
353     */
354    @WebMethod(operationName = "getActiveRouteNodeInstances")
355    @XmlElementWrapper(name = "routeNodeInstances", required = true)
356    @XmlElement(name = "routeNodeInstance", required = false)
357    @WebResult(name = "routeNodeInstances")
358        List<RouteNodeInstance> getActiveRouteNodeInstances(@WebParam(name = "documentId") String documentId)
359            throws RiceIllegalArgumentException;
360
361    /**
362     * Gets a list of terminal {@link RouteNodeInstance}s for a {@link Document} with the given documentId
363     *
364     * @param documentId the unique id of a Document
365     *
366     * @return the list of terminal {@link RouteNodeInstance}s for the {@link Document} with the given documentId
367     *
368     * @throws RiceIllegalArgumentException if {@code documentId} is null
369     */
370    @WebMethod(operationName = "getTerminalRouteNodeInstances")
371    @XmlElementWrapper(name = "routeNodeInstances", required = true)
372    @XmlElement(name = "routeNodeInstance", required = false)
373    @WebResult(name = "routeNodeInstances")
374        List<RouteNodeInstance> getTerminalRouteNodeInstances(@WebParam(name = "documentId") String documentId)
375            throws RiceIllegalArgumentException;
376
377    /**
378     * Gets a list of current {@link RouteNodeInstance}s for a {@link Document} with the given documentId
379     *
380     * @param documentId the unique id of a Document
381     *
382     * @return the list of current {@link RouteNodeInstance}s for the {@link Document} with the given documentId
383     *
384     * @throws RiceIllegalArgumentException if {@code documentId} is null
385     */
386    @WebMethod(operationName = "getCurrentRouteNodeInstances")
387    @XmlElementWrapper(name = "routeNodeInstances", required = true)
388    @XmlElement(name = "routeNodeInstance", required = false)
389    @WebResult(name = "routeNodeInstances")
390        List<RouteNodeInstance> getCurrentRouteNodeInstances(@WebParam(name = "documentId") String documentId)
391            throws RiceIllegalArgumentException;
392
393    /**
394     * Gets a list of all previous {@link RouteNodeInstance}'s node names for a {@link Document} with the given documentId
395     *
396     * @param documentId the unique id of a Document
397     *
398     * @return the list of all previous {@link RouteNodeInstance}'s node names for the {@link Document} with the
399     * given documentId
400     *
401     * @throws RiceIllegalArgumentException if {@code documentId} is null
402     */
403    @WebMethod(operationName = "getPreviousRouteNodeNames")
404    @XmlElementWrapper(name = "previousRouteNodeNames", required = true)
405    @XmlElement(name = "previousRouteNodeName", required = false)
406    @WebResult(name = "previousRouteNodeNames")
407        List<String> getPreviousRouteNodeNames(@WebParam(name = "documentId") String documentId)
408            throws RiceIllegalArgumentException;
409
410        /**
411     * Gets the status value for a {@link Document} with the given documentId
412     *
413     * @param documentId the unique id of a Document
414     *
415     * @return the current status of the {@link Document} with the
416     * given documentId
417     *
418     * @throws RiceIllegalArgumentException if {@code documentId} is null
419     */
420    @WebMethod(operationName = "getDocumentStatus")
421    @WebResult(name = "documentStatus")
422        DocumentStatus getDocumentStatus(@WebParam(name = "documentId") String documentId)
423            throws RiceIllegalArgumentException;
424
425
426    /**
427     * Gets a list of principalId values for a {@link Document} with the given documentId
428     * and action request code that have pending action requests
429     *
430     * @param actionRequestedCd code for the pending action requested
431     * @param documentId the unique id of a Document
432     *
433     * @return a list of principalIds for the {@link Document} with the
434     * given parameters and have a pending action request
435     *
436     * @throws RiceIllegalArgumentException if {@code documentId} is null
437     * @throws RiceIllegalArgumentException if {@code actionRequestCd} is null
438     */
439    @WebMethod(operationName = "getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId")
440    @XmlElementWrapper(name = "principalIds", required = true)
441    @XmlElement(name = "principalId", required = false)
442    @WebResult(name = "principalIds")
443        List<String> getPrincipalIdsWithPendingActionRequestByActionRequestedAndDocId(
444                    @WebParam(name = "actionRequestedCd") String actionRequestedCd,
445                            @WebParam(name = "documentId") String documentId)
446            throws RiceIllegalArgumentException;
447
448
449    /**
450     * Gets the {@link Document} initiator's principalId with the given documentId
451     *
452     * @param documentId the unique id of a Document
453     *
454     * @return the {@link Document} initiator's principalId
455     *
456     * @throws RiceIllegalArgumentException if {@code documentId} is null
457     */
458    @WebMethod(operationName = "getDocumentInitiatorPrincipalId")
459    @WebResult(name = "principalId")
460        String getDocumentInitiatorPrincipalId(@WebParam(name = "documentId") String documentId)
461            throws RiceIllegalArgumentException;
462
463    /**
464     * Gets the {@link Document}'s 'routed by' principalId with the given documentId
465     * Returns null if the document is not found
466     *
467     * @param documentId the unique id of a Document
468     *
469     * @return the {@link Document}'s 'routed by' principalId
470     *
471     * @throws RiceIllegalArgumentException if {@code documentId} is null
472     */
473    @WebMethod(operationName = "getRoutedByPrincipalIdByDocumentId")
474    @WebResult(name = "principalId")
475        String getRoutedByPrincipalIdByDocumentId(@WebParam(name = "documentId") String documentId)
476            throws RiceIllegalArgumentException;
477
478    /**
479     * Does a direct search for searchableAttributes without going through the document search
480     * This returns a list of String values for String searchableAttributes
481     *
482     * @param documentId the unique id of a Document
483     * @param key the searchableAttributes key value
484     *
485     * @return a list of String values for the {@link Document} with the
486     * given documentId and searchable attribute key
487     *
488     * @throws RiceIllegalArgumentException if {@code documentId} is null
489     * @throws RiceIllegalArgumentException if {@code key} is null
490     */
491    @WebMethod(operationName = "getSearchableAttributeStringValuesByKey")
492    @XmlElementWrapper(name = "searchableAttributeStringValues", required = true)
493    @XmlElement(name = "searchableAttributeStringValue", required = false)
494    @WebResult(name = "searchableAttributeStringValues")
495        List<String> getSearchableAttributeStringValuesByKey(@WebParam(name = "documentId") String documentId,
496                                                                     @WebParam(name = "key") String key)
497            throws RiceIllegalArgumentException;
498
499        /**
500     * Does a direct search for searchableAttributes without going through the document search
501     * This returns a list of DateTime values for date/time searchableAttributes
502     *
503     * @param documentId the unique id of a Document
504     * @param key the searchableAttributes key value
505     *
506     * @return a list of DateTime values for the {@link Document} with the
507     * given documentId and searchable attribute key
508     *
509     * @throws RiceIllegalArgumentException if {@code documentId} is null
510     * @throws RiceIllegalArgumentException if {@code key} is null
511     */
512    @WebMethod(operationName = "getSearchableAttributeDateTimeValuesByKey")
513    @XmlElementWrapper(name = "searchableAttributeDateTimeValues", required = true)
514    @XmlElement(name = "searchableAttributeDateTimeValue", required = false)
515    @WebResult(name = "searchableAttributeDateTimeValues")
516        @XmlJavaTypeAdapter(value = DateTimeAdapter.class)
517        List<DateTime> getSearchableAttributeDateTimeValuesByKey(@WebParam(name = "documentId") String documentId,
518                                                                         @WebParam(name = "key") String key)
519            throws RiceIllegalArgumentException;
520
521        /**
522     * Does a direct search for searchableAttributes without going through the document search
523     * This returns a list of BigDecimal values for decimal searchableAttributes
524     *
525     * @param documentId the unique id of a Document
526     * @param key the searchableAttributes key value
527     *
528     * @return a list of BigDecimal values for the {@link Document} with the
529     * given documentId and searchable attribute key
530     *
531     * @throws RiceIllegalArgumentException if {@code documentId} is null
532     * @throws RiceIllegalArgumentException if {@code key} is null
533     */
534    @WebMethod(operationName = "getSearchableAttributeFloatValuesByKey")
535    @XmlElementWrapper(name = "searchableAttributeBigDecimalValues", required = true)
536    @XmlElement(name = "searchableAttributeBigDecimalValue", required = false)
537    @WebResult(name = "searchableAttributeBigDecimalValues")
538        List<BigDecimal> getSearchableAttributeFloatValuesByKey(@WebParam(name = "documentId") String documentId,
539                                                                        @WebParam(name = "key") String key)
540            throws RiceIllegalArgumentException;
541
542        /**
543     * Does a direct search for searchableAttributes without going through the document search
544     * This returns a list of Long values for long searchableAttributes
545     *
546     * @param documentId the unique id of a Document
547     * @param key the searchableAttributes key value
548     *
549     * @return a list of BigDecimal values for the {@link Document} with the
550     * given documentId and searchable attribute key
551     *
552     * @throws RiceIllegalArgumentException if {@code documentId} is null
553     * @throws RiceIllegalArgumentException if {@code key} is null
554     */
555    @WebMethod(operationName = "getSearchableAttributeLongValuesByKey")
556    @XmlElementWrapper(name = "searchableAttributeLongValues", required = true)
557    @XmlElement(name = "searchableAttributeLongValue", required = false)
558    @WebResult(name = "searchableAttributeLongValues")
559        List<Long> getSearchableAttributeLongValuesByKey(@WebParam(name = "documentId") String documentId,
560                                                                 @WebParam(name = "key") String key)
561            throws RiceIllegalArgumentException;
562
563    /**
564     * Gets a list of DocumentStatusTransitions for the {@link Document} with the given documentId
565     *
566     * @param documentId the unique id of a Document
567     *
568     * @return a list of DocumentStatusTransitions for the {@link Document} with the
569     * given documentId
570     *
571     * @throws RiceIllegalArgumentException if {@code documentId} is null
572     */
573    @WebMethod(operationName = "getDocumentStatusTransitionHistory")
574    @XmlElementWrapper(name = "documentStatusTransitions", required = true)
575    @XmlElement(name = "documentStatusTransition", required = false)
576    @WebResult(name = "documentStatusTransitions")
577        List<DocumentStatusTransition> getDocumentStatusTransitionHistory(@WebParam(name = "documentId") String documentId)
578            throws RiceIllegalArgumentException;
579
580
581    /**
582     * Saves the passed in {@link DocumentLink}.  If the {@link DocumentLink}'s id field is created.  This method
583     * actually creates two different links in the database (one from the document being
584         * linked to the target and vice-versa).  If the links already exist, then the call is ignored.
585     *
586     * @param documentLink the unique id of a Document
587     *
588     * @return the newly saved {@link DocumentLink}
589     *
590     * @throws RiceIllegalArgumentException if {@code documentLink} is null
591     * @throws RiceIllegalArgumentException if {@code documentLink}'s is id value is populated
592     */
593    @WebMethod(operationName = "addDocumentLink")
594    @WebResult(name = "documentLink")
595        DocumentLink addDocumentLink(@WebParam(name = "documentLink") DocumentLink documentLink) throws RiceIllegalArgumentException;
596
597    /**
598     * Removes the  {@link DocumentLink} with the given documentLinkId.
599     *
600     * @param documentLinkId the unique id of a Document
601     *
602     * @return the deleted {@link DocumentLink}
603     *
604     * @throws RiceIllegalArgumentException if {@code documentLink} is null
605     * @throws RiceIllegalStateException if no DocumentLink with the passed in{@code documentLink} exist
606     */
607    @WebMethod(operationName = "deleteDocumentLink")
608    @WebResult(name = "documentLink")
609        DocumentLink deleteDocumentLink(@WebParam(name = "documentLinkId") String documentLinkId) throws RiceIllegalArgumentException;
610
611
612    /**
613     * Removes all {@link DocumentLink}s for the given {@link Document} with the given originatingDocumentId.
614     *
615     * @param originatingDocumentId the unique id of the originating Document of the document links to delete
616     *
617     * @return a list of the deleted {@link DocumentLink}s
618     *
619     * @throws RiceIllegalArgumentException if {@code documentLink} is null
620     */
621    @WebMethod(operationName = "deleteDocumentLinksByDocumentId")
622    @XmlElementWrapper(name = "documentLinks", required = true)
623    @XmlElement(name = "documentLink", required = false)
624    @WebResult(name = "documentLinks")
625    List<DocumentLink> deleteDocumentLinksByDocumentId(@WebParam(name = "originatingDocumentId") String originatingDocumentId) throws RiceIllegalArgumentException;
626
627    /**
628     * Gets a list of all {@link DocumentLink}s for outgoing links from the {@link Document} with the given documentId.
629     *
630     * @param originatingDocumentId the unique id of the originating Document of the document links to retrieve
631     *
632     * @return a list of the outgoing {@link DocumentLink}s for the originating document
633     *
634     * @throws RiceIllegalArgumentException if {@code originatingDocumentId} is null
635     */
636    @WebMethod(operationName = "getOutgoingDocumentLinks")
637    @XmlElementWrapper(name = "documentLinks", required = true)
638    @XmlElement(name = "documentLink", required = false)
639    @WebResult(name = "documentLinks")
640    List<DocumentLink> getOutgoingDocumentLinks(@WebParam(name = "originatingDocumentId") String originatingDocumentId) throws RiceIllegalArgumentException;
641
642    /**
643     * Gets a list of all {@link DocumentLink}s for incoming links from the {@link Document} with the given documentId.
644     *
645     * @param originatingDocumentId the unique id of the incoming Document of the document links to retrieve
646     *
647     * @return a list of the outgoing {@link DocumentLink}s for the incoming document
648     *
649     * @throws RiceIllegalArgumentException if {@code originatingDocumentId} is null
650     */
651    @WebMethod(operationName = "getIncomingDocumentLinks")
652    @XmlElementWrapper(name = "documentLinks", required = true)
653    @XmlElement(name = "documentLink", required = false)
654    @WebResult(name = "documentLinks")
655    List<DocumentLink> getIncomingDocumentLinks(@WebParam(name = "originatingDocumentId") String originatingDocumentId) throws RiceIllegalArgumentException;
656
657    /**
658     * Gets the {@link DocumentLink} for  with the given documentLinkId.
659     *
660     * @param documentLinkId the unique id of the {@link DocumentLink} to retrieve
661     *
662     * @return a {@link DocumentLink} with the passed in documentLinkId
663     *
664     * @throws RiceIllegalArgumentException if {@code documentLinkId} is null
665     */
666    @WebMethod(operationName = "getDocumentLink")
667    @WebResult(name = "documentLinks")
668    DocumentLink getDocumentLink(@WebParam(name = "documentLinkId") String documentLinkId) throws RiceIllegalArgumentException;
669    
670    /**
671     * Gets a list of active route node names for a {@link Document} with the given documentId.   Will never return null but an empty collection to indicate no results.
672     *
673     * @param documentId the unique id of a Document
674     *
675     * @return an unmodifiable list of active route node names for the {@link Document} with the given documentId
676     *
677     * @throws RiceIllegalArgumentException if {@code documentId} is null or blank
678     * 
679     * @since rice 2.2
680     */
681    @WebMethod(operationName = "getActiveRouteNodeNames")
682    @XmlElementWrapper(name = "nodes", required = true)
683    @XmlElement(name = "node", required = false)
684    @WebResult(name = "nodes")
685    List<String> getActiveRouteNodeNames(@WebParam(name = "documentId") String documentId) throws RiceIllegalArgumentException;
686    
687    /**
688     * Gets a list of terminal route node names for a {@link Document} with the given documentId.   Will never return null but an empty collection to indicate no results.
689     *
690     * @param documentId the unique id of a Document
691     *
692     * @return an unmodifiable list of terminal route node names for the {@link Document} with the given documentId
693     *
694     * @throws RiceIllegalArgumentException if {@code documentId} is null or blank
695     * 
696     * @since rice 2.2
697     */
698    @WebMethod(operationName = "getTerminalRouteNodeNames")
699    @XmlElementWrapper(name = "nodes", required = true)
700    @XmlElement(name = "node", required = false)
701    @WebResult(name = "nodes")
702    List<String> getTerminalRouteNodeNames(@WebParam(name = "documentId") String documentId) throws RiceIllegalArgumentException;
703
704    /**
705     * Gets a list of current route node names for a {@link Document} with the given documentId.  Will never return null but an empty collection to indicate no results.
706     *
707     * @param documentId the unique id of a Document
708     *
709     * @return an unmodifiable list of current route node names for the {@link Document} with the given documentId
710     *
711     * @throws RiceIllegalArgumentException if {@code documentId} is null or blank
712     * 
713     * @since rice 2.2
714     */
715    @WebMethod(operationName = "getCurrentRouteNodeNames")
716    @XmlElementWrapper(name = "nodes", required = true)
717    @XmlElement(name = "node", required = false)
718    @WebResult(name = "nodes")
719    List<String> getCurrentRouteNodeNames(@WebParam(name = "documentId") String documentId) throws RiceIllegalArgumentException;
720}