Author: adrianc
Date: Wed Jul 30 15:19:35 2008
New Revision: 681224
URL:
http://svn.apache.org/viewvc?rev=681224&view=revLog:
ObjectType.java simpleTypeConvert(...) improvement - now converts Long to Date and back, and Long to Timestamp and back.
Modified:
ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java
Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java?rev=681224&r1=681223&r2=681224&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/ObjectType.java Wed Jul 30 15:19:35 2008
@@ -710,6 +710,10 @@
Set<Long> tempSet = FastSet.newInstance();
tempSet.add(lng);
return tempSet;
+ } else if ("Date".equals(type) || "java.util.Date".equals(type)) {
+ return new Date(lng.longValue());
+ } else if ("Timestamp".equals(type) || "java.sql.Timestamp".equals(type)) {
+ return new java.sql.Timestamp(lng.longValue());
} else {
throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported");
}
@@ -792,6 +796,8 @@
Set<java.sql.Date> tempSet = FastSet.newInstance();
tempSet.add(dte);
return tempSet;
+ } else if ("Long".equals(type) || "java.lang.Long".equals(type)) {
+ return Long.valueOf(dte.getTime());
} else {
throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported");
}
@@ -850,6 +856,8 @@
Set<java.sql.Timestamp> tempSet = FastSet.newInstance();
tempSet.add(tme);
return tempSet;
+ } else if ("Long".equals(type) || "java.lang.Long".equals(type)) {
+ return Long.valueOf(tme.getTime());
} else {
throw new GeneralException("Conversion from " + fromType + " to " + type + " not currently supported");
}