* like integer or string to the correct type
* @param o
*/
private boolean mapBooleanFromDB(Object o) {
if (o == null) {
UsageException errorVar = new UsageException("could not map null to a valid boolean");
ErrorMgr.addError(errorVar);
throw errorVar;
}
else if (o instanceof Boolean) {
return ((Boolean)o).booleanValue();
}
else if (o instanceof String) {
String s = (String)o;
if (cTRUE.equalsIgnoreCase(s)) {
return true;
}
else if (cFALSE.equalsIgnoreCase(s)) {
return false;
}
else if (cYES.equalsIgnoreCase(s)) {
return true;
}
else if (cNO.equalsIgnoreCase(s)) {
return false;
}
else {
return Boolean.valueOf(s).booleanValue();
}
}
else if (o instanceof Short) {
return ((Short)o).intValue() != cFALSE_INT;
}
else if (o instanceof Integer) {
return ((Integer)o).intValue() != cFALSE_INT;
}
else if (o instanceof BigDecimal) {
return ((BigDecimal)o).intValue() != cFALSE_INT;
}
else {
UsageException errorVar = new UsageException("Could not map object of type " + o.getClass() + " to boolean");
ErrorMgr.addError(errorVar);
throw errorVar;
}
}