Reference Model Management

Reference Model Management feature is supported only in Astah Professional edition.
For details about this feature, please refer to this post.

1. Adding a reference project

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

public class Test {
  public static void main(String[] args) {
    try {
       ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().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();
    }
  }
}

2. Updating the reference project

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

public class Test {
  public static void main(String[] args) {
    try {
      ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().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();
    }
  }
}

3. Deleting reference project

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

public class Test {
  public static void main(String[] args) {
    try {
      ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().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();
    }
  }
}

4. Clearing reference project

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

  public class Test {
    public static void main(String[] args) {
      try {
        ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().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();
      }
    }
  }

5. Changing path of reference project

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

public class Test {
  public static void main(String[] args) {
    try {
      ProjectAccessor prjAccessor = AstahAPI.getAstahAPI().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();
    }
  }
}