# astah* API User Guide

## [Reference project configuration]

Reference project feature is supported in astah* professional.

#### Adding reference project

1. Open a project file
2. Add reference projects
3. Save as a 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.asta");
            prjAccessor.addReferenceProject("C:\\API\\pro305_ref.asta");

            prjAccessor.saveAs("C:\\API\\pro305_2.asta");

            prjAccessor.close();

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

#### Updating reference project

1. Open a project file
2. Update reference project
3. Save as a 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.asta");

            String path = "C:\\API\\pro305_ref.asta";
            int status = prjAccessor.getReferenceProjectStatus(path);
            if (status == ProjectAccessor.REFERENCE_PROJECT_STATUS_NEED_UPDATE) {
                prjAccessor.updateReferenceProject(path);
            }
            prjAccessor.saveAs("C:\\API\\pro305_2.asta");

            prjAccessor.close();

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

#### Deleting reference project

1. Open a project file
2. Delete a reference project
3. Save as a 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.asta");
            prjAccessor.removeReferenceProject("C:\\API\\pro305_ref.asta");

            prjAccessor.saveAs("C:\\API\\pro305_2.asta");

            prjAccessor.close();

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

#### Clearing reference project

1. Open a project file
2. Clear reference projects
3. Save as a 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.asta");
            prjAccessor.clearReferenceProject("C:\\API\\pro305_ref.asta");

            prjAccessor.saveAs("C:\\API\\pro305_2.asta");

            prjAccessor.close();

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

#### Changing path of reference project

1. Open a project file
2. Change a path of reference projects
3. Save as a 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.asta");
            prjAccessor.changeReferenceProject("C:\\API\\pro305_ref.asta","C:\\API2\\pro305_ref.asta");

            prjAccessor.saveAs("C:\\API\\pro305_2.asta");

            prjAccessor.close();

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

Home