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.Column; |
20 | |
import javax.persistence.Entity; |
21 | |
import javax.persistence.FetchType; |
22 | |
import javax.persistence.Id; |
23 | |
import javax.persistence.JoinColumn; |
24 | |
import javax.persistence.ManyToOne; |
25 | |
import javax.persistence.PrePersist; |
26 | |
import javax.persistence.Table; |
27 | |
import javax.persistence.Version; |
28 | |
|
29 | |
import org.kuali.rice.core.jpa.annotations.Sequence; |
30 | |
import org.kuali.rice.core.util.OrmUtils; |
31 | |
import org.kuali.rice.kew.bo.WorkflowPersistable; |
32 | |
import org.kuali.rice.kew.rule.bo.RuleTemplate; |
33 | |
import org.kuali.rice.kew.service.KEWServiceLocator; |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
@Entity |
46 | |
@Table(name="KREW_RULE_TMPL_OPTN_T") |
47 | |
@Sequence(name="KREW_RULE_TMPL_OPTN_S", property="ruleTemplateOptionId") |
48 | |
public class RuleTemplateOption implements WorkflowPersistable { |
49 | |
|
50 | |
private static final long serialVersionUID = 8913119135197149224L; |
51 | |
@Id |
52 | |
@Column(name="RULE_TMPL_OPTN_ID") |
53 | |
private Long ruleTemplateOptionId; |
54 | |
@Column(name="RULE_TMPL_ID", insertable=false, updatable=false) |
55 | |
private Long ruleTemplateId; |
56 | |
@Column(name="KEY_CD") |
57 | |
private String key; |
58 | |
@Column(name="VAL") |
59 | |
private String value; |
60 | |
@Version |
61 | |
@Column(name="VER_NBR") |
62 | |
private Integer lockVerNbr; |
63 | |
|
64 | |
@ManyToOne(fetch=FetchType.EAGER) |
65 | |
@JoinColumn(name="RULE_TMPL_ID") |
66 | |
private RuleTemplate ruleTemplate; |
67 | |
|
68 | 0 | public RuleTemplateOption(){} |
69 | |
|
70 | 0 | public RuleTemplateOption(String key, String value){ |
71 | 0 | this.key = key; |
72 | 0 | this.value = value; |
73 | 0 | } |
74 | |
|
75 | |
@PrePersist |
76 | |
public void beforeInsert(){ |
77 | 0 | OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager()); |
78 | 0 | } |
79 | |
|
80 | |
public Object copy(boolean preserveKeys) { |
81 | 0 | RuleTemplateOption ruleTemplateOptionClone = new RuleTemplateOption(); |
82 | |
|
83 | 0 | if (key != null) { |
84 | 0 | ruleTemplateOptionClone.setKey(new String(key)); |
85 | |
} |
86 | 0 | if (value != null) { |
87 | 0 | ruleTemplateOptionClone.setValue(new String(value)); |
88 | |
} |
89 | 0 | if (preserveKeys && ruleTemplateOptionId != null) { |
90 | 0 | ruleTemplateOptionClone.setRuleTemplateOptionId(new Long(ruleTemplateOptionId.longValue())); |
91 | |
} |
92 | 0 | return ruleTemplateOptionClone; |
93 | |
} |
94 | |
|
95 | |
public String getKey() { |
96 | 0 | return key; |
97 | |
} |
98 | |
|
99 | |
public void setKey(String key) { |
100 | 0 | this.key = key; |
101 | 0 | } |
102 | |
|
103 | |
public Integer getLockVerNbr() { |
104 | 0 | return lockVerNbr; |
105 | |
} |
106 | |
|
107 | |
public void setLockVerNbr(Integer lockVerNbr) { |
108 | 0 | this.lockVerNbr = lockVerNbr; |
109 | 0 | } |
110 | |
|
111 | |
public RuleTemplate getRuleTemplate() { |
112 | 0 | return ruleTemplate; |
113 | |
} |
114 | |
|
115 | |
public void setRuleTemplate(RuleTemplate ruleTemplate) { |
116 | 0 | this.ruleTemplate = ruleTemplate; |
117 | 0 | } |
118 | |
|
119 | |
public Long getRuleTemplateId() { |
120 | 0 | return ruleTemplateId; |
121 | |
} |
122 | |
|
123 | |
public void setRuleTemplateId(Long ruleTemplateId) { |
124 | 0 | this.ruleTemplateId = ruleTemplateId; |
125 | 0 | } |
126 | |
|
127 | |
public Long getRuleTemplateOptionId() { |
128 | 0 | return ruleTemplateOptionId; |
129 | |
} |
130 | |
|
131 | |
public void setRuleTemplateOptionId(Long ruleTemplateOptionId) { |
132 | 0 | this.ruleTemplateOptionId = ruleTemplateOptionId; |
133 | 0 | } |
134 | |
|
135 | |
public String getValue() { |
136 | 0 | return value; |
137 | |
} |
138 | |
|
139 | |
public void setValue(String value) { |
140 | 0 | this.value = value; |
141 | 0 | } |
142 | |
} |
143 | |
|