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.routemodule;
17  
18  import java.util.List;
19  
20  import org.kuali.rice.kew.actionrequest.ActionRequestValue;
21  import org.kuali.rice.kew.api.exception.WorkflowException;
22  import org.kuali.rice.kew.engine.RouteContext;
23  import org.kuali.rice.kew.util.ResponsibleParty;
24  
25  
26  /**
27   * A RouteModule is responsible for generating Action Requests for a given Route Header document.
28   * Implementations of this class are potentially remotable, so this interface uses value objects.
29   *
30   * @author Kuali Rice Team (rice.collab@kuali.org)
31   */
32  public interface RouteModule {
33  
34      /**
35       * Generate action requests for the given RouteContext.
36       *
37       * <p>The list of requests returned should only contain root action requests (those with no parent).</p>
38       *
39       * @return A List of the generated ActionRequestValue objects.
40       */
41      List<ActionRequestValue> findActionRequests(RouteContext context) throws Exception;
42  
43      /**
44       * The route module will re-resolve the given responsibilityId and return an object that contains the key to either
45       * a user, group, or role.  The original responsibility associated with the given id will then be swapped with the
46       * new ResponsibleParty when routing is resolved.
47       *
48       * <p>This method is intended to allow for the calling code to be able to "switch-out" one responsibility for
49       * another (in the case of a change to an assigned reponsibility).</p>
50       *
51       * <p>Returning null from this method will indicate that the original responsibile party should remain unchanged.
52       * This is typically the recommended default for implementation of this method and covers most use cases.</p>
53       *
54       * @param responsibilityId the id of the responsibility to be resolved
55       * @return the responsibility party with which to replace the original responsibility, or null if the responsibility
56       * should remain unchanged.
57       */
58      ResponsibleParty resolveResponsibilityId(String responsibilityId) throws WorkflowException;
59  
60      /**
61       * Returns true if this RouteModule has more requests available which it can generate.  This method will only be
62       * called after the first set of action requests returned by the first invocation of findActionRequests have been
63       * fully activated.  If this method returns true, findActionRequests will be invoked again and those requests will
64       * all be activated before the cycle continues until this method returns false;
65       *
66       * @param context the route context
67       * @return true if this route module has more requests it can generate, false otherwise
68       */
69      boolean isMoreRequestsAvailable(RouteContext context);
70  
71  }