A model element is a relationship, if it implements one of the following interfaces:
For checking if the model element is a relationship, call the com.nomagic.uml2.ext.jmi.helpers.CoreHelper.isRelationship(Element) method.
For getting supplier and client elements of a relationship, use CoreHelper class getSupplierElement(Element), getClientElement(Element) methods.
Use CoreHelper class setSupplierElement(Element, Element) , setClientElement(Element, Element) methods to set supplier and client elements of a relationship.
To create a new Relationship
- Create a new relationship model element.
- Set client and supplier model elements by using CoreHelper class setSupplierElement(Element, Element), setClientElement(Element, Element) methods.
- Add a new relationship into some parent by using the com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element.setOwner(Element) method.