Exemple #1
0
 def storeFinding(self, findingDoc, analystDoc):
     try:
         item_id = self.__addNewFinding(findingDoc)
         self.__logAction(
             LogEntry("Added new finding: " + findingDoc["description"],
                      analystDoc["initial"]).toDocument())
         return item_id
     except pymongo.errors.DuplicateKeyError:
         self.__updateFinding(findingDoc)
         self.__logAction(
             LogEntry("Updated finding: " + findingDoc["description"],
                      analystDoc["initial"]).toDocument())
     return findingDoc["_id"]
Exemple #2
0
 def storeSubtask(self, subtaskDoc, analystDoc):
     try:
         item_id = self.__addNewSubtask(subtaskDoc)
         self.__logAction(
             LogEntry("Added new subtask: " + subtaskDoc["title"],
                      analystDoc["initial"]).toDocument())
         return item_id
     except pymongo.errors.DuplicateKeyError:
         self.__updateSubtask(subtaskDoc)
         self.__logAction(
             LogEntry("Updated subtask: " + subtaskDoc["title"],
                      analystDoc["initial"]).toDocument())
     return subtaskDoc["_id"]
Exemple #3
0
 def storeEvent(self, eventDoc, analystDoc):
     try:
         event_id = self.__addNewEvent(eventDoc)
         self.__logAction(
             LogEntry("Added new event: " + eventDoc["name"],
                      analystDoc["initial"]).toDocument())
         return event_id
     except pymongo.errors.DuplicateKeyError:
         self.__updateEvent(eventDoc)
         self.__logAction(
             LogEntry("Updated event: " + eventDoc["name"],
                      analystDoc["initial"]).toDocument())
     return
Exemple #4
0
 def storeSystem(self, systemDoc, analystDoc):
     try:
         item_id = self.__addNewSystem(systemDoc)
         self.__logAction(
             LogEntry("Added new system: " + systemDoc["name"],
                      analystDoc["initial"]).toDocument())
         return item_id
     except pymongo.errors.DuplicateKeyError:
         self.__updateSystem(systemDoc)
         self.__logAction(
             LogEntry("Updated system: " + systemDoc["name"],
                      analystDoc["initial"]).toDocument())
     return systemDoc["_id"]
Exemple #5
0
 def removeFinding(self, findingDoc, analystDoc):
     query = {"_id": findingDoc["_id"]}
     self.__findingCollection.delete_one(query)
     self.__logAction(
         LogEntry("Deleted finding: " + findingDoc["name"],
                  analystDoc["initial"]).toDocument())
     return
Exemple #6
0
 def removeSubtask(self, subtaskDoc, analystDoc):
     query = {"_id": subtaskDoc["_id"]}
     self.__subtaskCollection.delete_one(query)
     self.__logAction(
         LogEntry("Deleted subtask: " + subtaskDoc["title"],
                  analystDoc["initial"]).toDocument())
     return
Exemple #7
0
 def removeSystem(self, systemDoc, analystDoc):
     query = {"_id": systemDoc["_id"]}
     self.__systemCollection.delete_one(query)
     self.__logAction(
         LogEntry("Deleted system: " + systemDoc["name"],
                  analystDoc["initial"]).toDocument())
     return
Exemple #8
0
 def removeEvent(self, eventDoc, analystDoc):
     query = {"_id": eventDoc["_id"]}
     self.__eventCollection.delete_one(query)
     self.__logAction(
         LogEntry("Deleted event: " + eventDoc["name"],
                  analystDoc["initial"]).toDocument())
     return