Coverage Report - org.kuali.rice.kim.bo.types.impl.KimAttributeDataImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
KimAttributeDataImpl
0%
0/30
0%
0/6
1.308
 
 1  
 /*
 2  
  * Copyright 2007-2008 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.kim.bo.types.impl;
 17  
 
 18  
 import java.util.LinkedHashMap;
 19  
 
 20  
 import javax.persistence.CascadeType;
 21  
 import javax.persistence.Column;
 22  
 import javax.persistence.FetchType;
 23  
 import javax.persistence.Id;
 24  
 import javax.persistence.JoinColumn;
 25  
 import javax.persistence.ManyToOne;
 26  
 import javax.persistence.MappedSuperclass;
 27  
 import javax.persistence.Transient;
 28  
 
 29  
 import org.kuali.rice.kim.bo.types.KimAttributeData;
 30  
 import org.kuali.rice.kim.bo.types.dto.KimTypeInfo;
 31  
 import org.kuali.rice.kim.service.KIMServiceLocator;
 32  
 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
 33  
 import org.kuali.rice.kns.util.ObjectUtils;
 34  
 
 35  
 /**
 36  
  * This is a description of what this class does - kellerj don't forget to fill this in.
 37  
  *
 38  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 39  
  *
 40  
  */
 41  
 @MappedSuperclass
 42  0
 public class KimAttributeDataImpl extends PersistableBusinessObjectBase implements KimAttributeData {
 43  
 
 44  
         private static final long serialVersionUID = 2717672624042902701L;
 45  
 
 46  
         @Id
 47  
         @Column(name="ATTR_DATA_ID")
 48  
         protected String attributeDataId;
 49  
 
 50  
         @Column(name="KIM_TYP_ID")
 51  
         protected String kimTypeId;
 52  
 
 53  
         @Column(name="KIM_ATTR_DEFN_ID")
 54  
         protected String kimAttributeId;
 55  
 
 56  
         @Column(name="ATTR_VAL")
 57  
         protected String attributeValue;
 58  
 
 59  
         @ManyToOne(targetEntity=KimAttributeImpl.class, fetch = FetchType.LAZY, cascade = { CascadeType.ALL })
 60  
         @JoinColumn(name = "KIM_ATTR_DEFN_ID", insertable = false, updatable = false)
 61  
         protected KimAttributeImpl kimAttribute;
 62  
 
 63  
         @Transient
 64  
         protected transient KimTypeInfo kimType;
 65  
 
 66  
         public String getAttributeDataId() {
 67  0
                 return this.attributeDataId;
 68  
         }
 69  
         public void setAttributeDataId(String attributeDataId) {
 70  0
                 this.attributeDataId = attributeDataId;
 71  0
         }
 72  
 
 73  
         public String getAttributeValue() {
 74  0
                 return this.attributeValue;
 75  
         }
 76  
         public void setAttributeValue(String attributeValue) {
 77  0
                 this.attributeValue = attributeValue;
 78  0
         }
 79  
         public String getKimTypeId() {
 80  0
                 return this.kimTypeId;
 81  
         }
 82  
         public void setKimTypeId(String kimTypeId) {
 83  0
                 this.kimTypeId = kimTypeId;
 84  0
         }
 85  
         public String getKimAttributeId() {
 86  0
                 return this.kimAttributeId;
 87  
         }
 88  
         public void setKimAttributeId(String kimAttributeId) {
 89  0
                 this.kimAttributeId = kimAttributeId;
 90  0
         }
 91  
         public KimAttributeImpl getKimAttribute() {
 92  0
                 if(ObjectUtils.isNull(this.kimAttribute)) {
 93  0
                                 this.refreshReferenceObject("kimAttribute");
 94  
                 }
 95  0
                 return this.kimAttribute;
 96  
         }
 97  
         public void setKimAttribute(KimAttributeImpl kimAttribute) {
 98  0
                 this.kimAttribute = kimAttribute;
 99  0
         }
 100  
         public KimTypeInfo getKimType() {
 101  0
                 if ( kimType == null ) {
 102  0
                         kimType = KIMServiceLocator.getTypeInfoService().getKimType(kimTypeId);
 103  
                 }
 104  0
                 return kimType;
 105  
         }
 106  
 
 107  
         /**
 108  
          * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
 109  
          */
 110  
         @SuppressWarnings("unchecked")
 111  
         @Override
 112  
         protected LinkedHashMap toStringMapper() {
 113  0
                 LinkedHashMap m = new LinkedHashMap();
 114  0
                 m.put( "attributeDataId", attributeDataId );
 115  0
                 m.put( "kimTypeId", kimTypeId );
 116  0
                 m.put( "kimAttributeId", kimAttributeId );
 117  0
                 m.put( "attributeValue", attributeValue );
 118  0
                 return m;
 119  
         }
 120  
 
 121  
         /**
 122  
          * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringBuilder(java.util.LinkedHashMap)
 123  
          */
 124  
         @SuppressWarnings("unchecked")
 125  
         @Override
 126  
     public String toStringBuilder(LinkedHashMap mapper) {
 127  0
         if(getKimAttribute() != null){
 128  0
                 return getAttributeValue();
 129  
         }
 130  
         else {
 131  0
             return super.toStringBuilder(mapper);
 132  
         }
 133  
     }
 134  
 
 135  
 }