def update_configuration(logger, box_configuration): """ method updates box configuration in the MongoDB""" w_number = CollectionContext.get_w_number(logger, COLLECTION_BOX_CONFIGURATION) collection = CollectionContext.get_collection(logger, COLLECTION_BOX_CONFIGURATION) collection.save(box_configuration.get_document(), safe=True, w=w_number)
def remove(logger, uow_id): w_number = CollectionContext.get_w_number(logger, COLLECTION_UNITS_OF_WORK) collection = CollectionContext.get_collection(logger, COLLECTION_UNITS_OF_WORK) collection.remove(uow_id, safe=True, w=w_number)
def insert(logger, unit_of_work): """ inserts unit of work to MongoDB. @throws DuplicateKeyError is such record already exists """ w_number = CollectionContext.get_w_number(logger, COLLECTION_UNITS_OF_WORK) collection = CollectionContext.get_collection(logger, COLLECTION_UNITS_OF_WORK) uow_id = collection.insert(unit_of_work.get_document(), safe=True, w=w_number) return uow_id
def update(logger, unit_of_work): """ method finds unit_of_work record and change its status""" w_number = CollectionContext.get_w_number(logger, COLLECTION_UNITS_OF_WORK) collection = CollectionContext.get_collection(logger, COLLECTION_UNITS_OF_WORK) collection.save(unit_of_work.get_document(), safe=True, w=w_number)
def _save_time_record(self, process_name, time_record): collection = self._get_timetable_collection(process_name) w_number = CollectionContext.get_w_number(self.logger, COLLECTION_TIMETABLE_YEARLY) return collection.save(time_record.get_document(), safe=True, w=w_number)
def update(logger, scheduler_configuration): """ method finds scheduler_configuration record and update its DB representation""" w_number = CollectionContext.get_w_number(logger, COLLECTION_SCHEDULER_CONFIGURATION) collection = CollectionContext.get_collection(logger, COLLECTION_SCHEDULER_CONFIGURATION) collection.save(scheduler_configuration.get_document(), safe=True, w=w_number)