Coverage Report - org.kuali.rice.core.impl.parameter.ParameterBo
 
Classes in this File Line Coverage Branch Coverage Complexity
ParameterBo
0%
0/20
0%
0/4
0
 
 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.core.impl.parameter;
 17  
 
 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.IdClass
 24  
 import javax.persistence.JoinColumn
 25  
 import javax.persistence.ManyToOne
 26  
 import javax.persistence.OneToOne
 27  
 import javax.persistence.Table
 28  
 import org.kuali.rice.core.api.parameter.EvaluationOperator
 29  
 import org.kuali.rice.core.api.parameter.ParameterContract
 30  
 import org.kuali.rice.core.impl.component.ComponentBo
 31  
 import org.kuali.rice.core.impl.namespace.NamespaceBo
 32  
 import org.kuali.rice.krad.bo.PersistableBusinessObjectBase
 33  
 import org.kuali.rice.core.impl.component.DerivedComponentBo
 34  
 
 35  
 @IdClass(ParameterId.class)
 36  
 @Entity
 37  
 @Table(name = "KRCR_PARM_T")
 38  
 public class ParameterBo extends PersistableBusinessObjectBase implements ParameterContract {
 39  
 
 40  
     private static final long serialVersionUID = 1L;
 41  
 
 42  
     @Id
 43  
     @Column(name = "NMSPC_CD")
 44  
     def String namespaceCode
 45  
 
 46  
     @Id
 47  
     @Column(name = "CMPNT_CD")
 48  
     def String componentCode
 49  
 
 50  
     @Id
 51  
     @Column(name = "PARM_NM")
 52  
     def String name
 53  
 
 54  
     @Id
 55  
     @Column(name = "APPL_ID")
 56  
     def String applicationId
 57  
 
 58  
     @Column(name = "VAL")
 59  
     def String value
 60  
 
 61  
     @Column(name = "PARM_DESC_TXT", length = 2048)
 62  
     def String description
 63  
 
 64  
     @Column(name = "PARM_TYP_CD")
 65  
     def String parameterTypeCode
 66  
 
 67  
     @Column(name = "EVAL_OPRTR_CD")
 68  
     def String evaluationOperatorCode
 69  
 
 70  
     @ManyToOne(fetch = FetchType.LAZY)
 71  
     @JoinColumn(name = "NMSPC_CD", insertable = false, updatable = false)
 72  
     def NamespaceBo namespace
 73  
 
 74  
     @OneToOne(fetch = FetchType.LAZY)
 75  
     @JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false)
 76  
     def ParameterTypeBo parameterType
 77  
 
 78  
     @OneToOne(fetch = FetchType.LAZY)
 79  
     @JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false)
 80  
     def ComponentBo component
 81  
 
 82  
     @OneToOne(fetch = FetchType.LAZY)
 83  
     @JoinColumn(name = "PARM_TYP_CD", insertable = false, updatable = false)
 84  
     def DerivedComponentBo derivedComponent
 85  
 
 86  
     /**
 87  
      * Converts a mutable bo to its immutable counterpart
 88  
      * @param bo the mutable business object
 89  
      * @return the immutable object
 90  
      */
 91  
     static org.kuali.rice.core.api.parameter.Parameter to(ParameterBo bo) {
 92  0
         if (bo == null) {
 93  0
             return null
 94  
         }
 95  
 
 96  0
         return org.kuali.rice.core.api.parameter.Parameter.Builder.create(bo).build();
 97  
     }
 98  
 
 99  
     /**
 100  
      * Converts a immutable object to its mutable counterpart
 101  
      * @param im immutable object
 102  
      * @return the mutable bo
 103  
      */
 104  
     static ParameterBo from(org.kuali.rice.core.api.parameter.Parameter im) {
 105  0
         if (im == null) {
 106  0
             return null
 107  
         }
 108  
 
 109  0
         ParameterBo bo = new ParameterBo()
 110  0
         bo.namespaceCode = im.namespaceCode
 111  0
         bo.componentCode = im.componentCode
 112  0
         bo.name = im.name
 113  0
         bo.applicationId = im.applicationId
 114  0
         bo.value = im.value
 115  0
         bo.description = im.description
 116  0
         bo.parameterTypeCode = im.parameterType.code
 117  0
         bo.evaluationOperatorCode = im.evaluationOperator.code
 118  
 
 119  0
         bo.parameterType = ParameterTypeBo.from(im.parameterType)
 120  0
         bo.versionNumber = im.versionNumber
 121  0
                 bo.objectId = im.objectId;
 122  
 
 123  0
         return bo
 124  
     }
 125  
 
 126  
     @Override
 127  
     ParameterTypeBo getParameterType() {
 128  0
         return parameterType
 129  
     }
 130  
         
 131  
         @Override
 132  
         EvaluationOperator getEvaluationOperator() {
 133  0
                 return EvaluationOperator.fromCode(evaluationOperatorCode);
 134  
         }
 135  
 }
 136