# JUDE API User Guide

## [Save as Project, Export/Import XMI]

#### Export XMI

Export JUDE Project file to XMI file (.xml).
Export XMI function is not available in JUDE/Community.

Example of Export XMI

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.open("C:\\API\\pro305.jude");
            prjAccessor.exportXMI("C:\\API\\pro305_xmi.xml");
            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

#### Import XMI

Import XMI project file(.xml) to a JUDE project file.
XMI Import function is not available in JUDE/Community. Ensure to let the ClassPath go through the jar that locates in the JUDE/Professional Install folder\lib to execute XMI Import. Ensure to let the ClassPath go through the jar that locates in the JUDE/Professional Install folder\lib to execute XMI Import.

#### Save as Project

Save as a new project(.jude).

Example of XMI Import and Save as Project

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.importXMI("C:\\API\\pro305_xmi.xml");
            prjAccessor.saveAs("C:\\API\\pro305_2.jude");
            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

#### Using Import/Export XMI in JUDE API

JUDE API for Import/Export XMI is available with the following steps.

Export JUDE project file to XMI - Edit - Import XMI - Save as JUDE project file.

    import com.change_vision.jude.api.inf.project.ProjectAccessor;
    import com.change_vision.jude.api.inf.project.ProjectAccessorFactory;

    public class Test {
      public static void main(String[] args) {
        try {
            ProjectAccessor prjAccessor = ProjectAccessorFactory.getProjectAccessor();

            prjAccessor.open("C:\\API\\pro305.jude");
            prjAccessor.exportXMI("C:\\API\\pro305_xmi.xml");
            prjAccessor.close();

            // Edit

            prjAccessor.importXMI("C:\\API\\pro305_xmi.xml");
            prjAccessor.saveAs("C:\\API\\pro305_2.jude");
            prjAccessor.close();

        } catch (Exception e) {
            e.printStackTrace();
        }
      }
    }

Home