diff --git a/src/main/java/org/spin/eca46/util/support/Accounting.java b/src/main/java/org/spin/eca46/util/support/Accounting.java index 6778d35..f3f5be5 100644 --- a/src/main/java/org/spin/eca46/util/support/Accounting.java +++ b/src/main/java/org/spin/eca46/util/support/Accounting.java @@ -15,6 +15,7 @@ ************************************************************************************/ package org.spin.eca46.util.support; +import java.sql.Timestamp; import java.util.TimeZone; import org.compiere.model.MAcctProcessor; @@ -96,4 +97,9 @@ public boolean isEnabled() { public int getProcessorType() { return ACCOUNTING; } + + @Override + public Timestamp getDateNextRun() { + return processor.getDateNextRun(); + } } diff --git a/src/main/java/org/spin/eca46/util/support/Alert.java b/src/main/java/org/spin/eca46/util/support/Alert.java index efa2ad7..2722e0c 100644 --- a/src/main/java/org/spin/eca46/util/support/Alert.java +++ b/src/main/java/org/spin/eca46/util/support/Alert.java @@ -15,6 +15,7 @@ ************************************************************************************/ package org.spin.eca46.util.support; +import java.sql.Timestamp; import java.util.TimeZone; import org.compiere.model.MAlertProcessor; @@ -96,4 +97,9 @@ public boolean isEnabled() { public int getProcessorType() { return ALERT; } + + @Override + public Timestamp getDateNextRun() { + return processor.getDateNextRun(); + } } diff --git a/src/main/java/org/spin/eca46/util/support/DKron.java b/src/main/java/org/spin/eca46/util/support/DKron.java index 9782e7b..2c1d4bc 100644 --- a/src/main/java/org/spin/eca46/util/support/DKron.java +++ b/src/main/java/org/spin/eca46/util/support/DKron.java @@ -15,10 +15,12 @@ ************************************************************************************/ package org.spin.eca46.util.support; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.TimeZone; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @@ -142,6 +144,11 @@ private Map getRequestDefinition(IProcessorEntity processor) { data.put("retries", 0); data.put("concurrency", "forbid"); data.put("executor", "http"); + if(processor.getDateNextRun() != null) { + SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + dateFormatter.setTimeZone(TimeZone.getTimeZone(processor.getTimeZone())); + data.put("next", dateFormatter.format(processor.getDateNextRun())); + } Map executorConfig = new HashMap<>(); executorConfig.put("method", "POST"); executorConfig.put("url", getCompleteUrl(processor)); diff --git a/src/main/java/org/spin/eca46/util/support/IProcessorEntity.java b/src/main/java/org/spin/eca46/util/support/IProcessorEntity.java index 74377c4..77959b5 100644 --- a/src/main/java/org/spin/eca46/util/support/IProcessorEntity.java +++ b/src/main/java/org/spin/eca46/util/support/IProcessorEntity.java @@ -15,6 +15,8 @@ *************************************************************************************/ package org.spin.eca46.util.support; +import java.sql.Timestamp; + /** * Interface as contract for supported API * @author Yamel Senih, ysenih@erpya.com , http://www.erpya.com @@ -90,4 +92,10 @@ public interface IProcessorEntity { * @return */ public boolean isEnabled(); + + /** + * get Date Next Run from service + * @return + */ + public Timestamp getDateNextRun(); } diff --git a/src/main/java/org/spin/eca46/util/support/Project.java b/src/main/java/org/spin/eca46/util/support/Project.java index 7e18d12..1411ae0 100644 --- a/src/main/java/org/spin/eca46/util/support/Project.java +++ b/src/main/java/org/spin/eca46/util/support/Project.java @@ -15,6 +15,7 @@ ************************************************************************************/ package org.spin.eca46.util.support; +import java.sql.Timestamp; import java.util.TimeZone; import org.eevolution.model.MProjectProcessor; @@ -95,7 +96,11 @@ public boolean isEnabled() { @Override public int getProcessorType() { - // TODO Auto-generated method stub - return 0; + return PROJECT; + } + + @Override + public Timestamp getDateNextRun() { + return processor.getDateNextRun(); } } diff --git a/src/main/java/org/spin/eca46/util/support/Request.java b/src/main/java/org/spin/eca46/util/support/Request.java index 4d58aa4..21cac3b 100644 --- a/src/main/java/org/spin/eca46/util/support/Request.java +++ b/src/main/java/org/spin/eca46/util/support/Request.java @@ -15,6 +15,7 @@ ************************************************************************************/ package org.spin.eca46.util.support; +import java.sql.Timestamp; import java.util.TimeZone; import org.compiere.model.MRequestProcessor; @@ -96,4 +97,9 @@ public boolean isEnabled() { public int getProcessorType() { return REQUEST; } + + @Override + public Timestamp getDateNextRun() { + return processor.getDateNextRun(); + } } diff --git a/src/main/java/org/spin/eca46/util/support/Schedule.java b/src/main/java/org/spin/eca46/util/support/Schedule.java index 6195a13..a5a19cc 100644 --- a/src/main/java/org/spin/eca46/util/support/Schedule.java +++ b/src/main/java/org/spin/eca46/util/support/Schedule.java @@ -15,6 +15,7 @@ ************************************************************************************/ package org.spin.eca46.util.support; +import java.sql.Timestamp; import java.util.TimeZone; import org.compiere.model.MScheduler; @@ -96,4 +97,9 @@ public boolean isEnabled() { public int getProcessorType() { return SCHEDULER; } + + @Override + public Timestamp getDateNextRun() { + return processor.getDateNextRun(); + } } diff --git a/src/main/java/org/spin/eca46/util/support/Workflow.java b/src/main/java/org/spin/eca46/util/support/Workflow.java index 7f9ac6c..af49cab 100644 --- a/src/main/java/org/spin/eca46/util/support/Workflow.java +++ b/src/main/java/org/spin/eca46/util/support/Workflow.java @@ -15,6 +15,7 @@ ************************************************************************************/ package org.spin.eca46.util.support; +import java.sql.Timestamp; import java.util.TimeZone; import org.compiere.wf.MWorkflowProcessor; @@ -97,4 +98,9 @@ public boolean isEnabled() { public int getProcessorType() { return WORKFLOW; } + + @Override + public Timestamp getDateNextRun() { + return processor.getDateNextRun(); + } }