def get_task_bean_by_id(self, task_id): task_row = self.db_service.select('task', self.db_service.get_cols('task'), 'id={0}'.format(task_id))[0] task = TaskBean(task_row[0], task_row[1], task_row[2], task_row[3], task_row[4], task_row[5], self.get_plugin_bean_by_id(task_row[6]), task_row[7], task_row[8]) return task
def json_to_task_bean(self, json_data, file_server_conf=None): plu = json_data['plugin'] plugin = PluginBean(p_id=plu['id'], active=plu['active'], create_date=plu['createDate'], deleted=plu['deleted'], description=plu['description'], machine_oriented=plu['machineOriented'], modify_date=plu['modifyDate'], name=plu['name'], policy_plugin=plu['policyPlugin'], user_oriented=plu['userOriented'], version=plu['version'], task_plugin=plu['taskPlugin'], x_based=plu['xBased']) return TaskBean(_id=json_data['id'], create_date=json_data['createDate'], modify_date=json_data['modifyDate'], command_cls_id=json_data['commandClsId'], parameter_map=json_data['parameterMap'], deleted=json_data['deleted'], plugin=plugin, cron_str=json_data['cronExpression'], file_server=str(file_server_conf))
def get_task_by_id(self, task_id): self.logger.debug('Getting task from db.') try: db_task = self.db_service.select( 'task', criteria='id={0}'.format(task_id))[0] return TaskBean(db_task[0], db_task[1], db_task[2], db_task[3], db_task[4], db_task[5], self.get_plugin_by_id(db_task[6]), db_task[7], db_task[8]) except Exception as e: self.logger.debug( 'A problem occurred while getting task by id. Error Message: {0}' .format(str(e)))