private bool validateFirstObject(String selectedExpressionString, int firtObjectClassifierId)
        {
            bool valid = false;

            if (methodParameterClassifierIdFilter != -1 && methodParameterClassifierIdFilter != 0)
            {
                if (selectedExpressionString == "ObjectVariableExpression" || selectedExpressionString == "ParameterExpression")
                {
                    try
                    {
                        //is object classifier == method parameter classifier, we can skip the base class detection
                        if (firtObjectClassifierId == methodParameterClassifierIdFilter)
                        {
                            valid = true;
                        }
                        //is the object classifier contained in the method parameter classifier type hierarchy?
                        else
                        {
                            SQLElement methodClassifier = EAUtil.getClassifierElement(repository, methodParameterClassifierIdFilter);
                            if (methodClassifier != null)
                            {
                                //all targets are valid for EObject parameters
                                if (methodClassifier.Name == "EObject")
                                {
                                    valid = true;
                                }
                            }

                            if (!valid)
                            {
                                SQLElement classifierFilter = repository.GetElementByID(firtObjectClassifierId);

                                List <SQLElement> baseClasses = EAUtil.getBaseClasses(classifierFilter);
                                foreach (SQLElement baseClass in baseClasses)
                                {
                                    if (baseClass.ElementID == methodParameterClassifierIdFilter)
                                    {
                                        valid = true;
                                    }
                                }
                            }
                        }
                    }
                    catch (COMException)
                    {
                    }
                }
                //other expression is used. do not filter it
                else
                {
                    valid = true;
                }
            }
            else
            {
                valid = true;
            }
            return(valid);
        }
        public List <string> getSecondStringList(int selectedFirstObjectIndex)
        {
            this.secondObjects             = new List <SecondObject>();
            this.selectedFirstObjectIndex  = selectedFirstObjectIndex;
            this.selectedSecondObjectIndex = -1;

            List <String> sourceStringList = new List <string>();

            Object              targetElement    = this.firstObjects[selectedFirstObjectIndex].EaObject;
            EditorExpression    editorExpression = EditorExpression.createEditorExpression(selectedExpressionString);
            List <SecondObject> sourceList       = editorExpression.getSecondObjects(targetElement, repository);

            foreach (SecondObject actSecondObject in sourceList)
            {
                String name         = actSecondObject.Name;
                int    classifierId = actSecondObject.ClassifierId;

                if (actSecondObject.EaObject is SQLMethod)
                {
                    SQLMethod method = actSecondObject.EaObject as SQLMethod;
                    if (methodParameterClassifierIdFilter != 0)
                    {
                        if (classifierId != 0)
                        {
                            SQLElement methodReturnTypeClass     = repository.GetElementByID(classifierId);
                            SQLElement wantedParameterTypeClasss = repository.GetElementByID(methodParameterClassifierIdFilter);

                            foreach (SQLElement baseClass in EAUtil.getBaseClasses(methodReturnTypeClass))
                            {
                                if (baseClass.ElementID == methodParameterClassifierIdFilter)
                                {
                                    name = EAUtil.getMethodSignature(method);
                                    break;
                                }
                            }
                        }
                    }
                    else
                    {
                        name = EAUtil.getMethodSignature(method);
                    }
                }

                if (name != "" && !sourceStringList.Contains(name))
                {
                    sourceStringList.Add(name);
                    this.secondObjects.Add(actSecondObject);
                }
            }

            this.expression = computeExpression();

            //sourceStringList.Sort();
            sourceStringList = sourceStringList.Distinct().ToList();

            return(sourceStringList);
        }
Exemple #3
0
        public override List <string> doRule(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> result = new List <string>();

            if (eaElement.Stereotype == TGGModelingMain.TggCorrespondenceTypeStereotype)
            {
                List <SQLElement> baseClasses = EAUtil.getBaseClasses(eaElement);
                if (baseClasses.Count > 1)
                {
                    foreach (SQLConnector con in eaElement.Connectors)
                    {
                        if (con.Type != Main.EAGeneralizationConType)
                        {
                            result.Add("Only the top level correspondence type in inheritance hierarchy should have connectors besides inheritance ");
                            break;
                        }
                    }
                }
                else
                {
                    int  count = 0;
                    bool valid = true;
                    foreach (SQLConnector con in eaElement.Connectors)
                    {
                        if (con.Type == Main.EAAssociationType)
                        {
                            count++;
                            SQLConnectorEnd rightEnd = null;
                            SQLConnectorEnd wrongEnd = null;
                            if (con.ClientID == eaElement.ElementID)
                            {
                                wrongEnd = con.ClientEnd;
                                rightEnd = con.SupplierEnd;
                            }
                            else if (con.SupplierID == eaElement.ElementID)
                            {
                                wrongEnd = con.SupplierEnd;
                                rightEnd = con.ClientEnd;
                            }

                            valid &= wrongEnd.Role == "";
                            valid &= !wrongEnd.IsNavigable;

                            valid &= (rightEnd.Role == "source" || rightEnd.Role == "target");
                            valid &= rightEnd.IsNavigable;
                            valid &= rightEnd.Cardinality == "1";
                        }
                    }

                    if (count != 2 || !valid)
                    {
                        result.Add("Correspondence type should only have source and target EReference with multiplicity 1");
                    }
                }
            }
            return(result);
        }
Exemple #4
0
        public override void doRuleQuickFix(SQLElement eaElement, SQLWrapperClasses.SQLRepository repository, int i, string errorMessage)
        {
            if (i == 0)
            {
                List <SQLConnector> toDelte     = new List <SQLConnector>();
                List <SQLElement>   baseClasses = EAUtil.getBaseClasses(eaElement);
                if (baseClasses.Count > 1)
                {
                    foreach (SQLConnector con in eaElement.Connectors)
                    {
                        if (con.Type != Main.EAGeneralizationConType)
                        {
                            toDelte.Add(con);
                        }
                    }
                }

                else
                {
                    foreach (SQLConnector con in eaElement.Connectors)
                    {
                        if (con.Type == Main.EAAssociationType)
                        {
                            bool            valid    = true;
                            SQLConnectorEnd rightEnd = null;
                            SQLConnectorEnd wrongEnd = null;
                            if (con.ClientID == eaElement.ElementID)
                            {
                                wrongEnd = con.ClientEnd;
                                rightEnd = con.SupplierEnd;
                            }
                            else if (con.SupplierID == eaElement.ElementID)
                            {
                                wrongEnd = con.SupplierEnd;
                                rightEnd = con.ClientEnd;
                            }

                            valid &= wrongEnd.Role == "";
                            valid &= !wrongEnd.IsNavigable;

                            valid &= (rightEnd.Role == "source" || rightEnd.Role == "target");
                            valid &= rightEnd.IsNavigable;
                            valid &= rightEnd.Cardinality == "1";
                            if (!valid)
                            {
                                toDelte.Add(con);
                            }
                        }
                    }
                }
                foreach (EA.Connector toDeleteCon in toDelte)
                {
                    EAUtil.deleteConnector(toDeleteCon, repository.GetOriginalRepository());
                }
            }
        }
Exemple #5
0
        private static bool checkIfClassifierContainsAttribute(SQLElement ovElement, SQLRepository repository, SQLAttribute attribute)
        {
            SQLElement ovClassifier = repository.GetElementByID(ovElement.ClassifierID);


            //assignment was created while ov had an other classifier
            Boolean attributeParentValid = false;

            foreach (SQLElement actBaseClass in EAUtil.getBaseClasses(ovClassifier))
            {
                if (attribute.ParentID == actBaseClass.ElementID)
                {
                    attributeParentValid = true;
                }
            }
            return(attributeParentValid);
        }
        private Dictionary <int, List <SQLConnector> > computeCorrespondencesWithLinks(SQLElement clientClassifier, SQLElement targetClassifier, SQLRepository Repository, int tggPackageId)
        {
            DateTime time1 = DateTime.Now;

            Dictionary <int, List <SQLConnector> > possibleCorrespondencesLinkWithConnectors = new Dictionary <int, List <SQLConnector> >();

            foreach (SQLElement clientAndBases in EAUtil.getBaseClasses(clientClassifier))
            {
                foreach (SQLConnector conOfClientClassifier in clientAndBases.Connectors)
                {
                    SQLElement elementOnOtherSide = null;
                    if (conOfClientClassifier.ClientID == clientAndBases.ElementID)
                    {
                        elementOnOtherSide = Repository.GetElementByID(conOfClientClassifier.SupplierID);
                    }
                    else if (conOfClientClassifier.SupplierID == clientAndBases.ElementID)
                    {
                        elementOnOtherSide = Repository.GetElementByID(conOfClientClassifier.ClientID);
                    }
                    if (elementOnOtherSide.Stereotype == TGGModelingMain.TggCorrespondenceTypeStereotype && EAUtil.getOutermostPackage(elementOnOtherSide, Repository).PackageID == tggPackageId)
                    {
                        foreach (SQLConnector conOfTGGCorrType in elementOnOtherSide.Connectors)
                        {
                            foreach (SQLElement targetAndBases in EAUtil.getBaseClasses(targetClassifier))
                            {
                                if (conOfTGGCorrType.ClientID == targetAndBases.ElementID || conOfTGGCorrType.SupplierID == targetAndBases.ElementID)
                                {
                                    foreach (SQLElement subClass in EAUtil.findSubclasses(elementOnOtherSide, Repository))
                                    {
                                        List <SQLConnector> refs = new List <SQLConnector>();
                                        refs.Add(conOfTGGCorrType);
                                        refs.Add(conOfClientClassifier);
                                        if (!possibleCorrespondencesLinkWithConnectors.ContainsKey(subClass.ElementID))
                                        {
                                            possibleCorrespondencesLinkWithConnectors.Add(subClass.ElementID, refs);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(possibleCorrespondencesLinkWithConnectors);
        }
Exemple #7
0
        public override List <SecondObject> getSecondObjects(Object targetObject, SQLRepository repository)
        {
            Object targetElement = targetObject;
            List <SecondObject> sourceMethods  = new List <SecondObject>();
            SQLElement          realClassifier = null;
            List <SQLElement>   allClasses     = new List <SQLElement>();

            if (targetObject is SQLElement)
            {
                realClassifier = EAUtil.getClassifierElement(repository, (targetObject as SQLElement).ClassifierID);
            }
            else if (targetElement is SQLParameter)
            {
                if ((targetObject as SQLParameter).ClassifierID != "0" && (targetObject as SQLParameter).ClassifierID != "")
                {
                    try
                    {
                        realClassifier = repository.GetElementByID(int.Parse((targetObject as SQLParameter).ClassifierID));
                    }
                    catch
                    {
                        realClassifier = null;
                    }
                }
            }
            if (realClassifier != null)
            {
                allClasses = EAUtil.getBaseClasses(realClassifier);
                foreach (SQLElement actClass in allClasses)
                {
                    foreach (SQLMethod method in actClass.Methods)
                    {
                        SecondObject sObject = new SecondObject(method);
                        sourceMethods.Add(sObject);
                    }
                }
                sourceMethods.Sort(new EAObjectIComparer());
            }

            return(sourceMethods);
        }
Exemple #8
0
        private void addLeftAttributes()
        {
            cmbAttributes.Items.Clear();
            if (this.objectVariable.Classifier != null)
            {
                SQLElement        classifier           = this.objectVariable.Classifier.EaElement;
                List <SQLElement> classifierAndParents = EAUtil.getBaseClasses(classifier);
                foreach (SQLElement classif in classifierAndParents)
                {
                    foreach (SQLAttribute attribute in classif.Attributes)
                    {
                        cmbAttributes.Items.Add(attribute.Name);
                        this.leftAttributes.Add(attribute);
                    }
                }

                if (cmbAttributes.Items.Count > 0)
                {
                    cmbAttributes.SelectedIndex = 0;
                }
                cmbAttributes.DropDownWidth = EAUtil.computeDropDownWidth(cmbAttributes);
            }
        }
        public override List <SecondObject> getSecondObjects(Object targetObject, SQLRepository repository)
        {
            Object targetElement = targetObject;
            List <SecondObject> sourceAttributes = new List <SecondObject>();
            SQLElement          realClassifier   = null;
            List <SQLElement>   allClasses       = new List <SQLElement>();

            if (targetObject is SQLElement)
            {
                SQLElement tempElement = targetObject as SQLElement;
                realClassifier = EAUtil.getClassifierElement(repository, tempElement.ClassifierID);
            }
            else if (targetElement is SQLParameter)
            {
                SQLParameter targetParameter = targetObject as SQLParameter;
                if (targetParameter.ClassifierID != "0" && targetParameter.ClassifierID != "")
                {
                    realClassifier = repository.GetElementByID(int.Parse((targetObject as EA.Parameter).ClassifierID));
                }
            }

            if (realClassifier != null)
            {
                allClasses = EAUtil.getBaseClasses(realClassifier);
                foreach (SQLElement actClass in allClasses)
                {
                    foreach (SQLAttribute attribute in actClass.Attributes)
                    {
                        SecondObject sObject = new SecondObject(attribute);
                        sourceAttributes.Add(sObject);
                    }
                }
                sourceAttributes.Sort(new EAObjectIComparer());
            }
            return(sourceAttributes);
        }
        public override List <String> doRule(SQLConnector eaConnector, SQLWrapperClasses.SQLRepository repository)
        {
            List <String> results = new List <string>();

            if (eaConnector.Stereotype == SDMModelingMain.LinkVariableStereotype || eaConnector.Stereotype == TGGModelingMain.TggLinkVariableStereotype)
            {
                LinkVariable lv = new LinkVariable(eaConnector, repository);
                lv.loadTreeFromTaggedValue();

                SQLConnector referencedReference = SDMUtil.getRelatedEReference(lv);


                //try to get the related EReference

                //related EReference cant be found
                if (referencedReference == null)
                {
                    results.Add("There is no related EReference");
                }


                //rolename of linkVariable not existing in the referenced EReference
                if (eaConnector.SupplierEnd.Role != "" && referencedReference != null)
                {
                    if (!((eaConnector.SupplierEnd.Role == referencedReference.ClientEnd.Role || eaConnector.SupplierEnd.Role == referencedReference.SupplierEnd.Role) &&
                          (eaConnector.ClientEnd.Role == referencedReference.ClientEnd.Role || eaConnector.ClientEnd.Role == referencedReference.SupplierEnd.Role)))
                    {
                        results.Add("The rolename(s) of the LinkVariable differs from the related EReference");
                    }
                }

                //for unidirectional EReferences the supplierEnd.Role of the linkvariable must be the "value" rolename
                if (eaConnector.ClientEnd.Role != "" && eaConnector.SupplierEnd.Role == "")
                {
                    results.Add("The rolename(s) of the LinkVariable differs from the related EReference");
                }

                //checks if the related reference is connecting the correct EClasses

                if (referencedReference != null)
                {
                    try
                    {
                        SQLElement lvSource = repository.GetElementByID(eaConnector.ClientID);
                        SQLElement lvTarget = repository.GetElementByID(eaConnector.SupplierID);

                        SQLElement sourceClassifier = EAUtil.getClassifierElement(repository, lvSource.ClassifierID);
                        SQLElement targetClassifier = EAUtil.getClassifierElement(repository, lvTarget.ClassifierID);


                        SQLElement refRefClient   = repository.GetElementByID(referencedReference.ClientID);
                        SQLElement refRefSupplier = repository.GetElementByID(referencedReference.SupplierID);


                        if (sourceClassifier != null && targetClassifier != null)
                        {
                            List <SQLElement> sourceBases = EAUtil.getBaseClasses(sourceClassifier);
                            List <SQLElement> targetBases = EAUtil.getBaseClasses(targetClassifier);

                            Boolean valid = false;

                            foreach (SQLElement sourceBase in sourceBases)
                            {
                                foreach (SQLElement targetBase in targetBases)
                                {
                                    if (((referencedReference.ClientID == sourceBase.ElementID || referencedReference.ClientID == targetBase.ElementID) &&
                                         (referencedReference.SupplierID == sourceBase.ElementID || referencedReference.SupplierID == targetBase.ElementID)))
                                    {
                                        valid = true;
                                    }
                                }
                            }

                            //maybe there is a direct connectio to EObject

                            if (!valid)
                            {
                                if (refRefClient.Name == "EObject" && (eaConnector.SupplierEnd.Role == referencedReference.SupplierEnd.Role || eaConnector.SupplierEnd.Role == referencedReference.ClientEnd.Role) ||
                                    refRefSupplier.Name == "EObject" && (eaConnector.SupplierEnd.Role == referencedReference.SupplierEnd.Role || eaConnector.SupplierEnd.Role == referencedReference.ClientEnd.Role))
                                {
                                    valid = true;
                                }
                            }


                            if (!valid)
                            {
                                results.Add("The related EReference doesn't connect EClasses from the same type hiearchy as the LinkVariable");
                            }
                        }
                    }
                    catch
                    {
                        results.Add("Error during computing of related EReference. Please update your LinkVariable manually");
                    }
                }
            }


            return(results);
        }
        /// <summary>
        /// Checks if the new created Element is an SDM related Element.
        /// Opens the custom User Dialogues or sets default values if it is necessary.
        /// </summary>
        /// <param name="sqlRep"></param>
        /// <param name="Info"></param>
        /// <returns>if newElement is still valid</returns>
        public bool EA_OnPostNewElement(SQLRepository sqlRep, EA.Element newElement, EA.Diagram currentDiagram)
        {
            if (SdmDiagramMetatype.Contains(currentDiagram.MetaType))
            {
                sqlRep.SuppressEADialogs = true;
                if (newElement.Stereotype == SDMModelingMain.ObjectVariableQuickCreateStereotype)
                {
                    newElement.Stereotype = SDMModelingMain.ObjectVariableStereotype;
                    ObjectVariable ov = new ObjectVariable(sqlRep.GetElementByID(newElement.ElementID), sqlRep);
                    OvDialog       objectVariableDialogue = new OvDialog(sqlRep, ov);

                    List <SQLElement> validEClassesTemp    = new List <SQLElement>();
                    List <EClass>     validEClasses        = new List <EClass>();
                    SQLElement        sourceObjectVariable = sqlRep.GetElementByGuid(Main.lastContextItemGUID);
                    SQLElement        classifier           = sqlRep.GetElementByID(sourceObjectVariable.ClassifierID);

                    foreach (SQLElement baseclass in EAUtil.getBaseClasses(classifier))
                    {
                        foreach (SQLConnector connector in baseclass.Connectors)
                        {
                            if (connector.Type == ECOREModelingMain.EReferenceConnectorType)
                            {
                                EReference eRef = new EReference(connector, sqlRep);
                                eRef.loadTreeFromTaggedValue();
                                SQLElement otherEnd = null;
                                if (connector.ClientID == baseclass.ElementID && eRef.SupplierEnd.Navigable)
                                {
                                    otherEnd = sqlRep.GetElementByID(connector.SupplierID);
                                }
                                else if (connector.SupplierID == baseclass.ElementID && eRef.ClientEnd.Navigable)
                                {
                                    otherEnd = sqlRep.GetElementByID(connector.ClientID);
                                }

                                if (otherEnd != null && otherEnd.Stereotype == ECOREModelingMain.EClassStereotype)
                                {
                                    validEClassesTemp.Add(otherEnd);
                                }
                            }
                        }
                    }


                    objectVariableDialogue.ovPropertiesControl.comboTypes.clearClassifiers();
                    foreach (SQLElement tempClassifier in validEClassesTemp)
                    {
                        objectVariableDialogue.ovPropertiesControl.comboTypes.addClassifier(new EClass(tempClassifier, sqlRep));
                    }
                    objectVariableDialogue.ovPropertiesControl.comboTypes.printClassifiers();

                    objectVariableDialogue.ShowDialog();
                }

                else if (newElement.Stereotype == SDMModelingMain.ObjectVariableStereotype || (newElement.Type == Main.EAObjectType && newElement.Stereotype == ""))
                {
                    Boolean dragAndDropUsed = newElement.ClassifierID != 0;

                    if (dragAndDropUsed && !classifierIsValid(sqlRep, newElement))
                    {
                        Main.addToDeleteGUIDQueue(newElement.ElementGUID);
                        return(false);
                    }
                    EA.DiagramObject diagObj = EAEcoreAddin.Util.EAUtil.findDiagramObject(sqlRep, newElement, currentDiagram);

                    foreach (EA.DiagramObject diagObjs in currentDiagram.DiagramObjects)
                    {
                        if (diagObj.left > (diagObjs.left - 45) && diagObj.right < (diagObjs.right + 45) && diagObj.top < (diagObjs.top + 30) && diagObj.bottom > (diagObjs.bottom - 30))
                        {
                            if (newElement.ElementID != diagObjs.ElementID)
                            {
                                EA.Element realElement = sqlRep.GetOriginalRepository().GetElementByID(newElement.ElementID);
                                realElement.ParentID = diagObjs.ElementID;
                                realElement.Update();
                                break;
                            }
                        }
                    }

                    //recompute newElement because of drag and drop changes to the element
                    if (dragAndDropUsed)
                    {
                        newElement = sqlRep.GetOriginalRepository().GetElementByID(newElement.ElementID);
                    }
                    newElement.Stereotype = SDMModelingMain.ObjectVariableStereotype;
                    ObjectVariable ov = new ObjectVariable(sqlRep.GetElementByID(newElement.ElementID), sqlRep);
                    OvDialog       objectVariableDialogue = new OvDialog(sqlRep, ov);
                    objectVariableDialogue.ShowDialog();
                }


                else if (newElement.Stereotype == SDMModelingMain.StoryNodeStereotype)
                {
                    //save initial data for storyNode
                    EAEcoreAddin.Util.EAUtil.setTaggedValue(sqlRep, newElement, Main.MoflonExtractedStoryPatternTaggedValueName, "false");
                    StoryNode storyNode = new StoryNode(sqlRep, sqlRep.GetElementByID(newElement.ElementID));
                    storyNode.ForEach = false;
                    storyNode.saveTreeToEATaggedValue(true);
                }

                else if (newElement.Stereotype == SDMModelingMain.StopNodeStereotype)
                {
                    //save initial data for stopNode
                    StopNode stopNode = new StopNode(sqlRep, sqlRep.GetElementByID(newElement.ElementID));
                    stopNode.saveTreeToEATaggedValue(true);
                }
                else if (newElement.Stereotype == SDMModelingMain.StartNodeStereotype)
                {
                    //save initial data for startNode
                    StartNode startNode = new StartNode(sqlRep, sqlRep.GetElementByID(newElement.ElementID));
                    startNode.saveTreeToEATaggedValue(false);
                }
                else if (newElement.Stereotype == SDMModelingMain.CSPInstanceStereotype)
                {
                    EA.DiagramObject instanceObject = EAUtil.findDiagramObject(sqlRep, newElement, sqlRep.GetCurrentDiagram());
                    instanceObject.right  = instanceObject.left + 225;
                    instanceObject.bottom = instanceObject.top - 125;
                    instanceObject.Update();

                    SDMCSPDialog sdmCspDialog = new SDMCSPDialog(sqlRep.GetElementByID(newElement.ElementID), sqlRep);
                    sdmCspDialog.ShowDialog();
                }
            }
            return(true);
        }
        public static void collectPossibleAssociations(ref SQLElement clientClassifier, ref SQLElement supplierClassifier, ref List <SQLConnector> clientToSupplierAssociations, ref List <SQLConnector> supplierToClientAssociations, ref SQLRepository repository)
        {
            List <SQLElement> clientBaseClasses   = EAUtil.getBaseClasses(clientClassifier);
            List <SQLElement> supplierBaseClasses = EAUtil.getBaseClasses(supplierClassifier);

            String sqlStub = "select * from t_connector where ";


            foreach (SQLElement actClient in clientBaseClasses)
            {
                String sqlClientToSupplier = "";
                String sqlSupplierToClient = "";

                foreach (SQLElement actSupplier in supplierBaseClasses)
                {
                    sqlClientToSupplier = sqlClientToSupplier + " Start_Object_ID = " + actClient.ElementID + " and End_Object_ID = " + actSupplier.ElementID + " and Connector_Type = 'Association' or ";
                    sqlSupplierToClient = sqlSupplierToClient + " End_Object_ID = " + actClient.ElementID + " and Start_Object_ID = " + actSupplier.ElementID + " and Connector_Type = 'Association' or ";
                }
                sqlSupplierToClient = sqlSupplierToClient.Substring(0, sqlSupplierToClient.Length - 3);
                sqlClientToSupplier = sqlClientToSupplier.Substring(0, sqlClientToSupplier.Length - 3);

                String sqlStringClientToSupplier = sqlStub + sqlClientToSupplier;
                String sqlStringSupplierToClient = sqlStub + sqlSupplierToClient;

                String sqlResultClientToSupplier = repository.SQLQuery(sqlStringClientToSupplier);
                String sqlResultSupplierToClient = repository.SQLQuery(sqlStringSupplierToClient);


                foreach (String row in EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(sqlResultClientToSupplier, "Row"))
                {
                    if (row != "")
                    {
                        SQLConnector actCon = new SQLConnector(repository, row);
                        clientToSupplierAssociations.Add(actCon);
                    }
                }

                foreach (String row in EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(sqlResultSupplierToClient, "Row"))
                {
                    if (row != "")
                    {
                        SQLConnector actCon = new SQLConnector(repository, row);
                        supplierToClientAssociations.Add(actCon);
                    }
                }
            }

            //only if there is no valid association
            if (supplierToClientAssociations.Count == 0 && clientToSupplierAssociations.Count == 0)
            {
                foreach (SQLElement actClient in clientBaseClasses)
                {
                    String sqlString = @"select a.* from t_connector a, t_object b where " +
                                       "a.Start_Object_ID = " + actClient.ElementID + " AND a.End_Object_ID = b.Object_ID AND " +
                                       "b.Name = 'EObject' AND a.Connector_Type = 'Association'";

                    String result = repository.SQLQuery(sqlString);
                    foreach (String row in EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
                    {
                        if (row != "")
                        {
                            SQLConnector actCon = new SQLConnector(repository, row);
                            clientToSupplierAssociations.Add(actCon);
                        }
                    }

                    sqlString = @"select a.* from t_connector a, t_object b where " +
                                "a.End_Object_ID = " + actClient.ElementID + " AND a.Start_Object_ID = b.Object_ID AND " +
                                "b.Name = 'EObject' AND a.Connector_Type = 'Association'";

                    result = repository.SQLQuery(sqlString);
                    foreach (String row in EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
                    {
                        if (row != "")
                        {
                            SQLConnector actCon = new SQLConnector(repository, row);
                            supplierToClientAssociations.Add(actCon);
                        }
                    }
                }

                foreach (SQLElement actClient in supplierBaseClasses)
                {
                    String sqlString = @"select a.* from t_connector a, t_object b where " +
                                       "a.End_Object_ID = " + actClient.ElementID + " AND a.Start_Object_ID = b.Object_ID AND " +
                                       "b.Name = 'EObject' AND a.Connector_Type = 'Association'";

                    String result = repository.SQLQuery(sqlString);
                    foreach (String row in EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
                    {
                        if (row != "")
                        {
                            SQLConnector actCon = new SQLConnector(repository, row);

                            clientToSupplierAssociations.Add(actCon);
                        }
                    }

                    sqlString = @"select a.* from t_connector a, t_object b where " +
                                "a.Start_Object_ID = " + actClient.ElementID + " AND a.End_Object_ID = b.Object_ID AND " +
                                "b.Name = 'EObject' AND a.Connector_Type = 'Association'";

                    result = repository.SQLQuery(sqlString);
                    foreach (String row in EAEcoreAddin.Util.EAUtil.getXMLNodeContentFromSQLQueryString(result, "Row"))
                    {
                        if (row != "")
                        {
                            SQLConnector actCon = new SQLConnector(repository, row);
                            supplierToClientAssociations.Add(actCon);
                        }
                    }
                }
            }
        }