Coverage Report - org.kuali.rice.core.framework.persistence.ojb.conversion.OjbCharBooleanConversion3
 
Classes in this File Line Coverage Branch Coverage Complexity
OjbCharBooleanConversion3
0%
0/8
0%
0/6
3.5
 
 1  
 /*
 2  
  * Copyright 2007-2009 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.core.framework.persistence.ojb.conversion;
 17  
 
 18  
 import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
 19  
 
 20  
 /**
 21  
  * This class originates from a similar class in the Kuali Financial System and has been adapted from 
 22  
  * that original state which was originally authored by the Kuali Nervous System team.
 23  
  * 
 24  
  * For records in the KEW tables, "0" and "1" are used to represent "false" and "true"
 25  
  * respectively which is the standard way to represent these values in OJB.
 26  
  * This differs from other pieces of the KNS where "N" and "Y" are used.
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  0
 public class OjbCharBooleanConversion3 implements FieldConversion {
 31  
     
 32  
         /**
 33  
      * This handles checking any incoming String value and converts them
 34  
      * to the appropriate Boolean value. 
 35  
      * @see FieldConversion#javaToSql(Object)
 36  
      */
 37  
     public Object javaToSql(Object source) {
 38  0
         if (source instanceof String) {
 39  0
             if ("Y".equals(source)) {
 40  0
                 return Boolean.TRUE;
 41  
             }
 42  0
             else if ("N".equals(source)) {
 43  0
                 return Boolean.FALSE;
 44  
             }
 45  
         }
 46  0
         return source;
 47  
     }
 48  
 
 49  
     public Object sqlToJava(Object source) {
 50  0
         return source;
 51  
     }
 52  
 }