Coverage Report - org.kuali.rice.kns.datadictionary.impl.FieldOverrideForListElementDeleteImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
FieldOverrideForListElementDeleteImpl
0%
0/7
0%
0/2
3
 
 1  
 /*
 2  
  * Copyright 2007-2010 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.impl;
 17  
 
 18  
 import java.util.List;
 19  
 
 20  
 import org.kuali.rice.kns.datadictionary.FieldOverride;
 21  
 
 22  
 /**
 23  
  * A Field Override used to delete elements from a Data Dictionary bean. 
 24  
  * 
 25  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 26  
  *
 27  
  */
 28  0
 public class FieldOverrideForListElementDeleteImpl extends FieldOverrideForListElementBase  implements FieldOverride{
 29  
         
 30  
         public Object performFieldOverride(Object bean, Object property) {
 31  0
         List oldList = (List)property;
 32  
 
 33  0
         int deletePos = getElementPositionInList(this.getElement(), oldList );
 34  
         
 35  0
         if ( deletePos < 0  )
 36  
         {
 37  0
                 throw new RuntimeException("Element to be deleted could not be found:bean=" + bean + ", property=" + property);
 38  
         }
 39  
         else
 40  
         {
 41  0
                 oldList.remove(deletePos);
 42  
         }
 43  0
         return oldList;
 44  
     }
 45  
 }