1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.rule.bo; |
18 | |
|
19 | |
import java.util.ArrayList; |
20 | |
import java.util.LinkedHashMap; |
21 | |
import java.util.List; |
22 | |
|
23 | |
import javax.persistence.Basic; |
24 | |
import javax.persistence.CascadeType; |
25 | |
import javax.persistence.Column; |
26 | |
import javax.persistence.Entity; |
27 | |
import javax.persistence.FetchType; |
28 | |
import javax.persistence.Id; |
29 | |
import javax.persistence.Lob; |
30 | |
import javax.persistence.NamedQueries; |
31 | |
import javax.persistence.NamedQuery; |
32 | |
import javax.persistence.OneToMany; |
33 | |
import javax.persistence.Table; |
34 | |
import javax.persistence.Transient; |
35 | |
|
36 | |
import org.kuali.rice.core.jpa.annotations.Sequence; |
37 | |
import org.kuali.rice.kew.bo.KewPersistableBusinessObjectBase; |
38 | |
import org.kuali.rice.kew.bo.WorkflowPersistable; |
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
@Entity |
48 | |
@Table(name="KREW_RULE_ATTR_T") |
49 | |
@Sequence(name="KREW_RTE_TMPL_S", property="ruleAttributeId") |
50 | |
@NamedQueries({ |
51 | |
@NamedQuery(name="RuleAttribute.FindById", query="select ra from RuleAttribute ra where ra.ruleAttributeId = :ruleAttributeId"), |
52 | |
@NamedQuery(name="RuleAttribute.FindByName", query="select ra from RuleAttribute ra where ra.name = :name"), |
53 | |
@NamedQuery(name="RuleAttribute.FindByClassName", query="select ra from RuleAttribute ra where ra.className = :className"), |
54 | |
@NamedQuery(name="RuleAttribute.GetAllRuleAttributes", query="select ra from RuleAttribute ra") |
55 | |
}) |
56 | |
public class RuleAttribute extends KewPersistableBusinessObjectBase implements WorkflowPersistable { |
57 | |
|
58 | |
private static final long serialVersionUID = 1027673603158346349L; |
59 | |
@Id |
60 | |
@Column(name="RULE_ATTR_ID") |
61 | |
private Long ruleAttributeId; |
62 | |
@Column(name="NM") |
63 | |
private String name; |
64 | |
@Column(name="LBL") |
65 | |
private String label; |
66 | |
@Column(name="RULE_ATTR_TYP_CD") |
67 | |
private String type; |
68 | |
@Column(name="CLS_NM") |
69 | |
private String className; |
70 | |
@Column(name="DESC_TXT") |
71 | |
private String description; |
72 | |
@Lob |
73 | |
@Basic(fetch=FetchType.LAZY) |
74 | |
@Column(name="XML") |
75 | |
private String xmlConfigData; |
76 | |
|
77 | |
@Column(name="SVC_NMSPC") |
78 | |
private String serviceNamespace; |
79 | |
|
80 | |
@OneToMany(cascade={CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.MERGE}, |
81 | |
targetEntity=org.kuali.rice.kew.rule.bo.RuleTemplateAttribute.class, mappedBy="ruleAttribute") |
82 | |
private List ruleTemplateAttributes; |
83 | |
@Transient |
84 | |
private List validValues; |
85 | |
|
86 | |
|
87 | |
@Transient |
88 | |
private String returnUrl; |
89 | |
|
90 | 0 | public RuleAttribute() { |
91 | 0 | ruleTemplateAttributes = new ArrayList(); |
92 | 0 | validValues = new ArrayList(); |
93 | 0 | } |
94 | |
|
95 | |
public List getValidValues() { |
96 | 0 | return validValues; |
97 | |
} |
98 | |
public void setValidValues(List ruleAttributeValidValues) { |
99 | 0 | this.validValues = ruleAttributeValidValues; |
100 | 0 | } |
101 | |
public List getRuleTemplateAttributes() { |
102 | 0 | return ruleTemplateAttributes; |
103 | |
} |
104 | |
public void setRuleTemplateAttributes(List ruleTemplateAttributes) { |
105 | 0 | this.ruleTemplateAttributes = ruleTemplateAttributes; |
106 | 0 | } |
107 | |
public String getDescription() { |
108 | 0 | return description; |
109 | |
} |
110 | |
public void setDescription(String description) { |
111 | 0 | this.description = description; |
112 | 0 | } |
113 | |
public String getLabel() { |
114 | 0 | return label; |
115 | |
} |
116 | |
public void setLabel(String label) { |
117 | 0 | this.label = label; |
118 | 0 | } |
119 | |
|
120 | |
public String getName() { |
121 | 0 | return name; |
122 | |
} |
123 | |
public void setName(String name) { |
124 | 0 | this.name = name; |
125 | 0 | } |
126 | |
public Long getRuleAttributeId() { |
127 | 0 | return ruleAttributeId; |
128 | |
} |
129 | |
public void setRuleAttributeId(Long ruleAttributeId) { |
130 | 0 | this.ruleAttributeId = ruleAttributeId; |
131 | 0 | } |
132 | |
public String getType() { |
133 | 0 | return type; |
134 | |
} |
135 | |
public void setType(String type) { |
136 | 0 | this.type = type; |
137 | 0 | } |
138 | |
|
139 | |
public Object copy(boolean preserveKeys) { |
140 | 0 | RuleAttribute ruleAttributeClone = new RuleAttribute(); |
141 | 0 | if(className != null){ |
142 | 0 | ruleAttributeClone.setClassName(new String (className)); |
143 | |
} |
144 | 0 | if(description != null){ |
145 | 0 | ruleAttributeClone.setDescription(new String (description)); |
146 | |
} |
147 | 0 | if(label != null){ |
148 | 0 | ruleAttributeClone.setLabel(new String(label)); |
149 | |
} |
150 | 0 | if(name != null){ |
151 | 0 | ruleAttributeClone.setName(new String (name)); |
152 | |
} |
153 | 0 | if(preserveKeys && ruleAttributeId != null){ |
154 | 0 | ruleAttributeClone.setRuleAttributeId(new Long(ruleAttributeId.longValue())); |
155 | |
} |
156 | 0 | if(type != null){ |
157 | 0 | ruleAttributeClone.setType(new String(type)); |
158 | |
} |
159 | 0 | return ruleAttributeClone; |
160 | |
} |
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
public String getClassName() { |
166 | 0 | return className; |
167 | |
} |
168 | |
|
169 | |
|
170 | |
|
171 | |
public void setClassName(String className) { |
172 | 0 | this.className = className; |
173 | 0 | } |
174 | |
|
175 | |
public String getRuleAttributeActionsUrl() { |
176 | 0 | return "<a href=\"RuleAttributeReport.do?ruleAttributeId="+ruleAttributeId+"\" >report</a>"; |
177 | |
} |
178 | |
|
179 | |
public String getReturnUrl() { |
180 | 0 | return returnUrl; |
181 | |
} |
182 | |
public void setReturnUrl(String returnUrl) { |
183 | 0 | this.returnUrl = returnUrl; |
184 | 0 | } |
185 | |
|
186 | |
public String getXmlConfigData() { |
187 | 0 | return xmlConfigData; |
188 | |
} |
189 | |
|
190 | |
public void setXmlConfigData(String xmlConfigData) { |
191 | 0 | this.xmlConfigData = xmlConfigData; |
192 | 0 | } |
193 | |
|
194 | |
public String getServiceNamespace() { |
195 | 0 | return serviceNamespace; |
196 | |
} |
197 | |
|
198 | |
public void setServiceNamespace(String ServiceNamespace) { |
199 | 0 | this.serviceNamespace = ServiceNamespace; |
200 | 0 | } |
201 | |
|
202 | |
@Override |
203 | |
protected LinkedHashMap<String, Object> toStringMapper() { |
204 | 0 | LinkedHashMap<String, Object> propMap = new LinkedHashMap<String, Object>(); |
205 | 0 | propMap.put("ruleAttributeId", getRuleAttributeId()); |
206 | 0 | propMap.put("name", getName()); |
207 | 0 | propMap.put("label", getLabel()); |
208 | 0 | propMap.put("description", getDescription()); |
209 | 0 | propMap.put("type", getType()); |
210 | 0 | propMap.put("className", getClassName()); |
211 | 0 | propMap.put("serviceNamespace", getServiceNamespace()); |
212 | 0 | return propMap; |
213 | |
} |
214 | |
|
215 | |
} |