//DIAGRAM CONTENT public void Generate_otDiagram_content(EA.Repository m_Repository, string TOI_GUID, string SP_BaseURL, out List <string> listOfElements, out List <string> listOfElementsNames, out List <string> listOfLinks, out List <string> listOfLinkNames, out Dictionary <string, string> DiagramDictionary) { listOfElements = new List <string>(); listOfElementsNames = new List <string>(); listOfLinks = new List <string>(); listOfLinkNames = new List <string>(); EA.Diagram DiagramToShow = (EA.Diagram)m_Repository.GetDiagramByGuid(TOI_GUID); //STORE DIAGRAM ELEMENTS for (short iDO = 0; iDO < DiagramToShow.DiagramObjects.Count; iDO++) { EA.DiagramObject MyDO = (EA.DiagramObject)DiagramToShow.DiagramObjects.GetAt(iDO); int ID = m_Repository.GetElementByID(MyDO.ElementID).ElementID; EA.Element MyEle = (EA.Element)m_Repository.GetElementByID(ID); listOfElements.Add(MyEle.Name + "|" + MyEle.ObjectType + "|" + MyEle.ElementGUID); listOfElementsNames.Add(MyEle.Name); } //STORE DIAGRAM LINKS for (short iDO = 0; iDO < DiagramToShow.DiagramLinks.Count; iDO++) { EA.DiagramLink MyLink = (EA.DiagramLink)DiagramToShow.DiagramLinks.GetAt(iDO); int ID = m_Repository.GetConnectorByID(MyLink.ConnectorID).ConnectorID; EA.Connector con; try //Try and get the connector object from the repository { con = (EA.Connector)m_Repository.GetConnectorByID(ID); listOfLinks.Add(con.Name + "|" + con.ObjectType + "|" + con.ConnectorGUID); listOfLinkNames.Add(con.Name); } catch { } } //JSON Content string DiagramURL = SP_BaseURL + "/" + DiagramToShow.Name + "|otDiagram|" + TOI_GUID; DiagramDictionary = new Dictionary <string, string>(); DiagramDictionary.Add("Diagram Name", DiagramToShow.Name); DiagramDictionary.Add("Created Data", DiagramToShow.CreatedDate.ToString()); DiagramDictionary.Add("Meta Type", DiagramToShow.MetaType); DiagramDictionary.Add("Notes", DiagramToShow.Notes); DiagramDictionary.Add("Package ID", DiagramToShow.PackageID.ToString()); DiagramDictionary.Add("Big Preview", DiagramURL + "/BigPreview"); DiagramDictionary.Add("Small Preview", DiagramURL + "/SmallPreview"); }
public bool GetConnector(out EA.Connector connector) { connector = null; int connectorId; if (GetEAObjectId(ConnectorID, out connectorId)) { connector = repository.GetConnectorByID(connectorId); return(connector != null); } return(false); }
public bool EA_OnPostNewConnector(EAAPI.Repository repository, EAAPI.EventProperties info) { bool result = true; int connectorId = Convert.ToInt32(info.Get(0).Value.ToString()); _channelDataTransferHelper.SetPropertyTypeAndDirectionOnFlowPortCreation(connectorId, "channel", "access type", "FMC4SE Channel"); EAAPI.Connector connector = repository.GetConnectorByID(connectorId) as EAAPI.Connector; if (connector != null && connector.Stereotype == "access type" && _mainViewModel != null) { _mainViewModel.ShowConnectorDirectionDialogCommand.Execute(connector); } return(result); }
/// <summary> /// Set attributes and tags of supplier port when port is created or connected. /// </summary> /// <param name="connectorId">The created item flow connector.</param> /// <param name="portStereotype">The stereotype of the port.</param> /// <param name="connectorStereotype">The stereotype of the port connectiong flow connector.</param> /// <param name="supplierName">The EA default name for the new created supplier port.</param> public void SetPropertyTypeAndDirectionOnFlowPortCreation(int connectorId, string portStereotype, string connectorStereotype, string supplierName) { EAShared.Connector connector = Rep.GetConnectorByID(connectorId); EAShared.Element client = Rep.GetElementByID(connector.ClientID); EAShared.Element supplier = Rep.GetElementByID(connector.SupplierID); if ((supplier.Stereotype == portStereotype) && (connector.Stereotype == connectorStereotype)) { CopyTaggedValuesFromClientToSupplierPort(client, supplier); if (supplier.PropertyType == 0) { supplier.PropertyType = client.PropertyType; if (supplier.Alias == "") { supplier.Alias = client.Alias; } if (supplier.Multiplicity == "") { supplier.Multiplicity = client.Multiplicity; } // Copy notes text from client to supplier if (supplier.Notes == "") { supplier.Notes = client.Notes; } } else if (supplier.PropertyType == client.PropertyType) { if (supplier.Alias == "") { supplier.Alias = client.Alias; } if (supplier.Multiplicity == "") { supplier.Multiplicity = client.Multiplicity; } // Copy notes text from client to supplier if (supplier.Notes == "") { supplier.Notes = client.Notes; } } if (supplier.Name.StartsWith(supplierName) || supplier.Name == "") { supplier.Name = client.Name; } supplier.Update(); supplier.Refresh(); } // if }