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.routemodule; 017 018import java.util.List; 019 020import org.kuali.rice.kew.actionrequest.ActionRequestValue; 021import org.kuali.rice.kew.api.exception.WorkflowException; 022import org.kuali.rice.kew.engine.RouteContext; 023import org.kuali.rice.kew.util.ResponsibleParty; 024 025 026/** 027 * A RouteModule is responsible for generating Action Requests for a given Route Header document. 028 * Implementations of this class are potentially remotable, so this interface uses value objects. 029 * 030 * @author Kuali Rice Team (rice.collab@kuali.org) 031 */ 032public interface RouteModule { 033 034 /** 035 * Generate action requests for the given RouteContext. 036 * 037 * <p>The list of requests returned should only contain root action requests (those with no parent).</p> 038 * 039 * @return A List of the generated ActionRequestValue objects. 040 */ 041 List<ActionRequestValue> findActionRequests(RouteContext context) throws Exception; 042 043 /** 044 * The route module will re-resolve the given responsibilityId and return an object that contains the key to either 045 * a user, group, or role. The original responsibility associated with the given id will then be swapped with the 046 * new ResponsibleParty when routing is resolved. 047 * 048 * <p>This method is intended to allow for the calling code to be able to "switch-out" one responsibility for 049 * another (in the case of a change to an assigned reponsibility).</p> 050 * 051 * <p>Returning null from this method will indicate that the original responsibile party should remain unchanged. 052 * This is typically the recommended default for implementation of this method and covers most use cases.</p> 053 * 054 * @param responsibilityId the id of the responsibility to be resolved 055 * @return the responsibility party with which to replace the original responsibility, or null if the responsibility 056 * should remain unchanged. 057 */ 058 ResponsibleParty resolveResponsibilityId(String responsibilityId) throws WorkflowException; 059 060 /** 061 * Returns true if this RouteModule has more requests available which it can generate. This method will only be 062 * called after the first set of action requests returned by the first invocation of findActionRequests have been 063 * fully activated. If this method returns true, findActionRequests will be invoked again and those requests will 064 * all be activated before the cycle continues until this method returns false; 065 * 066 * @param context the route context 067 * @return true if this route module has more requests it can generate, false otherwise 068 */ 069 boolean isMoreRequestsAvailable(RouteContext context); 070 071}