1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.rule;
18
19 import java.io.StringReader;
20 import java.util.ArrayList;
21 import java.util.List;
22 import java.util.Map;
23
24 import org.jdom.Document;
25 import org.jdom.Element;
26 import org.kuali.rice.kew.routeheader.DocumentContent;
27 import org.kuali.rice.kew.rule.WorkflowAttribute;
28 import org.kuali.rice.kew.util.XmlHelper;
29
30
31
32
33
34 public class MockWorkflowAttribute implements WorkflowAttribute {
35
36 private static final String MOCK_VALUE_ELEMENT = "mockValue";
37
38
39 private String value;
40
41 public MockWorkflowAttribute() {}
42
43 public MockWorkflowAttribute(String value) {
44 setValue(value);
45 }
46
47 public String getDocContent() {
48 if (value == null) return "";
49 return "<"+MOCK_VALUE_ELEMENT+">"+value+"</"+MOCK_VALUE_ELEMENT+">";
50 }
51
52 public List parseDocContent(String docContent) {
53 try {
54 Document doc = XmlHelper.buildJDocument(new StringReader(docContent));
55 Element mockValueElement = XmlHelper.findElement(doc.getRootElement(), MOCK_VALUE_ELEMENT);
56 List attributes = new ArrayList();
57 if (mockValueElement != null) {
58 attributes.add(new MockWorkflowAttribute(mockValueElement.getText()));
59 }
60 return attributes;
61 } catch (Exception e) {
62 throw new RuntimeException(e);
63 }
64 }
65
66 public String getIdFieldName() {
67 return null;
68 }
69 public String getLockFieldName() {
70 return null;
71 }
72 public List getRoutingDataRows() {
73 return null;
74 }
75 public List getRuleExtensionValues() {
76 return null;
77 }
78 public List getRuleRows() {
79 return null;
80 }
81 public boolean isMatch(DocumentContent docContent, List ruleExtensions) {
82 return false;
83 }
84 public boolean isRequired() {
85 return false;
86 }
87
88 public void setRequired(boolean required) {
89 }
90 public List validateRoutingData(Map paramMap) {
91 return null;
92 }
93 public List validateRuleData(Map paramMap) {
94 return null;
95 }
96
97 public String getValue() {
98 return value;
99 }
100
101 public void setValue(String value) {
102 this.value = value;
103 }
104
105
106 }