Scheduler Enhancement:

* Add cron job support
* Add IsIgnoreProcessingTime flag - use previous DateNextRun as source to calculate the new DateNextRun value
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2956390
This commit is contained in:
Heng Sin Low 2010-02-22 02:20:31 +00:00
parent 59e7297b6a
commit edf4a9b437
14 changed files with 622 additions and 193 deletions

View File

@ -138,5 +138,6 @@
<classpathentry exported="true" kind="lib" path="tools/lib/iText-2.1.7.jar"/> <classpathentry exported="true" kind="lib" path="tools/lib/iText-2.1.7.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/miglayout-3.7.1-swing.jar"/> <classpathentry exported="true" kind="lib" path="tools/lib/miglayout-3.7.1-swing.jar"/>
<classpathentry exported="true" kind="lib" path="tools/lib/payflow.jar"/> <classpathentry exported="true" kind="lib" path="tools/lib/payflow.jar"/>
<classpathentry kind="lib" path="tools/lib/cron4j-2.2.1.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View File

@ -23,6 +23,7 @@
<classpathentry kind="lib" path="/tools/lib/looks-2.0.4.jar"/> <classpathentry kind="lib" path="/tools/lib/looks-2.0.4.jar"/>
<classpathentry kind="lib" path="/tools/lib/commons-collections-3.1.jar"/> <classpathentry kind="lib" path="/tools/lib/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="/tools/lib/activemq-core-5.0.0.jar"/> <classpathentry kind="lib" path="/tools/lib/activemq-core-5.0.0.jar"/>
<classpathentry kind="lib" path="/tools/lib/cron4j-2.2.1.jar"/>
<classpathentry kind="src" path="/JasperReportsTools"/> <classpathentry kind="src" path="/JasperReportsTools"/>
<classpathentry kind="output" path="build"/> <classpathentry kind="output" path="build"/>
</classpath> </classpath>

View File

@ -31,6 +31,7 @@
<pathelement path="../tools/lib/j2ee.jar"/> <pathelement path="../tools/lib/j2ee.jar"/>
<pathelement path="../tools/lib/jnlp.jar"/> <pathelement path="../tools/lib/jnlp.jar"/>
<pathelement path="../tools/lib/servlet-api.jar" /> <pathelement path="../tools/lib/servlet-api.jar" />
<pathelement path="../tools/lib/cron4j-2.2.1.jar" />
</path> </path>

View File

@ -0,0 +1,28 @@
/******************************************************************************
* Copyright (C) 2010 Low Heng Sin *
* Copyright (C) 2010 Idalica Corporation *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*****************************************************************************/
package org.compiere.model;
/**
*
* @author hengsin
*
*/
public interface AdempiereProcessor2 {
/**
* @return true if previous DateNextRun should be use as base to calculate the new
* DateNextRun value. False to follow the legacy behaviour where current
* server time is use as the base to the new DateNextRun value.
*/
public boolean isIgnoreProcessingTime();
}

View File

@ -106,6 +106,19 @@ public interface I_AD_Scheduler
*/ */
public int getCreatedBy(); public int getCreatedBy();
/** Column name CronPattern */
public static final String COLUMNNAME_CronPattern = "CronPattern";
/** Set Cron Scheduling Pattern.
* Cron pattern to define when the process should be invoked.
*/
public void setCronPattern (String CronPattern);
/** Get Cron Scheduling Pattern.
* Cron pattern to define when the process should be invoked.
*/
public String getCronPattern();
/** Column name DateLastRun */ /** Column name DateLastRun */
public static final String COLUMNNAME_DateLastRun = "DateLastRun"; public static final String COLUMNNAME_DateLastRun = "DateLastRun";
@ -184,6 +197,19 @@ public interface I_AD_Scheduler
*/ */
public boolean isActive(); public boolean isActive();
/** Column name IsIgnoreProcessingTime */
public static final String COLUMNNAME_IsIgnoreProcessingTime = "IsIgnoreProcessingTime";
/** Set Ignore Processing Time.
* Do not include processing time for the DateNextRun calculation
*/
public void setIsIgnoreProcessingTime (boolean IsIgnoreProcessingTime);
/** Get Ignore Processing Time.
* Do not include processing time for the DateNextRun calculation
*/
public boolean isIgnoreProcessingTime();
/** Column name KeepLogDays */ /** Column name KeepLogDays */
public static final String COLUMNNAME_KeepLogDays = "KeepLogDays"; public static final String COLUMNNAME_KeepLogDays = "KeepLogDays";

View File

@ -16,6 +16,8 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import it.sauronsoftware.cron4j.SchedulingPattern;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
@ -32,13 +34,12 @@ import org.compiere.util.DB;
* @version $Id: MScheduler.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $ * @version $Id: MScheduler.java,v 1.3 2006/07/30 00:51:03 jjanke Exp $
*/ */
public class MScheduler extends X_AD_Scheduler public class MScheduler extends X_AD_Scheduler
implements AdempiereProcessor implements AdempiereProcessor, AdempiereProcessor2
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 1887276680441074725L; private static final long serialVersionUID = 6563650236096742870L;
/** /**
* Get Active * Get Active
@ -248,18 +249,19 @@ public class MScheduler extends X_AD_Scheduler
setFrequencyType(FREQUENCYTYPE_Day); setFrequencyType(FREQUENCYTYPE_Day);
if (getFrequency() < 1) if (getFrequency() < 1)
setFrequency(1); setFrequency(1);
setCronPattern(null);
} }
else if (SCHEDULETYPE_MonthDay.equals(getScheduleType())) else if (SCHEDULETYPE_CronSchedulingPattern.equals(getScheduleType()))
{ {
if (getMonthDay() < 1 || getMonthDay() > 31) String pattern = getCronPattern();
setMonthDay(1); if (pattern != null && pattern.trim().length() > 0)
{
if (!SchedulingPattern.validate(pattern))
{
log.saveError("Error", "InvalidCronPattern");
return false;
}
} }
else // SCHEDULETYPE_WeekDay
{
if (getScheduleType() == null)
setScheduleType(SCHEDULETYPE_WeekDay);
if (getWeekDay() == null)
setWeekDay(WEEKDAY_Monday);
} }
return true; return true;
} // beforeSave } // beforeSave

View File

@ -31,7 +31,7 @@ public class X_AD_Scheduler extends PO implements I_AD_Scheduler, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20090915L; private static final long serialVersionUID = 20100219L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_Scheduler (Properties ctx, int AD_Scheduler_ID, String trxName) public X_AD_Scheduler (Properties ctx, int AD_Scheduler_ID, String trxName)
@ -41,8 +41,6 @@ public class X_AD_Scheduler extends PO implements I_AD_Scheduler, I_Persistent
{ {
setAD_Process_ID (0); setAD_Process_ID (0);
setAD_Scheduler_ID (0); setAD_Scheduler_ID (0);
setFrequency (0);
setFrequencyType (null);
setKeepLogDays (0); setKeepLogDays (0);
// 7 // 7
setName (null); setName (null);
@ -131,6 +129,23 @@ public class X_AD_Scheduler extends PO implements I_AD_Scheduler, I_Persistent
return ii.intValue(); return ii.intValue();
} }
/** Set Cron Scheduling Pattern.
@param CronPattern
Cron pattern to define when the process should be invoked.
*/
public void setCronPattern (String CronPattern)
{
set_Value (COLUMNNAME_CronPattern, CronPattern);
}
/** Get Cron Scheduling Pattern.
@return Cron pattern to define when the process should be invoked.
*/
public String getCronPattern ()
{
return (String)get_Value(COLUMNNAME_CronPattern);
}
/** Set Date last run. /** Set Date last run.
@param DateLastRun @param DateLastRun
Date the process was last run. Date the process was last run.
@ -228,6 +243,30 @@ public class X_AD_Scheduler extends PO implements I_AD_Scheduler, I_Persistent
return (String)get_Value(COLUMNNAME_FrequencyType); return (String)get_Value(COLUMNNAME_FrequencyType);
} }
/** Set Ignore Processing Time.
@param IsIgnoreProcessingTime
Do not include processing time for the DateNextRun calculation
*/
public void setIsIgnoreProcessingTime (boolean IsIgnoreProcessingTime)
{
set_Value (COLUMNNAME_IsIgnoreProcessingTime, Boolean.valueOf(IsIgnoreProcessingTime));
}
/** Get Ignore Processing Time.
@return Do not include processing time for the DateNextRun calculation
*/
public boolean isIgnoreProcessingTime ()
{
Object oo = get_Value(COLUMNNAME_IsIgnoreProcessingTime);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set Days to keep Log. /** Set Days to keep Log.
@param KeepLogDays @param KeepLogDays
Number of days to keep the log entries Number of days to keep the log entries
@ -322,6 +361,8 @@ public class X_AD_Scheduler extends PO implements I_AD_Scheduler, I_Persistent
public static final String SCHEDULETYPE_WeekDay = "W"; public static final String SCHEDULETYPE_WeekDay = "W";
/** Month Day = M */ /** Month Day = M */
public static final String SCHEDULETYPE_MonthDay = "M"; public static final String SCHEDULETYPE_MonthDay = "M";
/** Cron Scheduling Pattern = C */
public static final String SCHEDULETYPE_CronSchedulingPattern = "C";
/** Set Schedule Type. /** Set Schedule Type.
@param ScheduleType @param ScheduleType
Type of schedule Type of schedule

View File

@ -0,0 +1,160 @@
-- Feb 19, 2010 5:22:38 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,54123,0,'IsIgnoreProcessingTime',TO_DATE('2010-02-19 17:22:35','YYYY-MM-DD HH24:MI:SS'),100,'Do not include processing time for the DateNextRun calculation','D','When this is selected, the previous DateNextRun is always use as the source for the next DateNextRun calculation.','Y','Ignore Processing Time','Ignore Proccessing Time',TO_DATE('2010-02-19 17:22:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:22:38 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=54123 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Feb 19, 2010 5:26:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,54124,0,'CronPattern',TO_DATE('2010-02-19 17:26:04','YYYY-MM-DD HH24:MI:SS'),100,'Cron pattern to define when the process should be invoked.','D','Cron pattern to define when the process should be invoked. See http://en.wikipedia.org/wiki/Cron#crontab_syntax for cron scheduling syntax and example.','Y','Cron Scheduling Pattern','Cron Scheduling Pattern',TO_DATE('2010-02-19 17:26:04','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:26:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=54124 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Feb 19, 2010 5:29:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,59028,54123,0,20,688,'IsIgnoreProcessingTime',TO_DATE('2010-02-19 17:29:09','YYYY-MM-DD HH24:MI:SS'),100,'N','Do not include processing time for the DateNextRun calculation','D',1,'When this is selected, the previous DateNextRun is always use as the source for the next DateNextRun calculation.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Ignore Processing Time',0,TO_DATE('2010-02-19 17:29:09','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Feb 19, 2010 5:29:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=59028 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Feb 19, 2010 5:29:16 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
ALTER TABLE AD_Scheduler ADD IsIgnoreProcessingTime CHAR(1) DEFAULT 'N' CHECK (IsIgnoreProcessingTime IN ('Y','N'))
;
-- Feb 19, 2010 5:46:42 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,59029,54124,0,10,688,'CronPattern',TO_DATE('2010-02-19 17:46:38','YYYY-MM-DD HH24:MI:SS'),100,'Cron pattern to define when the process should be invoked.','D',255,'Cron pattern to define when the process should be invoked. See http://en.wikipedia.org/wiki/Cron#crontab_syntax for cron scheduling syntax and example.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Cron Scheduling Pattern',0,TO_DATE('2010-02-19 17:46:38','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Feb 19, 2010 5:46:42 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=59029 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Feb 19, 2010 5:46:46 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
ALTER TABLE AD_Scheduler ADD CronPattern NVARCHAR2(255) DEFAULT NULL
;
-- Feb 19, 2010 5:47:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2010-02-19 17:47:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11247
;
-- Feb 19, 2010 5:47:18 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Column SET IsMandatory='N',Updated=TO_DATE('2010-02-19 17:47:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11255
;
-- Feb 19, 2010 5:48:07 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Ref_List SET IsActive='N',Updated=TO_DATE('2010-02-19 17:48:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=665
;
-- Feb 19, 2010 5:48:10 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Ref_List SET IsActive='N',Updated=TO_DATE('2010-02-19 17:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=664
;
-- Feb 19, 2010 5:49:04 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,318,53574,TO_DATE('2010-02-19 17:49:02','YYYY-MM-DD HH24:MI:SS'),100,'Use cron style scheduling pattern','D','Y','Cron Scheduling Pattern',TO_DATE('2010-02-19 17:49:02','YYYY-MM-DD HH24:MI:SS'),100,'C')
;
-- Feb 19, 2010 5:49:04 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=53574 AND NOT EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID)
;
-- Feb 19, 2010 5:53:21 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2010-02-19 17:53:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10053
;
-- Feb 19, 2010 5:53:26 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2010-02-19 17:53:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10052
;
-- Feb 19, 2010 5:54:51 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,59028,58773,0,589,TO_DATE('2010-02-19 17:54:49','YYYY-MM-DD HH24:MI:SS'),100,'Do not include processing time for the DateNextRun calculation',10,'@ScheduleType@=F','D','When this is selected, the previous DateNextRun is always use as the source for the next DateNextRun calculation.','Y','Y','Y','N','N','N','N','N','Ignore Processing Time',160,0,TO_DATE('2010-02-19 17:54:49','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:54:51 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58773 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Feb 19, 2010 5:55:49 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsMandatory,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,59029,58774,0,589,TO_DATE('2010-02-19 17:55:48','YYYY-MM-DD HH24:MI:SS'),100,'Cron pattern to define when the process should be invoked.',60,'@ScheduleType@=C','D','Cron pattern to define when the process should be invoked. See http://en.wikipedia.org/wiki/Cron#crontab_syntax for cron scheduling syntax and example.','Y','Y','Y','N','N','N','Y','N','N','Cron Scheduling Pattern',170,0,TO_DATE('2010-02-19 17:55:48','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:55:49 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58774 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=10053
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=10052
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=9437
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=9430
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=58773
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=58774
;
-- Feb 19, 2010 5:57:21 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsMandatory='Y',Updated=TO_DATE('2010-02-19 17:57:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9430
;
-- Feb 19, 2010 5:57:28 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsMandatory='Y',Updated=TO_DATE('2010-02-19 17:57:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9437
;
-- Feb 22, 2010 9:31:45 AM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,53095,0,TO_DATE('2010-02-22 09:31:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Invalid cron scheduling pattern','Invalid cron scheduling pattern - check syntax','E',TO_DATE('2010-02-22 09:31:41','YYYY-MM-DD HH24:MI:SS'),100,'InvalidCronPattern')
;
-- Feb 22, 2010 9:31:45 AM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53095 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;

View File

@ -0,0 +1,160 @@
-- Feb 19, 2010 5:22:38 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,54123,0,'IsIgnoreProcessingTime',TO_TIMESTAMP('2010-02-19 17:22:35','YYYY-MM-DD HH24:MI:SS'),100,'Do not include processing time for the DateNextRun calculation','D','When this is selected, the previous DateNextRun is always use as the source for the next DateNextRun calculation.','Y','Ignore Processing Time','Ignore Proccessing Time',TO_TIMESTAMP('2010-02-19 17:22:35','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:22:38 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=54123 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Feb 19, 2010 5:26:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element (AD_Client_ID,AD_Element_ID,AD_Org_ID,ColumnName,Created,CreatedBy,Description,EntityType,Help,IsActive,Name,PrintName,Updated,UpdatedBy) VALUES (0,54124,0,'CronPattern',TO_TIMESTAMP('2010-02-19 17:26:04','YYYY-MM-DD HH24:MI:SS'),100,'Cron pattern to define when the process should be invoked.','D','Cron pattern to define when the process should be invoked. See http://en.wikipedia.org/wiki/Cron#crontab_syntax for cron scheduling syntax and example.','Y','Cron Scheduling Pattern','Cron Scheduling Pattern',TO_TIMESTAMP('2010-02-19 17:26:04','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:26:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Description,Help,Name,PO_Description,PO_Help,PO_Name,PO_PrintName,PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Element_ID, t.Description,t.Help,t.Name,t.PO_Description,t.PO_Help,t.PO_Name,t.PO_PrintName,t.PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=54124 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
;
-- Feb 19, 2010 5:29:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,DefaultValue,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,59028,54123,0,20,688,'IsIgnoreProcessingTime',TO_TIMESTAMP('2010-02-19 17:29:09','YYYY-MM-DD HH24:MI:SS'),100,'N','Do not include processing time for the DateNextRun calculation','D',1,'When this is selected, the previous DateNextRun is always use as the source for the next DateNextRun calculation.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Ignore Processing Time',0,TO_TIMESTAMP('2010-02-19 17:29:09','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Feb 19, 2010 5:29:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=59028 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Feb 19, 2010 5:29:16 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
ALTER TABLE AD_Scheduler ADD COLUMN IsIgnoreProcessingTime CHAR(1) DEFAULT 'N' CHECK (IsIgnoreProcessingTime IN ('Y','N'))
;
-- Feb 19, 2010 5:46:42 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column (AD_Client_ID,AD_Column_ID,AD_Element_ID,AD_Org_ID,AD_Reference_ID,AD_Table_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAllowLogging,IsAlwaysUpdateable,IsAutocomplete,IsEncrypted,IsIdentifier,IsKey,IsMandatory,IsParent,IsSelectionColumn,IsSyncDatabase,IsTranslated,IsUpdateable,Name,SeqNo,Updated,UpdatedBy,Version) VALUES (0,59029,54124,0,10,688,'CronPattern',TO_TIMESTAMP('2010-02-19 17:46:38','YYYY-MM-DD HH24:MI:SS'),100,'Cron pattern to define when the process should be invoked.','D',255,'Cron pattern to define when the process should be invoked. See http://en.wikipedia.org/wiki/Cron#crontab_syntax for cron scheduling syntax and example.','Y','Y','N','N','N','N','N','N','N','N','N','N','Y','Cron Scheduling Pattern',0,TO_TIMESTAMP('2010-02-19 17:46:38','YYYY-MM-DD HH24:MI:SS'),100,1.000000000000)
;
-- Feb 19, 2010 5:46:42 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Column_ID, t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Column t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Column_ID=59029 AND NOT EXISTS (SELECT * FROM AD_Column_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Column_ID=t.AD_Column_ID)
;
-- Feb 19, 2010 5:46:46 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
ALTER TABLE AD_Scheduler ADD COLUMN CronPattern VARCHAR(255) DEFAULT NULL
;
-- Feb 19, 2010 5:47:11 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2010-02-19 17:47:11','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11247
;
-- Feb 19, 2010 5:47:18 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Column SET IsMandatory='N',Updated=TO_TIMESTAMP('2010-02-19 17:47:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=11255
;
-- Feb 19, 2010 5:48:07 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Ref_List SET IsActive='N',Updated=TO_TIMESTAMP('2010-02-19 17:48:07','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=665
;
-- Feb 19, 2010 5:48:10 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Ref_List SET IsActive='N',Updated=TO_TIMESTAMP('2010-02-19 17:48:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Ref_List_ID=664
;
-- Feb 19, 2010 5:49:04 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Ref_List (AD_Client_ID,AD_Org_ID,AD_Reference_ID,AD_Ref_List_ID,Created,CreatedBy,Description,EntityType,IsActive,Name,Updated,UpdatedBy,Value) VALUES (0,0,318,53574,TO_TIMESTAMP('2010-02-19 17:49:02','YYYY-MM-DD HH24:MI:SS'),100,'Use cron style scheduling pattern','D','Y','Cron Scheduling Pattern',TO_TIMESTAMP('2010-02-19 17:49:02','YYYY-MM-DD HH24:MI:SS'),100,'C')
;
-- Feb 19, 2010 5:49:04 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Ref_List_Trl (AD_Language,AD_Ref_List_ID, Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Ref_List_ID, t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Ref_List t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Ref_List_ID=53574 AND NOT EXISTS (SELECT * FROM AD_Ref_List_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Ref_List_ID=t.AD_Ref_List_ID)
;
-- Feb 19, 2010 5:53:21 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2010-02-19 17:53:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10053
;
-- Feb 19, 2010 5:53:26 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2010-02-19 17:53:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10052
;
-- Feb 19, 2010 5:54:51 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,59028,58773,0,589,TO_TIMESTAMP('2010-02-19 17:54:49','YYYY-MM-DD HH24:MI:SS'),100,'Do not include processing time for the DateNextRun calculation',10,'@ScheduleType@=F','D','When this is selected, the previous DateNextRun is always use as the source for the next DateNextRun calculation.','Y','Y','Y','N','N','N','N','N','Ignore Processing Time',160,0,TO_TIMESTAMP('2010-02-19 17:54:49','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:54:51 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58773 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Feb 19, 2010 5:55:49 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field (AD_Client_ID,AD_Column_ID,AD_Field_ID,AD_Org_ID,AD_Tab_ID,Created,CreatedBy,Description,DisplayLength,DisplayLogic,EntityType,Help,IsActive,IsCentrallyMaintained,IsDisplayed,IsEncrypted,IsFieldOnly,IsHeading,IsMandatory,IsReadOnly,IsSameLine,Name,SeqNo,SortNo,Updated,UpdatedBy) VALUES (0,59029,58774,0,589,TO_TIMESTAMP('2010-02-19 17:55:48','YYYY-MM-DD HH24:MI:SS'),100,'Cron pattern to define when the process should be invoked.',60,'@ScheduleType@=C','D','Cron pattern to define when the process should be invoked. See http://en.wikipedia.org/wiki/Cron#crontab_syntax for cron scheduling syntax and example.','Y','Y','Y','N','N','N','Y','N','N','Cron Scheduling Pattern',170,0,TO_TIMESTAMP('2010-02-19 17:55:48','YYYY-MM-DD HH24:MI:SS'),100)
;
-- Feb 19, 2010 5:55:49 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Field_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=58774 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID)
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=10053
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=0,IsDisplayed='N' WHERE AD_Field_ID=10052
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=9437
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=9430
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=58773
;
-- Feb 19, 2010 5:57:03 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=58774
;
-- Feb 19, 2010 5:57:21 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsMandatory='Y',Updated=TO_TIMESTAMP('2010-02-19 17:57:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9430
;
-- Feb 19, 2010 5:57:28 PM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
UPDATE AD_Field SET IsMandatory='Y',Updated=TO_TIMESTAMP('2010-02-19 17:57:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=9437
;
-- Feb 22, 2010 9:31:45 AM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Message (AD_Client_ID,AD_Message_ID,AD_Org_ID,Created,CreatedBy,EntityType,IsActive,MsgText,MsgTip,MsgType,Updated,UpdatedBy,Value) VALUES (0,53095,0,TO_TIMESTAMP('2010-02-22 09:31:41','YYYY-MM-DD HH24:MI:SS'),100,'D','Y','Invalid cron scheduling pattern','Invalid cron scheduling pattern - check syntax','E',TO_TIMESTAMP('2010-02-22 09:31:41','YYYY-MM-DD HH24:MI:SS'),100,'InvalidCronPattern')
;
-- Feb 22, 2010 9:31:45 AM MYT
-- adding cron4j to the Adempiere scheduler - ID: 2950261
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=53095 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
;

View File

@ -8,6 +8,7 @@
<classpathentry kind="src" path="/base"/> <classpathentry kind="src" path="/base"/>
<classpathentry kind="lib" path="/jboss/client/jbossall-client.jar"/> <classpathentry kind="lib" path="/jboss/client/jbossall-client.jar"/>
<classpathentry kind="lib" path="/tools/lib/activemq-core-5.0.0.jar"/> <classpathentry kind="lib" path="/tools/lib/activemq-core-5.0.0.jar"/>
<classpathentry kind="lib" path="/tools/lib/cron4j-2.2.1.jar"/>
<classpathentry kind="src" path="/serverApps"/> <classpathentry kind="src" path="/serverApps"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>

View File

@ -38,6 +38,7 @@
<pathelement location="../tools/lib/mail.jar" /> <pathelement location="../tools/lib/mail.jar" />
<pathelement location="../tools/lib/bsh-1.3.0.jar" /> <pathelement location="../tools/lib/bsh-1.3.0.jar" />
<pathelement location="../tools/lib/junit.jar" /> <pathelement location="../tools/lib/junit.jar" />
<pathelement location="../tools/lib/cron4j-2.2.1.jar" />
<pathelement location="../lib/oracle.jar" /> <pathelement location="../lib/oracle.jar" />
<pathelement location="../lib/jboss.jar" /> <pathelement location="../lib/jboss.jar" />
<pathelement location="../lib/postgresql.jar" /> <pathelement location="../lib/postgresql.jar" />

View File

@ -16,26 +16,13 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.server; package org.compiere.server;
import java.sql.Timestamp; import java.sql.*;
import java.util.Properties; import java.util.*;
import java.util.logging.Level; import java.util.logging.*;
import org.compiere.ldap.*;
import org.compiere.ldap.LdapProcessor; import org.compiere.model.*;
import org.compiere.model.AdempiereProcessor; import org.compiere.util.*;
import org.compiere.model.AdempiereProcessorLog; import org.compiere.wf.*;
import org.compiere.model.MAcctProcessor;
import org.compiere.model.MAlertProcessor;
import org.compiere.model.MClient;
import org.compiere.model.MIMPProcessor;
import org.compiere.model.MLdapProcessor;
import org.compiere.model.MRequestProcessor;
import org.compiere.model.MScheduler;
import org.compiere.model.MSystem;
import org.compiere.model.X_R_RequestProcessor;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.TimeUtil;
import org.compiere.wf.MWorkflowProcessor;
/** /**
* Adempiere Server Base * Adempiere Server Base
@ -235,9 +222,32 @@ public abstract class AdempiereServer extends Thread
m_runTotalMS += m_runLastMS; m_runTotalMS += m_runLastMS;
// //
m_sleepMS = calculateSleep(); m_sleepMS = calculateSleep();
Timestamp lastRun = new Timestamp(now);
if (p_model instanceof AdempiereProcessor2)
{
AdempiereProcessor2 ap = (AdempiereProcessor2) p_model;
if (ap.isIgnoreProcessingTime())
{
lastRun = new Timestamp(p_startWork);
if (m_nextWork <= 0)
m_nextWork = p_startWork;
m_nextWork = m_nextWork + m_sleepMS;
while (m_nextWork < now)
{
m_nextWork = m_nextWork + m_sleepMS;
}
}
else
{
m_nextWork = now + m_sleepMS; m_nextWork = now + m_sleepMS;
}
}
else
{
m_nextWork = now + m_sleepMS;
}
// //
p_model.setDateLastRun(new Timestamp(now)); p_model.setDateLastRun(lastRun);
p_model.setDateNextRun(new Timestamp(m_nextWork)); p_model.setDateNextRun(new Timestamp(m_nextWork));
p_model.save(); p_model.save();
// //

View File

@ -16,28 +16,17 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.server; package org.compiere.server;
import java.io.File; import it.sauronsoftware.cron4j.Predictor;
import java.math.BigDecimal; import it.sauronsoftware.cron4j.SchedulingPattern;
import java.sql.Timestamp;
import java.util.logging.Level;
import org.compiere.model.MAttachment; import java.io.*;
import org.compiere.model.MClient; import java.math.*;
import org.compiere.model.MNote; import java.sql.*;
import org.compiere.model.MPInstance; import java.util.logging.*;
import org.compiere.model.MPInstancePara; import org.compiere.model.*;
import org.compiere.model.MProcess; import org.compiere.print.*;
import org.compiere.model.MScheduler; import org.compiere.process.*;
import org.compiere.model.MSchedulerLog; import org.compiere.util.*;
import org.compiere.model.MSchedulerPara;
import org.compiere.model.MUser;
import org.compiere.print.ReportEngine;
import org.compiere.process.ProcessInfo;
import org.compiere.process.ProcessInfoUtil;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.TimeUtil;
import org.compiere.util.Trx;
/** /**
@ -66,6 +55,9 @@ public class Scheduler extends AdempiereServer
/** Transaction */ /** Transaction */
private Trx m_trx = null; private Trx m_trx = null;
private it.sauronsoftware.cron4j.Scheduler cronScheduler;
private Predictor predictor;
/** /**
* Work * Work
*/ */
@ -127,7 +119,7 @@ public class Scheduler extends AdempiereServer
// //
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID(), ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID(),
AD_Table_ID, Record_ID); AD_Table_ID, Record_ID);
pi.setAD_User_ID(getAD_User_ID()); pi.setAD_User_ID(m_model.getUpdatedBy());
pi.setAD_Client_ID(m_model.getAD_Client_ID()); pi.setAD_Client_ID(m_model.getAD_Client_ID());
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID()); pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());
if (!process.processIt(pi, m_trx) && pi.getClassName() != null) if (!process.processIt(pi, m_trx) && pi.getClassName() != null)
@ -141,15 +133,8 @@ public class Scheduler extends AdempiereServer
File report = re.getPDF(); File report = re.getPDF();
// Notice // Notice
int AD_Message_ID = 884; // HARDCODED SchedulerResult int AD_Message_ID = 884; // HARDCODED SchedulerResult
MUser from = new MUser(getCtx(), pi.getAD_User_ID(), null);
Integer[] userIDs = m_model.getRecipientAD_User_IDs(); Integer[] userIDs = m_model.getRecipientAD_User_IDs();
for (int i = 0; i < userIDs.length; i++) for (int i = 0; i < userIDs.length; i++)
{
MUser user = new MUser(getCtx(), userIDs[i].intValue(), null);
boolean email = user.isNotificationEMail();
boolean notice = user.isNotificationNote();
if (notice)
{ {
MNote note = new MNote(getCtx(), MNote note = new MNote(getCtx(),
AD_Message_ID, userIDs[i].intValue(), m_trx.getTrxName()); AD_Message_ID, userIDs[i].intValue(), m_trx.getTrxName());
@ -160,18 +145,12 @@ public class Scheduler extends AdempiereServer
note.save(); note.save();
// Attachment // Attachment
MAttachment attachment = new MAttachment (getCtx(), MAttachment attachment = new MAttachment (getCtx(),
MNote.Table_ID, note.getAD_Note_ID(), m_trx.getTrxName()); X_AD_Note.Table_ID, note.getAD_Note_ID(), m_trx.getTrxName());
attachment.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); attachment.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID());
attachment.addEntry(report); attachment.addEntry(report);
attachment.setTextMsg(m_model.getName()); attachment.setTextMsg(m_model.getName());
attachment.save(); attachment.save();
} }
if (email)
{
MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID());
client.sendEMail(from, user, m_model.getName(), m_model.getDescription(), report);
}
}
// //
return pi.getSummary(); return pi.getSummary();
} // runReport } // runReport
@ -194,39 +173,37 @@ public class Scheduler extends AdempiereServer
// //
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID(), ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID(),
AD_Table_ID, Record_ID); AD_Table_ID, Record_ID);
int AD_User_ID = getAD_User_ID(); pi.setAD_User_ID(m_model.getUpdatedBy());
pi.setAD_User_ID(AD_User_ID);
pi.setAD_Client_ID(m_model.getAD_Client_ID()); pi.setAD_Client_ID(m_model.getAD_Client_ID());
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID()); pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());
MUser from = new MUser(getCtx(), pi.getAD_User_ID(), null);
//notify supervisor if error //notify supervisor if error
MUser from = new MUser(getCtx(), pi.getAD_User_ID(), null);
if ( !process.processIt(pi, m_trx) ) if ( !process.processIt(pi, m_trx) )
{ {
int supervisor = m_model.getSupervisor_ID(); int supervisor = m_model.getSupervisor_ID();
if (supervisor > 0) if (supervisor > 0)
{ {
MUser user = new MUser(getCtx(), supervisor, null); MUser user = new MUser(getCtx(), supervisor, null);
boolean email = user.isNotificationEMail(); String type = user.getNotificationType();
boolean notice = user.isNotificationNote(); boolean email = X_AD_User.NOTIFICATIONTYPE_EMail.equals(type) ||
X_AD_User.NOTIFICATIONTYPE_EMailPlusNotice.equals(type);
if (email || notice) boolean notice = X_AD_User.NOTIFICATIONTYPE_Notice.equals(type) ||
ProcessInfoUtil.setLogFromDB(pi); X_AD_User.NOTIFICATIONTYPE_EMailPlusNotice.equals(type);
if (email) if (email)
{ {
MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID()); MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID());
client.sendEMail(from, user, process.getName(), pi.getSummary() + " " + pi.getLogInfo(), null); // client.sendEMail(from, user, process.getName(), pi.getSummary() + " " + pi.getLogInfo(), null);
client.sendEMail(from, user, m_model.getName(), pi.getSummary() + " " + pi.getLogInfo(), null);
} }
if (notice) { if (notice) {
int AD_Message_ID = 442; //ProcessRunError int AD_Message_ID = 442; //ProcessRunError
MNote note = new MNote(getCtx(), MNote note = new MNote(getCtx(),
AD_Message_ID, supervisor, null); AD_Message_ID, supervisor, m_trx.getTrxName());
note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID());
note.setTextMsg(pi.getSummary()); note.setTextMsg(pi.getSummary());
//note.setDescription(); //note.setDescription();
note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID()); note.setRecord(X_AD_PInstance.Table_ID, pi.getAD_PInstance_ID());
note.save(); note.save();
} }
} }
@ -234,49 +211,35 @@ public class Scheduler extends AdempiereServer
else else
{ {
Integer[] userIDs = m_model.getRecipientAD_User_IDs(); Integer[] userIDs = m_model.getRecipientAD_User_IDs();
if (userIDs.length > 0)
{
ProcessInfoUtil.setLogFromDB(pi);
for (int i = 0; i < userIDs.length; i++) for (int i = 0; i < userIDs.length; i++)
{ {
MUser user = new MUser(getCtx(), userIDs[i].intValue(), null); MUser user = new MUser(getCtx(), userIDs[i].intValue(), null);
boolean email = user.isNotificationEMail(); String type = user.getNotificationType();
boolean notice = user.isNotificationNote(); boolean email = X_AD_User.NOTIFICATIONTYPE_EMail.equals(type) ||
X_AD_User.NOTIFICATIONTYPE_EMailPlusNotice.equals(type);
boolean notice = X_AD_User.NOTIFICATIONTYPE_Notice.equals(type) ||
X_AD_User.NOTIFICATIONTYPE_EMailPlusNotice.equals(type);
if (email) if (email)
{ {
MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID()); MClient client = MClient.get(m_model.getCtx(), m_model.getAD_Client_ID());
client.sendEMail(from, user, process.getName(), pi.getSummary() + " " + pi.getLogInfo(), null); // client.sendEMail(from, user, process.getName(), pi.getSummary() + " " + pi.getLogInfo(), null);
client.sendEMail(from, user, m_model.getName(), pi.getSummary() + " " + pi.getLogInfo(), null);
} }
if (notice) { if (notice) {
int AD_Message_ID = 441; //ProcessOK int AD_Message_ID = 441; //ProcessOK
MNote note = new MNote(getCtx(), MNote note = new MNote(getCtx(),
AD_Message_ID, userIDs[i].intValue(), null); AD_Message_ID, userIDs[i].intValue(), m_trx.getTrxName());
note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID()); note.setClientOrg(m_model.getAD_Client_ID(), m_model.getAD_Org_ID());
note.setTextMsg(pi.getSummary()); note.setTextMsg(pi.getSummary());
//note.setDescription(); //note.setDescription();
note.setRecord(MPInstance.Table_ID, pi.getAD_PInstance_ID()); note.setRecord(X_AD_PInstance.Table_ID, pi.getAD_PInstance_ID());
note.save(); note.save();
} }
} }
} }
}
return pi.getSummary(); return pi.getSummary();
} // runProcess } // runProcess
private int getAD_User_ID() {
int AD_User_ID;
if (m_model.getSupervisor_ID() > 0)
AD_User_ID = m_model.getSupervisor_ID();
else if (m_model.getUpdatedBy() > 0)
AD_User_ID = m_model.getUpdatedBy();
else if (m_model.getCreatedBy() > 0)
AD_User_ID = m_model.getCreatedBy();
else
AD_User_ID = 100; //fall back to SuperUser
return AD_User_ID;
}
/** /**
* Fill Parameter * Fill Parameter
* @param pInstance process instance * @param pInstance process instance
@ -394,4 +357,34 @@ public class Scheduler extends AdempiereServer
return "#" + p_runCount + " - Last=" + m_summary.toString(); return "#" + p_runCount + " - Last=" + m_summary.toString();
} // getServerInfo } // getServerInfo
@Override
public void run() {
String cronPattern = (String) m_model.getCronPattern();
if (cronPattern != null && cronPattern.trim().length() > 0 && SchedulingPattern.validate(cronPattern)) {
cronScheduler = new it.sauronsoftware.cron4j.Scheduler();
cronScheduler.schedule(cronPattern, new Runnable() {
public void run() {
runNow();
long next = predictor.nextMatchingTime();
p_model.setDateNextRun(new Timestamp(next));
p_model.save();
}
});
predictor = new Predictor(cronPattern);
long next = predictor.nextMatchingTime();
p_model.setDateNextRun(new Timestamp(next));
p_model.save();
cronScheduler.start();
while (true) {
if (!sleep()) {
cronScheduler.stop();
break;
} else if (!cronScheduler.isStarted()) {
break;
}
}
} else {
super.run();
}
}
} // Scheduler } // Scheduler

View File

@ -315,6 +315,10 @@
<zipfileset src="lib/xercesImpl.jar"> <zipfileset src="lib/xercesImpl.jar">
<patternset refid="manifest.exclude" /> <patternset refid="manifest.exclude" />
</zipfileset> </zipfileset>
<!-- cron job -->
<zipfileset src="lib/cron4j-2.2.1.jar">
<patternset refid="manifest.exclude" />
</zipfileset>
</jar> </jar>
</target> </target>