diff --git a/src/main/java/org/gcube/vremanagement/executor/api/types/LaunchParameter.java b/src/main/java/org/gcube/vremanagement/executor/api/types/LaunchParameter.java index 96c8611..adc4fb1 100644 --- a/src/main/java/org/gcube/vremanagement/executor/api/types/LaunchParameter.java +++ b/src/main/java/org/gcube/vremanagement/executor/api/types/LaunchParameter.java @@ -18,7 +18,7 @@ import org.gcube.vremanagement.executor.api.types.adapter.MapAdapter; */ @XmlRootElement() @XmlAccessorType(XmlAccessType.FIELD) -public class LaunchParameter implements Comparable { +public class LaunchParameter { @XmlElement protected String pluginName; @@ -137,17 +137,22 @@ public class LaunchParameter implements Comparable { this.persist = persist; } - /** - * {@inheritDoc} - */ - @Override - public int compareTo(LaunchParameter launchParameter) { - int compare = pluginName.compareTo(launchParameter.pluginName); - if(compare!=0){ - return pluginName.compareTo(launchParameter.pluginName); + public boolean equals(LaunchParameter launchParameter){ + if(this.persist!=launchParameter.persist){ + return false; } - return 0; + if(!pluginName.equals(launchParameter.pluginName)){ + return false; + } + + if(!scheduling.equals(launchParameter.scheduling)){ + return false; + } + + return this.inputs.equals(launchParameter.inputs); + } + } diff --git a/src/main/java/org/gcube/vremanagement/executor/api/types/Scheduling.java b/src/main/java/org/gcube/vremanagement/executor/api/types/Scheduling.java index 8529866..7a6c6b3 100644 --- a/src/main/java/org/gcube/vremanagement/executor/api/types/Scheduling.java +++ b/src/main/java/org/gcube/vremanagement/executor/api/types/Scheduling.java @@ -172,5 +172,30 @@ public class Scheduling { return String.format("CronExpression %s, Delay %d, SchedulingTimes %d, FirstStartTime %d, EndTime %d, PreviuosExecutionsMustBeCompleted %b", cronExpression, delay, schedulingTimes, firstStartTime, endTime, previuosExecutionsMustBeCompleted); } + + + public boolean equals(Scheduling scheduling) { + if(cronExpression.equals(scheduling.cronExpression)){ + return false; + } + + if(delay.equals(scheduling.delay)){ + return false; + } + + if(schedulingTimes != scheduling.schedulingTimes){ + return false; + } + + if(firstStartTime.equals(scheduling.firstStartTime)){ + return false; + } + + if(endTime.equals(scheduling.endTime)){ + return false; + } + + return previuosExecutionsMustBeCompleted==scheduling.previuosExecutionsMustBeCompleted; + } }