Esempio n. 1
0
        private void updateConnectorEnd()
        {
            foreach (string eadId in eaIdConnectorIdMap.Keys)
            {
                int          id  = eaIdConnectorIdMap[eadId];
                EA.Connector con = this.repository.GetConnectorByID(id);
                if (eaIdPackageIdMap.ContainsKey(connectorSrcMap[id]))
                {
                    con.ClientID = repository.GetPackageByID(eaIdPackageIdMap[connectorSrcMap[id]]).Element.ElementID;
                }
                else if (eAIdElementIdMap.ContainsKey(connectorSrcMap[id]))
                {
                    con.ClientID = repository.GetElementByID(eAIdElementIdMap[connectorSrcMap[id]]).ElementID;
                }
                else
                {
                    continue;
                }

                if (eaIdPackageIdMap.ContainsKey(connectorTgtMap[id]))
                {
                    con.SupplierID = repository.GetPackageByID(eaIdPackageIdMap[connectorTgtMap[id]]).Element.ElementID;
                }
                else if (eAIdElementIdMap.ContainsKey(connectorTgtMap[id]))
                {
                    con.SupplierID = repository.GetElementByID(eAIdElementIdMap[connectorTgtMap[id]]).ElementID;
                }
                else
                {
                    continue;
                }
                con.Update();
            }
        }
Esempio n. 2
0
 public static bool filterSecurity(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier == null)
     {
         //logger.log("Filtering for Security: Ignoring" + e.Name);
     }
     if (classifier != null)
     {
         if (classifier.Name.Equals(APIAddIn.APIAddinClass.METAMODEL_SECURITYSCHEME))
         {
             return(true);
         }
         else
         {
             // If the classifier is inherited from the Security Scheme in the meta model then return true
             EA.Collection baseClasses = classifier.BaseClasses;
             foreach (EA.Element baseClass in baseClasses)
             {
                 if (baseClass.Name.Equals(APIAddIn.APIAddinClass.METAMODEL_SECURITYSCHEME))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Esempio n. 3
0
        public void EA_OnNotifyContextItemModified(EA.Repository Repository, String GUID, EA.ObjectType ot)
        {
            if (!preventCascade)
            {
                EALastBroadcastMethodId = EAOnContextItemModified;

                //updating package during this method can cause ea crashes
                if (!Import.MainImport.ImportBusy && !preventCascade && !Export.ExportRunning)
                {
                    preventCascade = true;
                    if (ot == EA.ObjectType.otConnector)
                    {
                        EA.Connector con = Repository.GetConnectorByGuid(GUID);
                        if (con.ClientID == 0 || con.SupplierID == 0)
                        {
                            return;
                        }
                    }

                    tggModeling.EA_OnNotifyContextItemModified(Repository, GUID, ot);
                    sdmModeling.EA_OnNotifyContextItemModified(Repository, GUID, ot);
                    ecoreModeling.EA_OnNotifyContextItemModified(Repository, GUID, ot);

                    if (ot != EA.ObjectType.otDiagram)
                    {
                        consistencyModule.dispatchSingleObject(Repository, GUID, ot);
                    }

                    incrementalUpdateAdapter.EA_OnNotifyContextItemModified(Repository, GUID, ot);

                    preventCascade = false;
                }
            }
        }
Esempio n. 4
0
        public override void doEaGuiStuff()
        {
            EA.Connector realconnector = LinkVariableEA.getRealConnector();

            if (linkDialogueEntry != null)
            {
                if (linkDialogueEntry.direction == LinkDialogueEntryDirection.LEFT && !Persistency.Export.ExportRunning)
                {
                    int clientID = LinkVariableEA.ClientID;
                    realconnector.ClientID   = LinkVariableEA.SupplierID;
                    realconnector.SupplierID = clientID;
                }
            }

            realconnector.Direction        = "Unspecified";
            realconnector.StereotypeEx     = SDMModelingMain.LinkVariableStereotype;
            realconnector.ClientEnd.Role   = this.linkDialogueEntry.clientRoleName;
            realconnector.SupplierEnd.Role = this.linkDialogueEntry.supplierRoleName;
            this.Name = realconnector.SupplierEnd.Role;

            EAEcoreAddin.Util.EAUtil.setTaggedValue(Repository, realconnector, Main.MoflonVerboseTaggedValueName, Main.FalseValue);
            EAEcoreAddin.Util.EAUtil.setTaggedValue(Repository, realconnector, ObjectVariable.BindingSemanticsTaggedValueName, this.BindingSemantics.ToString().ToLower());
            EAEcoreAddin.Util.EAUtil.setTaggedValue(Repository, realconnector, ObjectVariable.BindingOperatorTaggedValueName, this.BindingOperator.ToString().ToLower());

            if (NacIndex == -1)
            {
                EAUtil.deleteTaggedValue(realconnector, ObjectVariable.NacIndexTaggedValueName);
            }
            else
            {
                EAUtil.setTaggedValue(Repository, realconnector, ObjectVariable.NacIndexTaggedValueName, NacIndex.ToString());
            }

            this.LinkVariableEA.getRealConnector().Update();
        }
Esempio n. 5
0
        private static void linkToParent(EA.Repository Repository, EA.Diagram diagram, EA.Element sample, EA.Element parent)
        {
            foreach (EA.Connector con in sample.Connectors)
            {
                logger.log("Connector:" + con.SupplierEnd.Role);
                EA.Element related = null;

                if (sample.ElementID == con.ClientID && parent.ElementID == con.SupplierID)
                {
                    logger.log("Found parent link");
                    return;
                }
                else if (sample.ElementID == con.SupplierID && parent.ElementID == con.ClientID)
                {
                    logger.log("Found parent link");
                    return;
                }
            }

            logger.log("No  parent link found");
            EA.Connector link = sample.Connectors.AddNew("", "Association");
            link.SupplierID = parent.ElementID;
            link.Update();

            EA.DiagramLink dl = diagram.DiagramLinks.AddNew("", "");
            dl.ConnectorID = link.ConnectorID;
            sample.Connectors.Refresh();
            dl.Update();
        }
 public bool EA_OnPostNewConnector(SQLRepository sqlRepository, EA.Connector actCon, EA.Diagram currentDiagram)
 {
     try
     {
         if (TGGModelingMain.TggSchemaDiagramMetatype.Contains(currentDiagram.MetaType))
         {
             if (actCon.Type == ECOREModelingMain.EReferenceConnectorType)
             {
                 onPostEReferenceConnector(sqlRepository, actCon);
             }
         }
         else if (TGGModelingMain.TggRuleDiagramMetatype.Contains(currentDiagram.MetaType))
         {
             if (actCon.Stereotype == TGGModelingMain.TggLinkVariableStereotype || actCon.Stereotype == SDMModelingMain.LinkVariableStereotype)
             {
                 onPostLinkVariableConnector(sqlRepository, actCon);
             }
         }
         else if (TGGModelingMain.TggRulesDiagramMetatype.Contains(currentDiagram.MetaType))
         {
             if (actCon.Stereotype == TGGModelingMain.TGGkernelMorphismStereotype)
             {
                 onPostKernelMorphismConnector(sqlRepository, actCon);
             }
         }
     }
     catch
     {
     }
     return(true);
 }
Esempio n. 7
0
        private static void sync_relationship(EA.Repository Repository, EA.Diagram diagram, String connectorGuid, EA.Element source, EA.Element target, JObject jo, EA.Package pkg)
        {
            if (checkRelationship(Repository, connectorGuid, source, target))
            {
                //logger.log("Relationship exists:"+source.Name+":"+target.Name);
            }
            else
            {
                logger.log("Adding Relationship:" + source.Name + ":" + target.Name);

                //Add relationship  logger.log("No  parent link found");
                EA.Connector link = source.Connectors.AddNew("", "Association");
                link.SupplierID = target.ElementID;
                link.Update();
                source.Update();
                target.Update();

                EA.DiagramLink dl = diagram.DiagramLinks.AddNew("", "");
                dl.ConnectorID = link.ConnectorID;
                dl.Update();

                source.Connectors.Refresh();
                target.Connectors.Refresh();
            }
        }
Esempio n. 8
0
        private ExecResult <Boolean> Test3()
        {
            ExecResult <Boolean> result = new ExecResult <bool>();

            try
            {
                EA.Diagram diagram = Context.EARepository.GetCurrentDiagram();

                foreach (EA.DiagramLink curDL in diagram.DiagramLinks)
                {
                    EA.Connector connector = Context.EARepository.GetConnectorByID(curDL.ConnectorID);
                    foreach (EA.ConnectorTag connectorTag in connector.TaggedValues)
                    {
                        if (connectorTag.Name == "DP_Link")
                        {
                            connectorTag.Name = DAConst.DP_LinkTypeTag;
                            connectorTag.Update();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                result.setException(ex);
            }

            return(result);
        }
Esempio n. 9
0
        static YamlNode reifyMethodTraits(EA.Repository Repository, EA.Element e, EA.Connector con, EA.Element client)
        {
            // If there is a traits value in the runstate then use that
            Dictionary <string, RunState> rs = ObjectManager.parseRunState(e.RunState);

            if (rs.ContainsKey("traits"))
            {
                YamlScalarNode traits = new YamlScalarNode("!include " + rs["traits"].value + ".raml");
                traits.Style = ScalarStyle.Raw;
                return(traits);
            }

            YamlScalarNode t = null;

            if (REIFY_VERSION == APIAddinClass.RAML_0_8)
            {
                t = new YamlScalarNode("!include traits.raml");
            }
            else
            {
                t = new YamlScalarNode("!include traits.1_0.raml");
            }

            t.Style = ScalarStyle.Raw;
            //map.Add("traits", t);
            return(t);
        }
        private int AddConnector(EA.Diagram diagram, EA.Element eaElSource, EA.Element eaElDest, string strText, string strControlType, string strPath = "")
        {
            string strLogInfo = "Connector for operation: " + strText;

            EAImporter.LogMsg(EAImporter.LogMsgType.Adding, strLogInfo);

            EA.Connector eConnector = eaElSource.Connectors.AddNew(strText, strControlType);
            if (eConnector == null)
            {
                EAImporter.LogError(EAImporter.LogErrorLevel.A, strLogInfo);
                return(0);
            }

            // eConnector.Notes = strNotes;
            eConnector.SupplierID = eaElDest.ElementID;
            eConnector.Width      = 2;
            eConnector.Update();

            EA.DiagramLink eDiagramLink = diagram.DiagramLinks.AddNew(strText, strControlType);
            if (eDiagramLink == null)
            {
                EAImporter.LogError(EAImporter.LogErrorLevel.A, strLogInfo);
                return(0);
            }

            eDiagramLink.ConnectorID = eConnector.ConnectorID;
            if (strPath != "")
            {
                eDiagramLink.Path = strPath;
            }
            eDiagramLink.Update();

            EAImporter.LogMsg(EAImporter.LogMsgType.Added, strLogInfo);
            return(0);
        }
Esempio n. 11
0
        private void addDependency(EA.Package p, XmlNode xmlNode)
        {
            string name = xmlNode.Attributes.GetNamedItem("name") == null ? "" : xmlNode.Attributes.GetNamedItem("name").Value;

            EA.Connector connector = p.Connectors.AddNew(name, "Dependency");
            setConnectorInfo(p, connector, xmlNode);
        }
Esempio n. 12
0
        /// <summary>
        /// create Inheritance connectors
        /// </summary>
        public void setInheritances()
        {
            foreach (EA.Element element in MainImport.getInstance().ElementToBaseClassGuids.Keys)
            {
                if (MainImport.hasGui)
                {
                    MainImport.getInstance().ImportWorker.ReportProgress(3, new ProgressObject(ProgressBarType.Current, "Create Inheritance", MainImport.getInstance().ElementToBaseClassGuids.Count));
                }

                String[] guids = MainImport.getInstance().ElementToBaseClassGuids[element].Split(" ".ToCharArray());
                foreach (String baseClassGuid in guids)
                {
                    if (baseClassGuid != "")
                    {
                        EA.Element baseClass = MainImport.getInstance().ElementGuidToElement[MainImport.getInstance().OldGuidToNewGuid[baseClassGuid]];

                        String result = repository.SQLQuery("select Connector_ID from t_connector where Connector_Type ='Generalization' AND Start_Object_ID = " + element.ElementID + " AND End_Object_ID = " + baseClass.ElementID);

                        if (EAUtil.getXMLNodeContentFromSQLQueryString(result, "Connector_ID")[0] == "")
                        {
                            EA.Connector inhCon = element.Connectors.AddNew("", "Generalization") as EA.Connector;
                            inhCon.SupplierID = baseClass.ElementID;
                            inhCon.Update();
                        }
                    }
                }
            }
        }
Esempio n. 13
0
        public EAFactory addSupplier(EAElement element, string supplierRoleName, string cardinality, String stereotype)
        {
            object          obj    = EARepository.currentDiagram.DiagramObjects.AddNew(element.Name, "");
            EADiagramObject diaObj = (EADiagramObject)obj;

            diaObj.ElementID = element.ElementID;

            object o = clientElement.Connectors.AddNew(element.Name, APIAddinClass.EA_TYPE_ASSOCIATION);

            EA.Connector connector = (EA.Connector)o;

            connector.ClientID   = clientElement.ElementID;
            connector.SupplierID = element.ElementID;

            connector.SupplierEnd.Cardinality = cardinality;
            connector.SupplierEnd.Role        = supplierRoleName;
            connector.Stereotype = stereotype;

            object        dobj    = EARepository.currentDiagram.DiagramLinks.AddNew(element.Name + supplierRoleName, "");
            EADiagramLink diaLink = (EADiagramLink)dobj;

            diaLink.ConnectorID = connector.ConnectorID;

            return(this);
        }
Esempio n. 14
0
        /// <summary>
        /// For a given CCLibrary there shall not be two ASCCs with the same unique identifier tagged value.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="p"></param>
        /// <param name="accs"></param>
        private void checkC524n(IValidationContext context, EA.Package p, Dictionary <Int32, EA.Element> accs)
        {
            Dictionary <Int32, string> names = new Dictionary <Int32, string>();

            foreach (KeyValuePair <Int32, EA.Element> e in accs)
            {
                //Get all ASCCs
                foreach (EA.Connector con in e.Value.Connectors)
                {
                    //Get all emanating ASCCs of this ACC
                    if (con.Stereotype == UPCC.ASCC.ToString() && con.SupplierID == e.Value.ElementID)
                    {
                        EA.IConnectorTag tv = Utility.getTaggedValue(con, UPCC_TV.uniqueIdentifier.ToString());
                        if (names.ContainsValue(tv.Value.ToString()))
                        {
                            EA.Connector _con = context.Repository.GetConnectorByID(Utility.findKey(names, tv.Value.ToString()));

                            EA.Element duplicateACC = context.Repository.GetElementByID(_con.SupplierID);

                            String den = tv.Value.ToString();
                            if (den == null || den == "")
                            {
                                den = "No name specified.";
                            }

                            context.AddValidationMessage(new ValidationMessage("Duplicate unique identifier of ASCCs found.", "For a given CCLibrary there shall not be two ASCCs with the same unique identifier tagged value. ACC " + e.Value.Name + " and ACC " + duplicateACC.Name + "  both have an ASCC with the same unique identifier value: " + den, "CCLibrary", ValidationMessage.errorLevelTypes.ERROR, p.PackageID));
                        }
                        names.Add(con.ConnectorID, tv.Value.ToString());
                    }
                }
            }
        }
Esempio n. 15
0
        public Boolean EA_OnPostNewConnector(SQLRepository sqlRepository, EA.Connector actCon, EA.Diagram currentDiagram)
        {
            if (ECOREModelingMain.EcoreDiagramMetatype.Contains(currentDiagram.MetaType) || TGGModelingMain.TggSchemaDiagramMetatype.Contains(currentDiagram.MetaType))
            {
                if (actCon.Type.Equals(ECOREModelingMain.EReferenceConnectorType))
                {
                    if (actCon.Stereotype == "bi")
                    {
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.ClientEnd, actCon.ClientID, "0..1");
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.SupplierEnd, actCon.SupplierID, "0..1");

                        configureBx(actCon);
                    }
                    if (actCon.Stereotype == "biComposite")
                    {
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.ClientEnd, actCon.ClientID, "0..1");
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.SupplierEnd, actCon.SupplierID, "0..*");

                        configureBx(actCon);
                        toComposite(actCon);
                    }
                    else if (actCon.Stereotype == "biCompositeSingle")
                    {
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.ClientEnd, actCon.ClientID, "0..1");
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.SupplierEnd, actCon.SupplierID, "0..1");

                        configureBx(actCon);
                        toComposite(actCon);
                    }
                    else if (actCon.Stereotype == "uniSingle")
                    {
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.SupplierEnd, actCon.SupplierID, "0..1");

                        configureUni(actCon);
                    }
                    else if (actCon.Stereotype == "uniMultiple")
                    {
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.SupplierEnd, actCon.SupplierID, "0..*");

                        configureUni(actCon);
                    }
                    else if (actCon.Stereotype == "uniComposite")
                    {
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.SupplierEnd, actCon.SupplierID, "0..*");

                        configureUni(actCon);
                        toComposite(actCon);
                    }
                    else if (actCon.Stereotype == "uniCompositeSingle")
                    {
                        EAUtil.configureConnectorEnd(sqlRepository, actCon.SupplierEnd, actCon.SupplierID, "0..1");

                        configureUni(actCon);
                        toComposite(actCon);
                    }
                }
            }
            return(true);
        }
 public static bool filterSchema(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (e.Type.Equals(RoundTripAddIn.RoundTripAddInClass.EA_TYPE_CLASS))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 17
0
 static public bool isVisible(EA.Connector con)
 {
     if (diagramLinks != null)
     {
         return(diagramLinks.Contains(con.ConnectorID));
     }
     return(false);
 }
Esempio n. 18
0
 public EA.Connector getRealConnector()
 {
     if (realConnector == null)
     {
         realConnector = repository.GetOriginalRepository().GetConnectorByID(ConnectorID);
     }
     return(realConnector);
 }
Esempio n. 19
0
 public static EA.ConnectorTag setTaggedValueNotes(SQLRepository repository, EA.Connector connector, String name, String notes)
 {
     connector.TaggedValues.Refresh();
     EA.ConnectorTag aTag = setTaggedValue(repository, connector, name, "<memo>");
     aTag.Notes = notes;
     aTag.Update();
     return(aTag);
 }
Esempio n. 20
0
 public static bool filterContentType(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(APIAddIn.APIAddinClass.METAMODEL_CONTENTTYPE))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 21
0
 public static bool filterObject(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && e.Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_OBJECT))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 22
0
 public static bool filterClass(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (e.Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_CLASS))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 23
0
 public static bool filterResponse(EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(APIAddinClass.METAMODEL_RESPONSE))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 24
0
 public static bool filterPermission(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(APIAddinClass.METAMODEL_PERMISSION))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 25
0
 public static bool filterQueryParameter(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(APIAddinClass.METAMODEL_QUERY_PARAMETER))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 26
0
 public static bool filterMethod(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(APIAddinClass.METAMODEL_METHOD))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 27
0
 public static bool filterResourceType(EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(APIAddIn.APIAddinClass.METAMODEL_RESOURCETYPE))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 28
0
 public static bool filterDocumentation(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(APIAddIn.APIAddinClass.METAMODEL_DOCUMENTATION))
     {
         return(true);
     }
     return(false);
 }
        public static EA.DiagramLink CreateDiagramLink(EA.Connector connector)
        {
            EA.DiagramLink diagramLink = CurrentDiagram.DiagramLinks.AddNew("", "");
            diagramLink.ConnectorID = connector.ConnectorID;
            diagramLink.Update();

            return(diagramLink);
        }
 public static bool filterTypeForResource(EA.Repository Repository, EA.Connector con, EA.Element e, EA.Element classifier)
 {
     if (classifier != null && classifier.Name.Equals(RoundTripAddIn.RoundTripAddInClass.METAMODEL_TYPE_FOR_RESOURCE))
     {
         return(true);
     }
     return(false);
 }