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.routeheader.service;
017
018import org.kuali.rice.kew.api.action.ActionItem;
019import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
020import org.kuali.rice.kew.doctype.bo.DocumentType;
021import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
022import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValueContent;
023
024import java.math.BigDecimal;
025import java.sql.Timestamp;
026import java.util.Collection;
027import java.util.List;
028import java.util.Map;
029import java.util.Set;
030
031
032/**
033 * A service providing data access for documents (a.k.a route headers).
034 *
035 * @see DocumentRouteHeaderValue
036 *
037 * @author Kuali Rice Team (rice.collab@kuali.org)
038 */
039public interface RouteHeaderService {
040
041    DocumentRouteHeaderValue getRouteHeader(String documentId);
042
043    DocumentRouteHeaderValue getRouteHeader(String documentId, boolean clearCache);
044
045    Collection<DocumentRouteHeaderValue> getRouteHeaders (Collection<String> documentIds);
046
047    Collection<DocumentRouteHeaderValue> getRouteHeaders (Collection<String> documentIds, boolean clearCache);
048
049    Map<String,DocumentRouteHeaderValue> getRouteHeadersForActionItems(Collection<ActionItem> actionItems);
050
051    void lockRouteHeader(String documentId);
052
053    DocumentRouteHeaderValue saveRouteHeader(DocumentRouteHeaderValue routeHeader);
054
055    void deleteRouteHeader(DocumentRouteHeaderValue routeHeader);
056
057    String getNextDocumentId();
058
059    void validateRouteHeader(DocumentRouteHeaderValue routeHeader);
060
061    Collection findPendingByResponsibilityIds(Set responsibilityIds);
062
063    Collection findByDocTypeAndAppId(String documentTypeName, String appId);
064    
065    /**
066     * Removes all SearchableAttributeValues associated with the RouteHeader.
067     * @param routeHeader
068     */
069    void clearRouteHeaderSearchValues(String documentId);
070
071    /**
072     * Updates the searchable attribute values for the document with the given id to the given values.
073     * This method will clear existing search attribute values and replace with the ones given.
074     */
075    void updateRouteHeaderSearchValues(String documentId, List<SearchableAttributeValue> searchAttributes);
076    
077    /**
078     * Returns the application id of the {@link DocumentType} for the Document with the given ID.
079     */
080    String getApplicationIdByDocumentId(String documentId);
081
082    DocumentRouteHeaderValueContent getContent(String documentId);
083
084    boolean hasSearchableAttributeValue(String documentId, String searchableAttributeKey, String searchableAttributeValue);
085
086    String getDocumentStatus(String documentId);
087
088    String getAppDocId(String documentId);
089
090    /**
091     *
092     * This method Returns the application document status for the given document id
093     *
094     * @param documentId
095     * @return String
096     */
097    String getAppDocStatus(String documentId);
098    
099    /**
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}