예제 #1
0
        public EAFactory addSupplier(EAElement element, string supplierRoleName, string cardinality, String stereotype)
        {
            object          obj    = EARepository.currentDiagram.DiagramObjects.AddNew(element.Name, "");
            EADiagramObject diaObj = (EADiagramObject)obj;

            diaObj.ElementID = element.ElementID;

            object o = clientElement.Connectors.AddNew(element.Name, APIAddinClass.EA_TYPE_ASSOCIATION);

            EA.Connector connector = (EA.Connector)o;

            connector.ClientID   = clientElement.ElementID;
            connector.SupplierID = element.ElementID;

            connector.SupplierEnd.Cardinality = cardinality;
            connector.SupplierEnd.Role        = supplierRoleName;
            connector.Stereotype = stereotype;

            object        dobj    = EARepository.currentDiagram.DiagramLinks.AddNew(element.Name + supplierRoleName, "");
            EADiagramLink diaLink = (EADiagramLink)dobj;

            diaLink.ConnectorID = connector.ConnectorID;

            return(this);
        }
예제 #2
0
        public dynamic AddNew(string Name, string Type)
        {
            if (this.type.Equals("AttributeTag"))
            {
                EATaggedValue p = new EATaggedValue();
                collection.Add(Name, p);
                return(p);
            }

            if (this.type.Equals("Parameters"))
            {
                EAParameter p = new EAParameter();
                collection.Add(Name, p);
                return(p);
            }

            if (this.type.Equals("Method"))
            {
                EAMethod m = new EAMethod();
                collection.Add(Name, m);
                return(m);
            }
            if (this.type.Equals("DiagramLink"))
            {
                EADiagramLink dia = new EADiagramLink();
                collection.Add(Name, dia);
                return(dia);
            }
            if (this.type.Equals("Diagram"))
            {
                EADiagram dia = new EADiagram();
                dia.PackageID = parent;
                collection.Add(Name, dia);
                return(dia);
            }
            if (this.type.Equals("DiagramObject"))
            {
                EADiagramObject diaObj = new EADiagramObject();
                collection.Add(Name, diaObj);
                return(diaObj);
            }
            else
            {
                if (Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_PACKAGE))
                {
                    EAPackage package = new EAPackage(Name);
                    package.ParentID = parent;
                    collection.Add(Name, package);
                    return(package);
                }
                else if (Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_ASSOCIATION))
                {
                    EAConnector connector = new EAConnector();
                    connector.Name = Name;
                    collection.Add(Name, connector);

                    return(connector);
                }
                else if (Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_ATTRIBUTE))
                {
                    EAAttribute attr = new EAAttribute();
                    attr.ParentID   = parent;
                    attr.Name       = Name;
                    attr.LowerBound = "0";
                    attr.UpperBound = "*";
                    collection.Add(Name, attr);

                    return(attr);
                }
                else if (Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_CLASS) || Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_OBJECT))
                {
                    EAElement element = new EAElement();
                    element.Type = Type;
                    element.Name = Name;
                    collection.Add(Name, element);

                    return(element);
                }

                if (this.type.Equals(APIAddIn.APIAddinClass.EA_TYPE_ATTRIBUTE))
                {
                    if (Type.Equals(APIAddIn.APIAddinClass.EA_TYPE_STRING))
                    {
                        EAAttribute attr = new EAAttribute();
                        attr.Name = Name;
                        collection.Add(Name, attr);

                        return(attr);
                    }
                }

                throw new Exception("Not supported");
            }

            throw new NotImplementedException();
        }