def _create_objects(self, storage: Mysql, system_data: SystemData): storage._open_connection() for profile in system_data.get_profiles_list(): storage._update_profile(profile) for alert_level in system_data.get_alert_levels_list(): storage._update_alert_level(alert_level) for node in system_data.get_nodes_list(): storage._update_node(node) if node.nodeType.lower() == "alert": for alert in system_data.get_alerts_list(): if alert.nodeId == node.nodeId: storage._update_alert(alert) elif node.nodeType.lower() == "manager": for manager in system_data.get_managers_list(): if manager.nodeId == node.nodeId: storage._update_manager(manager) elif node.nodeType.lower() in ["sensor", "server"]: for sensor in system_data.get_sensors_list(): if sensor.nodeId == node.nodeId: storage._update_sensor(sensor) storage._conn.commit()
def _create_objects(self, storage: Mysql, system_data: SystemData): storage._open_connection() for alert_level in system_data.get_alert_levels_list(): storage._update_alert_level(alert_level) for sensor in system_data.get_sensors_list(): node = system_data.get_node_by_id(sensor.nodeId) storage._update_node(node) storage._update_sensor(sensor) storage._conn.commit()