static public void exportMapping(EA.Repository Repository, EA.Diagram diagram, DiagramCache diagramCache)
        {
            try
            {
                DiagramManager.captureDiagramLinks(diagram);

                //logger.log("links captured");
                RepositoryHelper.createDiagramCache(Repository, diagram, diagramCache);
                //logger.log("cache created");
                if (!diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_MAPPINGDIAGRAM))
                {
                    logger.log("exportSample: Ignore diagram that isnt a mapping diagram");
                    return;
                }

                Hashtable ht                   = sampleToJObject(Repository, diagram, diagramCache);
                string    sample               = (string)ht["sample"];
                string    clazz                = (string)ht["class"];
                string    container            = (string)ht["json"];
                string    export               = (string)ht[RoundTripAddInClass.FILENAME];
                string    sourcecontrolPackage = (string)ht[RoundTripAddInClass.PROJECT];

                logger.log("Project:" + sourcecontrolPackage);
                //KeyValuePair<string,JObject> kv = sampleToJObject(Repository, diagram);
                //JObject container = kv.Value;

                if (container == null)
                {
                    MessageBox.Show("No object linked to root with classification sample declared nor  (older style) object of classification Request declared");
                    return;
                }

                //string msg = JsonConvert.SerializeObject(container, Newtonsoft.Json.Formatting.Indented) + "\n";
                EA.Package samplePkg = Repository.GetPackageByID(diagram.PackageID);



                if (fileManager != null)
                {
                    fileManager.initializeAPI(sourcecontrolPackage);
                    fileManager.setDataName(RoundTripAddInClass.MAPPING_PATH);
                    fileManager.setup(RoundTripAddInClass.RAML_0_8);
                    fileManager.exportData(sample, clazz, container, RoundTripAddInClass.MAPPING_PATH, export);
                }
            }
            catch (ModelValidationException ex)
            {
                MessageBox.Show(ex.errors.messages.ElementAt(0).ToString());
            }
        }
示例#2
0
        static public void exportHierarchy(EA.Repository Repository, EA.Diagram diagram, DiagramCache diagramCache)
        {
            try
            {
                if (!diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_HIERARCHYDIAGRAM))
                {
                    logger.log("exportSample: Ignore diagram that isnt a hierarchy diagram");
                    return;
                }

                DiagramManager.captureDiagramLinks(diagram);

                RepositoryHelper.createDiagramCache(Repository, diagram, diagramCache);
                Hashtable ht = sampleToJObject(Repository, diagram, diagramCache);

                string sample      = (string)ht["sample"];
                string clazz       = (string)ht["class"];
                string container   = (string)ht["json"];
                string exportName  = (string)ht[RoundTripAddInClass.FILENAME];
                string projectName = (string)ht[RoundTripAddInClass.PROJECT];


                if (container == null)
                {
                    MessageBox.Show("No object linked to root with classification sample declared nor  (older style) object of classification Request declared");
                    return;
                }

                if (projectName == null)
                {
                    projectName = RoundTripAddInClass.EXPORT_PACKAGE;
                }

                logger.log("saving");
                if (fileManager != null)
                {
                    fileManager.initializeAPI(projectName);
                    fileManager.setDataName(RoundTripAddInClass.HIERARCHY_PATH);
                    fileManager.setup(RoundTripAddInClass.RAML_0_8);
                    fileManager.exportData(sample, clazz, container, RoundTripAddInClass.HIERARCHY_PATH, exportName);
                }
            }catch (ModelValidationException ex) {
                MessageBox.Show(ex.errors.messages.ElementAt(0).ToString());
            }
        }
示例#3
0
        static public void exportConstraint(EA.Repository Repository, EA.Diagram diagram, DiagramCache diagramCache)
        {
            try
            {
                DiagramManager.captureDiagramLinks(diagram);

                RepositoryHelper.createDiagramCache(Repository, diagram, diagramCache);

                if (!diagram.Stereotype.Equals(RoundTripAddInClass.EA_STEREOTYPE_CONSTRAINTDIAGRAM))
                {
                    logger.log("Ignore diagram that isnt a constraint diagram");
                    return;
                }

                Hashtable ht                   = sampleToJObject(Repository, diagram, diagramCache);
                string    sample               = (string)ht["sample"];
                string    clazz                = (string)ht["class"];
                string    container            = (string)ht["json"];
                string    export               = (string)ht[RoundTripAddInClass.FILENAME];
                string    sourcecontrolPackage = (string)ht[RoundTripAddInClass.PROJECT];

                logger.log("Project:" + sourcecontrolPackage);

                if (container == null)
                {
                    MessageBox.Show("No object linked to root with classification sample declared nor  (older style) object of classification Request declared");
                    return;
                }

                EA.Package samplePkg = Repository.GetPackageByID(diagram.PackageID);


                if (fileManager != null)
                {
                    fileManager.initializeAPI(sourcecontrolPackage);
                    fileManager.setDataName(RoundTripAddInClass.CONSTRAINT_PATH);
                    fileManager.setup(RoundTripAddInClass.RAML_0_8);
                    fileManager.exportData(sample, clazz, container, RoundTripAddInClass.CONSTRAINT_PATH, export);
                }
            }
            catch (ModelValidationException ex)
            {
                MessageBox.Show(ex.errors.messages.ElementAt(0).ToString());
            }
        }