def __init__(self, parent=None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_Hyperedge self.isGraphObjectVisual = True if (hasattr(self, '_setHierarchicalLink')): self._setHierarchicalLink(False) if (hasattr(self, '_setHierarchicalNode')): self._setHierarchicalNode(False) self.parent = parent self.trigger = ATOM3String('') self.guard = ATOM3String('1') self.action = ATOM3Text('', 60, 15) self.broadcast = ATOM3Text( '# return an instance of DEVSevent or None\nreturn None\n', 60, 15) self.broadcast_to = ATOM3String('') self.name = ATOM3String('') self.display = ATOM3String('') self.generatedAttributes = { 'trigger': ('ATOM3String', ), 'guard': ('ATOM3String', ), 'action': ('ATOM3Text', ), 'broadcast': ('ATOM3Text', ), 'broadcast_to': ('ATOM3String', ), 'name': ('ATOM3String', ), 'display': ('ATOM3String', ) } self.realOrder = [ 'trigger', 'guard', 'action', 'broadcast', 'broadcast_to', 'name', 'display' ] self.directEditing = [1, 1, 1, 1, 1, 1, 1]
def __init__(self, parent = None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_Composite self.parent = parent self.name=ATOM3String('Composite') self.is_default=ATOM3Boolean() self.is_default.setValue((None, 0)) self.is_default.config = 0 self.visible=ATOM3Boolean() self.visible.setValue((None, 1)) self.visible.config = 0 self.auto_adjust=ATOM3Boolean() self.auto_adjust.setValue((None, 1)) self.auto_adjust.config = 0 self.enter_action=ATOM3Text('', 60,15 ) self.exit_action=ATOM3Text('', 60,15 ) self.generatedAttributes = {'name': ('ATOM3String', ), 'is_default': ('ATOM3Boolean', ), 'visible': ('ATOM3Boolean', ), 'auto_adjust': ('ATOM3Boolean', ), 'enter_action': ('ATOM3Text', ), 'exit_action': ('ATOM3Text', ) } self.realOrder = ['name','is_default','visible','auto_adjust','enter_action','exit_action'] self.directEditing = [1,1,1,1,1,1]
def __init__(self, parent=None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_Hyperedge self.parent = parent self.trigger = ATOM3String('') self.guard = ATOM3String('1') self.action = ATOM3Text('', 60, 15) self.broadcast = ATOM3Text( '# return an instance of DEVSevent or None\nreturn None\n', 60, 15) self.broadcast_to = ATOM3String('') self.name = ATOM3String('') self.display = ATOM3String('') self.generatedAttributes = { 'trigger': ('ATOM3String', ), 'guard': ('ATOM3String', ), 'action': ('ATOM3Text', ), 'broadcast': ('ATOM3Text', ), 'broadcast_to': ('ATOM3String', ), 'name': ('ATOM3String', ), 'display': ('ATOM3String', ) } self.realOrder = [ 'trigger', 'guard', 'action', 'broadcast', 'broadcast_to', 'name', 'display' ] self.directEditing = [1, 1, 1, 1, 1, 1, 1]
def __init__(self, parent= None, ASGroot = None): ASG.__init__(self, 'CD_ClassDiagramsV3', ASGroot, ['ASG_CD_ClassDiagramsV3' ,'CD_Class3' ,'CD_Association3' ,'CD_Inheritance3']) ATOM3Type.__init__(self) self.parent = parent self.name=ATOM3String('') self.keyword_= self.name self.author=ATOM3String('Annonymous') self.description=ATOM3Text('\n', 60,15 ) self.attributes=ATOM3List([ 1, 1, 1, 0],ATOM3Attribute,parent.types ) lcobj0=[] cobj0=ATOM3Attribute(parent.types) cobj0.setValue(('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj0.initialValue=ATOM3String('') cobj0.isDerivedAttribute = False lcobj0.append(cobj0) cobj0=ATOM3Attribute(parent.types) cobj0.setValue(('author', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj0.initialValue=ATOM3String('Annonymous') cobj0.isDerivedAttribute = False lcobj0.append(cobj0) cobj0=ATOM3Attribute(parent.types) cobj0.setValue(('description', 'Text', None, ('Key', 0), ('Direct Editing', 1))) cobj0.initialValue=ATOM3Text('\n', 60,15 ) cobj0.isDerivedAttribute = False lcobj0.append(cobj0) self.attributes.setValue(lcobj0) self.constraints=ATOM3List([ 1, 1, 1, 0],ATOM3Constraint) lcobj0=[] self.constraints.setValue(lcobj0) self.showAssociationBox=ATOM3Boolean() self.showAssociationBox.setValue((None, 1)) self.showAssociationBox.config = 0 self.showAttributes=ATOM3Boolean() self.showAttributes.setValue((None, 1)) self.showAttributes.config = 0 self.showConditions=ATOM3Boolean() self.showConditions.setValue((None, 1)) self.showConditions.config = 0 self.showActions=ATOM3Boolean() self.showActions.setValue((None, 1)) self.showActions.config = 0 self.showCardinalities=ATOM3Boolean() self.showCardinalities.setValue((None, 1)) self.showCardinalities.config = 0 self.generatedAttributes = {'name': ('ATOM3String', ), 'author': ('ATOM3String', ), 'description': ('ATOM3Text', ), 'attributes': ('ATOM3List', 'ATOM3Attribute'), 'constraints': ('ATOM3List', 'ATOM3Constraint'), 'showAssociationBox': ('ATOM3Boolean', ), 'showAttributes': ('ATOM3Boolean', ), 'showConditions': ('ATOM3Boolean', ), 'showActions': ('ATOM3Boolean', ), 'showCardinalities': ('ATOM3Boolean', ) } self.realOrder = ['name','author','description','attributes','constraints','showAssociationBox','showAttributes','showConditions','showActions','showCardinalities'] self.directEditing = [1,1,1,1,1,1,1,1,1,1]
def __init__(self, parent = None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_Entity3 self.isGraphObjectVisual = True self.parent = parent self.name=ATOM3String('Entity_') self.keyword_= self.name self.Graphical_Appearance=ATOM3Appearance() self.Graphical_Appearance.setValue( (self.keyword_.toString(), self)) self.cardinality=ATOM3List([ 0, 1, 0, 0],ATOM3Connection) lcobj0=[] self.cardinality.setValue(lcobj0) self.attributes=ATOM3List([ 1, 1, 1, 0],ATOM3Attribute,parent.types ) lcobj0=[] self.attributes.setValue(lcobj0) self.Constraints=ATOM3List([ 1, 1, 1, 0],ATOM3Constraint) lcobj0=[] self.Constraints.setValue(lcobj0) self.Actions=ATOM3List([ 1, 1, 1, 0],ATOM3Action) lcobj0=[] self.Actions.setValue(lcobj0) self.display=ATOM3Text('\n', 60,15 ) self.displaySelect=ATOM3MSEnum(['attributes', 'constraints', 'actions', 'cardinality'], [0,0,0,0], 0, 1) self.generatedAttributes = {'name': ('ATOM3String', ), 'Graphical_Appearance': ('ATOM3Appearance', ), 'cardinality': ('ATOM3List', 'ATOM3Connection'), 'attributes': ('ATOM3List', 'ATOM3Attribute'), 'Constraints': ('ATOM3List', 'ATOM3Constraint'), 'Actions': ('ATOM3List', 'ATOM3Action'), 'display': ('ATOM3Text', ), 'displaySelect': ('ATOM3MSEnum', ) } self.realOrder = ['name','Graphical_Appearance','cardinality','attributes','Constraints','Actions','display','displaySelect'] self.directEditing = [1,1,1,1,1,1,0,1]
def __init__(self, parent = None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_Basic self.parent = parent self.name=ATOM3String('Basic') self.keyword_= self.name self.is_default=ATOM3Boolean() self.is_default.setValue((None, 0)) self.is_default.config = 0 self.enter_action=ATOM3Text('\n', 60,15 ) self.exit_action=ATOM3Text('\n', 60,15 ) self.generatedAttributes = {'name': ('ATOM3String', ), 'is_default': ('ATOM3Boolean', ), 'enter_action': ('ATOM3Text', ), 'exit_action': ('ATOM3Text', ) } self.realOrder = ['name','is_default','enter_action','exit_action'] self.directEditing = [1,1,1,1]
def __init__(self, parent=None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_CD_Class3 self.isGraphObjectVisual = True if (hasattr(self, '_setHierarchicalLink')): self._setHierarchicalLink(False) if (hasattr(self, '_setHierarchicalNode')): self._setHierarchicalNode(False) self.parent = parent self.name = ATOM3String('Class_') self.keyword_ = self.name self.Graphical_Appearance = ATOM3Appearance() self.Graphical_Appearance.setValue((self.keyword_.toString(), self)) self.cardinality = ATOM3List([0, 1, 0, 0], ATOM3Connection) lcobj0 = [] self.cardinality.setValue(lcobj0) self.attributes = ATOM3List([1, 1, 1, 0], ATOM3Attribute, parent.types) lcobj0 = [] self.attributes.setValue(lcobj0) self.Constraints = ATOM3List([1, 1, 1, 0], ATOM3Constraint) lcobj0 = [] self.Constraints.setValue(lcobj0) self.Actions = ATOM3List([1, 1, 1, 0], ATOM3Action) lcobj0 = [] self.Actions.setValue(lcobj0) self.display = ATOM3Text('\n', 80, 15) self.Abstract = ATOM3Boolean() self.Abstract.setValue((None, 0)) self.Abstract.config = 0 self.QOCA = ATOM3Action() self.QOCA.setValue( ('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), '"""\nQOCA Constraint Template\nNOTE: DO NOT select a POST/PRE action trigger\nConstraints will be added/removed in a logical manner by other mechanisms.\n"""\nreturn # <---- Remove this to use QOCA\n\n""" Get the high level constraint helper and solver """\nfrom Qoca.atom3constraints.OffsetConstraints import OffsetConstraints\noc = OffsetConstraints(self.parent.qocaSolver) \n\n"""\nExample constraint, see Kernel/QOCA/atom3constraints/OffsetConstraints.py\nFor more types of constraints\n"""\noc.fixedWidth(self.graphObject_, self.graphObject_.sizeX)\noc.fixedHeight(self.graphObject_, self.graphObject_.sizeY)\n\n' )) self.generatedAttributes = { 'name': ('ATOM3String', ), 'Graphical_Appearance': ('ATOM3Appearance', ), 'cardinality': ('ATOM3List', 'ATOM3Connection'), 'attributes': ('ATOM3List', 'ATOM3Attribute'), 'Constraints': ('ATOM3List', 'ATOM3Constraint'), 'Actions': ('ATOM3List', 'ATOM3Action'), 'display': ('ATOM3Text', ), 'Abstract': ('ATOM3Boolean', ), 'QOCA': ('ATOM3Action', ) } self.realOrder = [ 'name', 'Graphical_Appearance', 'cardinality', 'attributes', 'Constraints', 'Actions', 'display', 'Abstract', 'QOCA' ] self.directEditing = [1, 1, 1, 1, 1, 1, 0, 1, 0]
def __init__(self, parent=None, ASGroot=None): ASG.__init__(self, 'DCharts', ASGroot, [ 'ASG_DCharts', 'Composite', 'Basic', 'History', 'Orthogonal', 'visual_settings', 'Port', 'Server', 'contains', 'Hyperedge', 'orthogonality', 'connection' ]) ATOM3Type.__init__(self) self.parent = parent self.variables = ATOM3Text('\n', 80, 15) self.event_clauses = ATOM3Text('\n', 80, 15) self.misc = ATOM3Text('\n', 80, 15) self.generatedAttributes = { 'variables': ('ATOM3Text', ), 'event_clauses': ('ATOM3Text', ), 'misc': ('ATOM3Text', ) } self.realOrder = ['variables', 'event_clauses', 'misc'] self.directEditing = [1, 1, 0]
def __init__(self, parent=None, ASGroot=None): ASG.__init__(self, 'EntityRelationshipV3', ASGroot, ['ASG_EntityRelationshipV3', 'Entity3', 'Relationship3']) ATOM3Type.__init__(self) self.parent = parent self.name = ATOM3String('') self.keyword_ = self.name self.author = ATOM3String('Annonymous') self.description = ATOM3Text('\n', 60, 15) self.attributes = ATOM3List([1, 1, 1, 0], ATOM3Attribute, parent.types) lcobj0 = [] cobj0 = ATOM3Attribute(parent.types) cobj0.setValue( ('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj0.initialValue = ATOM3String('') lcobj0.append(cobj0) cobj0 = ATOM3Attribute(parent.types) cobj0.setValue( ('author', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj0.initialValue = ATOM3String('Annonymous') lcobj0.append(cobj0) cobj0 = ATOM3Attribute(parent.types) cobj0.setValue( ('description', 'Text', None, ('Key', 0), ('Direct Editing', 1))) cobj0.initialValue = ATOM3Text('\n', 60, 15) lcobj0.append(cobj0) self.attributes.setValue(lcobj0) self.constraints = ATOM3List([1, 1, 1, 0], ATOM3Constraint) lcobj0 = [] self.constraints.setValue(lcobj0) self.generatedAttributes = { 'name': ('ATOM3String', ), 'author': ('ATOM3String', ), 'description': ('ATOM3Text', ), 'attributes': ('ATOM3List', 'ATOM3Attribute'), 'constraints': ('ATOM3List', 'ATOM3Constraint') } self.realOrder = [ 'name', 'author', 'description', 'attributes', 'constraints' ] self.directEditing = [1, 1, 1, 1, 1]
def __init__(self, parent= None, ASGroot = None): ASG.__init__(self, 'FSB_Buttons', ASGroot, ['ASG_FSB_Buttons' ,'FSB_Toolbar' ,'FSB_Button' ,'FSB_Link' ,'FBS_BLink']) ATOM3Type.__init__(self) self.parent = parent self.name=ATOM3String('', 20) self.keyword_= self.name self.author=ATOM3String('Annonymous', 20) self.description=ATOM3Text('\n', 60,15 ) self.generatedAttributes = {'name': ('ATOM3String', ), 'author': ('ATOM3String', ), 'description': ('ATOM3Text', ) } self.realOrder = ['name','author','description'] self.directEditing = [1,1,1]
def __init__(self, parent= None, ASGroot = None): ASG.__init__(self, 'genericV2', ASGroot, ['ASG_genericV2' ,'genericEntityV2' ,'genericLinkV2']) ATOM3Type.__init__(self) self.parent = parent self.name=ATOM3String('') self.keyword_= self.name self.author=ATOM3String('Annonymous') self.description=ATOM3Text('\n', 60,15 ) self.generatedAttributes = {'name': ('ATOM3String', ), 'author': ('ATOM3String', ), 'description': ('ATOM3Text', ) } self.realOrder = ['name','author','description'] self.directEditing = [1,1,1]
def __init__(self, parent=None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_Composite self.isGraphObjectVisual = True if (hasattr(self, '_setHierarchicalLink')): self._setHierarchicalLink(False) if (hasattr(self, '_setHierarchicalNode')): self._setHierarchicalNode(False) self.parent = parent self.name = ATOM3String('Composite') self.keyword_ = self.name self.is_default = ATOM3Boolean() self.is_default.setValue((None, 0)) self.is_default.config = 0 self.visible = ATOM3Boolean() self.visible.setValue((None, 1)) self.visible.config = 0 self.auto_adjust = ATOM3Boolean() self.auto_adjust.setValue((None, 1)) self.auto_adjust.config = 0 self.enter_action = ATOM3Text('', 60, 15) self.exit_action = ATOM3Text('', 60, 15) self.generatedAttributes = { 'name': ('ATOM3String', ), 'is_default': ('ATOM3Boolean', ), 'visible': ('ATOM3Boolean', ), 'auto_adjust': ('ATOM3Boolean', ), 'enter_action': ('ATOM3Text', ), 'exit_action': ('ATOM3Text', ) } self.realOrder = [ 'name', 'is_default', 'visible', 'auto_adjust', 'enter_action', 'exit_action' ] self.directEditing = [1, 1, 1, 1, 1, 1]
def __init__(self, parent=None, ASGroot=None): ASG.__init__(self, 'omacss', ASGroot, [ 'ASG_omacss', 'Agent', 'Capabilitie', 'Role', 'Goal', 'posses', 'CapableOf', 'achieve', 'requir' ]) ATOM3Type.__init__(self) self.parent = parent self.name = ATOM3String('', 20) self.keyword_ = self.name self.author = ATOM3String('Annonymous', 20) self.description = ATOM3Text('\n', 60, 15) self.generatedAttributes = { 'name': ('ATOM3String', ), 'author': ('ATOM3String', ), 'description': ('ATOM3Text', ) } self.realOrder = ['name', 'author', 'description'] self.directEditing = [1, 1, 1]
def __init__(self, parent=None, ASGroot=None): ASG.__init__(self, 'pns2', ASGroot, [ 'ASG_pns2', 'rawMaterial', 'product', 'metarial', 'operatingUnit', 'fromRaw', 'intoMaterial', 'intoProduct', 'fromMaterial' ]) ATOM3Type.__init__(self) self.parent = parent self.name = ATOM3String('', 20) self.keyword_ = self.name self.author = ATOM3String('Annonymous', 20) self.description = ATOM3Text('\n', 60, 15) self.generatedAttributes = { 'name': ('ATOM3String', ), 'author': ('ATOM3String', ), 'description': ('ATOM3Text', ) } self.realOrder = ['name', 'author', 'description'] self.directEditing = [1, 1, 1]
def __init__(self, parent= None, ASGroot = None): ASG.__init__(self, 'ClassDiagramB', ASGroot, ['ASG_ClassDiagramB' ,'AtomClass' ,'AtomInheritance' ,'AtomAssociation']) ATOM3Type.__init__(self) self.parent = parent self.ModelName=ATOM3String('NewCD') self.keyword_= self.ModelName self.Author=ATOM3String('') self.Description=ATOM3Text('\n', 60,15 ) self.Attributes=ATOM3List([ 1, 1, 1, 0],ATOM3Attribute,parent.types ) lcobj0=[] self.Attributes.setValue(lcobj0) self.Constraints=ATOM3List([ 1, 1, 1, 0],ATOM3Constraint) lcobj0=[] self.Constraints.setValue(lcobj0) self.generatedAttributes = {'ModelName': ('ATOM3String', ), 'Author': ('ATOM3String', ), 'Description': ('ATOM3Text', ), 'Attributes': ('ATOM3List', 'ATOM3Attribute'), 'Constraints': ('ATOM3List', 'ATOM3Constraint') } self.realOrder = ['ModelName','Author','Description','Attributes','Constraints'] self.directEditing = [1,1,0,1,1]
def __init__(self, parent=None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_CD_Association3 self.isGraphObjectVisual = True if (hasattr(self, '_setHierarchicalLink')): self._setHierarchicalLink(False) if (hasattr(self, '_setHierarchicalNode')): self._setHierarchicalNode(False) self.parent = parent self.name = ATOM3String('Association_') self.keyword_ = self.name self.Graphical_Appearance = ATOM3Link() self.Graphical_Appearance.setValue(('None', self)) self.Graphical_Appearance.linkInfo = linkEditor( self, self.Graphical_Appearance.semObject, "Relationship3") self.Graphical_Appearance.linkInfo.FirstLink = stickylink() self.Graphical_Appearance.linkInfo.FirstLink.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.FirstLink.arrow.setValue((' ', 0)) self.Graphical_Appearance.linkInfo.FirstLink.arrow.config = 0 self.Graphical_Appearance.linkInfo.FirstLink.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.FirstLink.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.FirstLink.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.FirstLink.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.FirstLink.decoration.setValue( ('Relationship3_1stLink', self.Graphical_Appearance.linkInfo.FirstLink)) self.Graphical_Appearance.linkInfo.FirstSegment = widthXfillXdecoration( ) self.Graphical_Appearance.linkInfo.FirstSegment.width = ATOM3Integer(2) self.Graphical_Appearance.linkInfo.FirstSegment.fill = ATOM3String( 'black') self.Graphical_Appearance.linkInfo.FirstSegment.stipple = ATOM3String( '') self.Graphical_Appearance.linkInfo.FirstSegment.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.FirstSegment.arrow.setValue( (' ', 0)) self.Graphical_Appearance.linkInfo.FirstSegment.arrow.config = 0 self.Graphical_Appearance.linkInfo.FirstSegment.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.FirstSegment.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.FirstSegment.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.FirstSegment.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.FirstSegment.decoration.setValue( ('Relationship3_1stSegment', self.Graphical_Appearance.linkInfo.FirstSegment)) self.Graphical_Appearance.linkInfo.FirstSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) self.Graphical_Appearance.linkInfo.Center = ATOM3Appearance() self.Graphical_Appearance.linkInfo.Center.setValue( ('Relationship3_Center', self.Graphical_Appearance.linkInfo)) self.Graphical_Appearance.linkInfo.SecondSegment = widthXfillXdecoration( ) self.Graphical_Appearance.linkInfo.SecondSegment.width = ATOM3Integer( 2) self.Graphical_Appearance.linkInfo.SecondSegment.fill = ATOM3String( 'black') self.Graphical_Appearance.linkInfo.SecondSegment.stipple = ATOM3String( '') self.Graphical_Appearance.linkInfo.SecondSegment.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.SecondSegment.arrow.setValue( (' ', 0)) self.Graphical_Appearance.linkInfo.SecondSegment.arrow.config = 0 self.Graphical_Appearance.linkInfo.SecondSegment.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.SecondSegment.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.SecondSegment.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.SecondSegment.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.SecondSegment.decoration.setValue( ('Relationship3_2ndSegment', self.Graphical_Appearance.linkInfo.SecondSegment)) self.Graphical_Appearance.linkInfo.SecondSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) self.Graphical_Appearance.linkInfo.SecondLink = stickylink() self.Graphical_Appearance.linkInfo.SecondLink.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.SecondLink.arrow.setValue((' ', 1)) self.Graphical_Appearance.linkInfo.SecondLink.arrow.config = 0 self.Graphical_Appearance.linkInfo.SecondLink.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.SecondLink.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.SecondLink.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.SecondLink.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.SecondLink.decoration.setValue( ('Relationship3_2ndLink', self.Graphical_Appearance.linkInfo.SecondLink)) self.Graphical_Appearance.linkInfo.FirstLink.decoration.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.FirstSegment.decoration.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.Center.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.SecondSegment.decoration.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.SecondLink.decoration.semObject = self.Graphical_Appearance.semObject self.cardinality = ATOM3List([0, 1, 0, 0], ATOM3Connection) lcobj0 = [] self.cardinality.setValue(lcobj0) self.attributes = ATOM3List([1, 1, 1, 0], ATOM3Attribute, parent.types) lcobj0 = [] self.attributes.setValue(lcobj0) self.Constraints = ATOM3List([1, 1, 1, 0], ATOM3Constraint) lcobj0 = [] self.Constraints.setValue(lcobj0) self.Actions = ATOM3List([1, 1, 1, 0], ATOM3Action) lcobj0 = [] self.Actions.setValue(lcobj0) self.display = ATOM3Text('\n', 60, 15) self.displaySelect = ATOM3MSEnum( ['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0], 0, 1) self.QOCA = ATOM3Action() self.QOCA.setValue( ('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), '"""\nQOCA Constraint Template\nNOTE: DO NOT select a POST/PRE action trigger\nConstraints will be added/removed in a logical manner by other mechanisms.\n"""\nreturn # <--- Remove this if you want to use QOCA\n\n# Get the high level constraint helper and solver\nfrom Qoca.atom3constraints.OffsetConstraints import OffsetConstraints\noc = OffsetConstraints(self.parent.qocaSolver) \n\n# Constraint only makes sense if there exists 2 objects connected to this link\nif(not (self.in_connections_ and self.out_connections_)): return\n\n# Get the graphical objects (subclass of graphEntity/graphLink) \ngraphicalObjectLink = self.graphObject_\ngraphicalObjectSource = self.in_connections_[0].graphObject_\ngraphicalObjectTarget = self.out_connections_[0].graphObject_\nobjTuple = (graphicalObjectSource, graphicalObjectTarget, graphicalObjectLink)\n\n"""\nExample constraint, see Kernel/QOCA/atom3constraints/OffsetConstraints.py\nFor more types of constraints\n"""\noc.LeftExactDistance(objTuple, 20)\noc.resolve() # Resolve immediately after creating entity & constraint \n\n' )) self.generatedAttributes = { 'name': ('ATOM3String', ), 'Graphical_Appearance': ('ATOM3Link', ), 'cardinality': ('ATOM3List', 'ATOM3Connection'), 'attributes': ('ATOM3List', 'ATOM3Attribute'), 'Constraints': ('ATOM3List', 'ATOM3Constraint'), 'Actions': ('ATOM3List', 'ATOM3Action'), 'display': ('ATOM3Text', ), 'displaySelect': ('ATOM3MSEnum', ), 'QOCA': ('ATOM3Action', ) } self.realOrder = [ 'name', 'Graphical_Appearance', 'cardinality', 'attributes', 'Constraints', 'Actions', 'display', 'displaySelect', 'QOCA' ] self.directEditing = [1, 1, 1, 1, 1, 1, 0, 1, 0]
def __init__(self, parent=None): ASGNode.__init__(self) ATOM3Type.__init__(self) self.graphClass_ = graph_Relationship3 self.isGraphObjectVisual = True self.parent = parent self.name = ATOM3String('Relationship_') self.keyword_ = self.name self.Graphical_Appearance = ATOM3Link() self.Graphical_Appearance.setValue(('None', self)) self.Graphical_Appearance.linkInfo = linkEditor( self, self.Graphical_Appearance.semObject, "Relationship3") self.Graphical_Appearance.linkInfo.FirstLink = stickylink() self.Graphical_Appearance.linkInfo.FirstLink.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.FirstLink.arrow.setValue((' ', 0)) self.Graphical_Appearance.linkInfo.FirstLink.arrow.config = 0 self.Graphical_Appearance.linkInfo.FirstLink.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.FirstLink.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.FirstLink.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.FirstLink.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.FirstLink.decoration.setValue( ('Relationship3_1stLink', self.Graphical_Appearance.linkInfo.FirstLink)) self.Graphical_Appearance.linkInfo.FirstSegment = widthXfillXdecoration( ) self.Graphical_Appearance.linkInfo.FirstSegment.width = ATOM3Integer(2) self.Graphical_Appearance.linkInfo.FirstSegment.fill = ATOM3String( 'black') self.Graphical_Appearance.linkInfo.FirstSegment.stipple = ATOM3String( '') self.Graphical_Appearance.linkInfo.FirstSegment.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.FirstSegment.arrow.setValue( (' ', 0)) self.Graphical_Appearance.linkInfo.FirstSegment.arrow.config = 0 self.Graphical_Appearance.linkInfo.FirstSegment.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.FirstSegment.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.FirstSegment.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.FirstSegment.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.FirstSegment.decoration.setValue( ('Relationship3_1stSegment', self.Graphical_Appearance.linkInfo.FirstSegment)) self.Graphical_Appearance.linkInfo.FirstSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) self.Graphical_Appearance.linkInfo.Center = ATOM3Appearance() self.Graphical_Appearance.linkInfo.Center.setValue( ('Relationship3_Center', self.Graphical_Appearance.linkInfo)) self.Graphical_Appearance.linkInfo.SecondSegment = widthXfillXdecoration( ) self.Graphical_Appearance.linkInfo.SecondSegment.width = ATOM3Integer( 2) self.Graphical_Appearance.linkInfo.SecondSegment.fill = ATOM3String( 'black') self.Graphical_Appearance.linkInfo.SecondSegment.stipple = ATOM3String( '') self.Graphical_Appearance.linkInfo.SecondSegment.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.SecondSegment.arrow.setValue( (' ', 0)) self.Graphical_Appearance.linkInfo.SecondSegment.arrow.config = 0 self.Graphical_Appearance.linkInfo.SecondSegment.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.SecondSegment.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.SecondSegment.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.SecondSegment.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.SecondSegment.decoration.setValue( ('Relationship3_2ndSegment', self.Graphical_Appearance.linkInfo.SecondSegment)) self.Graphical_Appearance.linkInfo.SecondSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) self.Graphical_Appearance.linkInfo.SecondLink = stickylink() self.Graphical_Appearance.linkInfo.SecondLink.arrow = ATOM3Boolean() self.Graphical_Appearance.linkInfo.SecondLink.arrow.setValue((' ', 1)) self.Graphical_Appearance.linkInfo.SecondLink.arrow.config = 0 self.Graphical_Appearance.linkInfo.SecondLink.arrowShape1 = ATOM3Integer( 8) self.Graphical_Appearance.linkInfo.SecondLink.arrowShape2 = ATOM3Integer( 10) self.Graphical_Appearance.linkInfo.SecondLink.arrowShape3 = ATOM3Integer( 3) self.Graphical_Appearance.linkInfo.SecondLink.decoration = ATOM3Appearance( ) self.Graphical_Appearance.linkInfo.SecondLink.decoration.setValue( ('Relationship3_2ndLink', self.Graphical_Appearance.linkInfo.SecondLink)) self.Graphical_Appearance.linkInfo.FirstLink.decoration.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.FirstSegment.decoration.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.Center.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.SecondSegment.decoration.semObject = self.Graphical_Appearance.semObject self.Graphical_Appearance.linkInfo.SecondLink.decoration.semObject = self.Graphical_Appearance.semObject self.cardinality = ATOM3List([0, 1, 0, 0], ATOM3Connection) lcobj0 = [] self.cardinality.setValue(lcobj0) self.attributes = ATOM3List([1, 1, 1, 0], ATOM3Attribute, parent.types) lcobj0 = [] self.attributes.setValue(lcobj0) self.Constraints = ATOM3List([1, 1, 1, 0], ATOM3Constraint) lcobj0 = [] self.Constraints.setValue(lcobj0) self.Actions = ATOM3List([1, 1, 1, 0], ATOM3Action) lcobj0 = [] self.Actions.setValue(lcobj0) self.display = ATOM3Text('\n', 60, 15) self.displaySelect = ATOM3MSEnum( ['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0], 0, 1) self.generatedAttributes = { 'name': ('ATOM3String', ), 'Graphical_Appearance': ('ATOM3Link', ), 'cardinality': ('ATOM3List', 'ATOM3Connection'), 'attributes': ('ATOM3List', 'ATOM3Attribute'), 'Constraints': ('ATOM3List', 'ATOM3Constraint'), 'Actions': ('ATOM3List', 'ATOM3Action'), 'display': ('ATOM3Text', ), 'displaySelect': ('ATOM3MSEnum', ) } self.realOrder = [ 'name', 'Graphical_Appearance', 'cardinality', 'attributes', 'Constraints', 'Actions', 'display', 'displaySelect' ] self.directEditing = [1, 1, 1, 1, 1, 1, 0, 1]
def genericV2_MDL(self, rootNode, ClassDiagramsV3RootNode=None): # --- Generating attributes code for ASG ClassDiagramsV3 --- if( ClassDiagramsV3RootNode ): # name ClassDiagramsV3RootNode.name.setValue('') ClassDiagramsV3RootNode.name.setNone() # author ClassDiagramsV3RootNode.author.setValue('Annonymous') # showCardinalities ClassDiagramsV3RootNode.showCardinalities.setValue((None, 1)) ClassDiagramsV3RootNode.showCardinalities.config = 0 # showAssociationBox ClassDiagramsV3RootNode.showAssociationBox.setValue((None, 1)) ClassDiagramsV3RootNode.showAssociationBox.config = 0 # showAttributes ClassDiagramsV3RootNode.showAttributes.setValue((None, 1)) ClassDiagramsV3RootNode.showAttributes.config = 0 # showActions ClassDiagramsV3RootNode.showActions.setValue((None, 1)) ClassDiagramsV3RootNode.showActions.config = 0 # showConditions ClassDiagramsV3RootNode.showConditions.setValue((None, 1)) ClassDiagramsV3RootNode.showConditions.config = 0 # attributes ClassDiagramsV3RootNode.attributes.setActionFlags([ 1, 1, 1, 0]) lcobj1 =[] cobj1=ATOM3Attribute(self.types) cobj1.setValue(('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj1.initialValue=ATOM3String('') lcobj1.append(cobj1) cobj1=ATOM3Attribute(self.types) cobj1.setValue(('author', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue=ATOM3String('Annonymous') lcobj1.append(cobj1) cobj1=ATOM3Attribute(self.types) cobj1.setValue(('description', 'Text', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue=ATOM3Text('\n', 60,15 ) lcobj1.append(cobj1) ClassDiagramsV3RootNode.attributes.setValue(lcobj1) # constraints ClassDiagramsV3RootNode.constraints.setActionFlags([ 1, 1, 1, 0]) lcobj1 =[] ClassDiagramsV3RootNode.constraints.setValue(lcobj1) # description ClassDiagramsV3RootNode.description.setValue('\n') # --- ASG attributes over --- self.obj24=Class3(self) self.obj24.isGraphObjectVisual = True # QOCA self.obj24.QOCA.setValue(('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None)) # name self.obj24.name.setValue('genericEntityV2') # Abstract self.obj24.Abstract.setValue((None, 0)) self.obj24.Abstract.config = 0 # Actions self.obj24.Actions.setActionFlags([ 1, 1, 1, 0]) lcobj2 =[] self.obj24.Actions.setValue(lcobj2) # Graphical_Appearance self.obj24.Graphical_Appearance.setValue( ('genericEntityV2', self.obj24)) # attributes self.obj24.attributes.setActionFlags([ 1, 1, 1, 0]) lcobj2 =[] cobj2=ATOM3Attribute(self.types) cobj2.setValue(('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj2.initialValue=ATOM3String('E') lcobj2.append(cobj2) self.obj24.attributes.setValue(lcobj2) # cardinality self.obj24.cardinality.setActionFlags([ 0, 1, 0, 0]) lcobj2 =[] cobj2=ATOM3Connection() cobj2.setValue(('genericLinkV2', (('Source', 'Destination'), 0), '0', 'N')) lcobj2.append(cobj2) cobj2=ATOM3Connection() cobj2.setValue(('genericLinkV2', (('Source', 'Destination'), 1), '0', 'N')) lcobj2.append(cobj2) self.obj24.cardinality.setValue(lcobj2) # display self.obj24.display.setValue('Attributes:\n - name :: String\nCardinalities:\n - To genericLinkV2: 0 to N\n - From genericLinkV2: 0 to N\n') # Constraints self.obj24.Constraints.setActionFlags([ 1, 1, 1, 0]) lcobj2 =[] self.obj24.Constraints.setValue(lcobj2) self.obj24.graphClass_= graph_Class3 if self.genGraphics: new_obj = graph_Class3(120.0,200.0,self.obj24) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("Class3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.1375, 1.0] else: new_obj = None self.obj24.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj24) self.globalAndLocalPostcondition(self.obj24, rootNode) self.obj25=Association3(self) self.obj25.isGraphObjectVisual = True # QOCA self.obj25.QOCA.setValue(('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), (['EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE'], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), None)) # name self.obj25.name.setValue('genericLinkV2') # displaySelect self.obj25.displaySelect.setValue( (['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0]) ) self.obj25.displaySelect.config = 0 # Actions self.obj25.Actions.setActionFlags([ 1, 1, 1, 0]) lcobj2 =[] self.obj25.Actions.setValue(lcobj2) # Graphical_Appearance self.obj25.Graphical_Appearance.setValue( ('genericLinkV2', self.obj25)) self.obj25.Graphical_Appearance.linkInfo=linkEditor(self,self.obj25.Graphical_Appearance.semObject, "genericLinkV2") self.obj25.Graphical_Appearance.linkInfo.FirstLink= stickylink() self.obj25.Graphical_Appearance.linkInfo.FirstLink.arrow=ATOM3Boolean() self.obj25.Graphical_Appearance.linkInfo.FirstLink.arrow.setValue((' ', 0)) self.obj25.Graphical_Appearance.linkInfo.FirstLink.arrow.config = 0 self.obj25.Graphical_Appearance.linkInfo.FirstLink.arrowShape1=ATOM3Integer(8) self.obj25.Graphical_Appearance.linkInfo.FirstLink.arrowShape2=ATOM3Integer(10) self.obj25.Graphical_Appearance.linkInfo.FirstLink.arrowShape3=ATOM3Integer(3) self.obj25.Graphical_Appearance.linkInfo.FirstLink.decoration=ATOM3Appearance() self.obj25.Graphical_Appearance.linkInfo.FirstLink.decoration.setValue( ('genericLinkV2_1stLink', self.obj25.Graphical_Appearance.linkInfo.FirstLink)) self.obj25.Graphical_Appearance.linkInfo.FirstSegment= widthXfillXdecoration() self.obj25.Graphical_Appearance.linkInfo.FirstSegment.width=ATOM3Integer(2) self.obj25.Graphical_Appearance.linkInfo.FirstSegment.fill=ATOM3String('black') self.obj25.Graphical_Appearance.linkInfo.FirstSegment.stipple=ATOM3String('') self.obj25.Graphical_Appearance.linkInfo.FirstSegment.arrow=ATOM3Boolean() self.obj25.Graphical_Appearance.linkInfo.FirstSegment.arrow.setValue((' ', 0)) self.obj25.Graphical_Appearance.linkInfo.FirstSegment.arrow.config = 0 self.obj25.Graphical_Appearance.linkInfo.FirstSegment.arrowShape1=ATOM3Integer(8) self.obj25.Graphical_Appearance.linkInfo.FirstSegment.arrowShape2=ATOM3Integer(10) self.obj25.Graphical_Appearance.linkInfo.FirstSegment.arrowShape3=ATOM3Integer(3) self.obj25.Graphical_Appearance.linkInfo.FirstSegment.decoration=ATOM3Appearance() self.obj25.Graphical_Appearance.linkInfo.FirstSegment.decoration.setValue( ('genericLinkV2_1stSegment', self.obj25.Graphical_Appearance.linkInfo.FirstSegment)) self.obj25.Graphical_Appearance.linkInfo.FirstSegment.decoration_Position=ATOM3Enum(['Up', 'Down', 'Middle', 'No decoration'],3,0) self.obj25.Graphical_Appearance.linkInfo.Center=ATOM3Appearance() self.obj25.Graphical_Appearance.linkInfo.Center.setValue( ('genericLinkV2_Center', self.obj25.Graphical_Appearance.linkInfo)) self.obj25.Graphical_Appearance.linkInfo.SecondSegment= widthXfillXdecoration() self.obj25.Graphical_Appearance.linkInfo.SecondSegment.width=ATOM3Integer(2) self.obj25.Graphical_Appearance.linkInfo.SecondSegment.fill=ATOM3String('black') self.obj25.Graphical_Appearance.linkInfo.SecondSegment.stipple=ATOM3String('') self.obj25.Graphical_Appearance.linkInfo.SecondSegment.arrow=ATOM3Boolean() self.obj25.Graphical_Appearance.linkInfo.SecondSegment.arrow.setValue((' ', 0)) self.obj25.Graphical_Appearance.linkInfo.SecondSegment.arrow.config = 0 self.obj25.Graphical_Appearance.linkInfo.SecondSegment.arrowShape1=ATOM3Integer(8) self.obj25.Graphical_Appearance.linkInfo.SecondSegment.arrowShape2=ATOM3Integer(10) self.obj25.Graphical_Appearance.linkInfo.SecondSegment.arrowShape3=ATOM3Integer(3) self.obj25.Graphical_Appearance.linkInfo.SecondSegment.decoration=ATOM3Appearance() self.obj25.Graphical_Appearance.linkInfo.SecondSegment.decoration.setValue( ('genericLinkV2_2ndSegment', self.obj25.Graphical_Appearance.linkInfo.SecondSegment)) self.obj25.Graphical_Appearance.linkInfo.SecondSegment.decoration_Position=ATOM3Enum(['Up', 'Down', 'Middle', 'No decoration'],3,0) self.obj25.Graphical_Appearance.linkInfo.SecondLink= stickylink() self.obj25.Graphical_Appearance.linkInfo.SecondLink.arrow=ATOM3Boolean() self.obj25.Graphical_Appearance.linkInfo.SecondLink.arrow.setValue((' ', 1)) self.obj25.Graphical_Appearance.linkInfo.SecondLink.arrow.config = 0 self.obj25.Graphical_Appearance.linkInfo.SecondLink.arrowShape1=ATOM3Integer(8) self.obj25.Graphical_Appearance.linkInfo.SecondLink.arrowShape2=ATOM3Integer(10) self.obj25.Graphical_Appearance.linkInfo.SecondLink.arrowShape3=ATOM3Integer(3) self.obj25.Graphical_Appearance.linkInfo.SecondLink.decoration=ATOM3Appearance() self.obj25.Graphical_Appearance.linkInfo.SecondLink.decoration.setValue( ('genericLinkV2_2ndLink', self.obj25.Graphical_Appearance.linkInfo.SecondLink)) self.obj25.Graphical_Appearance.linkInfo.FirstLink.decoration.semObject=self.obj25.Graphical_Appearance.semObject self.obj25.Graphical_Appearance.linkInfo.FirstSegment.decoration.semObject=self.obj25.Graphical_Appearance.semObject self.obj25.Graphical_Appearance.linkInfo.Center.semObject=self.obj25.Graphical_Appearance.semObject self.obj25.Graphical_Appearance.linkInfo.SecondSegment.decoration.semObject=self.obj25.Graphical_Appearance.semObject self.obj25.Graphical_Appearance.linkInfo.SecondLink.decoration.semObject=self.obj25.Graphical_Appearance.semObject # attributes self.obj25.attributes.setActionFlags([ 1, 1, 1, 0]) lcobj2 =[] cobj2=ATOM3Attribute(self.types) cobj2.setValue(('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj2.initialValue=ATOM3String('L') lcobj2.append(cobj2) self.obj25.attributes.setValue(lcobj2) # cardinality self.obj25.cardinality.setActionFlags([ 0, 1, 0, 0]) lcobj2 =[] cobj2=ATOM3Connection() cobj2.setValue(('genericEntityV2', (('Source', 'Destination'), 0), '0', 'N')) lcobj2.append(cobj2) cobj2=ATOM3Connection() cobj2.setValue(('genericEntityV2', (('Source', 'Destination'), 1), '0', 'N')) lcobj2.append(cobj2) self.obj25.cardinality.setValue(lcobj2) # display self.obj25.display.setValue('Attributes:\n - name :: String\nCardinalities:\n - To genericEntityV2: 0 to N\n - From genericEntityV2: 0 to N\n') # Constraints self.obj25.Constraints.setActionFlags([ 1, 1, 1, 0]) lcobj2 =[] self.obj25.Constraints.setValue(lcobj2) self.obj25.graphClass_= graph_Association3 if self.genGraphics: new_obj = graph_Association3(499.0,271.0,self.obj25) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("Association3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.5190000000000001, 1.0161290322580647] else: new_obj = None self.obj25.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj25) self.globalAndLocalPostcondition(self.obj25, rootNode) # Connections for obj24 (graphObject_: Obj0) of type Class3 self.drawConnections( (self.obj24,self.obj25,[332.3125, 321.0, 499.0, 408.0, 499.0, 271.0],"bezier", 3) ) # Connections for obj25 (graphObject_: Obj1) of type Association3 self.drawConnections( (self.obj25,self.obj24,[499.0, 271.0, 499.0, 134.0, 332.3125, 241.0],"bezier", 3) )
def EntityRelationshipV3inV3_ER_MDL(self, rootNode, EntityRelationshipV3RootNode=None): # --- Generating attributes code for ASG EntityRelationshipV3 --- if (EntityRelationshipV3RootNode): # attributes EntityRelationshipV3RootNode.attributes.setActionFlags([1, 1, 1, 0]) lcobj1 = [] cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj1.initialValue = ATOM3String('') lcobj1.append(cobj1) cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('author', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue = ATOM3String('Annonymous') lcobj1.append(cobj1) cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('description', 'Text', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue = ATOM3Text('\n', 60, 15) lcobj1.append(cobj1) cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('attributes', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Attribute, self.types) lcobj2 = [] cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj2.initialValue = ATOM3String('') lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('author', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3String('Annonymous') lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('description', 'Text', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3Text('\n', 60, 15) lcobj2.append(cobj2) cobj1.initialValue.setValue(lcobj2) lcobj1.append(cobj1) cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('constraints', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Constraint) lcobj2 = [] cobj1.initialValue.setValue(lcobj2) lcobj1.append(cobj1) EntityRelationshipV3RootNode.attributes.setValue(lcobj1) # author EntityRelationshipV3RootNode.author.setValue('Denis') # description EntityRelationshipV3RootNode.description.setValue( 'A truly boostrapping Entity Relationship model\n\nThis model is: EntityRelationship version 3\nIt was created in formalism: EntityRelationship version 3\n\nBeautiful no? \n\nThe big advantage, of course, is that if want to make modifications to the ER formalism (like I did so that I could add a text-fitting post-action), it can be done right in this model, and then you just code re-generate the formalism. NO MORE CODE HACKING :D\n' ) # name EntityRelationshipV3RootNode.name.setValue('EntityRelationshipV3') # constraints EntityRelationshipV3RootNode.constraints.setActionFlags([1, 1, 1, 0]) lcobj1 = [] EntityRelationshipV3RootNode.constraints.setValue(lcobj1) # --- ASG attributes over --- self.obj23 = Entity3(self) self.obj23.isGraphObjectVisual = True # name self.obj23.name.setValue('Entity3') # displaySelect self.obj23.displaySelect.setValue( (['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0])) self.obj23.displaySelect.config = 0 # Actions self.obj23.Actions.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Action() cobj2.setValue( ('storeKeyword', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 0), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'self.oldKeyword = self.keyword_.toString()\n')) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('addCardinality', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]), '# see if we are source or destination\ndirection = params[0]\nif direction == "SOURCE&DESTINATION":\n at3c = ATOM3Connection(self.out_connections_[len(self.out_connections_)-1])\n at3c.direction.setValue((None,0)) # set value of direction\n self.cardinality.newItem( at3c )\n at3c = ATOM3Connection(self.in_connections_[len(self.in_connections_)-1])\n at3c.direction.setValue((None,1)) # set value of direction\n self.cardinality.newItem( at3c )\nelif direction == "SOURCE":\n at3c = ATOM3Connection(self.out_connections_[len(self.out_connections_)-1])\n at3c.direction.setValue((None,0)) # set value of direction\nelse:\n at3c = ATOM3Connection(self.in_connections_[len(self.in_connections_)-1])\n at3c.direction.setValue((None,1)) # set value of direction\nself.cardinality.newItem( at3c )\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('updateGraphics', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'self.Graphical_Appearance.updateGraphicalFile(self.keyword_.toString())\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('removeFromRelationships', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 0), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]), 'for rel in self.in_connections_:\n cards = rel.cardinality.getValue() # obtain the list of relationshp\'s cardinalities\n counter = 0 # an auxiliary counter\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.name.toString() and direction[1] == 1: # if that\'s me\n rel.cardinality.deleteItem(counter)\n break\n counter = counter + 1\nfor rel in self.out_connections_:\n cards = rel.cardinality.getValue() # obtain the list of relationshp\'s cardinalities\n counter = 0 # an auxiliary counter\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.name.toString() and direction[1] == 0: # if that\'s me\n rel.cardinality.deleteItem(counter)\n break\n counter = counter + 1\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('removeConnection', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]), 'object = params[0]\nif params[1] == "SOURCE": direct = "Source"\nelse: direct = "Destination"\n\ncards = self.cardinality.getValue() # obtain the list of cardinalities\ncounter = 0\nfor card in cards:\n name, direction, min, max = card.getValue()\n if name == object.name.toString() and direction[0][direction[1]] == direct: # if that\'s me\n self.cardinality.deleteItem(counter)\n break\n counter = counter + 1\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('updateRelationships', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'for rel in self.in_connections_:\n cards = rel.cardinality.getValue()\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.oldKeyword and direction[1] == 0:\n card.setValue((self, None, None, None))\n break\nfor rel in self.out_connections_:\n cards = rel.cardinality.getValue()\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.oldKeyword and direction[1] == 1:\n card.setValue((self, None, None, None))\n break\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('displayList', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0]), 'bullet = \' - \'\nbulletPre = \' < \'\nbulletPost = \' > \' \ntext = \'\'\nd = self.displaySelect.getValueAsDict()\n\n# Add stuff to the displayable text, depending on if it is hidden or not\nif( d.has_key( \'attributes\' ) and d[ \'attributes\' ] == False and len( self.attributes.getValue() ) > 0 ): \n text += \'Attributes:\\n\'\n for item in self.attributes.getValue():\n val = item.getValue()\n text += bullet + val[0] + \' :: \' + val[1] + \'\\n\'\n\nif( d.has_key( \'constraints\' ) and d[ \'constraints\' ] == False and len( self.Constraints.getValue() ) > 0 ): \n text += \'Constraints:\\n\'\n for item in self.Constraints.getValue():\n val = item.getValue()\n if( val[2][1] == 0 ): text += bulletPre\n else: text += bulletPost\n text += val[0] + \'\\n\'\n\nif( d.has_key( \'actions\' ) and d[ \'actions\' ] == False and len( self.Actions.getValue() ) > 0 ): \n text += \'Actions:\\n\'\n for item in self.Actions.getValue():\n val = item.getValue()\n if( val[2][1] == 0 ): text += bulletPre\n else: text += bulletPost\n text += val[0] + \'\\n\'\n\nif( d.has_key( \'cardinality\' ) and d[ \'cardinality\' ] == False and len( self.cardinality.getValue() ) > 0 ): \n text += \'Cardinalities:\\n\'\n for item in self.cardinality.getValue():\n val = item.getValue()\n if( val[1][1] == 0 ): text += bullet + \'To \'\n else: text += bullet + \'From \'\n text += val[0] + \': \' + val[2] + \' to \' + val[3] + \'\\n\'\n\nself.display.setValue( text )\n\nif( self.graphObject_ ): self.graphObject_.ModifyAttribute( \'display\', text ) \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('fitText', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0]), 'obj = self.graphObject_\nif( not obj ): return\n\n# Input to the fitNode2Text2 method is as follows:\n# String, GraphForm of the String attribute, GraphForm of the rectangle container, Fudge factor\n# NOTE: Fudge factor is two optional parameters: scale X and scale Y\ntextGFtupleList = []\ntextGFtupleList.append( (self.name.getValue(), obj.gf9, obj.gf8, 1.2 ) )\ntextGFtupleList.append( (self.display.getValue(), obj.gf68, obj.gf12, 1.05, 1.05 ) )\n\nobj.fitNodeToText2( textGFtupleList )\n\n\n\n\n\n\n\n\n\n\n\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('fixConnections', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]), '# After re-sizing, arrows may not line up unless we do this\nfrom Utilities import optimizeConnectionPorts\noptimizeConnectionPorts( self.parent )\n' )) lcobj2.append(cobj2) self.obj23.Actions.setValue(lcobj2) # Graphical_Appearance self.obj23.Graphical_Appearance.setValue(('Entity3', self.obj23)) # attributes self.obj23.attributes.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Attribute(self.types) cobj2.setValue(('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj2.initialValue = ATOM3String('Entity_') lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue(('Graphical_Appearance', 'Appearance', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3Appearance() cobj2.initialValue.setValue(('class0', None)) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('cardinality', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([0, 1, 0, self.types], ATOM3Connection) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('attributes', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Attribute, self.types) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('Constraints', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Constraint) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('Actions', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Action) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('display', 'Text', None, ('Key', 0), ('Direct Editing', 0))) cobj2.initialValue = ATOM3Text('\n', 60, 15) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('displaySelect', 'MSEnum', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3MSEnum( ['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0], 1, 1) lcobj2.append(cobj2) self.obj23.attributes.setValue(lcobj2) # cardinality self.obj23.cardinality.setActionFlags([0, 1, 0, 0]) lcobj2 = [] cobj2 = ATOM3Connection() cobj2.setValue(('Relationship3', (('Source', 'Destination'), 0), '0', 'N')) lcobj2.append(cobj2) cobj2 = ATOM3Connection() cobj2.setValue(('Relationship3', (('Source', 'Destination'), 1), '0', 'N')) lcobj2.append(cobj2) self.obj23.cardinality.setValue(lcobj2) # display self.obj23.display.setValue( 'Attributes:\n - name :: String\n - Graphical_Appearance :: Appearance\n - cardinality :: List\n - attributes :: List\n - Constraints :: List\n - Actions :: List\n - display :: Text\n - displaySelect :: MSEnum\nConstraints:\n > checkKeywordValidity\n > checkNameValidity\n > classes2relationships\nActions:\n < storeKeyword\n > addCardinality\n > updateGraphics\n < removeFromRelationships\n > removeConnection\n > updateRelationships\n > displayList\n > fitText\n > fixConnections\nCardinalities:\n - To Relationship3: 0 to N\n - From Relationship3: 0 to N\n' ) # Constraints self.obj23.Constraints.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Constraint() cobj2.setValue( ('checkKeywordValidity', (['Python', 'OCL'], 1), (['PREcondition', 'POSTcondition'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'attrs = self.attributes.getValue()\nnumKeys = 0\nfor attr in attrs:\n name, selType, ivalue, key, dirEditing = attr.getValue()\n if key[1] == 1:\n numKeys = numKeys + 1\n if numKeys > 1:\n return ("This entity has more than one keyword", self.graphObject_)\n if selType != "String":\n return ("Keyword ("+name+") is not a string", self.graphObject_)\nreturn None\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Constraint() cobj2.setValue( ('checkNameValidity', (['Python', 'OCL'], 1), (['PREcondition', 'POSTcondition'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'import string\nif not self.name.isNone():\n vname = self.name.getValue()\n # check if we have a name\n if (not vname) or (vname == ""): # the name is mandatory\n return "Entity name must be specified"\n # now check that the name is valid (a variable name)\n if string.count(vname, " ") > 0:\n return "Invalid entity name, no white spaces allowed"\n # check first character\n if (vname[0] >= \'0\') and (vname[0] <= \'9\'): # a number\n return "Invalid variable name, first character must be a letter or \'_\'"\n if vname[0] != \'_\' and (vname[0]<\'A\' or vname[0]>\'z\'):\n return "Invalid entity name, first character must be a letter or \'_\'"\n # now check for the rest of not allowed characters...\n for c in range(len(vname)-1):\n if vname[c+1] < \'A\' or vname[c+1] > \'z\': # not a letter\n if vname[c+1] < \'0\' or vname[c+1] > \'9\': # not a number\n if vname[c+1] != \'_\': # not underscore\n return ("Invalid entity name, character \'"+vname[c+1]+"\' is not allowed", self.graphObject_)\nreturn None\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Constraint() cobj2.setValue( ('classes2relationships', (['Python', 'OCL'], 1), (['PREcondition', 'POSTcondition'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]), 'for c in self.in_connections_:\n if c.getClass() != \'Relationship3\':\n return ( c.toString(), \'is not a relationship\' )\nfor c in self.out_connections_:\n if c.getClass() != \'Relationship3\':\n return ( c.toString(), \'is not a relationship\' )\nreturn None\n\n' )) lcobj2.append(cobj2) self.obj23.Constraints.setValue(lcobj2) self.obj23.graphClass_ = graph_Entity3 if self.genGraphics: new_obj = graph_Entity3(420.0, 188.0, self.obj23) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("Entity3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [ 1.8101226993865032, 5.5213483146067421 ] else: new_obj = None self.obj23.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj23) self.globalAndLocalPostcondition(self.obj23, rootNode) self.obj24 = Relationship3(self) self.obj24.isGraphObjectVisual = True # name self.obj24.name.setValue('Relationship3') # displaySelect self.obj24.displaySelect.setValue( (['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0])) self.obj24.displaySelect.config = 0 # Actions self.obj24.Actions.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Action() cobj2.setValue( ('storeKeyword', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 0), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'self.oldKeyword = self.keyword_.toString()\n')) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('updateGraphics', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'self.Graphical_Appearance.updateGraphicalFile(self.keyword_.toString())\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('removeCardinalitiesFromEntities', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]), 'for ent in self.in_connections_:\n cards = ent.cardinality.getValue() # obtain the list of relationshp\'s cardinalities\n counter = 0 # an auxiliary counter\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.name.toString() and direction[1] == 0: # if that\'s me\n ent.cardinality.deleteItem(counter)\n break\n counter = counter + 1\nfor ent in self.out_connections_:\n cards = ent.cardinality.getValue() # obtain the list of relationshp\'s cardinalities\n counter = 0 # an auxiliary counter\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.name.toString() and direction[1] == 1: # if that\'s me\n ent.cardinality.deleteItem(counter)\n break\n counter = counter + 1\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('removeConnection', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]), 'object = params[0]\nif object == None: # that means its myself!!\n object = self\nif params[1] == "SOURCE": direct = "Source"\nelse: direct = "Destination"\ncards = self.cardinality.getValue() # obtain the list of cardinalities\ncounter = 0\nfor card in cards:\n name, direction, min, max = card.getValue()\n if name == object.name.toString() and direction[0][direction[1]] == direct: # if that\'s me\n self.cardinality.deleteItem(counter)\n break\n counter = counter + 1\nif self == object: # have to remove the other part...\n if direct == "Source": direct = "Destination"\n else: direct = "Source"\n cards = self.cardinality.getValue() # obtain the list of cardinalities\n counter = 0\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == object.name.toString() and direction[0][direction[1]] == direct: # if that\'s me\n self.cardinality.deleteItem(counter)\n break\n counter = counter + 1\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('addCardinality', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]), '# see if we are source or destination\ndirection = params[0]\nif direction == "SOURCE&DESTINATION":\n at3c = ATOM3Connection(self.out_connections_[len(self.out_connections_)-1])\n at3c.direction.setValue((None,0)) # set value of direction\n self.cardinality.newItem( at3c )\n at3c = ATOM3Connection(self.in_connections_[len(self.in_connections_)-1])\n at3c.direction.setValue((None,1)) # set value of direction\n self.cardinality.newItem( at3c )\nelif direction == "SOURCE":\n at3c = ATOM3Connection(self.out_connections_[len(self.out_connections_)-1])\n at3c.direction.setValue((None,0)) # set value of direction\nelse:\n at3c = ATOM3Connection(self.in_connections_[len(self.in_connections_)-1])\n at3c.direction.setValue((None,1)) # set value of direction\nself.cardinality.newItem( at3c )\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('updateRelationships', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'for rel in self.in_connections_:\n cards = rel.cardinality.getValue()\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.oldKeyword and direction[1] == 0:\n card.setValue((self, None, None, None))\n break\nfor rel in self.out_connections_:\n cards = rel.cardinality.getValue()\n for card in cards:\n name, direction, min, max = card.getValue()\n if name == self.oldKeyword and direction[1] == 1:\n card.setValue((self, None, None, None))\n break\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('displayList', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'bullet = \' - \'\nbulletPre = \' < \'\nbulletPost = \' > \' \ntext = \'\'\nd = self.displaySelect.getValueAsDict()\n\n# Add stuff to the displayable text, depending on if it is hidden or not\nif( d.has_key( \'attributes\' ) and d[ \'attributes\' ] == False and len( self.attributes.getValue() ) > 0 ): \n text += \'Attributes:\\n\'\n for item in self.attributes.getValue():\n val = item.getValue()\n text += bullet + val[0] + \' :: \' + val[1] + \'\\n\'\n\nif( d.has_key( \'constraints\' ) and d[ \'constraints\' ] == False and len( self.Constraints.getValue() ) > 0 ): \n text += \'Constraints:\\n\'\n for item in self.Constraints.getValue():\n val = item.getValue()\n if( val[2][1] == 0 ): text += bulletPre\n else: text += bulletPost\n text += val[0] + \'\\n\'\n\nif( d.has_key( \'actions\' ) and d[ \'actions\' ] == False and len( self.Actions.getValue() ) > 0 ): \n text += \'Actions:\\n\'\n for item in self.Actions.getValue():\n val = item.getValue()\n if( val[2][1] == 0 ): text += bulletPre\n else: text += bulletPost\n text += val[0] + \'\\n\'\n\nif( d.has_key( \'cardinality\' ) and d[ \'cardinality\' ] == False and len( self.cardinality.getValue() ) > 0 ): \n text += \'Cardinalities:\\n\'\n for item in self.cardinality.getValue():\n val = item.getValue()\n if( val[1][1] == 0 ): text += bullet + \'To \'\n else: text += bullet + \'From \'\n text += val[0] + \': \' + val[2] + \' to \' + val[3] + \'\\n\'\n\nself.display.setValue( text )\n\nif( self.graphObject_ ): self.graphObject_.ModifyAttribute( \'display\', text ) \n\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('fitText', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'obj = self.graphObject_\nif( not obj ): return\nobj = obj.centerObject\nif( not obj ): return\n\n# String, GraphForm with string, Containing Rectangle GraphForm, Fudge factor\ntextGFtupleList = []\ntextGFtupleList.append( (self.name.getValue(), obj.gf3, obj.gf9, 1.2 ) )\ntextGFtupleList.append( (self.display.getValue(), obj.gf11, obj.gf12, 1.05, 1.05 ) )\n\nobj.fitNodeToText2( textGFtupleList )\n\n\n\n\n\n' )) lcobj2.append(cobj2) self.obj24.Actions.setValue(lcobj2) # Graphical_Appearance self.obj24.Graphical_Appearance.setValue(('Relationship3', self.obj24)) self.obj24.Graphical_Appearance.linkInfo = linkEditor( self, self.obj24.Graphical_Appearance.semObject, "Relationship3") self.obj24.Graphical_Appearance.linkInfo.FirstLink = stickylink() self.obj24.Graphical_Appearance.linkInfo.FirstLink.arrow = ATOM3Boolean() self.obj24.Graphical_Appearance.linkInfo.FirstLink.arrow.setValue((' ', 0)) self.obj24.Graphical_Appearance.linkInfo.FirstLink.arrow.config = 0 self.obj24.Graphical_Appearance.linkInfo.FirstLink.arrowShape1 = ATOM3Integer( 8) self.obj24.Graphical_Appearance.linkInfo.FirstLink.arrowShape2 = ATOM3Integer( 10) self.obj24.Graphical_Appearance.linkInfo.FirstLink.arrowShape3 = ATOM3Integer( 3) self.obj24.Graphical_Appearance.linkInfo.FirstLink.decoration = ATOM3Appearance( ) self.obj24.Graphical_Appearance.linkInfo.FirstLink.decoration.setValue( ('Relationship3_1stLink', self.obj24.Graphical_Appearance.linkInfo.FirstLink)) self.obj24.Graphical_Appearance.linkInfo.FirstSegment = widthXfillXdecoration( ) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.width = ATOM3Integer( 2) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.fill = ATOM3String( 'blue') self.obj24.Graphical_Appearance.linkInfo.FirstSegment.stipple = ATOM3String( '') self.obj24.Graphical_Appearance.linkInfo.FirstSegment.arrow = ATOM3Boolean( ) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.arrow.setValue( (' ', 0)) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.arrow.config = 0 self.obj24.Graphical_Appearance.linkInfo.FirstSegment.arrowShape1 = ATOM3Integer( 8) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.arrowShape2 = ATOM3Integer( 10) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.arrowShape3 = ATOM3Integer( 3) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.decoration = ATOM3Appearance( ) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.decoration.setValue( ('Relationship3_1stSegment', self.obj24.Graphical_Appearance.linkInfo.FirstSegment)) self.obj24.Graphical_Appearance.linkInfo.FirstSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) self.obj24.Graphical_Appearance.linkInfo.Center = ATOM3Appearance() self.obj24.Graphical_Appearance.linkInfo.Center.setValue( ('Relationship3_Center', self.obj24.Graphical_Appearance.linkInfo)) self.obj24.Graphical_Appearance.linkInfo.SecondSegment = widthXfillXdecoration( ) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.width = ATOM3Integer( 2) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.fill = ATOM3String( 'blue') self.obj24.Graphical_Appearance.linkInfo.SecondSegment.stipple = ATOM3String( '') self.obj24.Graphical_Appearance.linkInfo.SecondSegment.arrow = ATOM3Boolean( ) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.arrow.setValue( (' ', 0)) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.arrow.config = 0 self.obj24.Graphical_Appearance.linkInfo.SecondSegment.arrowShape1 = ATOM3Integer( 8) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.arrowShape2 = ATOM3Integer( 10) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.arrowShape3 = ATOM3Integer( 3) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.decoration = ATOM3Appearance( ) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.decoration.setValue( ('Relationship3_2ndSegment', self.obj24.Graphical_Appearance.linkInfo.SecondSegment)) self.obj24.Graphical_Appearance.linkInfo.SecondSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) self.obj24.Graphical_Appearance.linkInfo.SecondLink = stickylink() self.obj24.Graphical_Appearance.linkInfo.SecondLink.arrow = ATOM3Boolean() self.obj24.Graphical_Appearance.linkInfo.SecondLink.arrow.setValue( (' ', 1)) self.obj24.Graphical_Appearance.linkInfo.SecondLink.arrow.config = 0 self.obj24.Graphical_Appearance.linkInfo.SecondLink.arrowShape1 = ATOM3Integer( 8) self.obj24.Graphical_Appearance.linkInfo.SecondLink.arrowShape2 = ATOM3Integer( 15) self.obj24.Graphical_Appearance.linkInfo.SecondLink.arrowShape3 = ATOM3Integer( 9) self.obj24.Graphical_Appearance.linkInfo.SecondLink.decoration = ATOM3Appearance( ) self.obj24.Graphical_Appearance.linkInfo.SecondLink.decoration.setValue( ('Relationship3_2ndLink', self.obj24.Graphical_Appearance.linkInfo.SecondLink)) self.obj24.Graphical_Appearance.linkInfo.FirstLink.decoration.semObject = self.obj24.Graphical_Appearance.semObject self.obj24.Graphical_Appearance.linkInfo.FirstSegment.decoration.semObject = self.obj24.Graphical_Appearance.semObject self.obj24.Graphical_Appearance.linkInfo.Center.semObject = self.obj24.Graphical_Appearance.semObject self.obj24.Graphical_Appearance.linkInfo.SecondSegment.decoration.semObject = self.obj24.Graphical_Appearance.semObject self.obj24.Graphical_Appearance.linkInfo.SecondLink.decoration.semObject = self.obj24.Graphical_Appearance.semObject # attributes self.obj24.attributes.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Attribute(self.types) cobj2.setValue(('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj2.initialValue = ATOM3String('Relationship_') lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue(('Graphical_Appearance', 'Link', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3Link() cobj2.initialValue.setValue(('None', None)) cobj2.initialValue.linkInfo = linkEditor(self, cobj2.initialValue.semObject, "Relationship3") cobj2.initialValue.linkInfo.FirstLink = stickylink() cobj2.initialValue.linkInfo.FirstLink.arrow = ATOM3Boolean() cobj2.initialValue.linkInfo.FirstLink.arrow.setValue((' ', 0)) cobj2.initialValue.linkInfo.FirstLink.arrow.config = 0 cobj2.initialValue.linkInfo.FirstLink.arrowShape1 = ATOM3Integer(8) cobj2.initialValue.linkInfo.FirstLink.arrowShape2 = ATOM3Integer(10) cobj2.initialValue.linkInfo.FirstLink.arrowShape3 = ATOM3Integer(3) cobj2.initialValue.linkInfo.FirstLink.decoration = ATOM3Appearance() cobj2.initialValue.linkInfo.FirstLink.decoration.setValue( ('Relationship3_1stLink', cobj2.initialValue.linkInfo.FirstLink)) cobj2.initialValue.linkInfo.FirstSegment = widthXfillXdecoration() cobj2.initialValue.linkInfo.FirstSegment.width = ATOM3Integer(2) cobj2.initialValue.linkInfo.FirstSegment.fill = ATOM3String('black') cobj2.initialValue.linkInfo.FirstSegment.stipple = ATOM3String('') cobj2.initialValue.linkInfo.FirstSegment.arrow = ATOM3Boolean() cobj2.initialValue.linkInfo.FirstSegment.arrow.setValue((' ', 0)) cobj2.initialValue.linkInfo.FirstSegment.arrow.config = 0 cobj2.initialValue.linkInfo.FirstSegment.arrowShape1 = ATOM3Integer(8) cobj2.initialValue.linkInfo.FirstSegment.arrowShape2 = ATOM3Integer(10) cobj2.initialValue.linkInfo.FirstSegment.arrowShape3 = ATOM3Integer(3) cobj2.initialValue.linkInfo.FirstSegment.decoration = ATOM3Appearance() cobj2.initialValue.linkInfo.FirstSegment.decoration.setValue( ('Relationship3_1stSegment', cobj2.initialValue.linkInfo.FirstSegment)) cobj2.initialValue.linkInfo.FirstSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) cobj2.initialValue.linkInfo.Center = ATOM3Appearance() cobj2.initialValue.linkInfo.Center.setValue( ('Relationship3_Center', cobj2.initialValue.linkInfo)) cobj2.initialValue.linkInfo.SecondSegment = widthXfillXdecoration() cobj2.initialValue.linkInfo.SecondSegment.width = ATOM3Integer(2) cobj2.initialValue.linkInfo.SecondSegment.fill = ATOM3String('black') cobj2.initialValue.linkInfo.SecondSegment.stipple = ATOM3String('') cobj2.initialValue.linkInfo.SecondSegment.arrow = ATOM3Boolean() cobj2.initialValue.linkInfo.SecondSegment.arrow.setValue((' ', 0)) cobj2.initialValue.linkInfo.SecondSegment.arrow.config = 0 cobj2.initialValue.linkInfo.SecondSegment.arrowShape1 = ATOM3Integer(8) cobj2.initialValue.linkInfo.SecondSegment.arrowShape2 = ATOM3Integer(10) cobj2.initialValue.linkInfo.SecondSegment.arrowShape3 = ATOM3Integer(3) cobj2.initialValue.linkInfo.SecondSegment.decoration = ATOM3Appearance() cobj2.initialValue.linkInfo.SecondSegment.decoration.setValue( ('Relationship3_2ndSegment', cobj2.initialValue.linkInfo.SecondSegment)) cobj2.initialValue.linkInfo.SecondSegment.decoration_Position = ATOM3Enum( ['Up', 'Down', 'Middle', 'No decoration'], 3, 0) cobj2.initialValue.linkInfo.SecondLink = stickylink() cobj2.initialValue.linkInfo.SecondLink.arrow = ATOM3Boolean() cobj2.initialValue.linkInfo.SecondLink.arrow.setValue((' ', 1)) cobj2.initialValue.linkInfo.SecondLink.arrow.config = 0 cobj2.initialValue.linkInfo.SecondLink.arrowShape1 = ATOM3Integer(8) cobj2.initialValue.linkInfo.SecondLink.arrowShape2 = ATOM3Integer(10) cobj2.initialValue.linkInfo.SecondLink.arrowShape3 = ATOM3Integer(3) cobj2.initialValue.linkInfo.SecondLink.decoration = ATOM3Appearance() cobj2.initialValue.linkInfo.SecondLink.decoration.setValue( ('Relationship3_2ndLink', cobj2.initialValue.linkInfo.SecondLink)) cobj2.initialValue.linkInfo.FirstLink.decoration.semObject = cobj2.initialValue.semObject cobj2.initialValue.linkInfo.FirstSegment.decoration.semObject = cobj2.initialValue.semObject cobj2.initialValue.linkInfo.Center.semObject = cobj2.initialValue.semObject cobj2.initialValue.linkInfo.SecondSegment.decoration.semObject = cobj2.initialValue.semObject cobj2.initialValue.linkInfo.SecondLink.decoration.semObject = cobj2.initialValue.semObject lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('cardinality', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([0, 1, 0, self.types], ATOM3Connection) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('attributes', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Attribute, self.types) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('Constraints', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Constraint) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('Actions', 'List', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3List([1, 1, 1, self.types], ATOM3Action) lcobj3 = [] cobj2.initialValue.setValue(lcobj3) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('display', 'Text', None, ('Key', 0), ('Direct Editing', 0))) cobj2.initialValue = ATOM3Text('\n', 60, 15) lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('displaySelect', 'MSEnum', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3MSEnum( ['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0], 1, 1) lcobj2.append(cobj2) self.obj24.attributes.setValue(lcobj2) # cardinality self.obj24.cardinality.setActionFlags([0, 1, 0, 0]) lcobj2 = [] cobj2 = ATOM3Connection() cobj2.setValue(('Entity3', (('Source', 'Destination'), 1), '1', 'N')) lcobj2.append(cobj2) cobj2 = ATOM3Connection() cobj2.setValue(('Entity3', (('Source', 'Destination'), 0), '1', 'N')) lcobj2.append(cobj2) self.obj24.cardinality.setValue(lcobj2) # display self.obj24.display.setValue( 'Attributes:\n - name :: String\n - Graphical_Appearance :: Link\n - cardinality :: List\n - attributes :: List\n - Constraints :: List\n - Actions :: List\n - display :: Text\n - displaySelect :: MSEnum\nConstraints:\n > relationships2classes\n > checkKeywordValidity\n > checkNameValidity\nActions:\n < storeKeyword\n > updateGraphics\n > removeCardinalitiesFromEntities\n > removeConnection\n > addCardinality\n > updateRelationships\n > displayList\n > fitText\nCardinalities:\n - From Entity3: 1 to N\n - To Entity3: 1 to N\n' ) # Constraints self.obj24.Constraints.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Constraint() cobj2.setValue( ('relationships2classes', (['Python', 'OCL'], 1), (['PREcondition', 'POSTcondition'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]), 'for c in self.in_connections_:\n if c.getClass() != \'Entity3\' and c.getClass() != \'Relationship3\':\n return ( c.keyword_.toString(), \'bad object type\' )\nfor c in self.out_connections_:\n if c.getClass() != \'Entity3\' and c.getClass() != \'Relationship3\':\n return ( c.keyword_.toString(), \'bad object type\' )\nreturn None\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Constraint() cobj2.setValue( ('checkKeywordValidity', (['Python', 'OCL'], 1), (['PREcondition', 'POSTcondition'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'attrs = self.attributes.getValue()\nnumKeys = 0\nfor attr in attrs:\n name, selType, ivalue, key, dirEditing = attr.getValue()\n if key[1] == 1:\n numKeys = numKeys + 1\n if numKeys > 1:\n return ("This entity has more than one keyword", self.graphObject_)\n if selType != "String":\n return ("Keyword ("+name+") is not a string", self.graphObject_)\nreturn None\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Constraint() cobj2.setValue( ('checkNameValidity', (['Python', 'OCL'], 1), (['PREcondition', 'POSTcondition'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 'import string\nif not self.name.isNone:\n vname = self.name.getValue()\n # check if we have a name\n if (not vname) or (vname == ""): # the name is mandatory\n return "Relationship name must be specified"\n # now check that the name is valid (a variable name)\n if string.count(vname, " ") > 0:\n return "Invalid relationship name, no white spaces allowed"\n # check first character\n if (vname[0] >= \'0\') and (vname[0] <= \'9\'): # a number\n return "Invalid variable name, first character must be a letter or \'_\'"\n if vname[0] != \'_\' and (vname[0]<\'A\' or vname[0]>\'z\'):\n return "Invalid relationship name, first character must be a letter or \'_\'"\n # now check for the rest of not allowed characters...\n for c in range(len(vname)-1):\n if vname[c+1] < \'A\' or vname[c+1] > \'z\': # not a letter\n if vname[c+1] < \'0\' or vname[c+1] > \'9\': # not a number\n if vname[c+1] != \'_\': # not underscore\n return ("Invalid relationship name, character \'"+vname[c+1]+"\' is not allowed", self.graphObject_)\nreturn None\n' )) lcobj2.append(cobj2) self.obj24.Constraints.setValue(lcobj2) self.obj24.graphClass_ = graph_Relationship3 if self.genGraphics: new_obj = graph_Relationship3(220.0, 288.0, self.obj24) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("Relationship3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.75, 5.080645161290323] else: new_obj = None self.obj24.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj24) self.globalAndLocalPostcondition(self.obj24, rootNode) self.drawConnections( (self.obj23, self.obj24, [429.0, 347.42696629213481, 220.0, 348.0, 220.0, 288.0], "bezier", 3)) self.drawConnections( (self.obj24, self.obj23, [220.0, 288.0, 220.0, 248.0, 429.0, 237.0], "bezier", 3))
def RAM(self, pre): try: if pre: prefix = 'MTpre_' else: prefix = 'MTpost_' # Rename the meta-model self.ASGroot.name.setValue(prefix + self.ASGroot.name.getValue()) # Classes and Associations for nt in self.ASGroot.listNodes: if nt == 'CD_Class3' or nt == 'CD_Association3': for node in self.ASGroot.listNodes[nt]: # Name original_name = node.name.getValue() node.name.setValue(prefix + node.name.getValue()) # Attributes attributes = node.attributes.getValue() node.attributes.setActionFlags([1, 1, 1, 0]) newAttrs = [] for i, attr in enumerate(attributes): newAttr = ATOM3Attribute(self.types) newAttr.setValue( (prefix + attr.getValue()[0], 'Text', None, ('Key', 0), ('Direct Editing', 0))) if pre: newAttr.initialValue = ATOM3Text( "# Specify a boolean condition on the attribute\nreturn True\t# any value is allowed", 80, 15) else: newAttr.initialValue = ATOM3Text( "# Specify an action to be performed on the attribute\npass\t# do not modify the value", 80, 15) newAttr.isDerivedAttribute = False newAttrs.append(newAttr) MT_pivot = ATOM3Attribute(self.types) MT_pivot.setValue(('MT_pivot', 'Boolean', None, ('Key', 0), ('Direct Editing', 1))) MT_pivot.initialValue = ATOM3Boolean() MT_pivot.initialValue.setValue(('True', 0)) MT_pivot.initialValue.config = 1 MT_pivot.isDerivedAttribute = False newAttrs.append(MT_pivot) MT_isProcessed = ATOM3Attribute(self.types) MT_isProcessed.setValue( ('MT_isProcessed', 'Boolean', None, ('Key', 0), ('Direct Editing', 1))) MT_isProcessed.initialValue = ATOM3Boolean() MT_isProcessed.initialValue.setValue(('True', 0)) MT_isProcessed.initialValue.config = 1 MT_isProcessed.isDerivedAttribute = False newAttrs.append(MT_isProcessed) MT_label = ATOM3Attribute(self.types) MT_label.setValue(('MT_label', 'String', None, ('Key', 1), ('Direct Editing', 1))) MT_label.initialValue = ATOM3String(original_name, 20) MT_label.isDerivedAttribute = False newAttrs.append(MT_label) if pre: MT_macthSubType = ATOM3Attribute(self.types) MT_macthSubType.setValue( ('MT_macthSubType', 'Boolean', None, ('Key', 0), ('Direct Editing', 1))) MT_macthSubType.initialValue = ATOM3Boolean() MT_macthSubType.initialValue.setValue(('True', 0)) MT_macthSubType.initialValue.config = 1 MT_macthSubType.isDerivedAttribute = False newAttrs.append(MT_macthSubType) node.attributes.setValue(newAttrs) # Cardinalities cardinalities = node.cardinality.getValue() node.cardinality.setActionFlags([0, 1, 0, 0]) newCards = [] for i, card in enumerate(cardinalities): target, direction, min, max = card.getValue() card.setValue((target, direction, '0', max)) newCards.append(card) node.cardinality.setValue(newCards) if nt == 'CD_Class3': # Abstract node.Abstract.setValue((None, 0)) node.Abstract.config = 0 # Save the new meta-model path = self.statusbar.getState(StatusBar.MODEL)[1][0] path = os.path.join(os.path.dirname(path), prefix + os.path.basename(path)) self.save(0, path) return os.path.basename(path) except e: print e
def FSB_Buttons_MDL(self, rootNode, CD_ClassDiagramsV3RootNode=None): # --- Generating attributes code for ASG CD_ClassDiagramsV3 --- if (CD_ClassDiagramsV3RootNode): # name CD_ClassDiagramsV3RootNode.name.setValue('FSB_Buttons') # author CD_ClassDiagramsV3RootNode.author.setValue('Denis Dube') # showCardinalities CD_ClassDiagramsV3RootNode.showCardinalities.setValue((None, 1)) CD_ClassDiagramsV3RootNode.showCardinalities.config = 0 # showAssociationBox CD_ClassDiagramsV3RootNode.showAssociationBox.setValue((None, 1)) CD_ClassDiagramsV3RootNode.showAssociationBox.config = 0 # showAttributes CD_ClassDiagramsV3RootNode.showAttributes.setValue((None, 1)) CD_ClassDiagramsV3RootNode.showAttributes.config = 0 # showActions CD_ClassDiagramsV3RootNode.showActions.setValue((None, 1)) CD_ClassDiagramsV3RootNode.showActions.config = 0 # showConditions CD_ClassDiagramsV3RootNode.showConditions.setValue((None, 1)) CD_ClassDiagramsV3RootNode.showConditions.config = 0 # attributes CD_ClassDiagramsV3RootNode.attributes.setActionFlags([1, 1, 1, 0]) lcobj1 = [] cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('name', 'String', None, ('Key', 1), ('Direct Editing', 1))) cobj1.initialValue = ATOM3String('', 20) cobj1.isDerivedAttribute = False lcobj1.append(cobj1) cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('author', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue = ATOM3String('Annonymous', 20) cobj1.isDerivedAttribute = False lcobj1.append(cobj1) cobj1 = ATOM3Attribute(self.types) cobj1.setValue( ('description', 'Text', None, ('Key', 0), ('Direct Editing', 1))) cobj1.initialValue = ATOM3Text('\n', 60, 15) cobj1.isDerivedAttribute = False lcobj1.append(cobj1) CD_ClassDiagramsV3RootNode.attributes.setValue(lcobj1) # constraints CD_ClassDiagramsV3RootNode.constraints.setActionFlags([1, 1, 1, 0]) lcobj1 = [] CD_ClassDiagramsV3RootNode.constraints.setValue(lcobj1) # description CD_ClassDiagramsV3RootNode.description.setValue('\n') CD_ClassDiagramsV3RootNode.description.setHeight(15) # --- ASG attributes over --- self.obj30 = CD_Class3(self) self.obj30.isGraphObjectVisual = True if (hasattr(self.obj30, '_setHierarchicalLink')): self.obj30._setHierarchicalLink(False) # QOCA self.obj30.QOCA.setValue( ('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), '"""\nQOCA Constraint Template\nNOTE: DO NOT select a POST/PRE action trigger\nConstraints will be added/removed in a logical manner by other mechanisms.\n"""\nreturn # <---- Remove this to use QOCA\n\n""" Get the high level constraint helper and solver """\nfrom Qoca.atom3constraints.OffsetConstraints import OffsetConstraints\noc = OffsetConstraints(self.parent.qocaSolver) \n\n"""\nExample constraint, see Kernel/QOCA/atom3constraints/OffsetConstraints.py\nFor more types of constraints\n"""\noc.fixedWidth(self.graphObject_, self.graphObject_.sizeX)\noc.fixedHeight(self.graphObject_, self.graphObject_.sizeY)\n\n' )) # name self.obj30.name.setValue('FSB_Toolbar') # Abstract self.obj30.Abstract.setValue((None, 0)) self.obj30.Abstract.config = 0 # Actions self.obj30.Actions.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Action() cobj2.setValue( ('create', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), 'from FSB_Code.Constructor import toolbarCreate\ntoolbarCreate(self)\n' )) lcobj2.append(cobj2) self.obj30.Actions.setValue(lcobj2) # Graphical_Appearance self.obj30.Graphical_Appearance.setValue(('FSB_Toolbar', self.obj30)) # attributes self.obj30.attributes.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('FormalismName', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3String('', 20) cobj2.isDerivedAttribute = False lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('enableLayout', 'Boolean', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3Boolean() cobj2.initialValue.setValue((None, 0)) cobj2.initialValue.config = 1 cobj2.isDerivedAttribute = False lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('layoutAnchorX', 'Integer', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3Integer(0) cobj2.isDerivedAttribute = False lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('layoutAnchorY', 'Integer', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3Integer(0) cobj2.isDerivedAttribute = False lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('layoutDirection', 'String', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3String('E', 20) cobj2.isDerivedAttribute = False lcobj2.append(cobj2) cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('layoutPadding', 'Integer', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = ATOM3Integer(10) cobj2.isDerivedAttribute = False lcobj2.append(cobj2) self.obj30.attributes.setValue(lcobj2) # cardinality self.obj30.cardinality.setActionFlags([0, 1, 0, 0]) lcobj2 = [] cobj2 = ATOM3Connection() cobj2.setValue(('FSB_Link', (('Source', 'Destination'), 0), '0', 'N')) lcobj2.append(cobj2) self.obj30.cardinality.setValue(lcobj2) # display self.obj30.display.setValue( 'Attributes:\n - FormalismName :: String\n - enableLayout :: Boolean\n - layoutAnchorX :: Integer\n - layoutAnchorY :: Integer\n - layoutDirection :: String\n - layoutPadding :: Integer\nActions:\n > create\nMultiplicities:\n - To FSB_Link: 0 to N\n' ) self.obj30.display.setHeight(15) # Constraints self.obj30.Constraints.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj30.Constraints.setValue(lcobj2) self.obj30.graphClass_ = graph_CD_Class3 if self.genGraphics: new_obj = graph_CD_Class3(560.0, 120.0, self.obj30) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("CD_Class3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.0390625, 1.7040983606557381] else: new_obj = None self.obj30.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj30) self.globalAndLocalPostcondition(self.obj30, rootNode) self.obj30.postAction(rootNode.CREATE) self.obj31 = CD_Class3(self) self.obj31.isGraphObjectVisual = True if (hasattr(self.obj31, '_setHierarchicalLink')): self.obj31._setHierarchicalLink(False) # QOCA self.obj31.QOCA.setValue( ('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), '"""\nQOCA Constraint Template\nNOTE: DO NOT select a POST/PRE action trigger\nConstraints will be added/removed in a logical manner by other mechanisms.\n"""\nreturn # <---- Remove this to use QOCA\n\n""" Get the high level constraint helper and solver """\nfrom Qoca.atom3constraints.OffsetConstraints import OffsetConstraints\noc = OffsetConstraints(self.parent.qocaSolver) \n\n"""\nExample constraint, see Kernel/QOCA/atom3constraints/OffsetConstraints.py\nFor more types of constraints\n"""\noc.fixedWidth(self.graphObject_, self.graphObject_.sizeX)\noc.fixedHeight(self.graphObject_, self.graphObject_.sizeY)\n\n' )) # name self.obj31.name.setValue('FSB_Button') # Abstract self.obj31.Abstract.setValue((None, 0)) self.obj31.Abstract.config = 0 # Actions self.obj31.Actions.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Action() cobj2.setValue( ('Edit_Create', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), 'from FSB_Code.IconExchange import iconExchanger\niconExchanger(self)\n\n' )) lcobj2.append(cobj2) cobj2 = ATOM3Action() cobj2.setValue( ('Create', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]), 'from FSB_Code.Constructor import buttonCreate\nbuttonCreate(self)\n\n\n' )) lcobj2.append(cobj2) self.obj31.Actions.setValue(lcobj2) # Graphical_Appearance self.obj31.Graphical_Appearance.setValue(('FSB_Button', self.obj31)) # attributes self.obj31.attributes.setActionFlags([1, 1, 1, 0]) lcobj2 = [] cobj2 = ATOM3Attribute(self.types) cobj2.setValue( ('info', 'FSB_Button_TYPE', None, ('Key', 0), ('Direct Editing', 1))) cobj2.initialValue = iconPathXaction() cobj2.initialValue.iconPath = ATOM3String('', 20) cobj2.initialValue.action = ATOM3Text( '# Button action code\n# The following is generated for you: \n# def action(self): # self = ATOM3 instance\n# Typical contents of action:\n# newPlace = self.createNew<CLASS NAME IN META-MODEL>(self, wherex, wherey)\n# Action that shows dialog to edit ASG attributes:\n# self.modelAttributes(self.ASGroot.getASGbyName("<META-MODEL NAME>_META")) \n', 80, 15) cobj2.initialValue.takesActionImmediately = ATOM3Boolean() cobj2.initialValue.takesActionImmediately.setValue((None, 0)) cobj2.initialValue.takesActionImmediately.config = 0 cobj2.isDerivedAttribute = False lcobj2.append(cobj2) self.obj31.attributes.setValue(lcobj2) # cardinality self.obj31.cardinality.setActionFlags([0, 1, 0, 0]) lcobj2 = [] cobj2 = ATOM3Connection() cobj2.setValue(('FSB_Link', (('Source', 'Destination'), 1), '0', 'N')) lcobj2.append(cobj2) cobj2 = ATOM3Connection() cobj2.setValue(('FBS_BLink', (('Source', 'Destination'), 0), '0', 'N')) lcobj2.append(cobj2) cobj2 = ATOM3Connection() cobj2.setValue(('FBS_BLink', (('Source', 'Destination'), 1), '0', 'N')) lcobj2.append(cobj2) self.obj31.cardinality.setValue(lcobj2) # display self.obj31.display.setValue( 'Attributes:\n - info :: FSB_Button_TYPE\nActions:\n > Edit_Create\n > Create\nMultiplicities:\n - From FSB_Link: 0 to N\n - To FBS_BLink: 0 to N\n - From FBS_BLink: 0 to N\n' ) self.obj31.display.setHeight(15) # Constraints self.obj31.Constraints.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj31.Constraints.setValue(lcobj2) self.obj31.graphClass_ = graph_CD_Class3 if self.genGraphics: new_obj = graph_CD_Class3(320.0, 240.0, self.obj31) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("CD_Class3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.05, 1.3942622950819674] else: new_obj = None self.obj31.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj31) self.globalAndLocalPostcondition(self.obj31, rootNode) self.obj31.postAction(rootNode.CREATE) self.obj32 = CD_Association3(self) self.obj32.isGraphObjectVisual = False if (hasattr(self.obj32, '_setHierarchicalLink')): self.obj32._setHierarchicalLink(True) # QOCA self.obj32.QOCA.setValue( ('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), '"""\nQOCA Constraint Template\nNOTE: DO NOT select a POST/PRE action trigger\nConstraints will be added/removed in a logical manner by other mechanisms.\n"""\nreturn # <--- Remove this if you want to use QOCA\n\n# Get the high level constraint helper and solver\nfrom Qoca.atom3constraints.OffsetConstraints import OffsetConstraints\noc = OffsetConstraints(self.parent.qocaSolver) \n\n# Constraint only makes sense if there exists 2 objects connected to this link\nif(not (self.in_connections_ and self.out_connections_)): return\n\n# Get the graphical objects (subclass of graphEntity/graphLink) \ngraphicalObjectLink = self.graphObject_\ngraphicalObjectSource = self.in_connections_[0].graphObject_\ngraphicalObjectTarget = self.out_connections_[0].graphObject_\nobjTuple = (graphicalObjectSource, graphicalObjectTarget, graphicalObjectLink)\n\n"""\nExample constraint, see Kernel/QOCA/atom3constraints/OffsetConstraints.py\nFor more types of constraints\n"""\noc.LeftExactDistance(objTuple, 20)\noc.resolve() # Resolve immediately after creating entity & constraint \n\n' )) # name self.obj32.name.setValue('FSB_Link') # displaySelect self.obj32.displaySelect.setValue( (['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0])) self.obj32.displaySelect.config = 0 # Actions self.obj32.Actions.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj32.Actions.setValue(lcobj2) # Graphical_Appearance self.obj32.Graphical_Appearance.setValue(('FSB_Link', self.obj32)) self.obj32.Graphical_Appearance.linkInfo = linkEditor( self, self.obj32.Graphical_Appearance.semObject, "FSB_Link") # This is a non-visual link # attributes self.obj32.attributes.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj32.attributes.setValue(lcobj2) # cardinality self.obj32.cardinality.setActionFlags([0, 1, 0, 0]) lcobj2 = [] cobj2 = ATOM3Connection() cobj2.setValue(('FSB_Button', (('Source', 'Destination'), 0), '0', 'N')) lcobj2.append(cobj2) cobj2 = ATOM3Connection() cobj2.setValue(('FSB_Toolbar', (('Source', 'Destination'), 1), '0', 'N')) lcobj2.append(cobj2) self.obj32.cardinality.setValue(lcobj2) # display self.obj32.display.setValue( 'Multiplicities:\n - To FSB_Button: 0 to N\n - From FSB_Toolbar: 0 to N\n' ) self.obj32.display.setHeight(15) # Constraints self.obj32.Constraints.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj32.Constraints.setValue(lcobj2) self.obj32.graphClass_ = graph_CD_Association3 if self.genGraphics: new_obj = graph_CD_Association3(368.0, 96.0, self.obj32) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("CD_Association3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.407, 1.0] new_obj.layConstraints['Label Offset'] = [-103.0, -44.0] else: new_obj = None self.obj32.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj32) self.globalAndLocalPostcondition(self.obj32, rootNode) self.obj32.postAction(rootNode.CREATE) self.obj33 = CD_Association3(self) self.obj33.isGraphObjectVisual = False if (hasattr(self.obj33, '_setHierarchicalLink')): self.obj33._setHierarchicalLink(False) # QOCA self.obj33.QOCA.setValue( ('QOCA', (['Python', 'OCL'], 1), (['PREaction', 'POSTaction'], 1), ([ 'EDIT', 'SAVE', 'CREATE', 'CONNECT', 'DELETE', 'DISCONNECT', 'TRANSFORM', 'SELECT', 'DRAG', 'DROP', 'MOVE' ], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), '"""\nQOCA Constraint Template\nNOTE: DO NOT select a POST/PRE action trigger\nConstraints will be added/removed in a logical manner by other mechanisms.\n"""\nreturn # <--- Remove this if you want to use QOCA\n\n# Get the high level constraint helper and solver\nfrom Qoca.atom3constraints.OffsetConstraints import OffsetConstraints\noc = OffsetConstraints(self.parent.qocaSolver) \n\n# Constraint only makes sense if there exists 2 objects connected to this link\nif(not (self.in_connections_ and self.out_connections_)): return\n\n# Get the graphical objects (subclass of graphEntity/graphLink) \ngraphicalObjectLink = self.graphObject_\ngraphicalObjectSource = self.in_connections_[0].graphObject_\ngraphicalObjectTarget = self.out_connections_[0].graphObject_\nobjTuple = (graphicalObjectSource, graphicalObjectTarget, graphicalObjectLink)\n\n"""\nExample constraint, see Kernel/QOCA/atom3constraints/OffsetConstraints.py\nFor more types of constraints\n"""\noc.LeftExactDistance(objTuple, 20)\noc.resolve() # Resolve immediately after creating entity & constraint \n\n' )) # name self.obj33.name.setValue('FBS_BLink') # displaySelect self.obj33.displaySelect.setValue( (['attributes', 'constraints', 'actions', 'cardinality'], [0, 0, 0, 0])) self.obj33.displaySelect.config = 0 # Actions self.obj33.Actions.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj33.Actions.setValue(lcobj2) # Graphical_Appearance self.obj33.Graphical_Appearance.setValue(('FBS_BLink', self.obj33)) self.obj33.Graphical_Appearance.linkInfo = linkEditor( self, self.obj33.Graphical_Appearance.semObject, "FBS_BLink") # This is a non-visual link # attributes self.obj33.attributes.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj33.attributes.setValue(lcobj2) # cardinality self.obj33.cardinality.setActionFlags([0, 1, 0, 0]) lcobj2 = [] cobj2 = ATOM3Connection() cobj2.setValue(('FSB_Button', (('Source', 'Destination'), 0), '0', 'N')) lcobj2.append(cobj2) cobj2 = ATOM3Connection() cobj2.setValue(('FSB_Button', (('Source', 'Destination'), 1), '0', 'N')) lcobj2.append(cobj2) self.obj33.cardinality.setValue(lcobj2) # display self.obj33.display.setValue( 'Multiplicities:\n - To FSB_Button: 0 to N\n - From FSB_Button: 0 to N\n' ) self.obj33.display.setHeight(15) # Constraints self.obj33.Constraints.setActionFlags([1, 1, 1, 0]) lcobj2 = [] self.obj33.Constraints.setValue(lcobj2) self.obj33.graphClass_ = graph_CD_Association3 if self.genGraphics: new_obj = graph_CD_Association3(153.0, 263.0, self.obj33) new_obj.DrawObject(self.UMLmodel) self.UMLmodel.addtag_withtag("CD_Association3", new_obj.tag) new_obj.layConstraints = dict() # Graphical Layout Constraints new_obj.layConstraints['scale'] = [1.3440000000000001, 1.0] new_obj.layConstraints['Label Offset'] = [-112.0, -62.0] else: new_obj = None self.obj33.graphObject_ = new_obj # Add node to the root: rootNode rootNode.addNode(self.obj33) self.globalAndLocalPostcondition(self.obj33, rootNode) self.obj33.postAction(rootNode.CREATE) # Connections for obj30 (graphObject_: Obj6) named FSB_Toolbar self.drawConnections((self.obj30, self.obj32, [560.6328125, 124.59016393442619, 368.0, 96.0], "bezier", 2)) # Connections for obj31 (graphObject_: Obj7) named FSB_Button self.drawConnections( (self.obj31, self.obj33, [321.25, 296.57377049180332, 113.0, 233.0, 153.0, 263.0], "bezier", 3)) # Connections for obj32 (graphObject_: Obj8) named FSB_Link self.drawConnections( (self.obj32, self.obj31, [368.0, 96.0, 358.0, 240.80327868852453], "bezier", 2)) # Connections for obj33 (graphObject_: Obj10) named FBS_BLink self.drawConnections( (self.obj33, self.obj31, [153.0, 263.0, 193.0, 293.0, 321.25, 296.57377049180332], "bezier", 3))