Coverage Report - org.kuali.rice.krad.datadictionary.KimDataDictionaryAttributeDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
KimDataDictionaryAttributeDefinition
0%
0/22
0%
0/4
1.5
 
 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.krad.datadictionary;
 17  
 
 18  
 import java.util.Map;
 19  
 
 20  
 import org.apache.commons.lang.ClassUtils;
 21  
 import org.apache.commons.lang.builder.ToStringBuilder;
 22  
 import org.kuali.rice.core.util.ClassLoaderUtils;
 23  
 import org.kuali.rice.krad.bo.BusinessObject;
 24  
 import org.kuali.rice.krad.datadictionary.exception.ClassValidationException;
 25  
 import org.kuali.rice.krad.datadictionary.mask.Mask;
 26  
 
 27  
 /**
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 public class KimDataDictionaryAttributeDefinition extends KimAttributeDefinition {
 31  
         private static final long serialVersionUID = 7006569761728813805L;
 32  
         
 33  
         protected Mask mask;
 34  
         protected Map<String, String> lookupInputPropertyConversions;
 35  
         protected Map<String, String> lookupReturnPropertyConversions;
 36  
         protected String lookupBoClass;
 37  
 
 38  
         /**
 39  
          * 
 40  
          */
 41  0
         public KimDataDictionaryAttributeDefinition() {
 42  0
         }
 43  
 
 44  
         /**
 45  
          * @return the lookupInputPropertyConversions
 46  
          */
 47  
         public Map<String, String> getLookupInputPropertyConversions() {
 48  0
                 return this.lookupInputPropertyConversions;
 49  
         }
 50  
 
 51  
         /**
 52  
          * @param lookupInputPropertyConversions
 53  
          *            the lookupInputPropertyConversions to set
 54  
          */
 55  
         public void setLookupInputPropertyConversions(Map<String, String> lookupInputPropertyConversions) {
 56  0
                 this.lookupInputPropertyConversions = lookupInputPropertyConversions;
 57  0
         }
 58  
 
 59  
         /**
 60  
          * @return the lookupReturnPropertyConversions
 61  
          */
 62  
         public Map<String, String> getLookupReturnPropertyConversions() {
 63  0
                 return this.lookupReturnPropertyConversions;
 64  
         }
 65  
 
 66  
         /**
 67  
          * @param lookupReturnPropertyConversions
 68  
          *            the lookupReturnPropertyConversions to set
 69  
          */
 70  
         public void setLookupReturnPropertyConversions(Map<String, String> lookupReturnPropertyConversions) {
 71  0
                 this.lookupReturnPropertyConversions = lookupReturnPropertyConversions;
 72  0
         }
 73  
 
 74  
         /**
 75  
          * @see java.lang.Object#toString()
 76  
          */
 77  
         public String toString() {
 78  0
                 return new ToStringBuilder( this )
 79  
                         .append( "name", getName() )
 80  
                         .append( "label", getLabel() )
 81  
                         .append( "lookupBoClass", this.lookupBoClass )
 82  
                         .append( "required", isRequired() )
 83  
                         .append( "lookupInputPropertyConversions", this.lookupInputPropertyConversions )
 84  
                         .append( "lookupReturnPropertyConversions", this.lookupReturnPropertyConversions )
 85  
                         .toString();
 86  
         }
 87  
 
 88  
         public String getLookupBoClass() {
 89  0
                 return this.lookupBoClass;
 90  
         }
 91  
 
 92  
         public void setLookupBoClass(String lookupBoClass) {
 93  0
                 this.lookupBoClass = lookupBoClass;
 94  0
         }
 95  
 
 96  
     @Override
 97  
     public boolean isHasLookupBoDefinition() {
 98  0
         return true;
 99  
     }
 100  
 
 101  
 
 102  
         @SuppressWarnings("unchecked")
 103  
         @Override
 104  
         public void completeValidation(Class rootObjectClass, Class otherObjectClass) {
 105  0
                 if (lookupBoClass != null) {
 106  
                 try {
 107  0
                         Class lookupBoClassObject = ClassUtils.getClass(ClassLoaderUtils.getDefaultClassLoader(), getLookupBoClass());
 108  0
                         if (!BusinessObject.class.isAssignableFrom(lookupBoClassObject)) {
 109  0
                                 throw new ClassValidationException("lookupBoClass is not a valid instance of " + BusinessObject.class.getName() + " instead was: " + lookupBoClassObject.getName());
 110  
                         }
 111  0
                 } catch (ClassNotFoundException e) {
 112  0
                         throw new ClassValidationException("lookupBoClass could not be found: " + getLookupBoClass(), e);
 113  0
                 }
 114  
         }
 115  0
                 super.completeValidation(rootObjectClass, otherObjectClass);
 116  0
         }
 117  
     
 118  
     
 119  
 
 120  
         
 121  
 }