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
Beispiel #2
0
 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
Beispiel #3
0
 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
Beispiel #4
0
def translateVistrail(_vistrail):
    vistrail = DBVistrail()

    for _action in _vistrail.db_actions:
        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))
        annotations = []
        for annotation in _action.db_annotations:
            annotations.append(
                DBAnnotation(id=annotation.db_id,
                             key=annotation.db_key,
                             value=annotation.db_value))
        session = _action.db_session
        if not session:
            session = None
        else:
            session = long(_action.db_session)

        action = DBAction(id=_action.db_id,
                          prevId=_action.db_prevId,
                          date=_action.db_date,
                          user=_action.db_user,
                          prune=_action.db_prune,
                          session=session,
                          operations=ops,
                          annotations=annotations)
        vistrail.db_add_action(action)

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

    vistrail.db_version = '0.9.3'
    return vistrail
Beispiel #5
0
def convert_data(child):
    if child.vtType == 'module':
        return DBModule(id=child.db_id,
                        cache=child.db_cache,
                        name=child.db_name,
                        namespace=child.db_namespace,
                        package=child.db_package,
                        version=child.db_version,
                        tag=child.db_tag)
    elif child.vtType == 'abstractionRef':
        return DBAbstractionRef(id=child.db_id,
                                name=child.db_name,
                                cache=child.db_cache,
                                abstraction_id=child.db_abstraction_id,
                                version=child.db_version)
    elif child.vtType == 'connection':
        return DBConnection(id=child.db_id)
    elif child.vtType == 'portSpec':
        return DBPortSpec(id=child.db_id,
                          name=child.db_name,
                          type=child.db_type,
                          spec=child.db_spec)
    elif child.vtType == 'function':
        return DBFunction(id=child.db_id,
                          pos=child.db_pos,
                          name=child.db_name)
    elif child.vtType == 'parameter':
        return DBParameter(id=child.db_id,
                           pos=child.db_pos,
                           name=child.db_name,
                           type=child.db_type,
                           val=child.db_val,
                           alias=child.db_alias)
    elif child.vtType == 'location':
        return DBLocation(id=child.db_id,
                          x=child.db_x,
                          y=child.db_y)
    elif child.vtType == 'annotation':
        return DBAnnotation(id=child.db_id,
                            key=child.db_key,
                            value=child.db_value)
    elif child.vtType == 'port':
        return DBPort(id=child.db_id,
                      type=child.db_type,
                      moduleId=child.db_moduleId,
                      moduleName=child.db_moduleName,
                      name=child.db_name,
                      spec=child.db_spec)
    elif child.vtType == 'group':
        return DBGroup(id=child.db_id,
                       workflow=child.db_workflow,
                       cache=child.db_cache,
                       name=child.db_name,
                       namespace=child.db_namespace,
                       package=child.db_package,
                       version=child.db_version,
                       tag=child.db_tag)