View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.routeheader.service;
17  
18  import org.kuali.rice.kew.api.action.ActionItem;
19  import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
20  import org.kuali.rice.kew.doctype.bo.DocumentType;
21  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
22  import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValueContent;
23  
24  import java.math.BigDecimal;
25  import java.sql.Timestamp;
26  import java.util.Collection;
27  import java.util.List;
28  import java.util.Map;
29  import java.util.Set;
30  
31  
32  /**
33   * A service providing data access for documents (a.k.a route headers).
34   *
35   * @see DocumentRouteHeaderValue
36   *
37   * @author Kuali Rice Team (rice.collab@kuali.org)
38   */
39  public interface RouteHeaderService {
40  
41      DocumentRouteHeaderValue getRouteHeader(String documentId);
42  
43      DocumentRouteHeaderValue getRouteHeader(String documentId, boolean clearCache);
44  
45      Collection<DocumentRouteHeaderValue> getRouteHeaders (Collection<String> documentIds);
46  
47      Collection<DocumentRouteHeaderValue> getRouteHeaders (Collection<String> documentIds, boolean clearCache);
48  
49      Map<String,DocumentRouteHeaderValue> getRouteHeadersForActionItems(Collection<ActionItem> actionItems);
50  
51      void lockRouteHeader(String documentId);
52  
53      DocumentRouteHeaderValue saveRouteHeader(DocumentRouteHeaderValue routeHeader);
54  
55      void deleteRouteHeader(DocumentRouteHeaderValue routeHeader);
56  
57      String getNextDocumentId();
58  
59      void validateRouteHeader(DocumentRouteHeaderValue routeHeader);
60  
61      Collection findPendingByResponsibilityIds(Set responsibilityIds);
62  
63      Collection findByDocTypeAndAppId(String documentTypeName, String appId);
64      
65      /**
66       * Removes all SearchableAttributeValues associated with the RouteHeader.
67       * @param routeHeader
68       */
69      void clearRouteHeaderSearchValues(String documentId);
70  
71      /**
72       * Updates the searchable attribute values for the document with the given id to the given values.
73       * This method will clear existing search attribute values and replace with the ones given.
74       */
75      void updateRouteHeaderSearchValues(String documentId, List<SearchableAttributeValue> searchAttributes);
76      
77      /**
78       * Returns the application id of the {@link DocumentType} for the Document with the given ID.
79       */
80      String getApplicationIdByDocumentId(String documentId);
81  
82      DocumentRouteHeaderValueContent getContent(String documentId);
83  
84      boolean hasSearchableAttributeValue(String documentId, String searchableAttributeKey, String searchableAttributeValue);
85  
86      String getDocumentStatus(String documentId);
87  
88      String getAppDocId(String documentId);
89  
90      /**
91       *
92       * This method Returns the application document status for the given document id
93       *
94       * @param documentId
95       * @return String
96       */
97      String getAppDocStatus(String documentId);
98      
99      /**
100      *
101      * This method is a more direct way to get the searchable attribute values
102      *
103      * @param documentId
104      * @param key
105      * @return
106      */
107     List<String> getSearchableAttributeStringValuesByKey(String documentId, String key);
108     /**
109      *
110      * This method is a more direct way to get the searchable attribute values
111      *
112      * @param documentId
113      * @param key
114      * @return
115      */
116     List<Timestamp> getSearchableAttributeDateTimeValuesByKey(String documentId, String key);
117     /**
118      *
119      * This method is a more direct way to get the searchable attribute values
120      *
121      * @param documentId
122      * @param key
123      * @return
124      */
125     List<BigDecimal> getSearchableAttributeFloatValuesByKey(String documentId, String key);
126     /**
127      *
128      * This method is a more direct way to get the searchable attribute values
129      *
130      * @param documentId
131      * @param key
132      * @return
133      */
134     List<Long> getSearchableAttributeLongValuesByKey(String documentId, String key);
135 
136 }