1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.rule;
17
18 import org.apache.commons.lang.ObjectUtils;
19 import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;
20 import org.kuali.rice.kew.service.KEWServiceLocator;
21
22 import javax.persistence.CascadeType;
23 import javax.persistence.Column;
24 import javax.persistence.Entity;
25 import javax.persistence.FetchType;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.Id;
28 import javax.persistence.JoinColumn;
29 import javax.persistence.ManyToOne;
30 import javax.persistence.Table;
31 import javax.persistence.Version;
32 import java.io.Serializable;
33
34
35
36
37
38
39
40
41
42
43
44
45 @Entity
46 @Table(name="KREW_RULE_EXT_VAL_T")
47
48 public class RuleExtensionValue implements Serializable {
49
50 private static final long serialVersionUID = 8909789087052290261L;
51 @Id
52 @GeneratedValue(generator="KREW_RTE_TMPL_S")
53 @Column(name="RULE_EXT_VAL_ID")
54 private String ruleExtensionValueId;
55 @Column(name="RULE_EXT_ID", insertable=false, updatable=false)
56 private String ruleExtensionId;
57 @Column(name="VAL")
58 private String value;
59 @Column(name="KEY_CD")
60 private String key;
61 @Version
62 @Column(name="VER_NBR")
63 private Integer lockVerNbr;
64
65 @ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST})
66 @JoinColumn(name="RULE_EXT_ID")
67 private RuleExtensionBo extension;
68
69 public RuleExtensionValue() {
70 }
71
72 public RuleExtensionValue(String key, String value) {
73 this.key = key;
74 this.value = value;
75 }
76
77
78 public void beforeInsert(){
79 OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());
80 }
81
82 public RuleExtensionBo getExtension() {
83 return extension;
84 }
85 public void setExtension(RuleExtensionBo extension) {
86 this.extension = extension;
87 }
88 public Integer getLockVerNbr() {
89 return lockVerNbr;
90 }
91 public void setLockVerNbr(Integer lockVerNbr) {
92 this.lockVerNbr = lockVerNbr;
93 }
94 public String getKey() {
95 return key;
96 }
97 public void setKey(String key) {
98 this.key = key;
99 }
100 public String getRuleExtensionId() {
101 return ruleExtensionId;
102 }
103 public void setRuleExtensionId(String ruleExtensionId) {
104 this.ruleExtensionId = ruleExtensionId;
105 }
106 public String getRuleExtensionValueId() {
107 return ruleExtensionValueId;
108 }
109 public void setRuleExtensionValueId(String ruleExtensionValueId) {
110 this.ruleExtensionValueId = ruleExtensionValueId;
111 }
112 public String getValue() {
113 return value;
114 }
115 public void setValue(String value) {
116 this.value = value;
117 }
118
119 public boolean equals(Object o) {
120 if (o == null) return false;
121 if (!(o instanceof RuleExtensionValue)) return false;
122 RuleExtensionValue pred = (RuleExtensionValue) o;
123 return ObjectUtils.equals(key, pred.key) && ObjectUtils.equals(value, pred.value);
124 }
125
126 public String toString() {
127 return "[RuleExtensionValue:"
128 + " ruleExtensionValueId=" + ruleExtensionValueId
129 + ", ruleExtensionId=" + ruleExtensionId
130 + ", value=" + value
131 + ", key=" + key
132 + ", lockVerNbr=" + lockVerNbr
133 + "]";
134
135 }
136 }