def create_annotation(self, id_scope=None):
        from db.domain import IdScope

        if id_scope is None:
            id_scope = IdScope()
        annotation = Annotation(id=id_scope.getNewId(Annotation.vtType),
                                key='akey %s',
                                value='some value %s')
        return annotation
Beispiel #2
0
    def create_annotation(self, id_scope=None):
        from db.domain import IdScope

        if id_scope is None:
            id_scope = IdScope()
        annotation = Annotation(id=id_scope.getNewId(Annotation.vtType),
                                key='akey %s',
                                value='some value %s')
        return annotation
    def create_annotation(self, id_scope=None):
        from db.domain import IdScope

        if id_scope is None:
            id_scope = IdScope()
        annotation = \
            ActionAnnotation(id=id_scope.getNewId(ActionAnnotation.vtType),
                             key='akey', action_id=1L,
                             value='some value', user='******')
        return annotation
Beispiel #4
0
    def create_annotation(self, id_scope=None):
        from db.domain import IdScope

        if id_scope is None:
            id_scope = IdScope()
        annotation = \
            ActionAnnotation(id=id_scope.getNewId(ActionAnnotation.vtType),
                             key='akey', action_id=1L,
                             value='some value', user='******')
        return annotation
Beispiel #5
0
    def create_annotation(self, id_scope=IdScope()):

        annotation = \
            ActionAnnotation(id=id_scope.getNewId('actionAnnotation'),
                             key='akey', action_id=1L,
                             value='some value', user='******')
        return annotation
Beispiel #6
0
 def create_module(self, id_scope=None):
     from db.domain import IdScope
     if id_scope is None:
         id_scope = IdScope()
     
     params = [ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                               type='Int',
                               val='1')]
     functions = [ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                                 name='value',
                                 parameters=params)]
     module = Module(id=id_scope.getNewId(Module.vtType),
                     name='Float',
                     package='edu.utah.sci.vistrails.basic',
                     functions=functions)
     return module
Beispiel #7
0
 def create_port(self, id_scope=IdScope()):
     port = Port(id=id_scope.getNewId(Port.vtType),
                 type='source',
                 moduleId=12L,
                 moduleName='String',
                 name='value',
                 signature='(edu.utah.sci.vistrails.basic:String)')
     return port
Beispiel #8
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 #9
0
 def test_copy(self):
     id_scope = IdScope()
     c1 = self.create_component(id_scope)
     c2 = copy.copy(c1)
     self.assertEqual(c1, c2)
     self.assertEqual(c1.id, c2.id)
     c3 = c2.doCopy(True, id_scope, {})
     self.assertEqual(c1, c3)
     self.assertNotEqual(c1.id, c3.id)
Beispiel #10
0
 def test_copy(self):        
     id_scope = IdScope()
     f1 = self.create_function(id_scope)
     f2 = copy.copy(f1)
     self.assertEquals(f1, f2)
     self.assertEquals(f1.id, f2.id)
     f3 = f1.do_copy(True, id_scope, {})
     self.assertEquals(f1, f3)
     self.assertNotEquals(f1.real_id, f3.real_id)
Beispiel #11
0
 def test_copy(self):
     id_scope = IdScope()
     m1 = self.create_mashup(id_scope)
     m2 = copy.copy(m1)
     self.assertEqual(m1, m2)
     self.assertEqual(m1.id, m2.id)
     m3 = m2.doCopy(True, id_scope, {})
     self.assertEqual(m1, m3)
     self.assertNotEqual(m1.id, m3.id)
Beispiel #12
0
 def create_port_spec(self, id_scope=IdScope()):
     # FIXME add a valid port spec
     port_spec = PortSpec(
         id=id_scope.getNewId(PortSpec.vtType),
         name='SetValue',
         type='input',
         sigstring='(edu.utah.sci.vistrails.basic:String)',
     )
     return port_spec
Beispiel #13
0
 def test_copy(self):
     id_scope = IdScope()
     p1 = self.create_param(id_scope)
     p2 = copy.copy(p1)
     self.assertEquals(p1, p2)
     self.assertEquals(p1.id, p2.id)
     p3 = p1.do_copy(True, id_scope, {})
     self.assertEquals(p1, p3)
     self.assertNotEquals(p1.real_id, p3.real_id)
Beispiel #14
0
 def test_copy(self):
     id_scope = IdScope()
     a1 = self.create_alias(id_scope)
     a2 = copy.copy(a1)
     self.assertEqual(a1, a2)
     self.assertEqual(a1.id, a2.id)
     a3 = a2.doCopy(True, id_scope, {})
     self.assertEqual(a1, a3)
     self.assertNotEqual(a1.id, a3.id)
Beispiel #15
0
 def test_copy(self):
     id_scope = IdScope()
     
     loc1 = self.create_location(id_scope)
     loc2 = copy.copy(loc1)
     self.assertEquals(loc1, loc2)
     self.assertEquals(loc1.id, loc2.id)
     loc3 = loc1.do_copy(True, id_scope, {})
     self.assertEquals(loc1, loc3)
     self.assertNotEquals(loc1.id, loc3.id)
Beispiel #16
0
    def test_copy(self):
        id_scope = IdScope()

        t1 = self.create_tag(id_scope)
        t2 = copy.copy(t1)
        self.assertEquals(t1, t2)
        self.assertEquals(t1.id, t2.id)
        t3 = t1.do_copy(True, id_scope, {})
        self.assertEquals(t1, t3)
        self.assertNotEquals(t1.id, t3.id)
Beispiel #17
0
 def create_function(self, id_scope=IdScope()):
     param = ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                         pos=2,
                         type='Int',
                         val='1')
     function = ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                               pos=0,
                               name='value',
                               parameters=[param])
     return function
Beispiel #18
0
    def test_copy(self):
        id_scope = IdScope()

        s1 = self.create_port_spec(id_scope)
        s2 = copy.copy(s1)
        self.assertEquals(s1, s2)
        self.assertEquals(s1.id, s2.id)
        s3 = s1.do_copy(True, id_scope, {})
        self.assertEquals(s1, s3)
        self.assertNotEquals(s1.id, s3.id)
Beispiel #19
0
    def test_copy(self):
        id_scope = IdScope()

        c1 = self.create_connection(id_scope)
        c2 = copy.copy(c1)
        self.assertEquals(c1, c2)
        self.assertEquals(c1.id, c2.id)
        c3 = c1.do_copy(True, id_scope, {})
        self.assertEquals(c1, c3)
        self.assertNotEquals(c1.id, c3.id)
Beispiel #20
0
 def create_mashup(self, id_scope=IdScope()):
     c1 = Component(id=id_scope.getNewId('component'),
                       vttype='parameter', param_id=15L, 
                       parent_vttype='function', parent_id=3L, mid=4L,
                       type='String', value='test', p_pos=0, pos=1, 
                       strvaluelist='test1,test2', widget="text")
     a1 = Alias(id=id_scope.getNewId('alias'), name='alias1', component=c1)
     
     m = Mashup(id=id_scope.getNewId('mashup'), name='mashup1', vtid='empty.vt', 
                version=15L, alias_list=[a1])
     return m
Beispiel #21
0
    def test_copy(self):
        """Check that copy works correctly"""

        id_scope = IdScope()
        m1 = self.create_group(id_scope)
        m2 = copy.copy(m1)
        self.assertEquals(m1, m2)
        self.assertEquals(m1.id, m2.id)
        m3 = m1.do_copy(True, id_scope, {})
        self.assertEquals(m1, m3)
        self.assertNotEquals(m1.id, m3.id)
Beispiel #22
0
    def test_copy(self):
        from db.domain import IdScope
        id_scope = IdScope()

        a1 = self.create_annotation(id_scope)
        a2 = copy.copy(a1)
        self.assertEquals(a1, a2)
        self.assertEquals(a1.id, a2.id)
        a3 = a1.do_copy(True, id_scope, {})
        self.assertEquals(a1, a3)
        self.assertNotEquals(a1.id, a3.id)
Beispiel #23
0
    def create_module(self, id_scope=None):
        from db.domain import IdScope
        if id_scope is None:
            id_scope = IdScope()

        params = [
            ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                        type='Int',
                        val='1')
        ]
        functions = [
            ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                           name='value',
                           parameters=params)
        ]
        module = Module(id=id_scope.getNewId(Module.vtType),
                        name='Float',
                        package='edu.utah.sci.vistrails.basic',
                        functions=functions)
        return module
    def create_ops(self, id_scope=IdScope()):
        from core.vistrail.module import Module
        from core.vistrail.module_function import ModuleFunction
        from core.vistrail.module_param import ModuleParam
        from core.vistrail.annotation import Annotation
        
        if id_scope is None:
            id_scope = IdScope(remap={AddOp.vtType: 'operation',
                                      ChangeOp.vtType: 'operation',
                                      DeleteOp.vtType: 'operation'})

        m = Module(id=id_scope.getNewId(Module.vtType),
                   name='Float',
                   package='edu.utah.sci.vistrails.basic')
        add_op = AddOp(id=id_scope.getNewId(AddOp.vtType),
                       what=Module.vtType,
                       objectId=m.id,
                       data=m)
        function = ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                                  name='value')
        change_op = ChangeOp(id=id_scope.getNewId(ChangeOp.vtType),
                             what=ModuleFunction.vtType,
                             oldObjId=2,
                             newObjId=function.real_id,
                             parentObjId=m.id,
                             parentObjType=Module.vtType,
                             data=function)
        param = ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                            type='Float',
                            val='1.0')
        
        delete_op = DeleteOp(id=id_scope.getNewId(DeleteOp.vtType),
                             what=ModuleParam.vtType,
                             objectId=param.real_id,
                             parentObjId=function.real_id,
                             parentObjType=ModuleFunction.vtType)

        annotation = Annotation(id=id_scope.getNewId(Annotation.vtType),
                                key='foo',
                                value='bar')
        add_annotation = AddOp(id=id_scope.getNewId(AddOp.vtType),
                               what=Annotation.vtType,
                               objectId=m.id,
                               data=annotation)
        
        return [add_op, change_op, delete_op, add_annotation]
Beispiel #25
0
    def test_copy(self):
        """Check that copy works correctly"""
        from db.domain import IdScope

        id_scope = IdScope()
        m1 = self.create_module(id_scope)
        m2 = copy.copy(m1)
        self.assertEquals(m1, m2)
        self.assertEquals(m1.id, m2.id)
        m3 = m1.do_copy(True, id_scope, {})
        self.assertEquals(m1, m3)
        self.assertNotEquals(m1.id, m3.id)
Beispiel #26
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 #27
0
 def create_component(self, id_scope=IdScope()):
     c = Component(id=id_scope.getNewId('component'),
                   vttype='parameter',
                   param_id=15L,
                   parent_vttype='function',
                   parent_id=3L,
                   mid=4L,
                   type='String',
                   value='test',
                   p_pos=0,
                   pos=1,
                   strvaluelist='test1,test2',
                   widget="text")
     return c
Beispiel #28
0
 def test_copy(self):
     id_scope = IdScope(
         remap={
             AddOp.vtType: 'operation',
             ChangeOp.vtType: 'operation',
             DeleteOp.vtType: 'operation'
         })
     for op1 in self.create_ops(id_scope):
         op2 = copy.copy(op1)
         self.assertEquals(op1, op2)
         self.assertEquals(op1.id, op2.id)
         op3 = op1.do_copy(True, id_scope, {})
         self.assertEquals(op1, op3)
         self.assertNotEquals(op1.id, op3.id)
         if hasattr(op1, 'data'):
             self.assertNotEquals(op1.data.db_id, op3.data.db_id)
Beispiel #29
0
 def create_action(self, id_scope=IdScope()):
     from core.mashup.component import Component
     from core.mashup.alias import Alias
     c1 = Component(id=id_scope.getNewId('component'),
                       vttype='parameter', param_id=15L, 
                       parent_vttype='function', parent_id=3L, mid=4L,
                       type='String', value='test', p_pos=0, pos=1, 
                       strvaluelist='test1,test2', widget="text")
     a1 = Alias(id=id_scope.getNewId('alias'), name='alias1', component=c1)
     
     m = Mashup(id=id_scope.getNewId('mashup'), name='mashup1', vtid='empty.vt', 
                version=15L, alias_list=[a1])
     action = Action(id=id_scope.getNewId('action'),
                     parent_id=0L,
                     date=datetime(2007,11,18),
                     mashup=m)
     return action
Beispiel #30
0
 def create_connection(self, id_scope=IdScope()):
     from core.vistrail.port import Port
     source = Port(id=id_scope.getNewId(Port.vtType),
                   type='source',
                   moduleId=21L,
                   moduleName='String',
                   name='value',
                   signature='(edu.utah.sci.vistrails.basic:String)')
     destination = Port(id=id_scope.getNewId(Port.vtType),
                        type='destination',
                        moduleId=20L,
                        moduleName='Float',
                        name='value',
                        signature='(edu.utah.sci.vistrails.basic:Float)')
     connection = Connection(id=id_scope.getNewId(Connection.vtType),
                             ports=[source, destination])
     return connection
Beispiel #31
0
 def __init__(self, id, name, vtid=None, version=None, alias_list=None, 
              t='vistrail', has_seq=None, layout='', geometry='', id_scope=IdScope()):
     self.id = id
     self.name = name
     self.version = version
     self.alias_list = alias_list
     self.vtid = vtid
     self.type = t
     self.layout = layout
     self.geometry = geometry
     self.id_scope = id_scope
     if has_seq == None:
         self.has_seq = False
         if type(self.alias_list) == list:
             for v in self.alias_list:
                 if v.component.seq == True:
                     self.has_seq = True
     else:
         self.has_seq = has_seq
    def create_abstraction(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 core.vistrail.tag import Tag
        from db.domain import IdScope
        from datetime import datetime
        
        if id_scope is None:
            id_scope = IdScope()
        function = ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                                  name='value')
        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)
        add_op2 = AddOp(id=id_scope.getNewId('operation'),
                       what='function',
                       objectId=function.id,
                       data=function)
        action = Action(id=id_scope.getNewId(Action.vtType),
                        prevId=0,
                        date=datetime(2007,11, 18),
                        operations=[add_op, add_op2])
        tag = Tag(id=id_scope.getNewId(Tag.vtType),
                  name='a tag')
        abstraction = Abstraction(id=id_scope.getNewId(Abstraction.vtType),
                                  name='blah',
                                  actions=[action],
                                  tags=[tag])
        return abstraction
Beispiel #33
0
    def create_group(self, id_scope=IdScope()):
        from core.vistrail.location import Location
        from core.vistrail.module_function import ModuleFunction
        from core.vistrail.module_param import ModuleParam

        params = [
            ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                        type='Int',
                        val='1')
        ]
        functions = [
            ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                           name='value',
                           parameters=params)
        ]
        location = Location(id=id_scope.getNewId(Location.vtType),
                            x=12.342,
                            y=-19.432)
        module = \
            Group(id=id_scope.getNewId(Group.vtType),
                  location=location,
                  functions=functions,
                  )
        return module
Beispiel #34
0
 def create_tag(self, id_scope=IdScope()):
     tag = Tag(id=id_scope.getNewId(Tag.vtType), name='blah')
     return tag
Beispiel #35
0
    def create_ops(self, id_scope=IdScope()):
        from core.vistrail.module import Module
        from core.vistrail.module_function import ModuleFunction
        from core.vistrail.module_param import ModuleParam
        from core.vistrail.annotation import Annotation

        if id_scope is None:
            id_scope = IdScope(
                remap={
                    AddOp.vtType: 'operation',
                    ChangeOp.vtType: 'operation',
                    DeleteOp.vtType: 'operation'
                })

        m = Module(id=id_scope.getNewId(Module.vtType),
                   name='Float',
                   package='edu.utah.sci.vistrails.basic')
        add_op = AddOp(id=id_scope.getNewId(AddOp.vtType),
                       what=Module.vtType,
                       objectId=m.id,
                       data=m)
        function = ModuleFunction(id=id_scope.getNewId(ModuleFunction.vtType),
                                  name='value')
        change_op = ChangeOp(id=id_scope.getNewId(ChangeOp.vtType),
                             what=ModuleFunction.vtType,
                             oldObjId=2,
                             newObjId=function.real_id,
                             parentObjId=m.id,
                             parentObjType=Module.vtType,
                             data=function)
        param = ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                            type='Float',
                            val='1.0')

        delete_op = DeleteOp(id=id_scope.getNewId(DeleteOp.vtType),
                             what=ModuleParam.vtType,
                             objectId=param.real_id,
                             parentObjId=function.real_id,
                             parentObjType=ModuleFunction.vtType)

        annotation = Annotation(id=id_scope.getNewId(Annotation.vtType),
                                key='foo',
                                value='bar')
        add_annotation = AddOp(id=id_scope.getNewId(AddOp.vtType),
                               what=Annotation.vtType,
                               objectId=m.id,
                               data=annotation)

        return [add_op, change_op, delete_op, add_annotation]
Beispiel #36
0
 def create_param(self, id_scope=IdScope()):
     param = ModuleParam(id=id_scope.getNewId(ModuleParam.vtType),
                         pos=2,
                         type='Int',
                         val='1')
     return param
    def createMashupController(self, vt_controller, version, view=DummyView()):
        # print "Manager creating mashup controller ", vt_controller, version
        newvt_controller = MashupsManager.copyVistrailController(vt_controller, view)
        mashuptrail = MashupsManager.getMashuptrailforVersionInVistrailController(vt_controller, version)
        if mashuptrail is None:
            (p_mashuptrail, p_version) = MashupsManager.findClosestParentMashuptrail(vt_controller, version)
            id_scope = IdScope(1L)
            if p_mashuptrail is not None:
                version_name = vt_controller.get_pipeline_name(p_version)
                (res, mshpv) = MashupsManager.showFoundMashupsDialog(p_mashuptrail, version_name)
                if res in ["Copy", "Move"]:
                    pipeline = newvt_controller.vistrail.getPipeline(version)
                    if res == "Copy":
                        # we will copy the mashup from the parent trail and
                        # validate it to the current pipeline before adding
                        # to the current mashup trail
                        mashuptrail = Mashuptrail(self.getNewMashuptrailId(), version, id_scope)
                        p_mashup = p_mashuptrail.getMashup(mshpv)
                        mashup = p_mashup.doCopy()
                        mashup.id_scope = id_scope
                        mashup.version = version
                        mashup.validateForPipeline(pipeline)
                        currVersion = mashuptrail.addVersion(
                            parent_id=mashuptrail.getLatestVersion(),
                            mashup=mashup,
                            user=core.system.current_user(),
                            date=core.system.current_time(),
                        )
                        mashuptrail.currentVersion = currVersion
                        mashuptrail.updateIdScope()
                        p_tag = p_mashuptrail.getTagForActionId(mshpv)
                        if p_tag == "":
                            tag = "<latest>"
                        tag = "Copy from %s" % p_tag
                        MashupsManager.addMashuptrailtoVistrailController(vt_controller, mashuptrail)

                    elif res == "Move":
                        # we will move the parent trail and validate all mashups
                        # for the current pipeline to make sure they will be
                        # executable for the current version

                        mashuptrail = p_mashuptrail
                        currVersion = mashuptrail.getLatestVersion()
                        mashuptrail.currentVersion = currVersion
                        mashuptrail.validateMashupsForPipeline(version, pipeline)
                        tag = None

                    mashuptrail.vtVersion = version
                    mshpController = MashupController(vt_controller, newvt_controller, version, mashuptrail)
                    mshpController.setCurrentVersion(mashuptrail.currentVersion)
                    # this is to make sure the pipeline displayed in the mashup
                    # view is consistent with the list of aliases in the central
                    # panel
                    mshpController.updatePipelineAliasesFromCurrentMashup()
                    if tag is not None:
                        mshpController.updateCurrentTag(tag)
                    return mshpController

            mashuptrail = Mashuptrail(self.getNewMashuptrailId(), version, id_scope)
            pipeline = newvt_controller.vistrail.getPipeline(version)
            id = id_scope.getNewId("mashup")
            mashup = Mashup(id=id, name="mashup%s" % id, vtid=vt_controller.locator, version=version)
            mashup.loadAliasesFromPipeline(pipeline, id_scope)
            currVersion = mashuptrail.addVersion(
                parent_id=mashuptrail.getLatestVersion(),
                mashup=mashup,
                user=core.system.current_user(),
                date=core.system.current_time(),
            )

            mashuptrail.currentVersion = currVersion

            MashupsManager.addMashuptrailtoVistrailController(vt_controller, mashuptrail)
            mshpController = MashupController(vt_controller, newvt_controller, version, mashuptrail)
            mshpController.setCurrentVersion(mashuptrail.currentVersion)
            if mshpController.currentVersion == 1L:
                mshpController.updateCurrentTag("ROOT")
        else:
            # print "----> found mashuptrail ", mashuptrail.currentVersion
            mshpController = MashupController(vt_controller, newvt_controller, version, mashuptrail)
            mshpController.setCurrentVersion(mashuptrail.currentVersion)
            mshpController.updatePipelineAliasesFromCurrentMashup()

        return mshpController