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