1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kfs.coa.util;
17
18 import org.kuali.rice.core.framework.persistence.ojb.conversion.OjbCharBooleanConversion;
19
20
21
22
23
24
25 public class OjbAccountActiveIndicatorConversion extends OjbCharBooleanConversion {
26 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(OjbAccountActiveIndicatorConversion.class);
27
28 public final static String INDICATOR_NO = "N";
29 public final static String INDICATOR_YES = "Y";
30
31
32
33
34
35 @Override
36 public Object javaToSql(Object source) {
37 Object sqlValue = super.javaToSql(source);
38
39 if(INDICATOR_NO.equals(sqlValue)) {
40 return INDICATOR_YES;
41 }
42 else if(INDICATOR_YES.equals(sqlValue)) {
43 return INDICATOR_NO;
44 }
45
46 return sqlValue;
47 }
48
49
50
51
52
53 @Override
54 public Object sqlToJava(Object source) {
55 Object javaValue = super.sqlToJava(source);
56
57 if(javaValue == null) {
58 return null;
59 }
60 else if(Boolean.TRUE.equals(javaValue)) {
61 return Boolean.FALSE;
62 }
63 else if(Boolean.FALSE.equals(javaValue)) {
64 return Boolean.TRUE;
65 }
66
67 return javaValue;
68 }
69 }