Coverage Report - org.kuali.rice.kns.kim.type.KimAttributeDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
KimAttributeDefinition
0%
0/30
0%
0/4
1.333
 
 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.kns.kim.type;
 17  
 
 18  
 import org.apache.commons.lang.ClassUtils;
 19  
 import org.apache.commons.lang.builder.ToStringBuilder;
 20  
 import org.kuali.rice.core.api.util.ClassLoaderUtils;
 21  
 import org.kuali.rice.krad.bo.BusinessObject;
 22  
 import org.kuali.rice.krad.datadictionary.AttributeDefinition;
 23  
 import org.kuali.rice.krad.datadictionary.exception.ClassValidationException;
 24  
 
 25  
 import java.util.Map;
 26  
 
 27  
 /**
 28  
  * @deprecated A krad integrated type service base class will be provided in the future.
 29  
  * This is only used for the legacy {@link DataDictionaryTypeServiceBase}.
 30  
  */
 31  
 @Deprecated
 32  0
 final class KimAttributeDefinition extends AttributeDefinition {
 33  
         private static final long serialVersionUID = 7006569761728813805L;
 34  
 
 35  
         protected Map<String, String> lookupInputPropertyConversions;
 36  
         protected Map<String, String> lookupReturnPropertyConversions;
 37  
         protected String lookupBoClass;
 38  
     protected String sortCode;
 39  
         protected String kimAttrDefnId;
 40  
         protected String kimTypeId;
 41  
 
 42  
         /**
 43  
          * @return the sortCode
 44  
          */
 45  
         public String getSortCode() {
 46  0
                 return this.sortCode;
 47  
         }
 48  
 
 49  
         /**
 50  
          * @param sortCode
 51  
          *            the sortCode to set
 52  
          */
 53  
         public void setSortCode(String sortCode) {
 54  0
                 this.sortCode = sortCode;
 55  0
         }
 56  
 
 57  
         public String getKimAttrDefnId() {
 58  0
                 return this.kimAttrDefnId;
 59  
         }
 60  
 
 61  
         public void setKimAttrDefnId(String kimAttrDefnId) {
 62  0
                 this.kimAttrDefnId = kimAttrDefnId;
 63  0
         }
 64  
 
 65  
         /**
 66  
          * @return the kimTypeId
 67  
          */
 68  
         public String getKimTypeId() {
 69  0
                 return this.kimTypeId;
 70  
         }
 71  
 
 72  
         /**
 73  
          * @param kimTypeId the kimTypeId to set
 74  
          */
 75  
         public void setKimTypeId(String kimTypeId) {
 76  0
                 this.kimTypeId = kimTypeId;
 77  0
         }
 78  
 
 79  
 
 80  
         /**
 81  
          * @return the lookupInputPropertyConversions
 82  
          */
 83  
         public Map<String, String> getLookupInputPropertyConversions() {
 84  0
                 return this.lookupInputPropertyConversions;
 85  
         }
 86  
 
 87  
         /**
 88  
          * @param lookupInputPropertyConversions
 89  
          *            the lookupInputPropertyConversions to set
 90  
          */
 91  
         public void setLookupInputPropertyConversions(Map<String, String> lookupInputPropertyConversions) {
 92  0
                 this.lookupInputPropertyConversions = lookupInputPropertyConversions;
 93  0
         }
 94  
 
 95  
         /**
 96  
          * @return the lookupReturnPropertyConversions
 97  
          */
 98  
         public Map<String, String> getLookupReturnPropertyConversions() {
 99  0
                 return this.lookupReturnPropertyConversions;
 100  
         }
 101  
 
 102  
         /**
 103  
          * @param lookupReturnPropertyConversions
 104  
          *            the lookupReturnPropertyConversions to set
 105  
          */
 106  
         public void setLookupReturnPropertyConversions(Map<String, String> lookupReturnPropertyConversions) {
 107  0
                 this.lookupReturnPropertyConversions = lookupReturnPropertyConversions;
 108  0
         }
 109  
 
 110  
         /**
 111  
          * @see java.lang.Object#toString()
 112  
          */
 113  
         public String toString() {
 114  0
                 return new ToStringBuilder( this )
 115  
                         .append( "name", getName() )
 116  
                         .append( "label", getLabel() )
 117  
                         .append( "lookupBoClass", this.lookupBoClass )
 118  
                         .append( "required", isRequired() )
 119  
                         .append( "lookupInputPropertyConversions", this.lookupInputPropertyConversions )
 120  
                         .append( "lookupReturnPropertyConversions", this.lookupReturnPropertyConversions )
 121  
                         .toString();
 122  
         }
 123  
 
 124  
         public String getLookupBoClass() {
 125  0
                 return this.lookupBoClass;
 126  
         }
 127  
 
 128  
         public void setLookupBoClass(String lookupBoClass) {
 129  0
                 this.lookupBoClass = lookupBoClass;
 130  0
         }
 131  
 
 132  
     public boolean isHasLookupBoDefinition() {
 133  0
         return true;
 134  
     }
 135  
 
 136  
 
 137  
         @SuppressWarnings("unchecked")
 138  
         @Override
 139  
         public void completeValidation(Class rootObjectClass, Class otherObjectClass) {
 140  0
                 if (lookupBoClass != null) {
 141  
                 try {
 142  0
                         Class lookupBoClassObject = ClassUtils.getClass(ClassLoaderUtils.getDefaultClassLoader(), getLookupBoClass());
 143  0
                         if (!BusinessObject.class.isAssignableFrom(lookupBoClassObject)) {
 144  0
                                 throw new ClassValidationException("lookupBoClass is not a valid instance of " + BusinessObject.class.getName() + " instead was: " + lookupBoClassObject.getName());
 145  
                         }
 146  0
                 } catch (ClassNotFoundException e) {
 147  0
                         throw new ClassValidationException("lookupBoClass could not be found: " + getLookupBoClass(), e);
 148  0
                 }
 149  
         }
 150  0
                 super.completeValidation(rootObjectClass, otherObjectClass);
 151  0
         }
 152  
     
 153  
     
 154  
 
 155  
         
 156  
 }