Пример #1
0
 def create_source(self, source):
     self.logger.debug("Inserting source: {}".format(str(source)))
     rows = source.save()
     if rows == 1:
         self.logger.debug("Successfully inserted source: {}".format(
             str(source)))
         return source
     else:
         self.logger.debug("Insert of source: {} returned {}".format(
             str(source), str(rows)))
         raise PersistenceError("Insert of source: {} returned {}".format(
             str(source), str(rows)))
Пример #2
0
 def create_message(self, message):
     self.logger.debug("Inserting message: {}".format(str(message)))
     rows = message.save()
     if rows == 1:
         self.logger.debug("Successfully inserted message: {}".format(
             str(message)))
         return message
     else:
         self.logger.debug("Insert of message: {} returned {}".format(
             str(message), str(rows)))
         raise PersistenceError("Insert of message: {} returned {}".format(
             str(message), str(rows)))
 def create_parameters(self, parameters):
     self.logger.debug("Inserting parameters: {}".format(str(parameters)))
     rows = parameters.save()
     if rows == 1:
         self.logger.debug("Successfully inserted parameters: {}".format(
             str(parameters)))
         return parameters
     else:
         self.logger.debug("Insert of parameters: {} returned {}".format(
             str(parameters), str(rows)))
         raise PersistenceError(
             "Insert of parameters: {} returned {}".format(
                 str(parameters), str(rows)))
Пример #4
0
 def create_identity(self, identity):
     self.logger.debug("Inserting client identity: {}".format(
         str(identity)))
     rows = identity.save()
     if rows == 1:
         self.logger.debug("Successfully inserted identity: {}".format(
             str(identity)))
         return identity
     else:
         self.logger.debug("Insert of message: {} returned {}".format(
             str(identity), str(rows)))
         raise PersistenceError("Insert of message: {} returned {}".format(
             str(identity), str(rows)))
Пример #5
0
 def creat_telemetry(self, telemetry):
     self.logger.debug("Inserting telemetry: {}".format(str(telemetry)))
     rows = telemetry.save()
     if rows == 1:
         self.logger.debug("Successfully inserted telemetry: {}".format(
             str(telemetry)))
         return telemetry
     else:
         self.logger.debug("Insert of telemetry: {} returned {}".format(
             str(telemetry), str(rows)))
         raise PersistenceError(
             "Insert of telemetry: {} returned {}".format(
                 str(telemetry), str(rows)))
Пример #6
0
 def update(self, input_source):
     source = self.retrieve_source_by_value(input_source.value)
     source.source_type = input_source.source_type
     source.verifications = input_source.verifications
     updates = source.save()
     if updates == 1:
         self.logger.debug("Successfully updated source: {}".format(
             source.value))
         return source
     else:
         self.logger.debug("Update of source: {} returned {}".format(
             source.value, str(updates)))
         raise PersistenceError("Failed to update source: {}".format(
             source.value))
Пример #7
0
 def update_identity(self, identifier, profile, recovery, status):
     identity = self.retrieve_identity_by_identifier(identifier)
     identity.profile = profile
     identity.recovery = recovery
     identity.status = status
     updates = identity.save()
     if updates == 1:
         self.logger.debug("Successfully updated identity: {}".format(
             identity.identifier))
         return identity
     else:
         self.logger.debug("Update of identity: {} returned {}".format(
             identity.identifier, str(updates)))
         raise PersistenceError("Failed to update identity: {}".format(
             identity.identifier))