# JUDE API User Guide

## [How to edit models]

We will show you how to edit JUDE models with sample programs in this paragraph.
Please refer to JUDE API JavaDoc for "Class and Usecase Diagram Interface", "ER Diagram Interface", "Mindmap Interface" for more details.
Edit function of JUDE API is not available in JUDE/Community.

Edit class name and definition

      try {
          TransactionManager.beginTransaction();
          BasicModelEditor bme = ModelEditorFactory.getBasicModelEditor();
          // Create a class
          IClass class0 = bme.createClass(project, "class0");
          // Set name
          class0.setName("new class name");
          // Set definition
          class0.setDefinition("Definition of the class");
          TransactionManager.endTransaction();
      } catch (InvalidEditingException e) {
          TransactionManager.abortTransaction();
      }

Edit physical name of ER entity

      IERModel erModel = (IERModel) getElement(project.getOwnedElements(), "ER_Model");
      schema = erModel.getSchemata()[0];
      IEREntity[] entities = schema.getEntities();
      for (int i = 0; i < entities.length; i++) {
          if ("Entity0".equals(entities[i].getName())) {
          try {
             TransactionManager.beginTransaction();
             // Set physical name
             entities[i].setPhysicalName("entity0 physical name");
             TransactionManager.endTransaction();
          } catch (InvalidEditingException e) {
             TransactionManager.abortTransaction();
          }
      }

Home