Coverage Report - org.kuali.rice.kew.rule.RuleExtensionValue
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleExtensionValue
0%
0/31
0%
0/8
1.294
 
 1  
 /*
 2  
  * Copyright 2005-2008 The Kuali Foundation
 3  
  * 
 4  
  * 
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  * 
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 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  
  * The value of an extension to a rule.  Essentially contains a
 31  
  * key-value pair containing the key of the extension data and
 32  
  * it's value.
 33  
  * 
 34  
  * @see RuleBaseValues
 35  
  * @see RuleExtension
 36  
  *
 37  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 38  
  */
 39  
 @Entity
 40  
 @Table(name="KREW_RULE_EXT_VAL_T")
 41  
 //@Sequence(name="KREW_RTE_TMPL_S", property="ruleExtensionValueId")
 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 String ruleExtensionValueId;
 53  
     @Column(name="RULE_EXT_ID", insertable=false, updatable=false)
 54  
         private String 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  
     //@PrePersist
 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 String getRuleExtensionId() {
 99  0
         return ruleExtensionId;
 100  
     }
 101  
     public void setRuleExtensionId(String ruleExtensionId) {
 102  0
         this.ruleExtensionId = ruleExtensionId;
 103  0
     }
 104  
     public String getRuleExtensionValueId() {
 105  0
         return ruleExtensionValueId;
 106  
     }
 107  
     public void setRuleExtensionValueId(String 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  
 }