1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.document.validation;
17
18 import java.util.ArrayList;
19 import java.util.Collection;
20 import java.util.List;
21
22 import org.kuali.ole.sys.document.validation.event.AttributedDocumentEvent;
23 import org.kuali.rice.kew.api.WorkflowDocument;
24
25
26
27
28
29 public abstract class RouteNodeValidation extends GenericValidation {
30 private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(RouteNodeValidation.class);
31
32 protected List<String> validRouteNodeNames;
33
34 @Override
35 public boolean stageValidation(AttributedDocumentEvent event) {
36 boolean valid = true;
37 if (LOG.isDebugEnabled()) {
38 LOG.debug("Staging validation for: "+getClass().getName()+" for event "+event.getClass().getName());
39 }
40 populateParametersFromEvent(event);
41
42 Collection<String> currentRouteLevels = new ArrayList<String>();
43 try {
44 WorkflowDocument workflowDoc = event.getDocument().getDocumentHeader().getWorkflowDocument();
45 currentRouteLevels = workflowDoc.getNodeNames();
46 for(String nodeName : validRouteNodeNames) {
47 if (currentRouteLevels.contains(nodeName) && workflowDoc.isApprovalRequested()) {
48 return validate(event);
49 }
50 }
51
52 }
53 catch (Exception e) {
54 throw new RuntimeException(e);
55 }
56
57 return valid;
58
59
60 }
61
62
63
64
65
66 public void setValidRouteNodeNames(List<String> validRouteNodeNames) {
67 this.validRouteNodeNames = validRouteNodeNames;
68 }
69
70
71
72
73 public List<String> getValidRouteNodeNames() {
74 return validRouteNodeNames;
75 }
76
77
78
79
80
81 }