def translateVistrail(_vistrail): def update_port_spec_spec(new_obj, translate_dict): return new_obj.db_sigstring def update_port_spec(new_obj, translate_dict): return new_obj.db_signature def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict) translate_dict = { 'DBPortSpec': { 'spec': update_port_spec_spec }, 'DBPort': { 'spec': update_port_spec }, 'DBGroup': { 'workflow': update_workflow } } vistrail = DBVistrail.update_version(_vistrail, translate_dict) vistrail.db_version = '0.9.4' return vistrail
def translateVistrail(_vistrail): def update_operations(old_obj, trans_dict): def update_abstractionRef(old_obj, trans_dict): def get_internal_version(old_obj, trans_dict): return str(old_obj.db_version) def get_version(old_obj, trans_dict): return "" new_dict = {"DBAbstraction": {"internal_version": get_internal_version, "version": get_version}} new_dict.update(trans_dict) return DBAbstraction.update_version(old_obj.db_data, new_dict) new_ops = [] for obj in old_obj.db_operations: if obj.vtType == "add": if obj.db_what == "abstractionRef": trans_dict["DBAdd"] = {"data": update_abstractionRef} new_op = DBAdd.update_version(obj, trans_dict) new_op.db_what = "abstraction" new_ops.append(new_op) del trans_dict["DBAdd"] else: new_op = DBAdd.update_version(obj, trans_dict) if obj.db_parentObjType == "abstractionRef": new_op.db_parentObjType = "abstraction" new_ops.append(new_op) elif obj.vtType == "delete": new_ops.append(DBDelete.update_version(obj, trans_dict)) elif obj.vtType == "change": if obj.db_what == "abstractionRef": trans_dict["DBChange"] = {"data": update_abstractionRef} new_op = DBChange.update_version(obj, trans_dict) new_op.db_what = "abstraction" new_ops.append(new_op) del trans_dict["DBChange"] else: new_op = DBChange.update_version(obj, trans_dict) if obj.db_parentObjType == "abstractionRef": new_op.db_parentObjType = "abstraction" new_ops.append(new_op) return new_ops translate_dict = { "DBGroup": {"workflow": update_workflow}, "DBAction": {"operations": update_operations}, "DBWorkflow": {"modules": update_modules}, } vistrail = DBVistrail.update_version(_vistrail, translate_dict) vistrail.db_version = "0.9.4" return vistrail
def translateVistrail(_vistrail): def update_port_spec_spec(new_obj, translate_dict): return new_obj.db_sigstring def update_port_spec(new_obj, translate_dict): return new_obj.db_signature def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict) translate_dict = {'DBPortSpec': {'spec': update_port_spec_spec}, 'DBPort': {'spec': update_port_spec}, 'DBGroup': {'workflow': update_workflow}} vistrail = DBVistrail.update_version(_vistrail, translate_dict) vistrail.db_version = '0.9.4' return vistrail
def translateVistrail(_vistrail): def update_operations(old_obj, trans_dict): def update_abstractionRef(old_obj, trans_dict): def get_internal_version(old_obj, trans_dict): return str(old_obj.db_version) def get_version(old_obj, trans_dict): return '' new_dict = {'DBAbstraction': {'internal_version': get_internal_version, 'version': get_version}} new_dict.update(trans_dict) return DBAbstraction.update_version(old_obj.db_data, new_dict) new_ops = [] for obj in old_obj.db_operations: if obj.vtType == 'add': if obj.db_what == 'abstractionRef': trans_dict['DBAdd'] = {'data': update_abstractionRef} new_op = DBAdd.update_version(obj, trans_dict) new_op.db_what = 'abstraction' new_ops.append(new_op) del trans_dict['DBAdd'] else: new_op = DBAdd.update_version(obj, trans_dict) if obj.db_parentObjType == 'abstractionRef': new_op.db_parentObjType = 'abstraction' new_ops.append(new_op) elif obj.vtType == 'delete': new_ops.append(DBDelete.update_version(obj, trans_dict)) elif obj.vtType == 'change': if obj.db_what == 'abstractionRef': trans_dict['DBChange'] = {'data': update_abstractionRef} new_op = DBChange.update_version(obj, trans_dict) new_op.db_what = 'abstraction' new_ops.append(new_op) del trans_dict['DBChange'] else: new_op = DBChange.update_version(obj, trans_dict) if obj.db_parentObjType == 'abstractionRef': new_op.db_parentObjType = 'abstraction' new_ops.append(new_op) return new_ops translate_dict = {'DBGroup': {'workflow': update_workflow}, 'DBAction': {'operations': update_operations}, 'DBWorkflow': {'modules': update_modules}} vistrail = DBVistrail.update_version(_vistrail, translate_dict) vistrail.db_version = '0.9.4' return vistrail
def translateVistrail(_vistrail): def update_operations(old_obj, trans_dict): def update_abstractionRef(old_obj, trans_dict): def get_internal_version(old_obj, trans_dict): return str(old_obj.db_version) def get_version(old_obj, trans_dict): return '' new_dict = { 'DBAbstraction': { 'internal_version': get_internal_version, 'version': get_version } } new_dict.update(trans_dict) return DBAbstraction.update_version(old_obj.db_data, new_dict) new_ops = [] for obj in old_obj.db_operations: if obj.vtType == 'add': if obj.db_what == 'abstractionRef': trans_dict['DBAdd'] = {'data': update_abstractionRef} new_op = DBAdd.update_version(obj, trans_dict) new_op.db_what = 'abstraction' new_ops.append(new_op) del trans_dict['DBAdd'] else: new_op = DBAdd.update_version(obj, trans_dict) if obj.db_parentObjType == 'abstractionRef': new_op.db_parentObjType = 'abstraction' new_ops.append(new_op) elif obj.vtType == 'delete': new_ops.append(DBDelete.update_version(obj, trans_dict)) elif obj.vtType == 'change': if obj.db_what == 'abstractionRef': trans_dict['DBChange'] = {'data': update_abstractionRef} new_op = DBChange.update_version(obj, trans_dict) new_op.db_what = 'abstraction' new_ops.append(new_op) del trans_dict['DBChange'] else: new_op = DBChange.update_version(obj, trans_dict) if obj.db_parentObjType == 'abstractionRef': new_op.db_parentObjType = 'abstraction' new_ops.append(new_op) return new_ops translate_dict = { 'DBGroup': { 'workflow': update_workflow }, 'DBAction': { 'operations': update_operations }, 'DBWorkflow': { 'modules': update_modules } } vistrail = DBVistrail.update_version(_vistrail, translate_dict) vistrail.db_version = '0.9.4' return vistrail