X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=enrichment-coordinator-service%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fenrichment%2Frepository%2FEiJobs.java;h=f0e4051c9a4ec57af2a0bf9ea6f28d6d1ad2082b;hb=2d7ba05327959f5381f96fd885b3b82789d8936c;hp=9326195f6eed5cb658eefffb3f3c78d7df7d9631;hpb=ebf3211ddd6e634ca9c0a2fec56abd1f12c7625d;p=nonrtric.git diff --git a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiJobs.java b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiJobs.java index 9326195f..f0e4051c 100644 --- a/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiJobs.java +++ b/enrichment-coordinator-service/src/main/java/org/oransc/enrichment/repository/EiJobs.java @@ -28,16 +28,18 @@ import java.util.Vector; import org.oransc.enrichment.exceptions.ServiceException; /** - * Dynamic representation of all EI Jobs in the system. + * Dynamic representation of all existing EI jobs. */ public class EiJobs { private Map allEiJobs = new HashMap<>(); private MultiMap jobsByType = new MultiMap<>(); + private MultiMap jobsByOwner = new MultiMap<>(); public synchronized void put(EiJob job) { allEiJobs.put(job.id(), job); jobsByType.put(job.type().getId(), job.id(), job); + jobsByOwner.put(job.owner(), job.id(), job); } public synchronized Collection getJobs() { @@ -47,7 +49,7 @@ public class EiJobs { public synchronized EiJob getJob(String id) throws ServiceException { EiJob ric = allEiJobs.get(id); if (ric == null) { - throw new ServiceException("Could not find EI Job: " + id); + throw new ServiceException("Could not find EI job: " + id); } return ric; } @@ -60,6 +62,10 @@ public class EiJobs { return jobsByType.get(type.getId()); } + public synchronized Collection getJobsForOwner(String owner) { + return jobsByOwner.get(owner); + } + public synchronized EiJob get(String id) { return allEiJobs.get(id); } @@ -75,6 +81,7 @@ public class EiJobs { public synchronized void remove(EiJob job) { this.allEiJobs.remove(job.id()); jobsByType.remove(job.type().getId(), job.id()); + jobsByOwner.remove(job.owner(), job.id()); } public synchronized int size() { @@ -84,6 +91,7 @@ public class EiJobs { public synchronized void clear() { this.allEiJobs.clear(); this.jobsByType.clear(); + jobsByOwner.clear(); } }