Beispiel #1
0
def convert_operation_list(ops):
    for op in ops:
        if op.vtType == 'add':
            AddOp.convert(op)
        elif op.vtType == 'change':
            ChangeOp.convert(op)
        elif op.vtType == 'delete':
            DeleteOp.convert(op)
        else:
            raise Exception("Unknown operation type '%s'" % op.vtType)
Beispiel #2
0
 def convert(_action):
     if _action.__class__ == Action:
         return
     _action.__class__ = Action
     for _annotation in _action.annotations:
         Annotation.convert(_annotation)
     for _operation in _action.operations:
         if _operation.vtType == 'add':
             AddOp.convert(_operation)
         elif _operation.vtType == 'change':
             ChangeOp.convert(_operation)
         elif _operation.vtType == 'delete':
             DeleteOp.convert(_operation)
         else:
             raise Exception("Unknown operation type '%s'" % \
                                 _operation.vtType)
Beispiel #3
0
    def create_action(self, id_scope=None):
        from core.vistrail.action import Action
        from core.vistrail.module import Module
        from core.vistrail.module_function import ModuleFunction
        from core.vistrail.module_param import ModuleParam
        from core.vistrail.operation import AddOp
        from db.domain import IdScope
        from datetime import datetime

        if id_scope is None:
            id_scope = IdScope()
        param = ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                            type='Integer',
                            val='1')
        function = ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                                  name='value',
                                  parameters=[param])
        m = Module(id=id_scope.getNewId(Module.vtType),
                   name='Float',
                   package='edu.utah.sci.vistrails.basic',
                   functions=[function])

        add_op = AddOp(id=id_scope.getNewId('operation'),
                       what='module',
                       objectId=m.id,
                       data=m)
        action = Action(id=id_scope.getNewId(Action.vtType),
                        prevId=0,
                        date=datetime(2007, 11, 18),
                        operations=[add_op])
        return action
Beispiel #4
0
 def convert(_action):
     if _action.__class__ == Action:
         return
     _action.__class__ = Action
     for _annotation in _action.annotations:
         Annotation.convert(_annotation)
     for _operation in _action.operations:
         if _operation.vtType == 'add':
             AddOp.convert(_operation)
         elif _operation.vtType == 'change':
             ChangeOp.convert(_operation)
         elif _operation.vtType == 'delete':
             DeleteOp.convert(_operation)
         else:
             raise Exception("Unknown operation type '%s'" % \
                                 _operation.vtType)