public EReference(SQLConnector eaConnector, SQLRepository repository)
 {
     this.Repository  = repository;
     this.EaConnector = eaConnector;
     this.ClientEnd   = new EReferenceEnd(eaConnector.ClientEnd, eaConnector, repository);
     this.SupplierEnd = new EReferenceEnd(eaConnector.SupplierEnd, eaConnector, repository);
 }
 public EReference(SQLConnector eaConnector, SQLRepository repository, EClass source, EClass target)
 {
     this.Repository  = repository;
     this.EaConnector = eaConnector;
     this.ClientEnd   = new EReferenceEnd(eaConnector.ClientEnd, eaConnector, repository);
     this.SupplierEnd = new EReferenceEnd(eaConnector.SupplierEnd, eaConnector, repository);
     this.sourceClass = source;
     this.targetClass = target;
 }
        public void switchEnds()
        {
            EReferenceEnd tmp = this.SupplierEnd;

            this.SupplierEnd = this.ClientEnd;
            SupplierEnd.setEndString("Supplier");
            this.ClientEnd = tmp;
            ClientEnd.setEndString("Client");
        }
        private void setConnectorEnd(EReferenceEnd end)
        {
            EReferenceEnd opposite = null;
            int           oldAggregation;
            bool          isEnd       = ClientEnd == end;
            bool          containment = false;
            string        name        = end.Name;

            if (isEnd)
            {
                opposite = SupplierEnd;
            }
            else
            {
                opposite = ClientEnd;
            }

            if (opposite != null && !end.aggregationSet)
            {
                containment = opposite.containment;
            }
            if (end.Navigable)
            {
                if (containment)
                {
                    oldAggregation = end.ConnectorEnd.getAggregation();
                    end.ConnectorEnd.setAggregation(2);
                    end.aggregationSet = true;
                    end.ConnectorEnd.Update();
                    EaConnector.Update();
                    oldAggregation = end.ConnectorEnd.getAggregation();
                }
                if (end.lowerBound != ClientEnd.upperBound)
                {
                    end.ConnectorEnd.getRealConnectorEnd().Cardinality = end.lowerBound.Replace("-1", "*") + ".." + end.upperBound.Replace("-1", "*");
                    // Update();
                }
                else
                {
                    end.ConnectorEnd.getRealConnectorEnd().Cardinality = end.lowerBound.Replace("-1", "*");
                    // Update();
                }
                if (name != "" && name != null)
                {
                    end.ConnectorEnd.getRealConnectorEnd().Role = end.Name;
                    end.ConnectorEnd.Update();
                    end.ConnectorEnd.getRealConnectorEnd().Update();
                }
            }
        }