def getItem(self, typeID, itemID): result = None if typeID in self.__received: notifications = self.__received[typeID] criteria = SearchCriteria(typeID, itemID) if criteria in notifications: result = notifications[notifications.index(criteria)] else: LOG_ERROR('Type of notification not found', typeID) return result
def updateItem(self, typeID, itemID, entity): result = False if typeID in self.__received: notifications = self.__received[typeID] criteria = SearchCriteria(typeID, itemID) if criteria in notifications: result = True notifications[notifications.index(criteria)].update(entity) else: LOG_ERROR('Type of notification not found', typeID) return result
def removeItem(self, typeID, itemID): result = True if typeID in self.__received: notifications = self.__received[typeID] criteria = SearchCriteria(typeID, itemID) if criteria in notifications: index = notifications.index(criteria) removed = notifications.pop(index) removed.clear() else: result = False LOG_WARNING('Notification not found', typeID, itemID) else: result = False LOG_ERROR('Type of notification not found', typeID) return result