svn commit: r532557 - in /ofbiz/trunk/framework/common/src/org/ofbiz/common/uom: ./ UomWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r532557 - in /ofbiz/trunk/framework/common/src/org/ofbiz/common/uom: ./ UomWorker.java

jaz-3
Author: jaz
Date: Wed Apr 25 18:24:51 2007
New Revision: 532557

URL: http://svn.apache.org/viewvc?view=rev&rev=532557
Log:
added UomWorker

Added:
    ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/
    ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java   (with props)

Added: 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=auto&rev=532557
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java (added)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java Wed Apr 25 18:24:51 2007
@@ -0,0 +1,62 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+package org.ofbiz.common.uom;
+
+import org.ofbiz.entity.GenericDelegator;
+
+import java.util.Calendar;
+
+/**
+ * UomWorker
+ */
+public class UomWorker {
+
+    public static final String module = UomWorker.class.getName();
+
+    public static int[] uomTimeToCalTime(String uomId) {
+        if ("TF_ms".equals(uomId)) {
+            return new int[] { Calendar.MILLISECOND, 1 };
+        } else if ("TF_s".equals(uomId)) {
+            return new int[] { Calendar.SECOND, 1 };
+        } else if ("TF_min".equals(uomId)) {
+            return new int[] { Calendar.MINUTE, 1 };
+        } else if ("TF_hr".equals(uomId)) {
+            return new int[] { Calendar.HOUR, 1 };
+        } else if ("TF_day".equals(uomId)) {
+            return new int[] { Calendar.DAY_OF_YEAR, 1 };
+        } else if ("TF_wk".equals(uomId)) {
+            return new int[] { Calendar.WEEK_OF_YEAR, 1 };
+        } else if ("TF_mon".equals(uomId)) {
+            return new int[] { Calendar.MONTH, 1 };
+        } else if ("TF_yr".equals(uomId)) {
+            return new int[] { Calendar.YEAR, 1 };
+        } else if ("TF_decade".equals(uomId)) {
+            return new int[] { Calendar.YEAR, 10 };
+        } else if ("TF_score".equals(uomId)) {
+            return new int[] { Calendar.YEAR, 20 };
+        } else if ("TF_century".equals(uomId)) {
+            return new int[] { Calendar.YEAR, 100 };
+        } else if ("TF_millenium".equals(uomId)) {
+            return new int[] { Calendar.YEAR, 1000 };
+        }
+
+        return null;
+    }
+}

Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/framework/common/src/org/ofbiz/common/uom/UomWorker.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain