1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.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
36 @Override
37 public Object javaToSql(Object source) {
38 Object sqlValue = super.javaToSql(source);
39
40 if(INDICATOR_NO.equals(sqlValue)) {
41 return INDICATOR_YES;
42 }
43 else if(INDICATOR_YES.equals(sqlValue)) {
44 return INDICATOR_NO;
45 }
46
47 return sqlValue;
48 }
49
50
51
52
53
54
55 @Override
56 public Object sqlToJava(Object source) {
57 Object javaValue = super.sqlToJava(source);
58
59 if(javaValue == null) {
60 return null;
61 }
62 else if(Boolean.TRUE.equals(javaValue)) {
63 return Boolean.FALSE;
64 }
65 else if(Boolean.FALSE.equals(javaValue)) {
66 return Boolean.TRUE;
67 }
68
69 return javaValue;
70 }
71 }