Exemple #1
0
        public EAFactory setupClient(string name, string classifier, string stereotype, int classifierId, string[] states)
        {
            clientElement              = new EAElement();
            clientElement.Name         = name;
            clientElement.Type         = classifier;
            clientElement.ClassifierID = classifierId;
            clientElement.Stereotype   = stereotype;

            clientElement.PackageID = EARepository.currentPackage.PackageID;

            string state = "";

            if (states != null)
            {
                for (int i = 0; i < states.Length; i += 2)
                {
                    state = ObjectManager.addRunState(state, states[i], states[i + 1], 0);
                }
            }
            clientElement.RunState = state;

            EADiagram       d      = EARepository.currentDiagram;
            object          obj    = d.DiagramObjects.AddNew(name, "");
            EADiagramObject diaObj = (EADiagramObject)obj;

            diaObj.ElementID = clientElement.ElementID;

            EAFactory client = new EAFactory();

            client.clientElement = clientElement;

            return(client);
        }
Exemple #2
0
        public EAMetaModel()
        {
            if (EARepository.Repository == null)
            {
                EARepository.Repository = new EARepository();
            }

            META_API               = new EAElement();
            META_RESOURCE          = new EAElement();
            META_RESOURCE_TYPE     = new EAElement();
            META_TYPE_FOR_RESOURCE = new EAElement();
            META_SCHEMA            = new EAElement();
            META_METHOD            = new EAElement();
            META_TRAIT             = new EAElement();
            //META_DATAITEM = new EAElement();
            META_RELEASEPIPELINE = new EAElement();
            META_ENVIRONMENT     = new EAElement();
            META_PERMISSION      = new EAElement();
            META_QUERY_PARAMETER = new EAElement();
            META_SERVER          = new EAElement();

            META_API.Name               = RoundTripAddInClass.METAMODEL_API;
            META_RESOURCE.Name          = RoundTripAddInClass.METAMODEL_RESOURCE;
            META_RESOURCE_TYPE.Name     = RoundTripAddInClass.METAMODEL_RESOURCETYPE;
            META_TYPE_FOR_RESOURCE.Name = RoundTripAddInClass.METAMODEL_TYPE_FOR_RESOURCE;
            META_SCHEMA.Name            = RoundTripAddInClass.METAMODEL_SCHEMA;
            META_METHOD.Name            = RoundTripAddInClass.METAMODEL_METHOD;
            META_TRAIT.Name             = RoundTripAddInClass.METAMODEL_TRAIT;
            //META_DATAITEM.Name = RoundTripAddInClass.METAMODEL_DATAITEM;
            META_RELEASEPIPELINE.Name = RoundTripAddInClass.METAMODEL_RELEASEPIPELINE;
            META_ENVIRONMENT.Name     = RoundTripAddInClass.METAMODEL_ENVIRONMENT;
            META_PERMISSION.Name      = RoundTripAddInClass.METAMODEL_PERMISSION;
            META_QUERY_PARAMETER.Name = RoundTripAddInClass.METAMODEL_QUERY_PARAMETER;

            META_SERVER.Name = RoundTripAddInClass.METAMODEL_SERVER;

            apiPackage = new EAPackage("UnitTest");

            object o = apiPackage.Packages.AddNew(RoundTripAddInClass.API_PACKAGE_SCHEMAS, RoundTripAddInClass.EA_TYPE_PACKAGE);

            schemaPackage          = (EAPackage)o;
            schemaPackage.ParentID = apiPackage.PackageID;

            o = apiPackage.Packages.AddNew(RoundTripAddInClass.API_PACKAGE_SAMPLES, RoundTripAddInClass.EA_TYPE_PACKAGE);
            samplesPackage          = (EAPackage)o;
            samplesPackage.ParentID = apiPackage.PackageID;

            o                      = samplesPackage.Packages.AddNew("sample", RoundTripAddInClass.EA_TYPE_PACKAGE);
            samplePackage          = (EAPackage)o;
            samplePackage.ParentID = samplesPackage.PackageID;

            //o = apiPackage.Diagrams.AddNew("API Diagram","");
            //apiDiagram = (EADiagram)o;
            //apiDiagram.Stereotype = RoundTripAddInClass.EA_STEREOTYPE_APIDIAGRAM;

            o                        = schemaPackage.Diagrams.AddNew("Schema Diagram", "");
            schemaDiagram            = (EADiagram)o;
            schemaDiagram.Name       = "Unit Test Schema Diagram";
            schemaDiagram.Stereotype = RoundTripAddInClass.EA_STEREOTYPE_SCHEMADIAGRAM;

            o                        = samplePackage.Diagrams.AddNew("Sample Diagram", "");
            sampleDiagram            = (EADiagram)o;
            sampleDiagram.Name       = "Unit Test Sample Diagram";
            sampleDiagram.Stereotype = RoundTripAddInClass.EA_STEREOTYPE_SAMPLEDIAGRAM;

            //soaPackage = new EAPackage("UnitTestSOA");
            //o = soaPackage.Diagrams.AddNew("SOA Diagram", "");
            //soaDiagram = (EADiagram)o;
            //soaDiagram.Stereotype = RoundTripAddInClass.EA_STEREOTYPE_SOADIAGRAM;

            populationPackage = new EAPackage("PopulationPackage");
            //populationPackage.ParentID = samplesPackage.PackageID;

            o = populationPackage.Diagrams.AddNew("Population Diagram", "");
            populationDiagram            = (EADiagram)o;
            populationDiagram.Name       = "PopulationDiagram";
            populationDiagram.Stereotype = RoundTripAddInClass.EA_STEREOTYPE_POPULATIONDIAGRAM;
        }
Exemple #3
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();
        }