public Mapping(MappingNode sourceEnd, MappingNode targetEnd)
 {
     this._source = sourceEnd;
     this._source.addMapping(this);
     this._target = targetEnd;
     this._target.addMapping(this);
 }
        public static Mapping getMapping(MappingNode startNode, TaggedValue mappingTag, MappingNode targetRootNode)
        {
            var sourceMappingPath = getMappingPath(mappingTag, false);
            var targetMappingPath = getMappingPath(mappingTag, true);
            var targetElement     = mappingTag.tagValue as Element;

            return(getMapping(mappingTag, targetElement, startNode, sourceMappingPath, targetMappingPath, targetRootNode));
        }
        public static Mapping getMapping(MappingNode startNode, ConnectorWrapper mappingRelation, MappingNode targetRootNode)
        {
            var     sourceMappingPath = getMappingPath(mappingRelation, false);
            var     targetMappingPath = getMappingPath(mappingRelation, true);
            Element targetElement     = mappingRelation.targetElement;

            return(getMapping(mappingRelation, targetElement, startNode, sourceMappingPath, targetMappingPath, targetRootNode));
        }
 protected MappingNode(UML.Classes.Kernel.NamedElement source, MappingNode parent, MappingSettings settings, MP.ModelStructure structure)
 {
     this.source   = source;
     this.parent   = parent;
     this.settings = settings;
     this.parent?.addChildNode(this);
     this.structure = structure;
 }
示例#5
0
 protected MappingNode(NamedElement source, MappingNode parent, MappingSettings settings, MP.ModelStructure structure, NamedElement virtualOwner)
 {
     this.source   = source;
     this.parent   = parent;
     this.settings = settings;
     this.parent?.addChildNode(this);
     this.structure    = structure;
     this.virtualOwner = virtualOwner;
 }
示例#6
0
 public TaggedValueMapping(TaggedValue wrappedTaggedValue, MappingNode source, MappingNode target) : base(source, target)
 {
     this.wrappedTaggedValue = wrappedTaggedValue;
     //make sure the mappingset is defined for all tagged value mappings.
     if (!this.hasMappingSetDefined &&
         !this.isReadOnly)
     {
         var temp = this.EAMappingLogics; //load mapping logics to make sure they get saved
         this.saveMe();
     }
 }
        private static List <string> getMappingPath(Element nodeSource, MappingNode targetRootNode)
        {
            if (nodeSource.owner == null || targetRootNode.source == null || nodeSource.uniqueID == targetRootNode.source.uniqueID)
            {
                return(new List <string>()
                {
                    nodeSource.uniqueID
                });
            }

            var path = getMappingPath((Element)nodeSource.owner, targetRootNode);

            path.Add(nodeSource.uniqueID);
            return(path);
        }
示例#8
0
        public static Mapping createMapping(UML.Extended.UMLItem mappingItem, MappingNode startNode, MappingNode targetNode)
        {
            var connector = mappingItem as ConnectorWrapper;

            if (connector != null)
            {
                return(new ConnectorMapping(connector, startNode, targetNode));
            }
            var taggedValue = mappingItem as TaggedValue;

            if (taggedValue != null)
            {
                return(new TaggedValueMapping(taggedValue, startNode, targetNode));
            }
            throw new ArgumentException("MappingItem should be Connector or TaggedValue");
        }
        protected override UMLItem createMappingItem(MappingNode targetNode)
        {
            var classifierTargetNode = targetNode as ClassifierMappingNode;

            if (classifierTargetNode != null)
            {
                var trace = this.sourceElement.EAModel.factory.createNewElement <UML.Classes.Dependencies.Abstraction>(this.sourceElement, "");
                trace.addStereotype(this.sourceElement.EAModel.factory.createStereotype(trace, "trace"));
                trace.target = classifierTargetNode.sourceElement;
                trace.save();
                return(trace);
            }
            else
            {
                return(this.createTaggedValueMappingItem(targetNode));
            }
        }
        public static MappingNode getMappingNode(UML.Classes.Kernel.NamedElement source, MappingNode rootNode)
        {
            var mappingPath = getMappingPath(source as Element, rootNode);

            return(rootNode.createMappingNode(mappingPath));
        }
        private static Mapping getMapping(UML.Extended.UMLItem mappingItem, Element mappingTarget, MappingNode startNode, List <string> sourceMappingPath, List <string> targetMappingPath, MappingNode targetRootNode)
        {
            //do nothing if mappign target is null
            if (mappingTarget == null)
            {
                return(null);
            }
            //check if the mappingPath of the source corresponds with the path of the node
            var startNodeMappingPath = startNode.mappingPath;
            //source is OK if mapping corresponds, or no mappingPath found and it is not virtual
            var sourceOK = sourceMappingPath.SequenceEqual(startNodeMappingPath) || (!sourceMappingPath.Any() && !startNode.isVirtual);

            // if no targetMapping found then we try to build a Mapping up to the target root node source element
            if (!targetMappingPath.Any())
            {
                targetMappingPath = getMappingPath(mappingTarget, targetRootNode);
            }
            //target is OK if the first item of the targetMappignPath corresponds to the targetRootNode
            var targetOK = targetMappingPath.FirstOrDefault() == targetRootNode.source?.uniqueID;

            //if target or source is not OK then we return null
            if (!sourceOK || !targetOK)
            {
                return(null);
            }
            //first create the targetMappingNode
            var targetMappingNode = targetRootNode.createMappingNode(targetMappingPath);

            //return the actual mapping
            return(createMapping(mappingItem, startNode, targetMappingNode));
        }
 public ClassifierMappingNode(TSF_EA.ElementWrapper sourceElement, MappingNode parent, MappingSettings settings, MP.ModelStructure structure) : base(sourceElement, parent, settings, structure)
 {
 }
示例#13
0
 public ConnectorMapping(ConnectorWrapper wrappedConnector, MappingNode sourceEnd, MappingNode targetEnd) : base(sourceEnd, targetEnd)
 {
     this.wrappedConnector = wrappedConnector;
 }
 public ElementMappingNode(TSF_EA.ElementWrapper sourceElement, MappingNode parent, MappingSettings settings, MP.ModelStructure structure, bool isTarget)
     : this(sourceElement, parent, settings, structure, null, isTarget)
 {
 }
 public Mapping(MappingNode sourceEnd, MappingNode targetEnd, MappingLogic logic) : this(sourceEnd, targetEnd)
 {
     this._mappingLogic = logic;
 }
示例#16
0
 public ClassifierMappingNode(TSF_EA.ElementWrapper sourceElement, MappingNode parent, MappingSettings settings, MP.ModelStructure structure, UML.Classes.Kernel.NamedElement virtualOwner) : base(sourceElement, parent, settings, structure, virtualOwner)
 {
 }
 public TaggedValueMapping(TaggedValue wrappedTaggedValue, MappingNode source, MappingNode target) : base(source, target)
 {
     this.wrappedTaggedValue = wrappedTaggedValue;
 }
 public Mapping(MappingNode sourceEnd, MappingNode targetEnd, IEnumerable <MappingLogic> logics) : this(sourceEnd, targetEnd)
 {
     this.mappingLogics = logics;
 }
示例#19
0
        public static MappingNode createMappingNode(UML.Classes.Kernel.NamedElement source, MappingNode parent, MappingSettings settings)
        {
            //AttributeMappingNode
            var attributeSource = source as AttributeWrapper;

            if (attributeSource != null)
            {
                return(new AttributeMappingNode(attributeSource, parent as ClassifierMappingNode, settings, parent.structure));
            }

            //AssociationMappingNode
            var associationSource = source as Association;

            if (associationSource != null)
            {
                return(new AssociationMappingNode(associationSource, parent as ClassifierMappingNode, settings, parent.structure));
            }

            //ClassifierMappingNode
            var classifierSource = source as ElementWrapper;

            if (classifierSource != null)
            {
                return(new ClassifierMappingNode(classifierSource, parent, settings, parent.structure));
            }

            //not a valid source type, return null
            return(null);
        }
        public static MappingNode createMappingNode(UML.Classes.Kernel.NamedElement source, MappingNode parent, MappingSettings settings)
        {
            //check if there is a virtual owner
            UML.Classes.Kernel.NamedElement virtualOwner = null;
            if (source.owner.uniqueID != parent.source.uniqueID)
            {
                virtualOwner = source.owner as UML.Classes.Kernel.NamedElement;
            }

            //AttributeMappingNode
            var attributeSource = source as AttributeWrapper;

            if (attributeSource != null)
            {
                return(new AttributeMappingNode(attributeSource, parent as ElementMappingNode, settings, parent.structure, virtualOwner, parent.isTarget));
            }

            //AssociationMappingNode
            var associationSource = source as Association;

            if (associationSource != null)
            {
                return(new AssociationMappingNode(associationSource, parent as ElementMappingNode, settings, parent.structure, virtualOwner, parent.isTarget));
            }

            //ClassifierMappingNode
            var classifierSource = source as ElementWrapper;

            if (classifierSource != null)
            {
                return(new ElementMappingNode(classifierSource, parent, settings, parent.structure, parent.isTarget));
            }

            //not a valid source type, return null
            return(null);
        }
示例#21
0
 protected override UMLItem createMappingItem(MappingNode targetNode)
 {
     return(this.createTaggedValueMappingItem(targetNode));
 }
 public ElementMappingNode(TSF_EA.ElementWrapper sourceElement, MappingNode parent, MappingSettings settings, MP.ModelStructure structure, UML.Classes.Kernel.NamedElement virtualOwner, bool isTarget)
     : base(sourceElement, parent, settings, structure, virtualOwner, isTarget)
 {
 }