Author: adrianc
Date: Tue Sep 16 11:19:55 2008
New Revision: 695995
URL: http://svn.apache.org/viewvc?rev=695995&view=rev
Log:
More temporal expression work - additional JavaDocs, code fixups, converted all
job sandbox jobs to temporal expressions.
Modified:
ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
ofbiz/trunk/applications/order/data/OrderScheduledServices.xml
ofbiz/trunk/applications/party/data/ScheduledJobs.xml
ofbiz/trunk/applications/product/data/ProductScheduledServices.xml
ofbiz/trunk/framework/service/data/ServiceDemoData.xml
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceInfo.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TemporalExpressions.java
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TimeDuration.java
Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=695995&r1=695994&r2=695995&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Tue Sep 16
11:19:55 2008
@@ -160,7 +160,7 @@
<!-- The following three elements set up a regularly scheduled job that
will automatically create
fixed asset maintenances from ProductMaint time intervals. -->
- <TemporalExpression tempExprId="FAM_AUTO_CREATE"
tempExprTypeId="FREQUENCY" date1="2000-01-01 00:00:00.000" integer1="12"
integer2="5"/>
+ <TemporalExpression tempExprId="FAM_AUTO_CREATE"
tempExprTypeId="FREQUENCY" integer1="12" integer2="5"/>
<JobSandbox jobId="FAM_AUTO_CREATE" jobName="Auto-create Fixed Asset
Maintenances" runTime="2000-01-01 00:00:00.000"
serviceName="createMaintsFromTimeInterval" poolId="pool" runAsUser="system"
tempExprId="FAM_AUTO_CREATE" maxRecurrenceCount="-1"/>
<!-- Fixed Asset Maintenance party roles -->
Modified: ofbiz/trunk/applications/order/data/OrderScheduledServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderScheduledServices.xml?rev=695995&r1=695994&r2=695995&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/data/OrderScheduledServices.xml (original)
+++ ofbiz/trunk/applications/order/data/OrderScheduledServices.xml Tue Sep 16
11:19:55 2008
@@ -19,20 +19,12 @@
-->
<entity-engine-xml>
- <RecurrenceRule recurrenceRuleId="200" untilDateTime="" frequency="DAILY"
intervalNumber="1" countNumber="-1"/>
- <RecurrenceInfo recurrenceInfoId="200" startDateTime="2000-01-01
00:00:00.000" recurrenceRuleId="200" recurrenceCount="0"/>
- <RecurrenceInfo recurrenceInfoId="201" startDateTime="2000-01-01
01:00:00.000" recurrenceRuleId="200" recurrenceCount="0"/>
- <RecurrenceInfo recurrenceInfoId="202" startDateTime="2000-01-01
02:00:00.000" recurrenceRuleId="200" recurrenceCount="0"/>
- <RecurrenceInfo recurrenceInfoId="203" startDateTime="2000-01-01
03:00:00.000" recurrenceRuleId="200" recurrenceCount="0"/>
- <RecurrenceInfo recurrenceInfoId="204" startDateTime="2000-01-01
04:00:00.000" recurrenceRuleId="200" recurrenceCount="0"/>
-
- <JobSandbox jobId="8000" jobName="BackOrder Notification"
runTime="2000-01-01 00:00:00.000" serviceName="checkInventoryAvailability"
poolId="pool" runAsUser="system" recurrenceInfoId="200"/>
- <JobSandbox jobId="8001" jobName="Re-Try Failed Auths" runTime="2000-01-01
01:00:00.000" serviceName="retryFailedAuths" poolId="pool" runAsUser="system"
recurrenceInfoId="201"/>
-
+ <JobSandbox jobId="8000" jobName="BackOrder Notification"
runTime="2000-01-01 00:00:00.000" serviceName="checkInventoryAvailability"
poolId="pool" runAsUser="system" tempExprId="MIDNIGHT_DAILY"
maxRecurrenceCount="-1"/>
+ <JobSandbox jobId="8001" jobName="Re-Try Failed Auths" runTime="2000-01-01
01:00:00.000" serviceName="retryFailedAuths" poolId="pool" runAsUser="system"
tempExprId="MIDNIGHT_DAILY" maxRecurrenceCount="-1"/>
<!-- Schedule this job if you want orders older than 30 days to be
automatically cancelled
- <JobSandbox jobId="8002" jobName="Order Auto-Cancel" runTime="2000-01-01
03:00:00.000" serviceName="autoCancelOrderItems" poolId="pool"
runAsUser="system" recurrenceInfoId="202"/>
+ <JobSandbox jobId="8002" jobName="Order Auto-Cancel" runTime="2000-01-01
03:00:00.000" serviceName="autoCancelOrderItems" poolId="pool"
runAsUser="system" tempExprId="MIDNIGHT_DAILY" maxRecurrenceCount="-1"/>
-->
- <JobSandbox jobId="8003" jobName="Run Auto-Reorders" runTime="2000-01-01
03:00:00.000" serviceName="runShoppingListAutoReorder" poolId="pool"
runAsUser="system" recurrenceInfoId="203"/>
- <JobSandbox jobId="8004" jobName="Re-Try Failed Auths NSF"
runTime="2000-01-01 01:00:00.000" serviceName="retryFailedAuthNsfs"
poolId="pool" runAsUser="system" recurrenceInfoId="204"/>
- <JobSandbox jobId="8005" jobName="Extend expired Subscriptions"
runTime="2000-01-01 03:00:00.000" serviceName="runSubscriptionAutoReorders"
poolId="pool" runAsUser="system" recurrenceInfoId="203"/>
+ <JobSandbox jobId="8003" jobName="Run Auto-Reorders" runTime="2000-01-01
03:00:00.000" serviceName="runShoppingListAutoReorder" poolId="pool"
runAsUser="system" tempExprId="MIDNIGHT_DAILY" maxRecurrenceCount="-1"/>
+ <JobSandbox jobId="8004" jobName="Re-Try Failed Auths NSF"
runTime="2000-01-01 01:00:00.000" serviceName="retryFailedAuthNsfs"
poolId="pool" runAsUser="system" tempExprId="MIDNIGHT_DAILY"
maxRecurrenceCount="-1"/>
+ <JobSandbox jobId="8005" jobName="Extend expired Subscriptions"
runTime="2000-01-01 03:00:00.000" serviceName="runSubscriptionAutoReorders"
poolId="pool" runAsUser="system" tempExprId="MIDNIGHT_DAILY"
maxRecurrenceCount="-1"/>
</entity-engine-xml>
Modified: ofbiz/trunk/applications/party/data/ScheduledJobs.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/data/ScheduledJobs.xml?rev=695995&r1=695994&r2=695995&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/data/ScheduledJobs.xml (original)
+++ ofbiz/trunk/applications/party/data/ScheduledJobs.xml Tue Sep 16 11:19:55
2008
@@ -21,7 +21,6 @@
<!-- This is a recurring job with will check for communication events which
need to be send as emails. -->
<entity-engine-xml>
<!-- create recurring job to check email communication events with the
status COM_IN_PROGRESS to send these emails.. -->
- <RecurrenceRule recurrenceRuleId="SENDEMAIL" untilDateTime=""
frequency="MINUTELY" intervalNumber="5" countNumber="-1"/>
- <RecurrenceInfo recurrenceInfoId="SENDEMAIL" startDateTime="2000-01-01
00:00:00.000" recurrenceRuleId="SENDEMAIL" recurrenceCount="0"/>
- <JobSandbox jobId="SENDEMAIL" jobName="Send Email" runTime="2000-01-01
00:00:00.000" serviceName="sendEmailDated" poolId="pool" runAsUser="system"
recurrenceInfoId="SENDEMAIL"/>
+ <TemporalExpression tempExprId="SENDEMAIL" tempExprTypeId="FREQUENCY"
integer1="12" integer2="5"/>
+ <JobSandbox jobId="SENDEMAIL" jobName="Send Email" runTime="2000-01-01
00:00:00.000" serviceName="sendEmailDated" poolId="pool" runAsUser="system"
tempExprId="SENDEMAIL" maxRecurrenceCount="-1"/>
</entity-engine-xml>
Modified: ofbiz/trunk/applications/product/data/ProductScheduledServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductScheduledServices.xml?rev=695995&r1=695994&r2=695995&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/data/ProductScheduledServices.xml
(original)
+++ ofbiz/trunk/applications/product/data/ProductScheduledServices.xml Tue Sep
16 11:19:55 2008
@@ -19,9 +19,7 @@
-->
<entity-engine-xml>
- <RecurrenceRule recurrenceRuleId="420" untilDateTime="" frequency="DAILY"
intervalNumber="1" countNumber="-1"/>
- <RecurrenceInfo recurrenceInfoId="420" startDateTime="2000-01-01
00:00:00.000" recurrenceRuleId="420" recurrenceCount="0"/>
- <JobSandbox jobId="8100" jobName="Purge Old Store Auto-Entered Promos"
runTime="2000-01-01 00:00:00.000" serviceName="purgeOldStoreAutoPromos"
poolId="pool" runAsUser="system" recurrenceInfoId="420"/>
+ <JobSandbox jobId="8100" jobName="Purge Old Store Auto-Entered Promos"
runTime="2000-01-01 00:00:00.000" serviceName="purgeOldStoreAutoPromos"
poolId="pool" runAsUser="system" tempExprId="MIDNIGHT_DAILY"
maxRecurrenceCount="-1"/>
<!--Data for scheduling the service productImportFromSpreadsheet -->
<!--RecurrenceRule recurrenceRuleId="500" untilDateTime=""
frequency="MINUTELY" intervalNumber="5" countNumber="-1"/>
Modified: ofbiz/trunk/framework/service/data/ServiceDemoData.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/data/ServiceDemoData.xml?rev=695995&r1=695994&r2=695995&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/data/ServiceDemoData.xml (original)
+++ ofbiz/trunk/framework/service/data/ServiceDemoData.xml Tue Sep 16 11:19:55
2008
@@ -176,7 +176,7 @@
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
+ FREQUENCY freq type [6] freq count [7] start[8]
[1] hh:mm:ss.sss
[2] Day of week: 1 = Sunday, 7 = Saturday
@@ -185,6 +185,7 @@
[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.
-->
</entity-engine-xml>
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceInfo.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceInfo.java?rev=695995&r1=695994&r2=695995&view=diff
==============================================================================
---
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceInfo.java
(original)
+++
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/RecurrenceInfo.java
Tue Sep 16 11:19:55 2008
@@ -328,6 +328,10 @@
}
}
+ /** Convert a RecurrenceInfo object to a TemporalExpression object.
+ * @param info A RecurrenceInfo instance
+ * @return A TemporalExpression instance
+ */
public static TemporalExpression toTemporalExpression(RecurrenceInfo info)
{
if (info == null) {
throw new IllegalArgumentException("info argument cannot be null");
@@ -335,6 +339,10 @@
return new RecurrenceWrapper(info);
}
+ /** Wraps a RecurrenceInfo object with a TemporalExpression object. This
+ * class is intended to help with the transition from
RecurrenceInfo/RecurrenceRule
+ * to TemporalExpression.
+ */
@SuppressWarnings("serial")
protected static class RecurrenceWrapper extends TemporalExpression {
protected RecurrenceInfo info;
@@ -343,7 +351,7 @@
this.info = info;
}
public Calendar first(Calendar cal) {
- long result = info.first();
+ long result = this.info.first();
if (result == 0) {
return null;
}
@@ -352,10 +360,10 @@
return first;
}
public boolean includesDate(Calendar cal) {
- return info.isValidCurrent(cal.getTimeInMillis());
+ return this.info.isValidCurrent(cal.getTimeInMillis());
}
public Calendar next(Calendar cal) {
- long result = info.next(cal.getTimeInMillis());
+ long result = this.info.next(cal.getTimeInMillis());
if (result == 0) {
return null;
}
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=695995&r1=695994&r2=695995&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
Tue Sep 16 11:19:55 2008
@@ -30,8 +30,7 @@
import org.ofbiz.entity.condition.EntityCondition;
import org.ofbiz.entity.util.EntityUtil;
-/** Schedule and TemporalExpression persistence worker.
- */
+/** TemporalExpression persistence worker. */
public class TemporalExpressionWorker {
// Temporal expression constants
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=695995&r1=695994&r2=695995&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
Tue Sep 16 11:19:55 2008
@@ -689,9 +689,9 @@
protected int occurrence;
/**
- * @param start An integer in the range of <code>Calendar.SUNDAY</code>
+ * @param dayOfWeek An integer in the range of
<code>Calendar.SUNDAY</code>
* to <code>Calendar.SATURDAY</code>
- * @param end An integer in the range of -5 to 5, excluding zero
+ * @param occurrence An integer in the range of -5 to 5, excluding zero
*/
public DayInMonth(int dayOfWeek, int occurrence) {
if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) {
@@ -790,15 +790,13 @@
protected int freqCount;
/**
- * @param start One of the following integer values:
<code>Calendar.SECOND
+ * @param start Starting date, defaults to current system time
+ * @param freqType One of the following integer values:
<code>Calendar.SECOND
* Calendar.MINUTE Calendar.HOUR Calendar.DAY_OF_MONTH Calendar.MONTH
* Calendar.YEAR</code>
- * @param end An integer in the range of -5 to 5, excluding zero
+ * @param freqCount A positive integer
*/
public Frequency(Date start, int freqType, int freqCount) {
- if (start == null) {
- throw new IllegalArgumentException("Invalid start argument");
- }
if (freqType != Calendar.SECOND && freqType != Calendar.MINUTE
&& freqType != Calendar.HOUR && freqType !=
Calendar.DAY_OF_MONTH
&& freqType != Calendar.MONTH && freqType !=
Calendar.YEAR) {
@@ -807,9 +805,13 @@
if (freqCount < 1) {
throw new IllegalArgumentException("freqCount argument must be
a positive integer");
}
+ if (start != null) {
+ this.start = start;
+ } else {
+ this.start = new Date();
+ }
this.sequence = 100;
this.subSequence = freqType;
- this.start = start;
this.freqType = freqType;
this.freqCount = freqCount;
if (Debug.verboseOn()) {
Modified:
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TimeDuration.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TimeDuration.java?rev=695995&r1=695994&r2=695995&view=diff
==============================================================================
---
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TimeDuration.java
(original)
+++
ofbiz/trunk/framework/service/src/org/ofbiz/service/calendar/TimeDuration.java
Tue Sep 16 11:19:55 2008
@@ -48,31 +48,31 @@
this.years = years;
}
- public long millis() {
+ public int millis() {
return this.millis;
}
- public long seconds() {
+ public int seconds() {
return this.seconds;
}
- public long minutes() {
+ public int minutes() {
return this.minutes;
}
- public long hours() {
+ public int hours() {
return this.hours;
}
- public long days() {
+ public int days() {
return this.days;
}
- public long months() {
+ public int months() {
return this.months;
}
- public long years() {
+ public int years() {
return this.years;
}