Skip to content

Commit

Permalink
Add Date Next run support
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Nov 7, 2024
1 parent 4ab7579 commit 24272ec
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/spin/eca46/util/support/Accounting.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
************************************************************************************/
package org.spin.eca46.util.support;

import java.sql.Timestamp;
import java.util.TimeZone;

import org.compiere.model.MAcctProcessor;
Expand Down Expand Up @@ -96,4 +97,9 @@ public boolean isEnabled() {
public int getProcessorType() {
return ACCOUNTING;
}

@Override
public Timestamp getDateNextRun() {
return processor.getDateNextRun();
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/spin/eca46/util/support/Alert.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
************************************************************************************/
package org.spin.eca46.util.support;

import java.sql.Timestamp;
import java.util.TimeZone;

import org.compiere.model.MAlertProcessor;
Expand Down Expand Up @@ -96,4 +97,9 @@ public boolean isEnabled() {
public int getProcessorType() {
return ALERT;
}

@Override
public Timestamp getDateNextRun() {
return processor.getDateNextRun();
}
}
7 changes: 7 additions & 0 deletions src/main/java/org/spin/eca46/util/support/DKron.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -142,6 +144,11 @@ private Map<String, Object> 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<String, Object> executorConfig = new HashMap<>();
executorConfig.put("method", "POST");
executorConfig.put("url", getCompleteUrl(processor));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*************************************************************************************/
package org.spin.eca46.util.support;

import java.sql.Timestamp;

/**
* Interface as contract for supported API
* @author Yamel Senih, [email protected] , http://www.erpya.com
Expand Down Expand Up @@ -90,4 +92,10 @@ public interface IProcessorEntity {
* @return
*/
public boolean isEnabled();

/**
* get Date Next Run from service
* @return
*/
public Timestamp getDateNextRun();
}
9 changes: 7 additions & 2 deletions src/main/java/org/spin/eca46/util/support/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
************************************************************************************/
package org.spin.eca46.util.support;

import java.sql.Timestamp;
import java.util.TimeZone;

import org.eevolution.model.MProjectProcessor;
Expand Down Expand Up @@ -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();
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/spin/eca46/util/support/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
************************************************************************************/
package org.spin.eca46.util.support;

import java.sql.Timestamp;
import java.util.TimeZone;

import org.compiere.model.MRequestProcessor;
Expand Down Expand Up @@ -96,4 +97,9 @@ public boolean isEnabled() {
public int getProcessorType() {
return REQUEST;
}

@Override
public Timestamp getDateNextRun() {
return processor.getDateNextRun();
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/spin/eca46/util/support/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
************************************************************************************/
package org.spin.eca46.util.support;

import java.sql.Timestamp;
import java.util.TimeZone;

import org.compiere.model.MScheduler;
Expand Down Expand Up @@ -96,4 +97,9 @@ public boolean isEnabled() {
public int getProcessorType() {
return SCHEDULER;
}

@Override
public Timestamp getDateNextRun() {
return processor.getDateNextRun();
}
}
6 changes: 6 additions & 0 deletions src/main/java/org/spin/eca46/util/support/Workflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
************************************************************************************/
package org.spin.eca46.util.support;

import java.sql.Timestamp;
import java.util.TimeZone;

import org.compiere.wf.MWorkflowProcessor;
Expand Down Expand Up @@ -97,4 +98,9 @@ public boolean isEnabled() {
public int getProcessorType() {
return WORKFLOW;
}

@Override
public Timestamp getDateNextRun() {
return processor.getDateNextRun();
}
}

0 comments on commit 24272ec

Please sign in to comment.