01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.workflow.module.vendor.node;
17:
18: import java.util.ArrayList;
19: import java.util.List;
20:
21: import org.kuali.kfs.context.SpringContext;
22: import org.kuali.module.vendor.service.VendorService;
23:
24: import edu.iu.uis.eden.engine.RouteContext;
25: import edu.iu.uis.eden.engine.RouteHelper;
26: import edu.iu.uis.eden.engine.node.SplitNode;
27: import edu.iu.uis.eden.engine.node.SplitResult;
28:
29: /**
30: * Checks for conditions on a Vendor Maintenance document that allow auto-approval by the initiator. If these conditions are not
31: * met, standard routing of the Vendor is performed. The conditions for auto-approval are: 1)
32: */
33: public class VendorMaintenanceDocumentApprovalNoApprovalSplitNode
34: implements SplitNode {
35:
36: public SplitResult process(RouteContext routeContext,
37: RouteHelper routeHelper) throws Exception {
38: boolean shouldVendorRoute = SpringContext.getBean(
39: VendorService.class).shouldVendorRouteForApproval(
40: routeContext.getDocument().getRouteHeaderId()
41: .toString());
42: List branchNames = new ArrayList();
43: if (shouldVendorRoute) {
44: branchNames.add("ApprovalBranch");
45: } else {
46: branchNames.add("NoApprovalBranch");
47: }
48: return new SplitResult(branchNames);
49: }
50: }
|