Пример #1
0
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
Пример #2
0
def translateVistrail(_vistrail):
    def update_workflow(old_obj, translate_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict,
                                         DBWorkflow())

    def update_operations(old_obj, trans_dict):
        def update_abstractionRef(old_obj, trans_dict):
            return DBAbstraction.update_version(old_obj.db_data, trans_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
        }
    }
    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_workflow(old_obj, translate_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, 
                                         translate_dict, DBWorkflow())
    def update_operations(old_obj, trans_dict):
        def update_abstractionRef(old_obj, trans_dict):
            return DBAbstraction.update_version(old_obj.db_data, trans_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}}
    vistrail = DBVistrail.update_version(_vistrail, translate_dict)
    vistrail.db_version = '0.9.4'
    return vistrail