Ejemplo n.º 1
0
        private void cleanUpEA(EA.ConnectorEnd eaSupEnd, EA.ConnectorEnd eaCliEnd, EReference eRef)
        {
            eaSupEnd.Role = eRef.SupplierEnd.Name;
            eaSupEnd.Update();
            eaCliEnd.Role = eRef.ClientEnd.Name;
            eaCliEnd.Update();

            // repair Suppliers End
            if (eaSupEnd.Role == null || eaSupEnd.Role == "")
            {
                eaSupEnd.Cardinality = "";
            }
            else
            {
                eaSupEnd.Cardinality = eRef.SupplierEnd.lowerBound.Replace("-1", "*") + ".." + eRef.SupplierEnd.upperBound.Replace("-1", "*");
            }
            eaSupEnd.Update();

            // repair Cliend End
            if (eaCliEnd.Role == null || eaCliEnd.Role == "")
            {
                eaCliEnd.Cardinality = "";
            }
            else
            {
                eaCliEnd.Cardinality = eRef.ClientEnd.lowerBound.Replace("-1", "*") + ".." + eRef.ClientEnd.upperBound.Replace("-1", "*");
            }
            eaCliEnd.Update();
        }
Ejemplo n.º 2
0
 public EA.ConnectorEnd getOppositeConnectorEnd()
 {
     if (oppositeConnectorEnd == null)
     {
         if (clientOrTarget == "client")
         {
             oppositeConnectorEnd = OwningConnector.getRealConnector().SupplierEnd;
         }
         else if (clientOrTarget == "target")
         {
             oppositeConnectorEnd = OwningConnector.getRealConnector().ClientEnd;
         }
     }
     return(oppositeConnectorEnd);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Sets the GoatAssociationEnd according to values in EA.ConnectorEnd
        /// </summary>
        /// <param name="GoatEnd">instance of GoatAssociationEnd that will be set</param>
        /// <param name="EAEnd">instance of EA.ConnectorEnd</param>
        /// <param name="MemberEnd">element that is at the connector end</param>
        private void SetLeftOrRight(GoatAssociationEndModel GoatEnd, EA.ConnectorEnd EAEnd, EA.Element MemberEnd)
        {
            GoatEnd.Multiplicity        = EAEnd.Cardinality;
            GoatEnd.Aggregation         = (AggregationType)EAEnd.Aggregation;
            GoatEnd.Derived             = EAEnd.Derived;
            GoatEnd.Union               = EAEnd.DerivedUnion;
            GoatEnd.IsOwnedByClassifier = EAEnd.OwnedByClassifier;
            GoatEnd.Role = EAEnd.Role;
            switch (EAEnd.Navigable)
            {
            case "Navigable": GoatEnd.Navigability = NavigabilityType.Navigable; break;

            case "Non-Navigable": GoatEnd.Navigability = NavigabilityType.NonNavigable; break;

            case "Unspecified": GoatEnd.Navigability = NavigabilityType.Unspecified; break;
            }
            GoatEnd.MemberEnd = MemberEnd.Name;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sets the EA.ConnectorEnd according to values in Model.GoatAssociationEnd
        /// </summary>
        /// <param name="GoatEnd">instance of GoatAssociationEnd as a source</param>
        /// <param name="EAEnd">instance of EA.ConnectorEnd as a target</param>
        private void UpdateLeftOrRightConnector(GoatAssociationEndModel GoatEnd, EA.ConnectorEnd EAEnd)
        {
            EAEnd.Cardinality       = GoatEnd.Multiplicity;
            EAEnd.Aggregation       = (int)GoatEnd.Aggregation;
            EAEnd.Derived           = GoatEnd.Derived;
            EAEnd.DerivedUnion      = GoatEnd.Union;
            EAEnd.OwnedByClassifier = GoatEnd.IsOwnedByClassifier;
            EAEnd.Role = GoatEnd.Role;
            switch (GoatEnd.Navigability)
            {
            case NavigabilityType.Navigable: EAEnd.Navigable = "Navigable"; break;

            case NavigabilityType.NonNavigable: EAEnd.Navigable = "Non-Navigable"; break;

            case NavigabilityType.Unspecified: EAEnd.Navigable = "Unspecified"; break;
            }
            EAEnd.Update();
        }
Ejemplo n.º 5
0
        public static void configureConnectorEnd(SQLRepository sqlRepository, EA.ConnectorEnd sourceOrTarget, int valueId, String cardinality)
        {
            EA.Element targetEClass = sqlRepository.GetElementByID(valueId).getRealElement();
            sourceOrTarget.Role = targetEClass.Name.Substring(0, 1).ToLower() + targetEClass.Name.Substring(1, targetEClass.Name.Length - 1);

            // If the association end has a cardinality larger than 1, add a 'plural s' to the role name.
            String lowerBound = "";
            String upperBound = "";

            EcoreUtil.computeLowerUpperBound(cardinality, ref lowerBound, ref upperBound);
            if (upperBound == EcoreUtil.ARBITRARY_MANY_MULTIPLICITY_PLACEHOLDER || int.Parse(upperBound) > 1)
            {
                sourceOrTarget.Role = sourceOrTarget.Role + "s";
            }

            sourceOrTarget.Cardinality = cardinality;
            sourceOrTarget.Update();
        }
Ejemplo n.º 6
0
 private void addConnectST(EA.Element ele, XElement e, EA.ConnectorEnd connectorEnd)
 {
     e.Add(new XElement("model", new XAttribute("ea_localid", ele.ElementID),
                        new XAttribute("type", "Class"), new XAttribute("name", ele.Name)));
     e.Add(new XElement("role", new XAttribute("visibility", connectorEnd.Visibility.ToLower())),
           new XAttribute("targetScope", "instance"));
     e.Add(new XElement("type", new XAttribute("aggregation", connectorEnd.Aggregation),
                        new XAttribute("multiplicity", connectorEnd.Cardinality),
                        new XAttribute("containment", connectorEnd.Containment)));
     e.Add(new XElement("constraints"));
     e.Add(new XElement("modifiers", new XAttribute("isOrdered", connectorEnd.Ordering != 0),
                        new XAttribute("changeable", connectorEnd.IsChangeable),
                        new XAttribute("isNavigable", connectorEnd.IsNavigable)));
     e.Add(new XElement("style", new XAttribute("value", "Union=0;Derived=0;AllowDuplicates=0;Owned=0;Navigable=Unspecified;")));
     e.Add(new XElement("documentation"));
     e.Add(new XElement("xrefs"));
     e.Add(new XElement("tags"));
 }
Ejemplo n.º 7
0
 public override void doRuleQuickFix(SQLElement eaElement2, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage)
 {
     EA.Element eaElement = eaElement2.getRealElement();
     i = 1;
     if (eaElement.Stereotype == ECOREModelingMain.EClassStereotype)
     {
         List <String> referenceNames = new List <string>();
         foreach (EA.Connector con in eaElement.Connectors)
         {
             if (con.Type == ECOREModelingMain.EReferenceConnectorType)
             {
                 EA.ConnectorEnd otherEnd = null;
                 if (con.ClientID == eaElement.ElementID)
                 {
                     otherEnd = con.SupplierEnd;
                 }
                 else
                 {
                     otherEnd = con.ClientEnd;
                 }
                 if (otherEnd.Role != "")
                 {
                     if (referenceNames.Contains(otherEnd.Role))
                     {
                         otherEnd.Role = otherEnd.Role + i++;
                         otherEnd.Update();
                     }
                     else
                     {
                         referenceNames.Add(otherEnd.Role);
                     }
                 }
             }
             con.Update();
         }
     }
     EA.Diagram currentDiag = repository.GetCurrentDiagram();
     if (currentDiag != null)
     {
         repository.SaveDiagram(currentDiag.DiagramID);
         repository.ReloadDiagram(currentDiag.DiagramID);
     }
 }
Ejemplo n.º 8
0
 static string nameSupplierRole(EA.Connector con, EA.Element e, EA.Element client)
 {
     EA.ConnectorEnd end = con.SupplierEnd;
     return(end.Role);
 }