View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kew.rule;
17  
18  import org.apache.commons.lang.ObjectUtils;
19  import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator;
20  
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.FetchType;
24  import javax.persistence.GeneratedValue;
25  import javax.persistence.Id;
26  import javax.persistence.JoinColumn;
27  import javax.persistence.ManyToOne;
28  import javax.persistence.Table;
29  import javax.persistence.Version;
30  import java.io.Serializable;
31  
32  
33  /**
34   * The value of an extension to a rule.  Essentially contains a
35   * key-value pair containing the key of the extension data and
36   * it's value.
37   * 
38   * @see RuleBaseValues
39   * @see RuleExtensionBo
40   *
41   * @author Kuali Rice Team (rice.collab@kuali.org)
42   */
43  @Entity
44  @Table(name="KREW_RULE_EXT_VAL_T")
45  public class RuleExtensionValue implements Serializable {
46  
47  	private static final long serialVersionUID = 8909789087052290261L;
48  	@Id
49      @PortableSequenceGenerator(name="KREW_RTE_TMPL_S")
50  	@GeneratedValue(generator="KREW_RTE_TMPL_S")
51  	@Column(name="RULE_EXT_VAL_ID")
52  	private String ruleExtensionValueId;
53  
54      @Column(name="VAL")
55  	private String value;
56      @Column(name="KEY_CD")
57  	private String key;
58      @Version
59  	@Column(name="VER_NBR")
60  	private Integer lockVerNbr;
61      
62      @ManyToOne(fetch=FetchType.EAGER)
63  	@JoinColumn(name="RULE_EXT_ID", nullable = false)
64  	private RuleExtensionBo extension;
65      
66      public RuleExtensionValue() {
67      }
68      
69      public RuleExtensionValue(String key, String value) {
70          this.key = key;
71          this.value = value;
72      }
73  
74      public RuleExtensionBo getExtension() {
75          return extension;
76      }
77      public void setExtension(RuleExtensionBo extension) {
78          this.extension = extension;
79      }
80      public Integer getLockVerNbr() {
81          return lockVerNbr;
82      }
83      public void setLockVerNbr(Integer lockVerNbr) {
84          this.lockVerNbr = lockVerNbr;
85      }
86      public String getKey() {
87          return key;
88      }
89      public void setKey(String key) {
90          this.key = key;
91      }
92      public String getRuleExtensionValueId() {
93          return ruleExtensionValueId;
94      }
95      public void setRuleExtensionValueId(String ruleExtensionValueId) {
96          this.ruleExtensionValueId = ruleExtensionValueId;
97      }
98      public String getValue() {
99          return value;
100     }
101     public void setValue(String value) {
102         this.value = value;
103     }
104 
105     public boolean equals(Object o) {
106         if (o == null) return false;
107         if (!(o instanceof RuleExtensionValue)) return false;
108         RuleExtensionValue pred = (RuleExtensionValue) o;
109         return ObjectUtils.equals(key, pred.key) && ObjectUtils.equals(value, pred.value);
110     }
111 
112     public String toString() {
113         return "[RuleExtensionValue:"
114                +  " ruleExtensionValueId=" + ruleExtensionValueId
115                + ", value=" + value
116                + ", key=" + key
117                + ", lockVerNbr=" + lockVerNbr
118                + "]";
119             
120     }
121 }