Update available policies when on configuration file update
[aquarium] / src / main / scala / gr / grnet / aquarium / store / mongodb / MongoDBStore.scala
index ad60547..16721ed 100644 (file)
@@ -313,6 +313,14 @@ class MongoDBStore(
   }
 
   def storePolicy(policy: PolicyEntry): Maybe[RecordID] = MongoDBStore.storeAquariumEvent(policy, policies)
+
+
+  def updatePolicy(policy: PolicyEntry) = {
+    //Find the entry
+    val query = new BasicDBObject(PolicyEntry.JsonNames.id, policy.id)
+    val policyObject = MongoDBStore.jsonSupportToDBObject(policy)
+    policies.update(query, policyObject, true, false)
+  }
   //-PolicyStore
 }