Merge "Return response codes from policy controller"
[nonrtric.git] / policy-agent / src / main / java / org / oransc / policyagent / repository / PolicyTypes.java
index 63450cb..7723983 100644 (file)
@@ -21,6 +21,7 @@
 package org.oransc.policyagent.repository;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -40,23 +41,27 @@ public class PolicyTypes {
         return t;
     }
 
+    public synchronized PolicyType get(String name) {
+        return types.get(name);
+    }
+
     public synchronized void put(PolicyType type) {
         types.put(type.name(), type);
     }
 
-    public boolean contains(PolicyType policyType) {
-        return types.containsKey(policyType.name());
+    public synchronized boolean contains(String policyType) {
+        return types.containsKey(policyType);
     }
 
     public synchronized Collection<PolicyType> getAll() {
-        return types.values();
+        return Collections.unmodifiableCollection(types.values());
     }
 
-    public int size() {
+    public synchronized int size() {
         return types.size();
     }
 
-    public void clear() {
+    public synchronized void clear() {
         this.types.clear();
     }
 }