Esempio n. 1
0
        public static List <Mapping> createNewMappings(TSF.UmlToolingFramework.Wrappers.EA.Attribute attribute, string basepath, ElementWrapper targetRootElement)
        {
            List <Mapping> returnedMappings = new List <Mapping>();

            //connectors from owned attributes
            foreach (ConnectorWrapper mappedConnector in attribute.relationships.OfType <ConnectorWrapper>())
            {
                if (!mappedConnector.taggedValues.Any(x => x.name == mappingSourcePathName && x.tagValue.ToString() != basepath))
                {
                    //get the target base path
                    ConnectorMapping connectorMapping;
                    var    targetTV       = mappedConnector.taggedValues.FirstOrDefault(x => x.name == mappingTargetPathName);
                    string targetBasePath = string.Empty;
                    if (targetTV != null)
                    {
                        targetBasePath = targetTV.tagValue.ToString();
                    }
                    if (!string.IsNullOrEmpty(targetBasePath))
                    {
                        //connectorMapping = new ConnectorMapping(mappedConnector,basepath,targetBasePath);
                    }
                    else
                    {
                        //connectorMapping = new ConnectorMapping(mappedConnector,basepath,targetRootElement);
                    }
                    //returnedMappings.Add(connectorMapping);
                }
            }
            //tagged value references from owned attributes
            foreach (TaggedValue mappedTaggedValue in attribute.taggedValues.Where(x => x.tagValue is Element))
            {
                string mappingSourcePath = KeyValuePairsHelper.getValueForKey(mappingSourcePathName, mappedTaggedValue.comment);
                string targetBasePath    = KeyValuePairsHelper.getValueForKey(mappingTargetPathName, mappedTaggedValue.comment);

                //if not filled in or corresponds to the attributeBasePath or the attributeBasePath + the name of the attribute
                if (string.IsNullOrEmpty(mappingSourcePath) || mappingSourcePath == basepath ||
                    mappingSourcePath == basepath + "." + attribute.name)
                {
                    TaggedValueMapping tagMapping;
                    if (!string.IsNullOrEmpty(targetBasePath))
                    {
                        //tagMapping = new TaggedValueMapping(mappedTaggedValue,basepath,targetBasePath);
                    }
                    else
                    {
                        //tagMapping = new TaggedValueMapping(mappedTaggedValue,basepath,targetRootElement);
                    }
                    //returnedMappings.Add(tagMapping);
                }
            }
            //add the mappings for the type of the attribute
            var attributeType = attribute.type as ElementWrapper;

            if (attributeType != null)
            {
                returnedMappings.AddRange(createOwnedMappings(attributeType, basepath + "." + attribute.name, false));
            }
            return(returnedMappings);
        }
Esempio n. 2
0
        private static List <string> getMappingPath(TaggedValue mappingTag, bool target)
        {
            var mappingPath = new List <String>();
            var pathString  = target ? KeyValuePairsHelper.getValueForKey(mappingTargetPathName, mappingTag.comment) : KeyValuePairsHelper.getValueForKey(mappingTargetPathName, mappingTag.comment);

            if (!string.IsNullOrEmpty(pathString))
            {
                mappingPath = pathString.Split(',').ToList();
            }
            return(mappingPath);
        }
        private string getNextIdRefString(string pdata)
        {
            int    i          = 0;
            string idRefValue = null;

            do
            {
                i++;
                idRefValue = KeyValuePairsHelper.getValueForKey("idref" + i, pdata);
            }while (!string.IsNullOrEmpty(idRefValue));
            return("idref" + i);
        }
        private UML.Extended.UMLItem getLinkedFeature(bool isSource)
        {
            UML.Extended.UMLItem linkedFeature = null;
            //determine start or end keyword
            string key         = isSource ? "LFSP" : "LFEP";
            string featureGUID = KeyValuePairsHelper.getValueForKey(key, this.wrappedConnector.StyleEx);

            if (!string.IsNullOrEmpty(featureGUID))
            {
                if (featureGUID.EndsWith("}R") ||
                    featureGUID.EndsWith("}L"))
                {
                    //remove the last "R" or "L"
                    featureGUID = featureGUID.Substring(0, featureGUID.Length - 1);
                }
                //get the linked feature
                linkedFeature = this.model.getItemFromGUID(featureGUID);
            }
            return(linkedFeature);
        }