def translateVistrail(_vistrail):
    """ Translate new DBVistrailVariable based vistrail variables to old
         annotation based type """
    global id_scope
    
    def update_workflow(old_obj, trans_dict):
        return DBWorkflow.update_version(old_obj.db_workflow, 
                                         trans_dict, DBWorkflow())

    def update_operations(old_obj, trans_dict):
        new_ops = []
        for obj in old_obj.db_operations:
            if obj.vtType == 'delete':
                new_ops.append(DBDelete.update_version(obj, trans_dict))
            elif obj.vtType == 'add':
                new_op = DBAdd.update_version(obj, trans_dict)
                new_ops.append(new_op)
            elif obj.vtType == 'change':
                new_op = DBChange.update_version(obj, trans_dict)
                new_ops.append(new_op)
        return new_ops

    vistrail = DBVistrail()
    id_scope = vistrail.idScope

    translate_dict = {'DBAction': {'operations': update_operations},
                      'DBGroup': {'workflow': update_workflow}
                      }

    if _vistrail.db_controlParameters:
        debug.warning(("Vistrail contains %s control parameters that "
                      "cannot be converted") % len(_vistrail.db_controlParameters))
    vistrail = DBVistrail.update_version(_vistrail, translate_dict, vistrail)

    vistrail.db_version = '1.0.3'
    return vistrail
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/versions/v1_0_3/translate/v1_0_4.py/translateVistrail/original