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 javax.persistence.CascadeType; |
20 | |
import javax.persistence.Column; |
21 | |
import javax.persistence.Entity; |
22 | |
import javax.persistence.FetchType; |
23 | |
import javax.persistence.Id; |
24 | |
import javax.persistence.JoinColumn; |
25 | |
import javax.persistence.ManyToOne; |
26 | |
import javax.persistence.PrePersist; |
27 | |
import javax.persistence.Table; |
28 | |
import javax.persistence.Version; |
29 | |
|
30 | |
import org.kuali.rice.core.jpa.annotations.Sequence; |
31 | |
import org.kuali.rice.core.util.OrmUtils; |
32 | |
import org.kuali.rice.kew.bo.WorkflowPersistable; |
33 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
34 | |
import org.kuali.rice.kew.util.Utilities; |
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
@Entity |
48 | |
@Table(name="KREW_RULE_EXT_VAL_T") |
49 | |
@Sequence(name="KREW_RTE_TMPL_S", property="ruleExtensionValueId") |
50 | |
public class RuleExtensionValue implements WorkflowPersistable { |
51 | |
|
52 | |
private static final long serialVersionUID = 8909789087052290261L; |
53 | |
@Id |
54 | |
@Column(name="RULE_EXT_VAL_ID") |
55 | |
private Long ruleExtensionValueId; |
56 | |
@Column(name="RULE_EXT_ID", insertable=false, updatable=false) |
57 | |
private Long ruleExtensionId; |
58 | |
@Column(name="VAL") |
59 | |
private String value; |
60 | |
@Column(name="KEY_CD") |
61 | |
private String key; |
62 | |
@Version |
63 | |
@Column(name="VER_NBR") |
64 | |
private Integer lockVerNbr; |
65 | |
|
66 | |
@ManyToOne(fetch=FetchType.EAGER, cascade={CascadeType.PERSIST}) |
67 | |
@JoinColumn(name="RULE_EXT_ID") |
68 | |
private RuleExtension extension; |
69 | |
|
70 | 0 | public RuleExtensionValue() { |
71 | 0 | } |
72 | |
|
73 | 0 | public RuleExtensionValue(String key, String value) { |
74 | 0 | this.key = key; |
75 | 0 | this.value = value; |
76 | 0 | } |
77 | |
|
78 | |
@PrePersist |
79 | |
public void beforeInsert(){ |
80 | 0 | OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); |
81 | 0 | } |
82 | |
|
83 | |
public RuleExtension getExtension() { |
84 | 0 | return extension; |
85 | |
} |
86 | |
public void setExtension(RuleExtension extension) { |
87 | 0 | this.extension = extension; |
88 | 0 | } |
89 | |
public Integer getLockVerNbr() { |
90 | 0 | return lockVerNbr; |
91 | |
} |
92 | |
public void setLockVerNbr(Integer lockVerNbr) { |
93 | 0 | this.lockVerNbr = lockVerNbr; |
94 | 0 | } |
95 | |
public String getKey() { |
96 | 0 | return key; |
97 | |
} |
98 | |
public void setKey(String key) { |
99 | 0 | this.key = key; |
100 | 0 | } |
101 | |
public Long getRuleExtensionId() { |
102 | 0 | return ruleExtensionId; |
103 | |
} |
104 | |
public void setRuleExtensionId(Long ruleExtensionId) { |
105 | 0 | this.ruleExtensionId = ruleExtensionId; |
106 | 0 | } |
107 | |
public Long getRuleExtensionValueId() { |
108 | 0 | return ruleExtensionValueId; |
109 | |
} |
110 | |
public void setRuleExtensionValueId(Long ruleExtensionValueId) { |
111 | 0 | this.ruleExtensionValueId = ruleExtensionValueId; |
112 | 0 | } |
113 | |
public String getValue() { |
114 | 0 | return value; |
115 | |
} |
116 | |
public void setValue(String value) { |
117 | 0 | this.value = value; |
118 | 0 | } |
119 | |
public Object copy(boolean preserveKeys) { |
120 | 0 | RuleExtensionValue ruleExtensionValueClone = new RuleExtensionValue(); |
121 | |
|
122 | 0 | if(key != null){ |
123 | 0 | ruleExtensionValueClone.setKey(new String(key)); |
124 | |
} |
125 | 0 | if(preserveKeys && ruleExtensionValueId != null){ |
126 | 0 | ruleExtensionValueClone.setRuleExtensionValueId(new Long(ruleExtensionValueId.longValue())); |
127 | |
} |
128 | 0 | if(value != null){ |
129 | 0 | ruleExtensionValueClone.setValue(new String(value)); |
130 | |
} |
131 | |
|
132 | 0 | return ruleExtensionValueClone; |
133 | |
} |
134 | |
|
135 | |
public boolean equals(Object o) { |
136 | 0 | if (o == null) return false; |
137 | 0 | if (!(o instanceof RuleExtensionValue)) return false; |
138 | 0 | RuleExtensionValue pred = (RuleExtensionValue) o; |
139 | 0 | return Utilities.equals(key, pred.key) && Utilities.equals(value, pred.value); |
140 | |
} |
141 | |
|
142 | |
public String toString() { |
143 | 0 | return "[RuleExtensionValue:" |
144 | |
+ " ruleExtensionValueId=" + ruleExtensionValueId |
145 | |
+ ", ruleExtensionId=" + ruleExtensionId |
146 | |
+ ", value=" + value |
147 | |
+ ", key=" + key |
148 | |
+ ", lockVerNbr=" + lockVerNbr |
149 | |
+ "]"; |
150 | |
|
151 | |
} |
152 | |
} |