Author: jaz
Date: Wed Jun 27 12:47:49 2007
New Revision: 551295
URL:
http://svn.apache.org/viewvc?view=rev&rev=551295Log:
added Uom -> Calendar worker methods
Modified:
ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java?view=diff&rev=551295&r1=551294&r2=551295==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java Wed Jun 27 12:47:49 2007
@@ -22,6 +22,7 @@
import org.ofbiz.entity.GenericDelegator;
import java.util.Calendar;
+import java.sql.Timestamp;
/**
* UomWorker
@@ -59,4 +60,26 @@
return null;
}
+
+ public static Calendar addUomTime(Calendar cal, Timestamp startTime, String uomId, int value) {
+ if (cal == null) {
+ cal = Calendar.getInstance();
+ }
+ if (startTime != null) {
+ cal.setTimeInMillis(startTime.getTime());
+ }
+ int[] conv = uomTimeToCalTime(uomId);
+
+ // conversion multiplier * value by type
+ cal.add(conv[0], (value * conv[1]));
+ return cal;
+ }
+
+ public static Calendar addUomTime(Calendar cal, String uomId, int value) {
+ return addUomTime(cal, null, uomId, value);
+ }
+
+ public static Calendar addUomTime(Timestamp startTime, String uomId, int value) {
+ return addUomTime(null, startTime, uomId, value);
+ }
}