You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2010/05/03 20:30:02 UTC

svn commit: r940559 - in /ofbiz/trunk: applications/workeffort/src/org/ofbiz/workeffort/workeffort/ framework/common/config/ framework/service/data/ framework/service/src/org/ofbiz/service/calendar/

Author: adrianc
Date: Mon May  3 18:30:02 2010
New Revision: 940559

URL: http://svn.apache.org/viewvc?rev=940559&view=rev
Log:
Removed deprecated temporal expression class.

Modified:
    ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalRecurConverter.java
    ofbiz/trunk/framework/common/config/TemporalExpressionUiLabels.xml
    ofbiz/trunk/framework/service/data/ServiceDemoData.xml
    ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionPrinter.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionVisitor.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
    ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java

Modified: ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalRecurConverter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalRecurConverter.java?rev=940559&r1=940558&r2=940559&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalRecurConverter.java (original)
+++ ofbiz/trunk/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalRecurConverter.java Mon May  3 18:30:02 2010
@@ -286,25 +286,6 @@ public class ICalRecurConverter implemen
         this.state.addRecur(recur);
     }
 
-    @SuppressWarnings({ "unchecked", "deprecation" })
-    @Override
-    public void visit(TimeOfDayRange expr) {
-        int startHr = expr.getStartHours();
-        int endHr = expr.getEndHours();
-        NumberList hourList = new NumberList();
-        hourList.add(startHr);
-        while (startHr != endHr) {
-            startHr++;
-            if (startHr == 24) {
-                startHr = 0;
-            }
-            hourList.add(startHr);
-        }
-        Recur recur = new Recur(Recur.HOURLY, 0);
-        recur.getHourList().addAll(hourList);
-        this.state.addRecur(recur);
-    }
-
     @Override
     public void visit(Union expr) {
         for (TemporalExpression childExpr : expr.getExpressionSet()) {

Modified: ofbiz/trunk/framework/common/config/TemporalExpressionUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/TemporalExpressionUiLabels.xml?rev=940559&r1=940558&r2=940559&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/TemporalExpressionUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/TemporalExpressionUiLabels.xml Mon May  3 18:30:02 2010
@@ -147,12 +147,6 @@
     <property key="TemporalExpression_SUBSTITUTION">
         <value xml:lang="en">Substitution</value>
     </property>
-    <property key="TemporalExpression_TIME_OF_DAY_RANGE">
-        <value xml:lang="en">Time Of Day Range (deprecated)</value>
-        <value xml:lang="fr">Intervalle entre 2 heures d'un jour</value>
-        <value xml:lang="it">Ora nel giorno dell'intervallo</value>
-        <value xml:lang="zh">日中时间的范围</value>
-    </property>
     <property key="TemporalExpression_UNION">
         <value xml:lang="en">Union</value>
         <value xml:lang="fr">Union</value>

Modified: ofbiz/trunk/framework/service/data/ServiceDemoData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/data/ServiceDemoData.xml?rev=940559&r1=940558&r2=940559&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/data/ServiceDemoData.xml (original)
+++ ofbiz/trunk/framework/service/data/ServiceDemoData.xml Mon May  3 18:30:02 2010
@@ -257,28 +257,24 @@ under the License.
 
         tempExprTypeId        integer1       integer2        date1  date2  string1    string2
         ====================  ============== =============== ====== ====== ========== ========
-        HOUR_RANGE            start[11]      end[11]
+        HOUR_RANGE            start[8]       end[8]
         DATE_RANGE                                           start  end
-        TIME_OF_DAY_RANGE[10] interval [9]   count [7]                     start [1]  end [1]
-        DAY_OF_WEEK_RANGE     start [2]      end [2]
-        MINUTE_RANGE          start [12]     end [12]
-        MONTH_RANGE           start [3]      end [3]
-        DAY_OF_MONTH_RANGE    start [4]      end [4]
-        DAY_IN_MONTH          day [2]        occurrence [5]
-        FREQUENCY             freq type [6]  freq count [7]  start[8]
+        DAY_OF_WEEK_RANGE     start [1]      end [1]
+        MINUTE_RANGE          start [9]      end [9]
+        MONTH_RANGE           start [2]      end [2]
+        DAY_OF_MONTH_RANGE    start [3]      end [3]
+        DAY_IN_MONTH          day [1]        occurrence [4]
+        FREQUENCY             freq type [5]  freq count [6]  start[7]
 
-        [1] hh:mm:ss
-        [2] Day of week: 1 = Sunday, 7 = Saturday
-        [3] Month: January = 0, Undecimber = 12
-        [4] Day of month: 1 to 31
-        [5] Integer: -5 to +5, zero excluded
-        [6] Second = 13, Minute = 12, Hour = 11, Day = 5, Month = 2, Year = 1
-        [7] Positive integer, zero excluded
-        [8] If null, defaults to system date when the expression was retrieved from storage.
-        [9] Second = 13, Minute = 12, Hour = 11 (default)
-        [10] Deprecated - do not use
-        [11] Integer: 0 to 23, midnight = 0
-        [12] Integer: 0 to 59
+        [1] Day of week: 1 = Sunday, 7 = Saturday
+        [2] Month: January = 0, Undecimber = 12
+        [3] Day of month: 1 to 31
+        [4] Integer: -5 to +5, zero excluded
+        [5] Second = 13, Minute = 12, Hour = 11, Day = 5, Month = 2, Year = 1
+        [6] Positive integer, zero excluded
+        [7] If null, defaults to system date when the expression was retrieved from storage.
+        [8] Integer: 0 to 23, midnight = 0
+        [9] Integer: 0 to 59
     -->
 
 </entity-engine-xml>

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionPrinter.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionPrinter.java?rev=940559&r1=940558&r2=940559&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionPrinter.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionPrinter.java Mon May  3 18:30:02 2010
@@ -18,23 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.service.calendar;
 
-import org.ofbiz.service.calendar.TemporalExpressions.DateRange;
-import org.ofbiz.service.calendar.TemporalExpressions.DayInMonth;
-import org.ofbiz.service.calendar.TemporalExpressions.DayOfMonthRange;
-import org.ofbiz.service.calendar.TemporalExpressions.DayOfWeekRange;
-import org.ofbiz.service.calendar.TemporalExpressions.Difference;
-import org.ofbiz.service.calendar.TemporalExpressions.Frequency;
-import org.ofbiz.service.calendar.TemporalExpressions.HourRange;
-import org.ofbiz.service.calendar.TemporalExpressions.Intersection;
-import org.ofbiz.service.calendar.TemporalExpressions.MinuteRange;
-import org.ofbiz.service.calendar.TemporalExpressions.MonthRange;
-import org.ofbiz.service.calendar.TemporalExpressions.Null;
-import org.ofbiz.service.calendar.TemporalExpressions.Substitution;
-import org.ofbiz.service.calendar.TemporalExpressions.TimeOfDayRange;
-import org.ofbiz.service.calendar.TemporalExpressions.Union;
-
 /** Temporal expression pretty printer. */
-@SuppressWarnings("deprecation")
 public class TemporalExpressionPrinter implements TemporalExpressionVisitor {
     protected final TemporalExpression expression;
     protected final StringBuilder sb = new StringBuilder();
@@ -79,27 +63,27 @@ public class TemporalExpressionPrinter i
     }
 
     @Override
-    public void visit(DateRange expr) {
+    public void visit(TemporalExpressions.DateRange expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(DayInMonth expr) {
+    public void visit(TemporalExpressions.DayInMonth expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(DayOfMonthRange expr) {
+    public void visit(TemporalExpressions.DayOfMonthRange expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(DayOfWeekRange expr) {
+    public void visit(TemporalExpressions.DayOfWeekRange expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(Difference expr) {
+    public void visit(TemporalExpressions.Difference expr) {
         appendIndent();
         this.sb.append("Difference [");
         this.sb.append(expr.getId());
@@ -119,17 +103,17 @@ public class TemporalExpressionPrinter i
     }
 
     @Override
-    public void visit(Frequency expr) {
+    public void visit(TemporalExpressions.Frequency expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(HourRange expr) {
+    public void visit(TemporalExpressions.HourRange expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(Intersection expr) {
+    public void visit(TemporalExpressions.Intersection expr) {
         appendIndent();
         this.sb.append("Intersection [");
         this.sb.append(expr.getId());
@@ -142,22 +126,22 @@ public class TemporalExpressionPrinter i
     }
 
     @Override
-    public void visit(MinuteRange expr) {
+    public void visit(TemporalExpressions.MinuteRange expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(MonthRange expr) {
+    public void visit(TemporalExpressions.MonthRange expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(Null expr) {
+    public void visit(TemporalExpressions.Null expr) {
         appendExpression(expr);
     }
 
     @Override
-    public void visit(Substitution expr) {
+    public void visit(TemporalExpressions.Substitution expr) {
         appendIndent();
         this.sb.append("Substitution [");
         this.sb.append(expr.getId());
@@ -182,12 +166,7 @@ public class TemporalExpressionPrinter i
     }
 
     @Override
-    public void visit(TimeOfDayRange expr) {
-        appendExpression(expr);
-    }
-
-    @Override
-    public void visit(Union expr) {
+    public void visit(TemporalExpressions.Union expr) {
         appendIndent();
         this.sb.append("Union [");
         this.sb.append(expr.getId());

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionVisitor.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionVisitor.java?rev=940559&r1=940558&r2=940559&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionVisitor.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionVisitor.java Mon May  3 18:30:02 2010
@@ -32,7 +32,5 @@ public interface TemporalExpressionVisit
     void visit(TemporalExpressions.MonthRange expr);
     void visit(TemporalExpressions.Null expr);
     void visit(TemporalExpressions.Substitution expr);
-    @SuppressWarnings("deprecation")
-    void visit(TemporalExpressions.TimeOfDayRange expr);
     void visit(TemporalExpressions.Union expr);
 }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java?rev=940559&r1=940558&r2=940559&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java Mon May  3 18:30:02 2010
@@ -18,7 +18,6 @@
  *******************************************************************************/
 package org.ofbiz.service.calendar;
 
-import com.ibm.icu.util.Calendar;
 import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
@@ -48,10 +47,9 @@ public class TemporalExpressionWorker {
     public final static String MinuteRange = "MINUTE_RANGE";
     public final static String MonthRange = "MONTH_RANGE";
     public final static String Substitution = "SUBSTITUTION";
-    public final static String TimeOfDayRange = "TIME_OF_DAY_RANGE";
     public final static String Union = "UNION";
     public final static String ExpressionTypeList[] = {DateRange, DayInMonth, DayOfMonthRange, DayOfWeekRange,
-        Difference, Frequency, HourRange, Intersection, MinuteRange, MonthRange, TimeOfDayRange, Substitution, Union};
+        Difference, Frequency, HourRange, Intersection, MinuteRange, MonthRange, Substitution, Union};
 
     /** Get a <code>TemporalExpression</code> from persistent storage.
      * @param delegator
@@ -83,7 +81,6 @@ public class TemporalExpressionWorker {
      * @return A <code>TemporalExpression</code> instance based on <code>exprValue</code>
      * @throws GenericEntityException
      */
-    @SuppressWarnings("deprecation")
     public static TemporalExpression makeTemporalExpression(Delegator delegator, GenericValue exprValue) throws GenericEntityException {
         String tempExprId = exprValue.getString("tempExprId");
         String tempExprTypeId = exprValue.getString("tempExprTypeId");
@@ -136,19 +133,6 @@ public class TemporalExpressionWorker {
             if (inclAssoc != null && exclAssoc != null && substAssoc != null) {
                 return setExpressionId(exprValue, new TemporalExpressions.Substitution(getTemporalExpression(delegator, inclAssoc.getString("toTempExprId")), getTemporalExpression(delegator, exclAssoc.getString("toTempExprId")), getTemporalExpression(delegator, substAssoc.getString("toTempExprId"))));
             }
-        } else if (TimeOfDayRange.equals(tempExprTypeId)) {
-            Debug.logWarning(TimeOfDayRange + " has been deprecated. Use " + HourRange + " and/or " + MinuteRange, module);
-            int interval = Calendar.HOUR_OF_DAY;
-            int count = 1;
-            Long longObj = exprValue.getLong("integer1");
-            if (longObj != null) {
-                interval = longObj.intValue();
-            }
-            longObj = exprValue.getLong("integer2");
-            if (longObj != null) {
-                count = longObj.intValue();
-            }
-            return setExpressionId(exprValue, new TemporalExpressions.TimeOfDayRange(exprValue.getString("string1"), exprValue.getString("string2"), interval, count));
         } else if (Union.equals(tempExprTypeId)) {
             return setExpressionId(exprValue, new TemporalExpressions.Union(getChildExpressions(delegator, tempExprId)));
         }

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java?rev=940559&r1=940558&r2=940559&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java Mon May  3 18:30:02 2010
@@ -26,7 +26,6 @@ import java.util.Set;
 import java.util.TreeSet;
 
 import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilValidate;
 
 /** A collection of TemporalExpression classes.
  * <p>For the most part, these classes are immutable - with the exception
@@ -1373,193 +1372,6 @@ public class TemporalExpressions impleme
         }
     }
 
-    /** A temporal expression that represents a time of day range.
-     * @deprecated 
-     */
-    @Deprecated
-    public static class TimeOfDayRange extends TemporalExpression {
-        protected final int count;
-        protected final int endHrs;
-        protected final int endMins;
-        protected final int endSecs;
-        protected final String endStr;
-        protected final int interval;
-        protected final int startHrs;
-        protected final int startMins;
-        protected final int startSecs;
-        protected final String startStr;
-
-        /**
-         * @param start A time String in the form of hh:mm:ss (24 hr clock)
-         * @param end A time String in the form of hh:mm:ss (24 hr clock)
-         * @param interval The range interval - must be one of <code>
-         * Calendar.SECOND Calendar.MINUTE Calendar.HOUR_OF_DAY</code>
-         * @param count The interval count - must be greater than zero
-         */
-        public TimeOfDayRange(String start, String end, int interval, int count) {
-            if (UtilValidate.isEmpty(start)) {
-                throw new IllegalArgumentException("start argument cannot be null or empty");
-            }
-            if (UtilValidate.isEmpty(end)) {
-                throw new IllegalArgumentException("end argument cannot be null or empty");
-            }
-            if (interval != Calendar.SECOND && interval != Calendar.MINUTE && interval != Calendar.HOUR_OF_DAY) {
-                throw new IllegalArgumentException("invalid interval argument");
-            }
-            if (count < 1) {
-                throw new IllegalArgumentException("invalid count argument");
-            }
-            this.startStr = start;
-            this.endStr = end;
-            this.interval = interval;
-            this.count = count;
-            String strArray[] = this.startStr.split(":");
-            if (strArray.length == 0 || strArray.length > 3) {
-                throw new IllegalArgumentException("Invalid start time argument");
-            }
-            this.startHrs = Integer.valueOf(strArray[0]);
-            this.startMins = strArray.length > 1 ? Integer.valueOf(strArray[1]) : 0;
-            this.startSecs = strArray.length > 2 ? Integer.valueOf(strArray[2]) : 0;
-            if (this.startHrs > 23 || this.startMins > 59 || this.startSecs > 59) {
-                throw new IllegalArgumentException("Invalid start time argument");
-            }
-            strArray = this.endStr.split(":");
-            if (strArray.length == 0 || strArray.length > 3) {
-                throw new IllegalArgumentException("Invalid end time argument");
-            }
-            this.endHrs = Integer.valueOf(strArray[0]);
-            this.endMins = strArray.length > 1 ? Integer.valueOf(strArray[1]) : 0;
-            this.endSecs = strArray.length > 2 ? Integer.valueOf(strArray[2]) : 0;
-            if (this.endHrs > 23 || this.endMins > 59 || this.endSecs > 59) {
-                throw new IllegalArgumentException("Invalid end time argument");
-            }
-            this.sequence = SEQUENCE_TOD_RANGE + this.startHrs;
-            if (Debug.verboseOn()) {
-                Debug.logVerbose("Created " + this, module);
-            }
-        }
-
-        @Override
-        public void accept(TemporalExpressionVisitor visitor) {
-            visitor.visit(this);
-        }
-
-        @Override
-        public boolean equals(Object obj) {
-            if (obj == this) {
-                return true;
-            }
-            try {
-                TimeOfDayRange that = (TimeOfDayRange) obj;
-                return this.startStr.equals(that.startStr) && this.endStr.equals(that.endStr);
-            } catch (ClassCastException e) {}
-            return false;
-        }
-
-        @Override
-        public Calendar first(Calendar cal) {
-            if (includesDate(cal)) {
-                return cal;
-            }
-            return next(cal);
-        }
-
-        public int getCount() {
-            return this.count;
-        }
-
-        public int getEndHours() {
-            return this.endHrs;
-        }
-
-        public int getEndMins() {
-            return this.endMins;
-        }
-
-        public int getEndSecs() {
-            return this.endSecs;
-        }
-
-        public int getInterval() {
-            return this.interval;
-        }
-
-        public int getStartHours() {
-            return this.startHrs;
-        }
-
-        public int getStartMins() {
-            return this.startMins;
-        }
-
-        public int getStartSecs() {
-            return this.startSecs;
-        }
-
-        @Override
-        public boolean includesDate(Calendar cal) {
-            long millis = cal.getTimeInMillis();
-            Calendar startCal = setStart(cal);
-            Calendar endCal = setEnd(startCal);
-            if (endCal.before(startCal)) {
-                endCal.add(Calendar.DAY_OF_MONTH, 1);
-            }
-            long startMillis = startCal.getTimeInMillis();
-            long endMillis = endCal.getTimeInMillis();
-            return millis >= startMillis && millis <= endMillis;
-        }
-
-        @Override
-        public boolean isSubstitutionCandidate(Calendar cal, TemporalExpression expressionToTest) {
-            Calendar checkCal = (Calendar) cal.clone();
-            checkCal.add(this.interval, -this.count);
-            while (!includesDate(checkCal)) {
-                if (expressionToTest.includesDate(checkCal)) {
-                    return true;
-                }
-                checkCal.add(this.interval, -this.count);
-            }
-            return false;
-        }
-
-        @Override
-        public Calendar next(Calendar cal, ExpressionContext context) {
-            Calendar next = (Calendar) cal.clone();
-            next.add(this.interval, this.count);
-            if (!includesDate(next)) {
-                Calendar last = next;
-                next = setStart(next);
-                if (next.before(last)) {
-                    next.add(Calendar.DAY_OF_MONTH, 1);
-                }
-            }
-            return next;
-        }
-
-        protected Calendar setCalendar(Calendar cal, int hrs, int mins, int secs) {
-            Calendar newCal = (Calendar) cal.clone();
-            newCal.set(Calendar.MILLISECOND, 0);
-            newCal.set(Calendar.SECOND, secs);
-            newCal.set(Calendar.MINUTE, mins);
-            newCal.set(Calendar.HOUR_OF_DAY, hrs);
-            return newCal;
-        }
-
-        protected Calendar setEnd(Calendar cal) {
-            return setCalendar(cal, this.endHrs, this.endMins, this.endSecs);
-        }
-
-        protected Calendar setStart(Calendar cal) {
-            return setCalendar(cal, this.startHrs, this.startMins, this.startSecs);
-        }
-
-        @Override
-        public String toString() {
-            return super.toString() + ", start = " + this.startStr + ", end = " + this.endStr
-            + ", interval = " + this.interval + ", count = " + this.count;
-        }
-    }
-
     /** A temporal expression that represents a mathematical union of all of its
      * member expressions. */
     public static class Union extends TemporalExpression {