Update of EI Data Producer API
[nonrtric.git] / enrichment-coordinator-service / src / main / java / org / oransc / enrichment / repository / EiProducer.java
index 63e5d4c..d5423ae 100644 (file)
@@ -21,6 +21,8 @@
 package org.oransc.enrichment.repository;
 
 import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
 import lombok.Getter;
 
@@ -37,6 +39,8 @@ public class EiProducer {
     @Getter
     private final String producerSupervisionCallbackUrl;
 
+    private final Set<String> enabledJobs = new HashSet<>();
+
     private int unresponsiveCounter = 0;
 
     public EiProducer(String id, Collection<EiType> eiTypes, String jobCallbackUrl,
@@ -63,4 +67,16 @@ public class EiProducer {
         return this.unresponsiveCounter == 0;
     }
 
+    public synchronized void setJobEnabled(EiJob job) {
+        this.enabledJobs.add(job.getId());
+    }
+
+    public synchronized void setJobDisabled(EiJob job) {
+        this.enabledJobs.remove(job.getId());
+    }
+
+    synchronized boolean isJobEnabled(EiJob job) {
+        return this.enabledJobs.contains(job.getId());
+    }
+
 }