def updateVistrail(self, url, vistrail=None):
        """ updateVistrail(self, string:url, Vistrail:vistrail)
        Update the specified entity url. Delete or reload as necessary.
        Need to make sure workspaces are updated if the entity is changed.
        """
        entities = [e for e in self.entities.itervalues() if e.url == url]
        entity = entities[0] if len(entities) else None
        while entity and entity.parent:
            entity = entity.parent 
            url = entity.url
        workspaces = [p for p in self.workspaces if entity in self.workspaces[p]]
        if entity:
            for p in workspaces:
                self.del_from_workspace(entity, p)
            self.delete_entity(entity)

        locator = BaseLocator.from_url(url)
        if locator.is_valid():
            if not vistrail:
                (vistrail, abstractions, thumbnails, mashups) = load_vistrail(locator)
                vistrail.abstractions = abstractions
                vistrail.thumbnails = thumbnails
                vistrail.mashups = mashups
            entity = self.create_vistrail_entity(vistrail)
            for p in workspaces:
                self.add_to_workspace(entity, p)
            return entity
        else:
            # probably an unsaved vistrail
            pass
示例#2
0
    def updateVistrail(self, url, vistrail=None):
        """ updateVistrail(self, string:url, Vistrail:vistrail)
        Update the specified entity url. Delete or reload as necessary.
        Need to make sure workspaces are updated if the entity is changed.
        """
        entities = [e for e in self.entities.itervalues() if e.url == url]
        entity = entities[0] if len(entities) else None
        while entity and entity.parent:
            entity = entity.parent
            url = entity.url
        workspaces = [
            p for p in self.workspaces if entity in self.workspaces[p]
        ]
        if entity:
            for p in workspaces:
                self.del_from_workspace(entity, p)
            self.delete_entity(entity)

        locator = BaseLocator.from_url(url)
        if locator.is_valid():
            if not vistrail:
                (vistrail, abstractions, thumbnails,
                 mashups) = load_vistrail(locator)
                vistrail.abstractions = abstractions
                vistrail.thumbnails = thumbnails
                vistrail.mashups = mashups
            entity = self.create_vistrail_entity(vistrail)
            for p in workspaces:
                self.add_to_workspace(entity, p)
            return entity
        else:
            # probably an unsaved vistrail
            pass
 def locator(self):
     locator = BaseLocator.from_url(self.url)
     return locator
 def urlExists(self, url):
     """ Check if entity with this url exist """
     locator = BaseLocator.from_url(url)
     if locator.is_valid():
             return True
     return False
示例#5
0
 def urlExists(self, url):
     """ Check if entity with this url exist """
     locator = BaseLocator.from_url(url)
     if locator.is_valid():
         return True
     return False