Coverage Report - org.kuali.rice.kew.rule.RuleTemplateOptionBo
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleTemplateOptionBo
0%
0/27
N/A
1
 
 1  
 /**
 2  
  * Copyright 2005-2011 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.hibernate.annotations.GenericGenerator;
 19  
 import org.hibernate.annotations.Parameter;
 20  
 import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;
 21  
 import org.kuali.rice.kew.api.rule.RuleTemplateOptionContract;
 22  
 import org.kuali.rice.kew.rule.bo.RuleTemplateBo;
 23  
 import org.kuali.rice.kew.service.KEWServiceLocator;
 24  
 import org.kuali.rice.krad.bo.BusinessObjectBase;
 25  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 26  
 
 27  
 import javax.persistence.Column;
 28  
 import javax.persistence.Entity;
 29  
 import javax.persistence.FetchType;
 30  
 import javax.persistence.GeneratedValue;
 31  
 import javax.persistence.Id;
 32  
 import javax.persistence.JoinColumn;
 33  
 import javax.persistence.ManyToOne;
 34  
 import javax.persistence.Table;
 35  
 import javax.persistence.Version;
 36  
 
 37  
 /**
 38  
  * Defines default values and other preset information for a {@link RuleBaseValues} 
 39  
  * which is based off of the associated {@link org.kuali.rice.kew.rule.bo.RuleTemplateBo}.
 40  
  * 
 41  
  * @see RuleBaseValues
 42  
  * @see org.kuali.rice.kew.rule.bo.RuleTemplateBo
 43  
  *
 44  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 45  
  */
 46  
 @Entity
 47  
 @Table(name="KREW_RULE_TMPL_OPTN_T")
 48  
 //@Sequence(name="KREW_RULE_TMPL_OPTN_S", property="id")
 49  
 public class RuleTemplateOptionBo extends BusinessObjectBase implements RuleTemplateOptionContract {
 50  
 
 51  
         private static final long serialVersionUID = 8913119135197149224L;
 52  
         @Id
 53  
         @GeneratedValue(generator="KREW_RULE_TMPL_OPTN_S")
 54  
         @GenericGenerator(name="KREW_RULE_TMPL_OPTN_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={
 55  
                         @Parameter(name="sequence_name",value="KREW_RULE_TMPL_OPTN_S"),
 56  
                         @Parameter(name="value_column",value="id")
 57  
         })
 58  
         @Column(name="RULE_TMPL_OPTN_ID")
 59  
         private String id;
 60  
     @Column(name="RULE_TMPL_ID", insertable=false, updatable=false)
 61  
         private String ruleTemplateId;
 62  
     @Column(name="KEY_CD")
 63  
         private String code;
 64  
     @Column(name="VAL")
 65  
         private String value;
 66  
     @Version
 67  
         @Column(name="VER_NBR")
 68  
         private Long versionNumber;
 69  
 
 70  
     @ManyToOne(fetch=FetchType.EAGER)
 71  
         @JoinColumn(name="RULE_TMPL_ID")
 72  
         private RuleTemplateBo ruleTemplate;
 73  
     
 74  0
     public RuleTemplateOptionBo(){}
 75  
     
 76  0
     public RuleTemplateOptionBo(String key, String value){
 77  0
         this.code = key;
 78  0
         this.value = value;
 79  0
     }
 80  
 
 81  
     //@PrePersist
 82  
     public void beforeInsert(){
 83  0
         OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());
 84  0
     }
 85  
     @Override
 86  
     public String getCode() {
 87  0
         return code;
 88  
     }
 89  
 
 90  
     public void setCode(String code) {
 91  0
         this.code = code;
 92  0
     }
 93  
     @Override
 94  
     public Long getVersionNumber() {
 95  0
         return versionNumber;
 96  
     }
 97  
 
 98  
     public void setVersionNumber(Long versionNumber) {
 99  0
         this.versionNumber = versionNumber;
 100  0
     }
 101  
 
 102  
     public RuleTemplateBo getRuleTemplate() {
 103  0
         return ruleTemplate;
 104  
     }
 105  
 
 106  
     public void setRuleTemplate(RuleTemplateBo ruleTemplate) {
 107  0
         this.ruleTemplate = ruleTemplate;
 108  0
     }
 109  
     @Override
 110  
     public String getRuleTemplateId() {
 111  0
         return ruleTemplateId;
 112  
     }
 113  
 
 114  
     public void setRuleTemplateId(String ruleTemplateId) {
 115  0
         this.ruleTemplateId = ruleTemplateId;
 116  0
     }
 117  
     @Override
 118  
     public String getId() {
 119  0
         return id;
 120  
     }
 121  
 
 122  
     public void setId(String id) {
 123  0
         this.id = id;
 124  0
     }
 125  
 
 126  
     @Override
 127  
     public String getValue() {
 128  0
         return value;
 129  
     }
 130  
 
 131  
     public void setValue(String value) {
 132  0
         this.value = value;
 133  0
     }
 134  
 
 135  
     @Override
 136  
     public void refresh() {
 137  0
         KRADServiceLocator.getPersistenceService().retrieveNonKeyFields(this);
 138  0
     }
 139  
 }
 140