def addCardinality(self, params): # see if we are source or destination direction = params[0] relationshipName = 'CD_Association3' if direction == "SOURCE&DESTINATION": newestConn = self.out_connections_[-1] if (newestConn.__class__.__name__ != relationshipName): return at3c = ATOM3Connection(newestConn) at3c.direction.setValue((None, 0)) # set value of direction self.cardinality.newItem(at3c) newestConn = self.in_connections_[-1] if (newestConn.__class__.__name__ != relationshipName): return at3c = ATOM3Connection(newestConn) at3c.direction.setValue((None, 1)) # set value of direction self.cardinality.newItem(at3c) elif direction == "SOURCE": newestConn = self.out_connections_[-1] if (newestConn.__class__.__name__ != relationshipName): return at3c = ATOM3Connection(newestConn) at3c.direction.setValue((None, 0)) # set value of direction else: newestConn = self.in_connections_[-1] if (newestConn.__class__.__name__ != relationshipName): return at3c = ATOM3Connection(newestConn) at3c.direction.setValue((None, 1)) # set value of direction self.cardinality.newItem(at3c)
def addCardinality(self, direction): # see if we are source or destination if direction == "SOURCE": at3c = ATOM3Connection( self.out_connections_[len(self.out_connections_) - 1]) at3c.direction.setValue((None, 0)) # set value of direction else: at3c = ATOM3Connection( self.in_connections_[len(self.in_connections_) - 1]) at3c.direction.setValue((None, 1)) # set value of direction self.cardinality.newItem(at3c)
def cloneCardinality(assoc, parent, child, dir): for elem in assoc.AssociationCardinality.getValue(): name, dire, min, max = elem.getValue() if name == parent.keyword_.toString() and dir == dire[1]: if min == '1' and max == '1': elem.setValue((name, dire, '0', '1')) if dire == 0: addConstraintMinOut(assoc) else: addConstraintMinIn(assoc) newElem = ATOM3Connection(child, min, max) newElem.setValue( (child, dire, '0', max)) # as we can have more than one child, we are not # sure whether we should restrict to exactly one # that is, it is ONE among all the children assoc.AssociationCardinality.newItem(newElem) if dir == 0: if "added_out_connections_" in assoc.__dict__.keys(): assoc.added_out_connections_.append(child) else: assoc.added_out_connections_ = [child] else: if "added_in_connections_" in assoc.__dict__.keys(): assoc.added_in_connections_.append(child) else: assoc.added_in_connections_ = [child] if "addedCardinalities" in assoc.__dict__.keys(): assoc.addedCardinalities.append(newElem) else: assoc.addedCardinalities = [newElem] return
def createCardinality(self, params): #constraint that generates cardinality variables for the associated classes. for a in self.in_connections_: if a.getTypeName() == 'AtomAssociation': self_source = ATOM3Connection(a, '1', '1') self_source.setValue((a, (["Source", "Destination"], 1), '0', 'N')) if not self_source in self.ClassCardinality.getValue(): self.ClassCardinality.newItem(self_source) for a in self.out_connections_: if a.getTypeName() == 'AtomAssociation': self_source = ATOM3Connection(a, '1', '1') self_source.setValue((a, (["Source", "Destination"], 0), '0', 'N')) if not self_source in self.ClassCardinality.getValue(): self.ClassCardinality.newItem(self_source)
def addCardinality(self, params): # see if we are source or destination direction = params[0] if direction == "SOURCE&DESTINATION": at3c = ATOM3Connection(self.out_connections_[len(self.out_connections_)-1]) at3c.direction.setValue((None,0)) # set value of direction self.cardinality.newItem( at3c ) at3c = ATOM3Connection(self.in_connections_[len(self.in_connections_)-1]) at3c.direction.setValue((None,1)) # set value of direction self.cardinality.newItem( at3c ) elif direction == "SOURCE": at3c = ATOM3Connection(self.out_connections_[len(self.out_connections_)-1]) at3c.direction.setValue((None,0)) # set value of direction else: at3c = ATOM3Connection(self.in_connections_[len(self.in_connections_)-1]) at3c.direction.setValue((None,1)) # set value of direction self.cardinality.newItem( at3c )
def createCardinality(self, params): in_C = self.in_connections_ out_C = self.out_connections_ for a in in_C: if a.getTypeName() == 'AtomClass': #self.AssociationCardinality.newItem(ATOM3Connection(a, 1, 1)) source=ATOM3Connection(a, 1, 1) source.setValue((a,(["Source", "Destination"], 1),'1','1')) if not source in self.AssociationCardinality.getValue(): self.AssociationCardinality.newItem(source) for a in out_C: if a.getTypeName() == 'AtomClass': #self.AssociationCardinality.newItem(ATOM3Connection(a, 1, 1)) source=ATOM3Connection(a, 1, 1) source.setValue((a,(["Source", "Destination"], 0),'1','1')) if not source in self.AssociationCardinality.getValue(): self.AssociationCardinality.newItem(source)
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 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))
def setUp(self): unUsed = Tk() self.atc = ATOM3Connection()
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))