Esempio n. 1
0
def translateVistrail(_vistrail):
    def update_key(old_obj, translate_dict):
        return '__notes__'

    def update_annotation(old_obj, translate_dict):
        new_dict = {'DBAnnotation': {'key': update_key}}
        new_list = []
        for annotation in old_obj.db_annotations:
            if annotation.db_key == 'notes':
                new_list.append(DBAnnotation.update_version(annotation, 
                                                            new_dict))
            else:
                new_list.append(DBAnnotation.update_version(annotation,
                                                            {}))
        return new_list
                
    def update_session(old_obj, translate_dict):
        if not old_obj.db_session:
            session = None
        else:
            session = long(old_obj.db_session)
        return session

    def update_workflow(old_obj, translate_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)

    translate_dict = {'DBAction': {'annotations': update_annotation,
                                   'session': update_session},
                      'DBGroup': {'workflow': update_workflow}}
    # pass DBVistrail because domain contains enriched version of the auto_gen
    vistrail = DBVistrail.update_version(_vistrail, translate_dict)
    vistrail.db_version = '0.9.3'
    return vistrail
Esempio n. 2
0
def translateVistrail(_vistrail):
    def update_key(old_obj, translate_dict):
        return '__notes__'

    def update_annotation(old_obj, translate_dict):
        new_dict = {'DBAnnotation': {'key': update_key}}
        new_list = []
        for annotation in old_obj.db_annotations:
            if annotation.db_key == 'notes':
                new_list.append(DBAnnotation.update_version(annotation, 
                                                            new_dict))
            else:
                new_list.append(DBAnnotation.update_version(annotation,
                                                            {}))
        return new_list
                
    def update_session(old_obj, translate_dict):
        if not old_obj.db_session:
            session = None
        else:
            session = long(old_obj.db_session)
        return session

    def update_workflow(old_obj, translate_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)

    translate_dict = {'DBAction': {'annotations': update_annotation,
                                   'session': update_session},
                      'DBGroup': {'workflow': update_workflow}}
    # pass DBVistrail because domain contains enriched version of the auto_gen
    vistrail = DBVistrail.update_version(_vistrail, translate_dict)
    vistrail.db_version = '0.9.3'
    return vistrail
Esempio n. 3
0
def translateVistrail(_vistrail):
    def update_key(old_obj, translate_dict):
        return "__notes__"

    def update_annotation(old_obj, translate_dict):
        new_dict = {"DBAnnotation": {"key": update_key}}
        new_list = []
        for annotation in old_obj.db_annotations:
            if annotation.db_key == "notes":
                new_list.append(DBAnnotation.update_version(annotation, new_dict))
            else:
                new_list.append(DBAnnotation.update_version(annotation, {}))
        return new_list

    def update_session(old_obj, translate_dict):
        if not old_obj.db_session:
            session = None
        else:
            session = long(old_obj.db_session)
        return session

    def update_workflow(old_obj, translate_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, translate_dict)

    translate_dict = {
        "DBAction": {"annotations": update_annotation, "session": update_session},
        "DBGroup": {"workflow": update_workflow},
    }
    # pass DBVistrail because domain contains enriched version of the auto_gen
    vistrail = DBVistrail.update_version(_vistrail, translate_dict)
    vistrail.db_version = "0.9.3"
    return vistrail
Esempio n. 4
0
def translateVistrail(_vistrail):
    def update_operations(old_obj, trans_dict):
        def update_abstraction(old_obj, trans_dict):
            def get_version(old_obj, trans_dict):
                return long(old_obj.db_internal_version)

            new_dict = {'DBAbstractionRef': {'version': get_version}}
            new_dict.update(trans_dict)
            return DBAbstractionRef.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 == 'abstraction':
                    trans_dict['DBAdd'] = {'data': update_abstraction}
                    new_op = DBAdd.update_version(obj, trans_dict)
                    new_op.db_what = 'abstractionRef'
                    new_ops.append(new_op)
                    del trans_dict['DBAdd']
                else:
                    new_op = DBAdd.update_version(obj, trans_dict)
                    if obj.db_parentObjType == 'abstraction':
                        new_op.db_parentObjType = 'abstractionRef'
                    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 == 'abstraction':
                    trans_dict['DBChange'] = {'data': update_abstraction}
                    new_op = DBChange.update_version(obj, trans_dict)
                    new_op.db_what = 'abstractionRef'
                    new_ops.append(new_op)
                    del trans_dict['DBChange']
                else:
                    new_op = DBChange.update_version(obj, trans_dict)
                    if obj.db_parentObjType == 'abstraction':
                        new_op.db_parentObjType = 'abstractionRef'
                    new_ops.append(new_op)
        return new_ops

    translate_dict = {
        'DBGroup': {
            'workflow': update_workflow
        },
        'DBAction': {
            'operations': update_operations
        },
        'DBWorkflow': {
            'modules': update_modules
        }
    }
    # pass DBVistrail because domain contains enriched version of the auto_gen
    vistrail = DBVistrail.update_version(_vistrail, translate_dict)
    vistrail.db_version = '0.9.3'
    return vistrail
Esempio n. 5
0
def translateVistrail(_vistrail):
    def update_operations(old_obj, trans_dict):
        def update_abstraction(old_obj, trans_dict):
            def get_version(old_obj, trans_dict):
                return long(old_obj.db_internal_version)

            new_dict = {"DBAbstractionRef": {"version": get_version}}
            new_dict.update(trans_dict)
            return DBAbstractionRef.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 == "abstraction":
                    trans_dict["DBAdd"] = {"data": update_abstraction}
                    new_op = DBAdd.update_version(obj, trans_dict)
                    new_op.db_what = "abstractionRef"
                    new_ops.append(new_op)
                    del trans_dict["DBAdd"]
                else:
                    new_op = DBAdd.update_version(obj, trans_dict)
                    if obj.db_parentObjType == "abstraction":
                        new_op.db_parentObjType = "abstractionRef"
                    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 == "abstraction":
                    trans_dict["DBChange"] = {"data": update_abstraction}
                    new_op = DBChange.update_version(obj, trans_dict)
                    new_op.db_what = "abstractionRef"
                    new_ops.append(new_op)
                    del trans_dict["DBChange"]
                else:
                    new_op = DBChange.update_version(obj, trans_dict)
                    if obj.db_parentObjType == "abstraction":
                        new_op.db_parentObjType = "abstractionRef"
                    new_ops.append(new_op)
        return new_ops

    translate_dict = {
        "DBGroup": {"workflow": update_workflow},
        "DBAction": {"operations": update_operations},
        "DBWorkflow": {"modules": update_modules},
    }
    # pass DBVistrail because domain contains enriched version of the auto_gen
    vistrail = DBVistrail.update_version(_vistrail, translate_dict)
    vistrail.db_version = "0.9.3"
    return vistrail
Esempio n. 6
0
def translateVistrail(_vistrail):
    def update_operations(old_obj, trans_dict):
        def update_abstraction(old_obj, trans_dict):
            def get_version(old_obj, trans_dict):
                return long(old_obj.db_internal_version)
            new_dict = {'DBAbstractionRef': {'version': get_version}}
            new_dict.update(trans_dict)
            return DBAbstractionRef.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 == 'abstraction':
                    trans_dict['DBAdd'] = {'data': update_abstraction}
                    new_op = DBAdd.update_version(obj, trans_dict)
                    new_op.db_what = 'abstractionRef'
                    new_ops.append(new_op)
                    del trans_dict['DBAdd']
                else:
                    new_op = DBAdd.update_version(obj, trans_dict)
                    if obj.db_parentObjType == 'abstraction':
                        new_op.db_parentObjType = 'abstractionRef'
                    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 == 'abstraction':
                    trans_dict['DBChange'] = {'data': update_abstraction}
                    new_op = DBChange.update_version(obj, trans_dict)
                    new_op.db_what = 'abstractionRef'
                    new_ops.append(new_op)
                    del trans_dict['DBChange']
                else:
                    new_op = DBChange.update_version(obj, trans_dict)
                    if obj.db_parentObjType == 'abstraction':
                        new_op.db_parentObjType = 'abstractionRef'
                    new_ops.append(new_op)
        return new_ops

    translate_dict = {'DBGroup': {'workflow': update_workflow},
                      'DBAction': {'operations': update_operations},
                      'DBWorkflow': {'modules': update_modules}}
    # pass DBVistrail because domain contains enriched version of the auto_gen
    vistrail = DBVistrail.update_version(_vistrail, translate_dict)
    vistrail.db_version = '0.9.3'
    return vistrail