Example #1
0
 public static void initialCallback() {
   if (preloaded) {
     ui.writeText("Loaded the domain ontology (" + ontofilename + ")");
     ui.writeText("Loaded the information model (" + umlfilename + ")");
     ui.writeText("Loaded the decisions (" + mapfilename + ")");
   }
 }
Example #2
0
  public static void exception() {
    // TODO: Dialog asking for permission?
    File f = new File(umlfilename);
    if (f.delete()) ui.writeText("File " + umlfilename + " was deleted");

    f = new File(mapfilename);
    if (f.delete()) ui.writeText("File " + mapfilename + " was deleted");

    // FIXME: reinitialize some variables

    ui.refreshWorkspace();
  }
Example #3
0
  public static void transformation(String fileAbsolutePath) {
    ontofilename = fileAbsolutePath;
    umlfilename = fileAbsolutePath.replace(".refontouml", " [info].uml");
    mapfilename = fileAbsolutePath.replace(".refontouml", ".dec");

    ontoAbstraction = new RefOntoUMLModelAbstraction();
    umlAbstraction = new UMLModelAbstraction();
    ui = new Onto2InfoInterface();

    try {
      // OntoUML Model
      if (!ontoAbstraction.load(fileAbsolutePath)) {
        System.out.println("Unable to load " + fileAbsolutePath);
        return;
      }

      if (!ontoAbstraction.process()) {
        System.out.println("Unable to process OntoUML model");
        return;
      }

      dh =
          new DecisionHandler(
              ontoAbstraction); // TODO: initialize decisions only if they were not pre-loaded?

      // UML Model, if any
      if (umlAbstraction.load(umlfilename)) {
        // TODO: in case of Exception here, delete the Map and the UML model (this.exception())
        // Loads the user Decisions, the OntoUML<->UML mappings
        Serializer.loadMap(
            ontoAbstraction.resource, umlAbstraction.resource, mapfilename, dh, umlAbstraction);
        preloaded = true;
      } else {
        Onto2InfoMap.initializeMap();
        umlAbstraction.createPrimitiveTypes();
        preloaded = false;
      }

      Transformation t = new Transformation(ontoAbstraction, umlAbstraction, ui);

      ui.load(ontoAbstraction, dh, t, project);
      // Program execution stops here, until the user closes the window
    } catch (Exception e) {
      System.out.println("A terrible execution problem has happened.");
      e.printStackTrace();
    }
  }