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 java.math.BigDecimal;
019import java.sql.Timestamp;
020import java.util.Collection;
021import java.util.List;
022import java.util.Map;
023import java.util.Set;
024
025import org.kuali.rice.kew.api.action.ActionItem;
026import org.kuali.rice.kew.docsearch.SearchableAttributeValue;
027import org.kuali.rice.kew.doctype.bo.DocumentType;
028import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
029import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValueContent;
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    public DocumentRouteHeaderValue getRouteHeader(String documentId);
042    public DocumentRouteHeaderValue getRouteHeader(String documentId, boolean clearCache);
043    public Collection<DocumentRouteHeaderValue> getRouteHeaders (Collection<String> documentIds);
044    public Collection<DocumentRouteHeaderValue> getRouteHeaders (Collection<String> documentIds, boolean clearCache);
045    public Map<String,DocumentRouteHeaderValue> getRouteHeadersForActionItems(Collection<ActionItem> actionItems);
046    public void lockRouteHeader(String documentId, boolean wait);
047    public void saveRouteHeader(DocumentRouteHeaderValue routeHeader);
048    public void deleteRouteHeader(DocumentRouteHeaderValue routeHeader);
049    public String getNextDocumentId();
050    public void validateRouteHeader(DocumentRouteHeaderValue routeHeader);
051    public Collection findPendingByResponsibilityIds(Set responsibilityIds);
052    public Collection findByDocTypeAndAppId(String documentTypeName, String appId);
053    
054    /**
055     * Removes all SearchableAttributeValues associated with the RouteHeader.
056     * @param routeHeader
057     */
058    public void clearRouteHeaderSearchValues(String documentId);
059
060    /**
061     * Updates the searchable attribute values for the document with the given id to the given values.
062     * This method will clear existing search attribute values and replace with the ones given.
063     */
064    public void updateRouteHeaderSearchValues(String documentId, List<SearchableAttributeValue> searchAttributes);
065    
066    /**
067     * Returns the application id of the {@link DocumentType} for the Document with the given ID.
068     */
069    public String getApplicationIdByDocumentId(String documentId);
070
071    public DocumentRouteHeaderValueContent getContent(String documentId);
072
073    public boolean hasSearchableAttributeValue(String documentId, String searchableAttributeKey, String searchableAttributeValue);
074
075    public String getDocumentStatus(String documentId);
076
077    public String getAppDocId(String documentId);
078
079    /**
080     *
081     * This method Returns the application document status for the given document id
082     *
083     * @param documentId
084     * @return String
085     */
086    public String getAppDocStatus(String documentId);
087    
088    /**
089     *
090     * This method is a more direct way to get the searchable attribute values
091     *
092     * @param documentId
093     * @param key
094     * @return
095     */
096    public List<String> getSearchableAttributeStringValuesByKey(String documentId, String key);
097    /**
098     *
099     * This method is a more direct way to get the searchable attribute values
100     *
101     * @param documentId
102     * @param key
103     * @return
104     */
105    public List<Timestamp> getSearchableAttributeDateTimeValuesByKey(String documentId, String key);
106    /**
107     *
108     * This method is a more direct way to get the searchable attribute values
109     *
110     * @param documentId
111     * @param key
112     * @return
113     */
114    public List<BigDecimal> getSearchableAttributeFloatValuesByKey(String documentId, String key);
115    /**
116     *
117     * This method is a more direct way to get the searchable attribute values
118     *
119     * @param documentId
120     * @param key
121     * @return
122     */
123    public List<Long> getSearchableAttributeLongValuesByKey(String documentId, String key);
124
125}