本文整理汇总了Python中vistrails.db.domain.IdScope.updateBeginId方法的典型用法代码示例。如果您正苦于以下问题:Python IdScope.updateBeginId方法的具体用法?Python IdScope.updateBeginId怎么用?Python IdScope.updateBeginId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vistrails.db.domain.IdScope
的用法示例。
在下文中一共展示了IdScope.updateBeginId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Mashuptrail
# 需要导入模块: from vistrails.db.domain import IdScope [as 别名]
# 或者: from vistrails.db.domain.IdScope import updateBeginId [as 别名]
#.........这里部分代码省略.........
break
if found:
self.actionAnnotations.remove(found)
def getTagMap(self):
"""getTagMap() -> dict of tag:action_id"""
tagMap = {}
for a in self.actionAnnotations:
if a.key == "__tag__":
tagMap[a.value] = a.action_id
return tagMap
def addActionAnnotation(self, action_id, key, value, user, date):
id = self.id_scope.getNewId("mashup_actionAnnotation")
annot = ActionAnnotation(id=id, action_id=action_id, key=key,
value=value, user=user, date=date)
self.actionAnnotations.append(annot)
##########################################################################
# Operators
def __str__(self):
""" __str__() -> str - Returns a string representation of itself """
return ("(Mashuptrail id='%s' vtVersion='%s' actions='%s')@%X" %
(self.id,
self.vtVersion,
self.actions,
id(self)))
######################################################################
## Serialization and Unserialization
##
# def toXml(self, node=None):
# """toXml(node: ElementTree.Element) -> ElementTree.Element
# writes itself to xml
# """
#
# if node is None:
# node = ElementTree.Element('mashuptrail')
#
# #set attributes
# node.set('id', self.convert_to_str(self.id, 'uuid'))
# node.set('vtVersion', self.convert_to_str(self.vtVersion,'long'))
# node.set('version', self.convert_to_str(self.version, 'str'))
# for action in self.actions:
# child_ = ElementTree.SubElement(node, 'action')
# action.toXml(child_)
# for annot in self.annotations:
# child_ = ElementTree.SubElement(node, 'actionAnnotation')
# annot.toXml(child_)
# return node
#
# @staticmethod
# def fromXml(node):
# if node.tag != 'mashuptrail':
# debug.debug("node.tag != 'mashuptrail'")
# return None
# #read attributes
# data = node.get('id', None)
# id = Mashuptrail.convert_from_str(data, 'uuid')
# data = node.get('vtVersion', None)
# vtVersion = Mashuptrail.convert_from_str(data, 'long')
# data = node.get('version', None)
# version = Mashuptrail.convert_from_str(data, 'str')
# actions = []
# action_map = {}
# annotations = []
# for child in node.getchildren():
# if child.tag == 'action':
# action = Action.fromXml(child)
# actions.append(action)
# action_map[action.id] = action
# elif child.tag == 'actionAnnotation':
# annot = ActionAnnotation.fromXml(child)
# annotations.append(annot)
#
# mtrail = Mashuptrail(id,vtVersion)
# mtrail.version = version
# mtrail.actions = actions
# mtrail.actionMap = action_map
# mtrail.annotations = annotations
# mtrail.currentVersion = mtrail.getLatestVersion()
# mtrail.updateIdScope()
# return mtrail
######################################################################
## IdScope
##
def updateIdScope(self):
for action in self.actions:
self.id_scope.updateBeginId('mashup_action', action.id+1)
for alias in action.mashup.alias_list:
self.id_scope.updateBeginId('mashup_alias', alias.id+1)
self.id_scope.updateBeginId('mashup_component', alias.component.id+1)
for annotation in self.annotations:
self.id_scope.updateBeginId('annotation', annotation.id+1)
for aannotation in self.actionAnnotations:
self.id_scope.updateBeginId('mashup_actionAnnotation', aannotation.id+1)