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 public RuleTemplateOption(){}
69
70 public RuleTemplateOption(String key, String value){
71 this.key = key;
72 this.value = value;
73 }
74
75 @PrePersist
76 public void beforeInsert(){
77 OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());
78 }
79
80 public Object copy(boolean preserveKeys) {
81 RuleTemplateOption ruleTemplateOptionClone = new RuleTemplateOption();
82
83 if (key != null) {
84 ruleTemplateOptionClone.setKey(new String(key));
85 }
86 if (value != null) {
87 ruleTemplateOptionClone.setValue(new String(value));
88 }
89 if (preserveKeys && ruleTemplateOptionId != null) {
90 ruleTemplateOptionClone.setRuleTemplateOptionId(new Long(ruleTemplateOptionId.longValue()));
91 }
92 return ruleTemplateOptionClone;
93 }
94
95 public String getKey() {
96 return key;
97 }
98
99 public void setKey(String key) {
100 this.key = key;
101 }
102
103 public Integer getLockVerNbr() {
104 return lockVerNbr;
105 }
106
107 public void setLockVerNbr(Integer lockVerNbr) {
108 this.lockVerNbr = lockVerNbr;
109 }
110
111 public RuleTemplate getRuleTemplate() {
112 return ruleTemplate;
113 }
114
115 public void setRuleTemplate(RuleTemplate ruleTemplate) {
116 this.ruleTemplate = ruleTemplate;
117 }
118
119 public Long getRuleTemplateId() {
120 return ruleTemplateId;
121 }
122
123 public void setRuleTemplateId(Long ruleTemplateId) {
124 this.ruleTemplateId = ruleTemplateId;
125 }
126
127 public Long getRuleTemplateOptionId() {
128 return ruleTemplateOptionId;
129 }
130
131 public void setRuleTemplateOptionId(Long ruleTemplateOptionId) {
132 this.ruleTemplateOptionId = ruleTemplateOptionId;
133 }
134
135 public String getValue() {
136 return value;
137 }
138
139 public void setValue(String value) {
140 this.value = value;
141 }
142 }
143