001/**
002 * Copyright 2005-2014 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.actionlist.service;
017
018import java.util.Collection;
019import java.util.List;
020
021import org.kuali.rice.kew.actionitem.ActionItem;
022import org.kuali.rice.kew.actionitem.OutboxItem;
023import org.kuali.rice.kew.actionlist.ActionListFilter;
024import org.kuali.rice.kew.actionrequest.ActionRequestValue;
025import org.kuali.rice.kew.actionrequest.Recipient;
026import org.kuali.rice.kew.routeheader.DocumentRouteHeaderValue;
027
028
029
030
031/**
032 * Main service for doing action list data access work
033 *
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 *
036 */
037public interface ActionListService {
038    public ActionItem createActionItemForActionRequest(ActionRequestValue actionRequest);
039
040    public Collection<ActionItem> getActionList(String principalId, ActionListFilter filter);
041
042    public Collection<ActionItem> getActionListForSingleDocument(String documentId);
043
044    /**
045     * Returns a list of recipients <i>which secondary-delegate to</i> the target principalId
046     * @param principalId the target principalId/delegate
047     * @return a list of recipients <i>which secondary-delegate to</i> the target principalId
048     */
049    public Collection<Recipient> findUserSecondaryDelegators(String principalId);
050
051    /**
052     * Retruns a list of recipients <i>which are primary-delegated to by</i> the source principalId
053     * @param principalId the source principalId to query for primary delegates
054     * @return a list of recipients <i>which are primary-delegated to by</i> the source principalId
055     */
056    public Collection<Recipient> findUserPrimaryDelegations(String principalId);
057
058    public ActionItem saveActionItem(ActionItem actionItem);
059
060    public void deleteActionItemNoOutbox(ActionItem actionItem);
061
062    public void deleteActionItem(ActionItem actionItem);
063
064    public void deleteActionItem(ActionItem actionItem, boolean forceIntoOutbox);
065
066    public void deleteByDocumentId(String documentId);
067
068    public Collection<ActionItem> findByPrincipalId(String principalId);
069
070    public Collection<ActionItem> findByWorkflowUserDocumentId(String workflowUserId, String documentId);
071
072    public Collection<ActionItem> findByDocumentId(String documentId);
073
074    public Collection<ActionItem> findByDocumentTypeName(String documentTypeName);
075
076    public void updateActionItemsForTitleChange(String documentId, String newTitle);
077
078    public ActionItem findByActionItemId(String actionItemId);
079
080    /**
081     * Retrieves the number of Action List items in the given user's primary Action List (does not include secondary delegations)
082     */
083    public int getCount(String principalId);
084
085    /**
086     * Retrieves the max action item Id  and the total number of action items for the given user's primary Action List
087     * (does not include secondary delegations)
088     * @param principalId
089     */
090    public List<Object> getMaxActionItemDateAssignedAndCountForUser(String principalId);
091
092    public Collection<ActionItem> findByActionRequestId(String actionRequestId);
093
094    /**
095     *
096     * Retrieves {@link OutboxItem} items for the given user
097     *
098     * @param principalId
099     * @param filter
100     * @return
101     */
102    public Collection<OutboxItem> getOutbox(String principalId, ActionListFilter filter);
103    public Collection<OutboxItem> getOutboxItemsByDocumentType(String documentTypeName);
104    public void removeOutboxItems(String principalId, List<String> outboxItems);
105    public OutboxItem saveOutboxItem(ActionItem actionItem);
106    public OutboxItem saveOutboxItem(ActionItem actionItem, boolean forceIntoOutbox);
107    public OutboxItem saveOutboxItem(OutboxItem outboxItem);
108
109    /**
110     * Pulls a proxied version of the document route header with only the properties needed by the
111     * action list display.
112     */
113    DocumentRouteHeaderValue getMinimalRouteHeader( String documentId );
114}