EAAddinFramework.Databases.Transformation.DB2.DB2TableTransformer.getDependingAssociationEnds C# (CSharp) Method

getDependingAssociationEnds() public method

gets the Class Elements that are needed for this logical element. This means the classes to which this element has an association to with multiplicity of 1..1 or 0..1. We will need these classes because they will create one or more columns in the associated table.
public getDependingAssociationEnds ( ) : List
return List
        public List<UTF_EA.AssociationEnd> getDependingAssociationEnds()
        {
            var dependingAssociationEnds = new List<UTF_EA.AssociationEnd>();
            foreach (var currentClass in this.allLogicalClasses)
            {
                foreach (var association in currentClass.relationships.OfType<UTF_EA.Association>())
                {
                    foreach (UTF_EA.AssociationEnd end in association.memberEnds)
                    {
                        if (!currentClass.Equals(end.type)
                              && end.type is UTF_EA.Class
                              && (end.upper.integerValue.HasValue && end.upper.integerValue == 1))
                        {
                            //if both end have an upper value of 1 then we take only the one with {id} or else use the association direction
                            var otherEnd = association.memberEnds.FirstOrDefault(x => x != end) as UTF_EA.AssociationEnd;
                            //both have an upper value of 1
                            if (otherEnd.upper.integerValue.HasValue && otherEnd.upper.integerValue == 1)
                            {
                                //this one is the one with ID
                                if (end.isID)
                                {
                                    dependingAssociationEnds.Add(end);
                                    break;
                                }
                                //the other end is not an ID either,
                                // then we use the association direction to determine wher the FK should be placed
                                if (! otherEnd.isID
                                         && association.targetEnd == end)
                                {
                                    dependingAssociationEnds.Add(end);
                                    break;
                                }
                            }
                            else
                            {
                                dependingAssociationEnds.Add(end);
                                break;
                            }
                        }
                    }
                }
            }
            return dependingAssociationEnds;
        }