예제 #1
0
        private void DeleteWrongPortReferenceOfConnections(int originalElementID)
        {
            for (short connectorCount = 0; connectorCount < _referenceElement.EmbeddedElements.Count; connectorCount++)
            {
                EAAPI.Element embeddedElement = _referenceElement.EmbeddedElements.GetAt(connectorCount) as EAAPI.Element;
                if (embeddedElement.Type == "Port")
                {
                    for (short portCounter = 0; portCounter < embeddedElement.Connectors.Count; portCounter++)
                    {
                        EAAPI.Connector referencePortConnector = (EAAPI.Connector)embeddedElement.Connectors.GetAt(portCounter);

                        if (referencePortConnector.ClientID == embeddedElement.ElementID &&
                            referencePortConnector.SupplierID != embeddedElement.ElementID &&
                            referencePortConnector.Type == "Dependency" &&
                            referencePortConnector.Stereotype == "referenceOf")
                        {
                            EAAPI.Element referencedElement = _repository.GetElementByID(referencePortConnector.SupplierID);

                            if (referencedElement.Type == "Port" &&
                                referencedElement.ParentID == originalElementID)
                            {
                                // correct reference
                            }
                            else
                            {
                                logger.Info("Deleting wrong referenceOf connector.");
                                _repository.DeleteConnector(referencePortConnector);
                            }
                        }
                    }
                }
            }
        }