def translateVistrail(_vistrail):
    # FIXME should this be a deepcopy?
    vistrail = DBVistrail()

    for _action in _vistrail.db_actions.itervalues():
        ops = []
        for op in _action.db_operations:
            if op.vtType == "add":
                data = convert_data(op.db_data)
                ops.append(
                    DBAdd(
                        id=op.db_id,
                        what=op.db_what,
                        objectId=op.db_objectId,
                        parentObjId=op.db_parentObjId,
                        parentObjType=op.db_parentObjType,
                        data=data,
                    )
                )
            elif op.vtType == "change":
                data = convert_data(op.db_data)
                ops.append(
                    DBChange(
                        id=op.db_id,
                        what=op.db_what,
                        oldObjId=op.db_oldObjId,
                        newObjId=op.db_newObjId,
                        parentObjId=op.db_parentObjId,
                        parentObjType=op.db_parentObjType,
                        data=data,
                    )
                )
            elif op.vtType == "delete":
                ops.append(
                    DBDelete(
                        id=op.db_id,
                        what=op.db_what,
                        objectId=op.db_objectId,
                        parentObjId=op.db_parentObjId,
                        parentObjType=op.db_parentObjType,
                    )
                )
        action = DBAction(
            id=_action.db_id, prevId=_action.db_prevId, date=_action.db_date, user=_action.db_user, operations=ops
        )
        vistrail.db_add_action(action)

    for _tag in _vistrail.db_tags.itervalues():
        tag = DBTag(id=_tag.db_time, name=_tag.db_name)
        vistrail.db_add_tag(tag)

    vistrail.db_version = "0.6.0"
    return vistrail
Beispiel #2
0
def translateVistrail(_vistrail):
    # FIXME should this be a deepcopy?
    vistrail = DBVistrail()

    for _action in _vistrail.db_actions.itervalues():
        ops = []
        for op in _action.db_operations:
            if op.vtType == 'add':
                data = convert_data(op.db_data)
                ops.append(
                    DBAdd(id=op.db_id,
                          what=op.db_what,
                          objectId=op.db_objectId,
                          parentObjId=op.db_parentObjId,
                          parentObjType=op.db_parentObjType,
                          data=data))
            elif op.vtType == 'change':
                data = convert_data(op.db_data)
                ops.append(
                    DBChange(id=op.db_id,
                             what=op.db_what,
                             oldObjId=op.db_oldObjId,
                             newObjId=op.db_newObjId,
                             parentObjId=op.db_parentObjId,
                             parentObjType=op.db_parentObjType,
                             data=data))
            elif op.vtType == 'delete':
                ops.append(
                    DBDelete(id=op.db_id,
                             what=op.db_what,
                             objectId=op.db_objectId,
                             parentObjId=op.db_parentObjId,
                             parentObjType=op.db_parentObjType))
        action = DBAction(id=_action.db_id,
                          prevId=_action.db_prevId,
                          date=_action.db_date,
                          user=_action.db_user,
                          operations=ops)
        vistrail.db_add_action(action)

    for _tag in _vistrail.db_tags.itervalues():
        tag = DBTag(id=_tag.db_time, name=_tag.db_name)
        vistrail.db_add_tag(tag)

    vistrail.db_version = '0.6.0'
    return vistrail
Beispiel #3
0
def translateVistrail(_vistrail):
    vistrail = DBVistrail()
    id_scope = vistrail.idScope
    for _action in _vistrail.db_get_actions():
        #         print 'translating action %s' % _action.db_time
        functionName = 'translate%s%sAction' % \
            (_action.db_what[0].upper(), _action.db_what[1:])
        thisModule = sys.modules[__name__]
        action = getattr(thisModule, functionName)(_action, id_scope)
        vistrail.db_add_action(action)
    for _tag in _vistrail.db_get_tags():
        tag = DBTag(id=_tag.db_time, name=_tag.db_name)
        vistrail.db_add_tag(tag)

    convertIds(vistrail)
    #     for action in vistrail.getActions():
    #         print '%s %s' % (action.id, action.operations)
    vistrail.db_version = '0.6.0'
    return vistrail
def translateVistrail(_vistrail):
    vistrail = DBVistrail()
    id_scope = vistrail.idScope
    for _action in _vistrail.db_get_actions():
#         print 'translating action %s' % _action.db_time
        functionName = 'translate%s%sAction' % \
            (_action.db_what[0].upper(), _action.db_what[1:])
        thisModule = sys.modules[__name__]
        action = getattr(thisModule, functionName)(_action, id_scope)
        vistrail.db_add_action(action)
    for _tag in _vistrail.db_get_tags():
        tag = DBTag(id=_tag.db_time,
                    name=_tag.db_name)
        vistrail.db_add_tag(tag)

    convertIds(vistrail)
#     for action in vistrail.getActions():
#         print '%s %s' % (action.id, action.operations)
    vistrail.db_version = '0.6.0'
    return vistrail