Coverage Report - org.kuali.rice.kns.datadictionary.InactivationBlockingDefinition
 
Classes in this File Line Coverage Branch Coverage Complexity
InactivationBlockingDefinition
0%
0/29
0%
0/8
1.467
 
 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.kns.datadictionary;
 17  
 
 18  
 import org.apache.commons.lang.StringUtils;
 19  
 import org.kuali.rice.kns.bo.BusinessObject;
 20  
 import org.kuali.rice.kns.datadictionary.exception.AttributeValidationException;
 21  
 
 22  
 /**
 23  
  * This is a description of what this class does - wliang don't forget to fill this in. 
 24  
  * 
 25  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 26  
  *
 27  
  */
 28  
 public class InactivationBlockingDefinition extends DataDictionaryDefinitionBase implements InactivationBlockingMetadata {
 29  
         private static final long serialVersionUID = -8765429636173190984L;
 30  
         
 31  
         protected  Class<? extends BusinessObject> blockingReferenceBusinessObjectClass;
 32  
     protected  String blockedReferencePropertyName;
 33  
     protected  Class<? extends BusinessObject> blockedBusinessObjectClass;
 34  
     protected  String inactivationBlockingDetectionServiceBeanName;
 35  
     protected  String relationshipLabel;
 36  
     protected Class<? extends BusinessObject> businessObjectClass;
 37  
 
 38  0
     public InactivationBlockingDefinition() {
 39  0
     }    
 40  
 
 41  
     /**
 42  
      * This overridden method ...
 43  
      * 
 44  
      * @see org.kuali.rice.kns.datadictionary.DataDictionaryDefinition#completeValidation(java.lang.Class, java.lang.Class)
 45  
      */
 46  
     @SuppressWarnings("unchecked")
 47  
         public void completeValidation(Class rootBusinessObjectClass, Class otherBusinessObjectClass) {
 48  0
         if (StringUtils.isBlank(inactivationBlockingDetectionServiceBeanName)) {
 49  0
                 if (StringUtils.isBlank(blockedReferencePropertyName)) {
 50  
                         // the default inactivation blocking detection service (used when inactivationBlockingDetectionServiceBeanName is blank) requires that the property name be set
 51  0
                     throw new AttributeValidationException("inactivationBlockingDetectionServiceBeanName and  blockedReferencePropertyName can't both be blank in InactivationBlockingDefinition for class " +
 52  
                             rootBusinessObjectClass.getClass().getName());
 53  
                 }
 54  
         }
 55  0
         if (getBlockedBusinessObjectClass() == null) {
 56  0
                 throw new AttributeValidationException("Unable to determine blockedReferenceBusinessObjectClass in InactivationBlockingDefinition for class " +
 57  
                             rootBusinessObjectClass.getClass().getName());
 58  
         }
 59  0
         if (!BusinessObject.class.isAssignableFrom(getBlockedBusinessObjectClass())) {
 60  0
             throw new AttributeValidationException("InactivationBlockingDefinitions must block a reference of type BusinessObject.  Class name: " +
 61  
                     rootBusinessObjectClass.getClass().getName() + " blockedReferencePropertyName " + blockedReferencePropertyName + 
 62  
                     " class that should have been a BusinessObject: " + getBlockedBusinessObjectClass());
 63  
         }
 64  0
     }
 65  
 
 66  
     /**
 67  
      * This overridden method ...
 68  
      * 
 69  
      * @see org.kuali.rice.kns.datadictionary.InactivationBlockingMetadata#getBlockedReferencePropertyName()
 70  
      */
 71  
     public String getBlockedReferencePropertyName() {
 72  0
         return this.blockedReferencePropertyName;
 73  
     }
 74  
 
 75  
     public void setBlockedReferencePropertyName(String blockedReferencePropertyName) {
 76  0
         this.blockedReferencePropertyName = blockedReferencePropertyName;
 77  0
     }
 78  
 
 79  
     /**
 80  
      * This overridden method ...
 81  
      * 
 82  
      * @see org.kuali.rice.kns.datadictionary.InactivationBlockingMetadata#getBlockedBusinessObjectClass()
 83  
      */
 84  
     public Class<? extends BusinessObject> getBlockedBusinessObjectClass() {
 85  0
         return this.blockedBusinessObjectClass;
 86  
     }
 87  
 
 88  
     public void setBlockedBusinessObjectClass(Class<? extends BusinessObject> blockedBusinessObjectClass) {
 89  0
         this.blockedBusinessObjectClass = blockedBusinessObjectClass;
 90  0
     }
 91  
 
 92  
     /**
 93  
      * This overridden method ...
 94  
      * 
 95  
      * @see org.kuali.rice.kns.datadictionary.InactivationBlockingMetadata#getInactivationBlockingDetectionServiceBeanName()
 96  
      */
 97  
     public String getInactivationBlockingDetectionServiceBeanName() {
 98  0
         return this.inactivationBlockingDetectionServiceBeanName;
 99  
     }
 100  
 
 101  
     public void setInactivationBlockingDetectionServiceBeanName(String inactivationBlockingDetectionServiceImpl) {
 102  0
         this.inactivationBlockingDetectionServiceBeanName = inactivationBlockingDetectionServiceImpl;
 103  0
     }
 104  
 
 105  
     /**
 106  
      * This overridden method ...
 107  
      * 
 108  
      * @see org.kuali.rice.kns.datadictionary.InactivationBlockingMetadata#getBlockingReferenceBusinessObjectClass()
 109  
      */
 110  
     public Class<? extends BusinessObject> getBlockingReferenceBusinessObjectClass() {
 111  0
         return this.blockingReferenceBusinessObjectClass;
 112  
     }
 113  
 
 114  
     public void setBlockingReferenceBusinessObjectClass(Class<? extends BusinessObject> blockingReferenceBusinessObjectClass) {
 115  0
         this.blockingReferenceBusinessObjectClass = blockingReferenceBusinessObjectClass;
 116  0
     }
 117  
 
 118  
         public String getRelationshipLabel() {
 119  0
                 return this.relationshipLabel;
 120  
         }
 121  
 
 122  
         public void setRelationshipLabel(String relationshipLabel) {
 123  0
                 this.relationshipLabel = relationshipLabel;
 124  0
         }
 125  
 
 126  
         public Class<? extends BusinessObject> getBusinessObjectClass() {
 127  0
                 return this.businessObjectClass;
 128  
         }
 129  
 
 130  
         public void setBusinessObjectClass(Class<? extends BusinessObject> businessObjectClass) {
 131  0
                 this.businessObjectClass = businessObjectClass;
 132  0
         }
 133  
         
 134  
         @Override
 135  
         public String toString() {
 136  0
                 return "InactivationBlockingDefinition: blockedClass=" + blockedBusinessObjectClass.getName() 
 137  
                                 + " /blockingReferenceProperty=" + blockedReferencePropertyName
 138  
                                 + " /blockingClass=" + blockingReferenceBusinessObjectClass.getName();
 139  
         }
 140  
 }