From 97374ed180b7a297323210f6db2bb25f4b73fe33 Mon Sep 17 00:00:00 2001 From: Gustavo L Guidoni Date: Wed, 27 Jan 2021 13:15:33 -0300 Subject: [PATCH 01/10] Include OntoUML2DB feature --- .gitignore | 2 + .../unibz/inf/ontouml/vp/OntoUMLPlugin.java | 20 + .../vp/controllers/DBExportController.java | 41 ++ .../vp/controllers/DBExportServerRequest.java | 90 ++++ .../vp/controllers/OBDAExportController.java | 40 ++ .../controllers/OBDAExportServerReques.java | 116 ++++ .../OntoUMLServerAccessController.java | 181 ++++++- .../inf/ontouml/vp/model/DBMSSuported.java | 21 + .../inf/ontouml/vp/model/MappingStrategy.java | 18 + .../vp/model/ProjectConfigurations.java | 203 +++++++ .../inf/ontouml/vp/utils/OBDAResult.java | 107 ++++ .../inf/ontouml/vp/views/DBExportHandler.java | 64 +++ .../inf/ontouml/vp/views/DBExportView.java | 367 +++++++++++++ .../ontouml/vp/views/OBDAExportHandler.java | 64 +++ .../inf/ontouml/vp/views/OBDAExportView.java | 507 ++++++++++++++++++ .../vp/views/ProgressDialogStandard.java | 70 +++ .../inf/ontouml/vp/views/ProgressPanel.java | 3 +- .../resources/icons/toolbar/export_ontop.png | Bin 0 -> 32029 bytes .../icons/toolbar/export_ontop32.ico | Bin 0 -> 32988 bytes .../resources/icons/toolbar/export_schema.png | Bin 0 -> 41089 bytes .../icons/toolbar/export_schema32.ico | Bin 0 -> 32988 bytes src/main/resources/plugin.xml | 28 + 22 files changed, 1940 insertions(+), 2 deletions(-) create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/model/DBMSSuported.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java create mode 100644 src/main/resources/icons/toolbar/export_ontop.png create mode 100644 src/main/resources/icons/toolbar/export_ontop32.ico create mode 100644 src/main/resources/icons/toolbar/export_schema.png create mode 100644 src/main/resources/icons/toolbar/export_schema32.ico diff --git a/.gitignore b/.gitignore index 8f72a36e..45cdb2ca 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ repo/ ontouml-vp-plugin.zip .java-version + +.metadata/ diff --git a/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java b/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java index 1eb9eb50..40e523ec 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java @@ -24,6 +24,8 @@ public class OntoUMLPlugin implements VPPlugin { public static final String PLUGIN_REPO_NAME = "ontouml-vp-plugin"; private static boolean isExportToGUFOWindowOpen; + private static boolean isDBExportWindowOpen; + private static boolean isOBDAExportWindowOpen; private static boolean isConfigWindowOpen; private static ProjectListener projectListener; @@ -31,6 +33,8 @@ public class OntoUMLPlugin implements VPPlugin { public OntoUMLPlugin() { // The constructor of a VPPlugin MUST NOT have parameters. isExportToGUFOWindowOpen = false; + isDBExportWindowOpen = false; + isOBDAExportWindowOpen = false; isConfigWindowOpen = false; System.out.println("OntoUML Plugin (v" + PLUGIN_VERSION_RELEASE + ") loaded successfully."); } @@ -71,4 +75,20 @@ public static void setConfigWindowOpen(boolean open) { public static boolean getConfigWindowOpen() { return isConfigWindowOpen; } + + public static boolean getDBExportWindowOpen() { + return isDBExportWindowOpen; + } + + public static void setDBExportWindowOpen(boolean open) { + isDBExportWindowOpen = open; + } + + public static boolean getOBDAExportWindowOpen() { + return isOBDAExportWindowOpen; + } + + public static void setOBDAExportWindowOpen(boolean open) { + isOBDAExportWindowOpen = open; + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java new file mode 100644 index 00000000..1648af6d --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java @@ -0,0 +1,41 @@ +/** + * Access class of the Generate Schema toolbar button. + * + * Author: Gustavo Ludovico Guidoni + */ +package it.unibz.inf.ontouml.vp.controllers; + +import com.vp.plugin.ApplicationManager; +import com.vp.plugin.action.VPAction; +import com.vp.plugin.action.VPActionController; +import it.unibz.inf.ontouml.vp.OntoUMLPlugin; +import it.unibz.inf.ontouml.vp.views.DBExportHandler; + +public class DBExportController implements VPActionController { + + @Override + public void performAction(VPAction action) { + + DBExportHandler dialog = new DBExportHandler(); + + if( OntoUMLPlugin.getDBExportWindowOpen() == true ) + return; + + OntoUMLPlugin.setDBExportWindowOpen(true); + + ApplicationManager.instance().getViewManager(). showDialog(dialog); + } + + /** + * Called when the menu containing the button is accessed allowing for action + * manipulation, such as enable/disable or selecting the button. + * + * OBS: DOES NOT apply to this class. + */ + @Override + public void update(VPAction arg0) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java new file mode 100644 index 00000000..2d96a465 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java @@ -0,0 +1,90 @@ +package it.unibz.inf.ontouml.vp.controllers; + +import java.awt.FileDialog; +import java.awt.Frame; +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashSet; +import java.util.stream.Collectors; + +import com.vp.plugin.ApplicationManager; + +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; +import it.unibz.inf.ontouml.vp.model.uml.ModelElement; +import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; +import it.unibz.inf.ontouml.vp.views.ProgressDialogStandard; + +public class DBExportServerRequest extends Thread{ + + private ProgressDialogStandard loading; + + private final ProjectConfigurations projectConfigurations = Configurations.getInstance().getProjectConfigurations(); + + @Override + public void run() { + HashSet elements; + try { + + loading = new ProgressDialogStandard(); + loading.setTitle("Generating schema"); + ApplicationManager.instance().getViewManager().showDialog(loading);//This class must extend Thread for the ProgressDialog to be shown properly. + + elements = Configurations.getInstance().getProjectConfigurations().getExportGUFOElementsDiagramTree(); + + final BufferedReader script = OntoUMLServerAccessController.transformToDB( + ModelElement.generateModel(elements, true), + projectConfigurations.getMappingStrategy().toString(), + projectConfigurations.getTargetDBMS().toString(), + projectConfigurations.isStandardizeNames() + ); + + loading.canClosed(); + + if (script != null) { + saveFile(script); + ViewManagerUtils.cleanAndShowMessage("Object-relational mapping performed successfully."); + } else { + ViewManagerUtils.cleanAndShowMessage("Unable to generate the files. Please check your model."); + } + + } catch (Exception e) { + e.printStackTrace(); + loading.canClosed(); + } + } + + private void saveFile(BufferedReader buffer) throws IOException { + final Configurations configs = Configurations.getInstance(); + final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); + final FileDialog fd = + new FileDialog( + (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), + "Choose destination", + FileDialog.SAVE); + + String suggestedFolderPath = projectConfigurations.getExportFolderPath(); + String exportFormatExtension = ".sql"; + String suggestedFileName = ApplicationManager.instance().getProjectManager().getProject().getName() + exportFormatExtension; + + fd.setDirectory(suggestedFolderPath); + fd.setFile(suggestedFileName); + fd.setVisible(true); + + if (fd.getDirectory() != null && fd.getFile() != null) { + final String fileDirectory = fd.getDirectory(); + final String fileName = + !fd.getFile().endsWith(exportFormatExtension) + ? fd.getFile() + exportFormatExtension + : fd.getFile(); + final String output = buffer.lines().collect(Collectors.joining("\n")); + + Files.write(Paths.get(fileDirectory, fileName), output.getBytes()); + projectConfigurations.setExportFolderPath(fileDirectory); + configs.save(); + } + } + +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java new file mode 100644 index 00000000..2519b519 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java @@ -0,0 +1,40 @@ +/** + * Access class of the Integration with Ontop toolbar button. + * + * Author: Gustavo Ludovico Guidoni + */ +package it.unibz.inf.ontouml.vp.controllers; + +import com.vp.plugin.ApplicationManager; +import com.vp.plugin.action.VPAction; +import com.vp.plugin.action.VPActionController; +import it.unibz.inf.ontouml.vp.OntoUMLPlugin; +import it.unibz.inf.ontouml.vp.views.OBDAExportHandler; + +public class OBDAExportController implements VPActionController { + + @Override + public void performAction(VPAction action) { + + OBDAExportHandler dialog = new OBDAExportHandler(); + + if( OntoUMLPlugin.getOBDAExportWindowOpen() == true ) + return; + + OntoUMLPlugin.setOBDAExportWindowOpen(true); + + ApplicationManager.instance().getViewManager().showDialog (dialog); + } + + /** + * Called when the menu containing the button is accessed allowing for action + * manipulation, such as enable/disable or selecting the button. + * + * OBS: DOES NOT apply to this class. + */ + @Override + public void update(VPAction arg0) { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java new file mode 100644 index 00000000..7ef4a0a0 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java @@ -0,0 +1,116 @@ +package it.unibz.inf.ontouml.vp.controllers; + +import java.awt.FileDialog; +import java.awt.Frame; +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashSet; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.vp.plugin.ApplicationManager; + +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; +import it.unibz.inf.ontouml.vp.model.uml.ModelElement; +import it.unibz.inf.ontouml.vp.utils.OBDAResult; +import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; +import it.unibz.inf.ontouml.vp.views.ProgressDialogStandard; + +public class OBDAExportServerReques extends Thread{ + + private ProgressDialogStandard loading; + + private final ProjectConfigurations projectConfigurations = Configurations.getInstance().getProjectConfigurations(); + + @Override + public void run() { + HashSet elements; + try { + + loading = new ProgressDialogStandard(); + loading.setTitle("Generating the files"); + ApplicationManager.instance().getViewManager().showDialog(loading);//This class must extend Thread for the ProgressDialog to be shown properly. + + elements = Configurations.getInstance().getProjectConfigurations().getExportGUFOElementsDiagramTree(); + + final BufferedReader buffer = OntoUMLServerAccessController.generateODBAFile( + ModelElement.generateModel(elements, true), + projectConfigurations.getMappingStrategy().toString(), + projectConfigurations.getTargetDBMS().toString(), + projectConfigurations.isStandardizeNames(), + projectConfigurations.getExportGUFOIRI(), + projectConfigurations.isGenerateSchema(), + projectConfigurations.isGenerateConnection(), + projectConfigurations.getHostNameConnection(), + projectConfigurations.getDatabaseNameConnection(), + projectConfigurations.getUserNameConnection(), + projectConfigurations.getPassword() + ); + + loading.canClosed(); + + if (buffer != null) { + saveFile(buffer); + ViewManagerUtils.cleanAndShowMessage("OBDA mapping performed successfully."); + } else { + ViewManagerUtils.cleanAndShowMessage("Unable to generate the OBDA mapping. Please check your model and parameters."); + } + + } catch (Exception e) { + e.printStackTrace(); + loading.canClosed(); + } + } + + private void saveFile(BufferedReader buffer) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + String json = buffer.lines().collect(Collectors.joining("\n")); + + OBDAResult result = objectMapper.readValue(json, OBDAResult.class); + + final Configurations configs = Configurations.getInstance(); + final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); + final FileDialog fd = + new FileDialog( + (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), + "Choose destination", + FileDialog.SAVE); + + String suggestedFolderPath = projectConfigurations.getExportFolderPath(); + String suggestedFileName = ApplicationManager.instance().getProjectManager().getProject().getName(); + String fileName; + + fd.setDirectory(suggestedFolderPath); + fd.setFile(suggestedFileName); + fd.setVisible(true); + + if (fd.getDirectory() != null && fd.getFile() != null) { + + if(fd.getFile().indexOf('.') == -1) { + fileName = fd.getFile(); + } + else { + fileName = fd.getFile().substring(0, fd.getFile().lastIndexOf('.')); + } + + if( projectConfigurations.isGenerateSchema() ) { + Files.write(Paths.get(fd.getDirectory(), fileName+".sql"), result.getSchema().getBytes() ); + } + + if( projectConfigurations.isGenerateConnection() ) { + Files.write(Paths.get(fd.getDirectory(), fileName+".properties"), result.getConnection().getBytes() ); + } + + Files.write(Paths.get(fd.getDirectory(), fileName+".obda"), result.getObdaFile().getBytes() ); + + projectConfigurations.setExportFolderPath(fd.getDirectory()); + configs.save(); + } + + } + +} + diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java index c69f06e7..d16e7a40 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java @@ -28,6 +28,8 @@ public class OntoUMLServerAccessController { private static final String TRANSFORM_GUFO_SERVICE_ENDPOINT = "/v1/transform/gufo"; + private static final String TRANSFORM_DB_SERVICE_ENDPOINT = "/v1/transform/db"; + private static final String TRANSFORM_OBDA_SERVICE_ENDPOINT = "/v1/transform/obda"; private static final String VERIFICATION_SERVICE_ENDPOINT = "/v1/verify"; private static final String USER_MESSAGE_BAD_REQUEST = "There was a internal plugin error and the verification could not be completed."; @@ -37,7 +39,7 @@ public class OntoUMLServerAccessController { "Error sending model verification to the server."; private static final String USER_MESSAGE_UNKNOWN_ERROR_RESPONSE = "Error receiving model verification response."; - + public static BufferedReader transformToGUFO( String model, String baseIRI, @@ -89,6 +91,7 @@ public static BufferedReader transformToGUFO( loading.shown(); try { + final HttpURLConnection request = request(url, body); final BufferedReader responseReader = request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST @@ -284,4 +287,180 @@ private static HttpURLConnection request(String urlString, String body) return request; } + + + + public static BufferedReader transformToDB( + String model, + String mappingStrategy, + String targetDBMS, + boolean isStandardizeNames) throws Exception { + + final JsonObject optionsObj = new JsonObject(); + + optionsObj.addProperty("mappingStrategy", mappingStrategy); + optionsObj.addProperty("targetDBMS", targetDBMS); + optionsObj.addProperty("isStandardizeNames", isStandardizeNames); + + final JsonObject bodyObj = new JsonObject(); + bodyObj.add("options", optionsObj); + bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); + + final GsonBuilder builder = new GsonBuilder(); + final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); + final String body = gson.toJson(bodyObj); + + final ProjectConfigurations configurations = Configurations.getInstance().getProjectConfigurations(); + final String url; + + if (configurations.isCustomServerEnabled()) { + url = configurations.getServerURL() + TRANSFORM_DB_SERVICE_ENDPOINT; + } else { + url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_DB_SERVICE_ENDPOINT; + } + + try { + final HttpURLConnection request = request(url, body); + final BufferedReader responseReader = + request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST + ? new BufferedReader(new InputStreamReader(request.getInputStream())) + : new BufferedReader(new InputStreamReader(request.getErrorStream())); + + switch (request.getResponseCode()) { + case HttpURLConnection.HTTP_OK: + if (!request.getContentType().equals("text/html")) { + return responseReader; + } else { + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + } + case HttpURLConnection.HTTP_BAD_REQUEST: + ViewManagerUtils.exportToGUFOIssueDialog( + "Unable to transform the model due to an unexpected error.\n"+ + "Please check the model for any syntactical errors.\n\n"+ + "Warning: partially exporting models to gUFO may introduce syntactical errors."); + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception( + "Unable to transform the model due to an unexpected error.\n"+ + "Please check the model for any syntactical errors.\n\n"+ + "Warning: partially exporting models to gUFO may introduce syntactical errors.") + .printStackTrace(); + return null; + case HttpURLConnection.HTTP_NOT_FOUND: + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + case HttpURLConnection.HTTP_INTERNAL_ERROR: //500 + System.out.println(responseReader.lines().collect(Collectors.joining())); + ViewManagerUtils.exportToGUFOIssueDialog("Oops! Something went wrong. \n" + + "Please check the model for any syntactical errors.\n" + //+ "If the problem persists, open a ticket with a case that simulates this problem." + ); + new Exception("Server error" ).printStackTrace(); + return null; + default: + ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); + throw new Exception("Unknown error"); + } + } catch (MalformedURLException e) { + ViewManagerUtils.exportToGUFOIssueDialog("Server error."); + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + public static BufferedReader generateODBAFile( + String model, + String mappingStrategy, + String targetDBMS, + boolean isStandardizeNames, + String baseIRI, + boolean isGenerateSchema, + boolean generateConnection, + String hostName, + String databaseName, + String userConnection, + String passwordConnection) throws Exception { + + final JsonObject optionsObj = new JsonObject(); + + optionsObj.addProperty("mappingStrategy", mappingStrategy); + optionsObj.addProperty("targetDBMS", targetDBMS); + optionsObj.addProperty("isStandardizeNames", isStandardizeNames); + optionsObj.addProperty("baseIri", baseIRI); + optionsObj.addProperty("isGenerateSchema", isGenerateSchema); + optionsObj.addProperty("generateConnection", generateConnection); + optionsObj.addProperty("hostName", hostName); + optionsObj.addProperty("databaseName", databaseName); + optionsObj.addProperty("userConnection", userConnection); + optionsObj.addProperty("passwordConnection", passwordConnection); + + final JsonObject bodyObj = new JsonObject(); + bodyObj.add("options", optionsObj); + bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); + + final GsonBuilder builder = new GsonBuilder(); + final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); + final String body = gson.toJson(bodyObj); + + final ProjectConfigurations configurations = Configurations.getInstance().getProjectConfigurations(); + final String url; + + if (configurations.isCustomServerEnabled()) { + url = configurations.getServerURL() + TRANSFORM_OBDA_SERVICE_ENDPOINT; + } else { + url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_OBDA_SERVICE_ENDPOINT; + } + try { + final HttpURLConnection request = request(url, body); + final BufferedReader responseReader = + request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST + ? new BufferedReader(new InputStreamReader(request.getInputStream())) + : new BufferedReader(new InputStreamReader(request.getErrorStream())); + + switch (request.getResponseCode()) { + case HttpURLConnection.HTTP_OK: + if (!request.getContentType().equals("text/html")) { + return responseReader; + } else { + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + } + case HttpURLConnection.HTTP_BAD_REQUEST: + ViewManagerUtils.exportToGUFOIssueDialog( + "Unable to transform the model due to an unexpected error.\n"+ + "Please check the model for any syntactical errors.\n\n"+ + "Warning: partially exporting models to gUFO may introduce syntactical errors."); + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception( + "Unable to transform the model due to an unexpected error.\n"+ + "Please check the model for any syntactical errors.\n\n"+ + "Warning: partially exporting models to gUFO may introduce syntactical errors.") + .printStackTrace(); + return null; + case HttpURLConnection.HTTP_NOT_FOUND: + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + case HttpURLConnection.HTTP_INTERNAL_ERROR: + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server error.").printStackTrace(); + return null; + default: + ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); + throw new Exception("Unknown error"); + } + } catch (MalformedURLException e) { + ViewManagerUtils.exportToGUFOIssueDialog("Server error."); + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DBMSSuported.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DBMSSuported.java new file mode 100644 index 00000000..f4b58ff0 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DBMSSuported.java @@ -0,0 +1,21 @@ +package it.unibz.inf.ontouml.vp.model; + +public enum DBMSSuported { + GENERIC_SCHEMA("Generic Schema"), + MYSQL("MySql"), + H2("H2"), + SQLSERVER("SqlServer"), + ORACLE("Oracle"), + POSTGREE("Postgree"); + + private final String display; + + private DBMSSuported(String s) { + display = s; + } + + @Override + public String toString() { + return display; + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java b/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java new file mode 100644 index 00000000..06ce700b --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java @@ -0,0 +1,18 @@ +/** Author: Gustavo Ludovico Guidoni */ +package it.unibz.inf.ontouml.vp.model; + +public enum MappingStrategy { + ONE_TABLE_PER_CLASS("One Table per Class"), + ONE_TABLE_PER_KIND("One Table per Kind"); + + private final String display; + + private MappingStrategy(String s) { + display = s; + } + + @Override + public String toString() { + return display; + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java index 9c4cc3ef..c73488a1 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java @@ -24,6 +24,11 @@ public class ProjectConfigurations { public static final String DEFAULT_EXPORT_FILENAME = ""; public static final String DEFAULT_GUFO_EXPORT_PATH = System.getProperty("user.home"); public static final String DEFAULT_GUFO_EXPORT_FILENAME = ""; + public static final DBMSSuported DEFAULT_DBMS = DBMSSuported.GENERIC_SCHEMA; + public static final MappingStrategy DEFAULT_MAPPING_STRATEGY = MappingStrategy.ONE_TABLE_PER_KIND; + public static final boolean DEFAULT_STANTDARDIZE_NAMES = true; + public static final boolean DEFAULT_GENERATE_SCHEMA = true; + public static final boolean DEFAULT_GENERATE_CONNECTION = false; @SerializedName("projectId") @Expose() @@ -116,6 +121,44 @@ public class ProjectConfigurations { @SerializedName("ignoreAssociationInversionWarning") @Expose() private boolean ignoreAssociationInversionWarning; + + //Transformation properties for Relational Schema + @SerializedName("mappingStrategy") + @Expose() + private MappingStrategy mappingStrategy; + + @SerializedName("targetDBMS") + @Expose() + private DBMSSuported targetDBMS; + + @SerializedName("standarizeNames") + @Expose() + private boolean standardizeNames; + + @SerializedName("generateSchema") + @Expose() + private boolean generateSchema; + + @SerializedName("generateConnection") + @Expose() + private boolean generateConnection; + + @SerializedName("hostNameConnection") + @Expose() + private String hostNameConnection; + + @SerializedName("databaseConnection") + @Expose() + private String databaseConnection; + + @SerializedName("userConnection") + @Expose() + private String userConnection; + + @SerializedName("passwordConnectino") + @Expose() + private String passwordConnectino; + /** Constructor without args to be called when deserializing project settings. */ public ProjectConfigurations() { @@ -154,6 +197,12 @@ public void setDefaultValues() { this.isSmartModellingEnabled = ProjectConfigurations.DEFAULT_IS_AUTOMATIC_MODELLING_ENABLED; this.ignoreAssociationInversionWarning = ProjectConfigurations.DEFAULT_IGNORE_ASSOCIATION_INVERSION_WARNING; + + this.targetDBMS = ProjectConfigurations.DEFAULT_DBMS; + this.mappingStrategy = ProjectConfigurations.DEFAULT_MAPPING_STRATEGY; + this.standardizeNames = ProjectConfigurations.DEFAULT_STANTDARDIZE_NAMES; + this.generateSchema = ProjectConfigurations.DEFAULT_GENERATE_SCHEMA; + this.generateConnection = ProjectConfigurations.DEFAULT_GENERATE_CONNECTION; } /** @@ -425,4 +474,158 @@ public boolean ignoreAssociationInversionWarning() { public void setIgnoreAssociationInversionWarning(boolean ignoreAssociationInversionWarning) { this.ignoreAssociationInversionWarning = ignoreAssociationInversionWarning; } + + /** + * Informs the mapping strategy for the relational schema. + * + * @param mappingStrategy + */ + public void setMappingStrategy(MappingStrategy mappingStrategy) { + this.mappingStrategy = mappingStrategy; + } + + /** + * Returns the mapping strategy for the relational schema. + * @return MappingStrategy + */ + public MappingStrategy getMappingStrategy() { + return this.mappingStrategy; + } + + /** + * Checks whether the nomenclature will be standardized in the database. + * @return boolean + */ + public boolean isStandardizeNames() { + return standardizeNames; + } + + /** + * Informs if the nomenclature will be standardized in the database. + * @param standarizeNames + */ + public void setStandardizeNames(boolean standarizeNames) { + this.standardizeNames = standarizeNames; + } + + /** + * Returns the target DBMS for generating the files. + * @return DBMSSuported + */ + public DBMSSuported getTargetDBMS() { + return targetDBMS; + } + + /** + * Informs the target DBMS for generating the files. + * + * @param targetDBMS + */ + public void setTargetDBMS(DBMSSuported targetDBMS) { + this.targetDBMS = targetDBMS; + } + + /** + * Returns if it is necessary to generate the relational schema for the ontology. + * + * @return boolean + */ + public boolean isGenerateSchema() { + return generateSchema; + } + + /** + * Informs if it is necessary to generate the relational schema for the ontology. + * @param generateSchema + */ + public void setGenerateSchema(boolean generateSchema) { + this.generateSchema = generateSchema; + } + + /** + * Returns if it is necessary to generate the connection for the database. + * + * @return boolean + */ + public boolean isGenerateConnection() { + return generateConnection; + } + + /** + * Informs if it is necessary to generate the connection for the database. + * @param generateConnection + */ + public void setGenerateConnection(boolean generateConnection) { + this.generateConnection = generateConnection; + } + + /** + * Returns the host name connection. + * + * @return string + */ + public String getHostNameConnection() { + return hostNameConnection; + } + + /** + * Informs the host name connection. + * @param hostName + */ + public void setHostNameConnection(String hostName) { + this.hostNameConnection = hostName; + } + + /** + * Returns the database name connection. + * + * @return string + */ + public String getDatabaseNameConnection() { + return databaseConnection; + } + + /** + * Informs the database name connection. + * @param databaseName + */ + public void setDatabaseNameConnection(String databaseName) { + this.databaseConnection = databaseName; + } + + /** + * Returns the user name connection. + * + * @return string + */ + public String getUserNameConnection() { + return userConnection; + } + + /** + * Informs the user name connection. + * @param userName + */ + public void setUserNameConnection(String userName) { + this.userConnection = userName; + } + + /** + * Returns the password connection. + * + * @return string + */ + public String getPassword() { + return passwordConnectino; + } + + /** + * Informs the password connection. + * @param password + */ + public void setPassword(String password) { + this.passwordConnectino = password; + } + + } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java b/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java new file mode 100644 index 00000000..ed6c96d0 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java @@ -0,0 +1,107 @@ +package it.unibz.inf.ontouml.vp.utils; + +import java.io.BufferedReader; +import java.io.IOException; + +public class OBDAResult { + + private String schema; + private String obdaFile; + private String connection; + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getSchema() { + return schema; + } + + public void setObdaFile(String obdaFile) { + this.obdaFile = obdaFile; + } + + public String getObdaFile() { + return obdaFile; + } + + public void setConnection(String connection) { + this.connection = connection; + } + + public String getConnection() { + return connection; + } + + /* + private String schema; + private String obdaFile; + private String connection; + private BufferedReader buffer; + + public OBDAResult(BufferedReader buffer) { + this.buffer = buffer; + putVariables(); + } + + public String getSchema() { + return schema; + } + + public String getOBDAFile() { + return obdaFile; + } + + private void putVariables() { + StringBuilder auxSchema = new StringBuilder(); + StringBuilder auxObda = new StringBuilder(); + + int value; + try { + value = buffer.read(); + + while ((char) value != '|' && value != -1) { + auxObda.append((char) value); + value = buffer.read(); + } + + while ((value = buffer.read()) != -1) { + auxSchema.append((char) value); + } + schema = auxSchema.toString().trim(); + obdaFile = auxObda.toString().trim(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } + } + + private void putVariables() { + StringBuilder auxVar = new StringBuilder(); + StringBuilder auxValue = new StringBuilder(); + char val; + + val = getChar(); + + if(val == '{') { + + } + + } + + private char getChar() { + int val; + try { + if ((val = buffer.read()) != -1 ) { + return (char)val; + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return '|'; + + } + */ +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java new file mode 100644 index 00000000..b6ab17b4 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java @@ -0,0 +1,64 @@ +/** + * Class responsible for displaying the graphical interface for exporting the OntoUML model to the relational schema. + * + * Author: Gustavo Ludovico Guidoni + */ +package it.unibz.inf.ontouml.vp.views; + +import java.awt.Component; + +import com.vp.plugin.view.IDialog; +import com.vp.plugin.view.IDialogHandler; + +import it.unibz.inf.ontouml.vp.OntoUMLPlugin; +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; + +public class DBExportHandler implements IDialogHandler { + + private DBExportView view; + + + /** + * Called when the dialog is closed by the user clicking on the close button of + * the frame. + */ + @Override + public boolean canClosed() { + OntoUMLPlugin.setDBExportWindowOpen(false); + ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); + return true; + } + + /** + * Called once before the dialog is shown. Developer should return the content + * of the dialog (similar to the content pane). + */ + @Override + public Component getComponent() { + view = new DBExportView(Configurations.getInstance().getProjectConfigurations()); + return view; + } + + /** + * Called after the getComponent(). A dialog is created on Visual Paradigm + * internally (it still not shown out). Developer can set the outlook of the + * dialog on prepare(). + */ + @Override + public void prepare(IDialog dialog) { + dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate Schema"); + dialog.setModal(false); + dialog.setResizable(false); + dialog.setSize(view.getWidth(), view.getHeight()); + view.setContainerDialog(dialog); + } + + /** + * Called when the dialog is shown. + */ + @Override + public void shown() { + // TODO Auto-generated method stub + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java new file mode 100644 index 00000000..ea0815dc --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java @@ -0,0 +1,367 @@ +/** + * Graphical interface designed to collect data for the transformation of OntoUml to the relational + * schema. + * + * Author: Gustavo Ludovico Guidoni + */ +package it.unibz.inf.ontouml.vp.views; + +import com.vp.plugin.diagram.IDiagramUIModel; +import com.vp.plugin.model.IModelElement; +import com.vp.plugin.view.IDialog; +import it.unibz.inf.ontouml.vp.OntoUMLPlugin; +import it.unibz.inf.ontouml.vp.controllers.DBExportServerRequest; +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.DBMSSuported; +import it.unibz.inf.ontouml.vp.model.MappingStrategy; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; +import it.unibz.inf.ontouml.vp.model.ServerRequest; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.util.HashSet; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JScrollPane; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; + +public class DBExportView extends javax.swing.JPanel { + private static final long serialVersionUID = 1L; + + private HashSet elementsDiagramTree = new HashSet<>(); + + private IDialog parentContainer; + private ProjectConfigurations configurations; + private JCheckBoxTree diagramTree; + + private javax.swing.ButtonGroup btgMappingStrategy; + private javax.swing.JButton btnCancel; + private javax.swing.JButton btnGenerateSchema; + private javax.swing.JComboBox cbxDBMS; + private javax.swing.JCheckBox cbxStandarizeNames; + private javax.swing.JPanel diagramPanel; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jpanDiagram; + private javax.swing.JRadioButton rbtOneTablePerClass; + private javax.swing.JRadioButton rbtOntTablePerKind; + + public DBExportView(ProjectConfigurations configurations) { + initComponents(); + + this.configurations = configurations; + + updateComponentsValues(configurations); + } + + private void initComponents() { + + // ************************************* + // Manually generated code. + // ************************************* + setSize(new Dimension(500, 360)); + + diagramPanel = new javax.swing.JPanel(); + diagramTree = new JCheckBoxTree("diagram"); + + JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); + scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + diagramPanel.add(scrollableTextAreaDiagram); + + diagramPanel.setLayout(new GridLayout(1, 1)); + diagramPanel.setPreferredSize(new Dimension(100, 100)); + + // ************************************* + // Automatically generated code. + // ************************************* + + + btgMappingStrategy = new javax.swing.ButtonGroup(); + jPanel3 = new javax.swing.JPanel(); + btnGenerateSchema = new javax.swing.JButton(); + btnCancel = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + jPanel2 = new javax.swing.JPanel(); + cbxDBMS = new javax.swing.JComboBox<>(); + jPanel1 = new javax.swing.JPanel(); + rbtOneTablePerClass = new javax.swing.JRadioButton(); + rbtOntTablePerKind = new javax.swing.JRadioButton(); + cbxStandarizeNames = new javax.swing.JCheckBox(); + jLabel1 = new javax.swing.JLabel(); + jpanDiagram = new javax.swing.JPanel(); + + + jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + btnGenerateSchema.setText("Generate Schema"); + + btnCancel.setText("Cancel"); + btnCancel.setMaximumSize(new java.awt.Dimension(117, 23)); + btnCancel.setMinimumSize(new java.awt.Dimension(117, 23)); + btnCancel.setPreferredSize(new java.awt.Dimension(117, 23)); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addGap(48, 48, 48) + .addComponent(btnGenerateSchema, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(50, 50, 50)) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel3Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(btnGenerateSchema, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("DBMS: ")); + + cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addComponent(cbxDBMS, 0, 142, Short.MAX_VALUE) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); + + btgMappingStrategy.add(rbtOneTablePerClass); + rbtOneTablePerClass.setText("One Table per Class"); + + btgMappingStrategy.add(rbtOntTablePerKind); + rbtOntTablePerKind.setSelected(true); + rbtOntTablePerKind.setText("One Table per Kind"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerClass) + .addComponent(rbtOntTablePerKind)) + .addContainerGap(35, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(rbtOneTablePerClass) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(rbtOntTablePerKind) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + cbxStandarizeNames.setSelected(true); + cbxStandarizeNames.setText("Standardize the names for the database"); + + jLabel1.setText("eg.: 'PersonalCustomer' to 'personal_customer'."); + + jpanDiagram.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram:")); + + javax.swing.GroupLayout diagramPanelLayout = new javax.swing.GroupLayout(diagramPanel); + //diagramPanel.setLayout(diagramPanelLayout); + diagramPanelLayout.setHorizontalGroup( + diagramPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + diagramPanelLayout.setVerticalGroup( + diagramPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE) + ); + + javax.swing.GroupLayout jpanDiagramLayout = new javax.swing.GroupLayout(jpanDiagram); + jpanDiagram.setLayout(jpanDiagramLayout); + jpanDiagramLayout.setHorizontalGroup( + jpanDiagramLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + jpanDiagramLayout.setVerticalGroup( + jpanDiagramLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(cbxStandarizeNames, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)) + .addGroup(jPanel4Layout.createSequentialGroup() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent(jpanDiagram, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()))) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jpanDiagram, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbxStandarizeNames) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + + // ************************************* + // Manually generated code. + // ************************************* + + + btnCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + + btnGenerateSchema.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnGenerateSchemaActionPerformed(evt); + } + }); + } + + /** Sets a direct reference to the container dialog after initialization. */ + public void setContainerDialog(IDialog dialog) { + parentContainer = dialog; + } + + private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) { + parentContainer.close(); + OntoUMLPlugin.setDBExportWindowOpen(false); + } + + private void btnGenerateSchemaActionPerformed(java.awt.event.ActionEvent evt) { + saveSelectedElements(); + updateConfigurationsValues(configurations); + Configurations.getInstance().save(); + parentContainer.close(); + OntoUMLPlugin.setDBExportWindowOpen(false); + // Thread thread = new Thread(request); + // thread.start(); + (new DBExportServerRequest()).start(); + } + + /** Updates project configurations with components' information. */ + private void updateConfigurationsValues(ProjectConfigurations configurations) { + + configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); + + if (rbtOneTablePerClass.isSelected()) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); + else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); + + configurations.setTargetDBMS((DBMSSuported) cbxDBMS.getSelectedItem()); + + configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); + } + + /** + * Updates components with project configurations' information. + * + * @param configurations + */ + private void updateComponentsValues(ProjectConfigurations configurations) { + + if(configurations.getExportGUFOElementsDiagramTree() != null) + diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); + + if (configurations.getMappingStrategy() != null && !configurations.getMappingStrategy().equals("")) { + if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) + rbtOneTablePerClass.setSelected(true); + else + rbtOntTablePerKind.setSelected(true); + } + + if (configurations.getTargetDBMS() != null && !configurations.getTargetDBMS().equals("")) + cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); + + cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); + } + + private void saveSelectedElements() { + TreePath[] paths; + + paths = diagramTree.getCheckedPaths(); + + for (TreePath path : paths) { + Object[] object = path.getPath(); + for (Object o : object) { + + if (o instanceof DefaultMutableTreeNode) { + + DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; + + if (node.getUserObject() instanceof IModelElement) + this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); + + if (node.getUserObject() instanceof IDiagramUIModel) + this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); + } + } + } + + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java new file mode 100644 index 00000000..328050bd --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java @@ -0,0 +1,64 @@ +/** + * Class responsible for displaying the graphical interface for integrating the OntoUML model with Ontop. + * + * Author: Gustavo Ludovico Guidoni + */ +package it.unibz.inf.ontouml.vp.views; + +import java.awt.Component; + +import com.vp.plugin.view.IDialog; +import com.vp.plugin.view.IDialogHandler; + +import it.unibz.inf.ontouml.vp.OntoUMLPlugin; +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; + +public class OBDAExportHandler implements IDialogHandler { + + private OBDAExportView view; + + + /** + * Called when the dialog is closed by the user clicking on the close button of + * the frame. + */ + @Override + public boolean canClosed() { + OntoUMLPlugin.setOBDAExportWindowOpen(false); + ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); + return true; + } + + /** + * Called once before the dialog is shown. Developer should return the content + * of the dialog (similar to the content pane). + */ + @Override + public Component getComponent() { + view = new OBDAExportView(Configurations.getInstance().getProjectConfigurations()); + return view; + } + + /** + * Called after the getComponent(). A dialog is created on Visual Paradigm + * internally (it still not shown out). Developer can set the outlook of the + * dialog on prepare(). + */ + @Override + public void prepare(IDialog dialog) { + dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate OBDA file"); + dialog.setModal(false); + dialog.setResizable(false); + dialog.setSize(view.getWidth(), view.getHeight()); + view.setContainerDialog(dialog); + } + + /** + * Called when the dialog is shown. + */ + @Override + public void shown() { + // TODO Auto-generated method stub + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java new file mode 100644 index 00000000..e9100d8d --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java @@ -0,0 +1,507 @@ +package it.unibz.inf.ontouml.vp.views; + +import java.awt.Dimension; +import java.awt.GridLayout; +import java.util.HashSet; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; + +import com.vp.plugin.diagram.IDiagramUIModel; +import com.vp.plugin.model.IModelElement; +import com.vp.plugin.view.IDialog; + +import it.unibz.inf.ontouml.vp.OntoUMLPlugin; +import it.unibz.inf.ontouml.vp.controllers.OBDAExportServerReques; +import it.unibz.inf.ontouml.vp.model.DBMSSuported; +import it.unibz.inf.ontouml.vp.model.MappingStrategy; +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; + +public class OBDAExportView extends javax.swing.JPanel { + + private static final long serialVersionUID = 1L; + + private ProjectConfigurations configurations; + private JCheckBoxTree diagramTree; + private IDialog parentContainer; + private HashSet elementsDiagramTree = new HashSet<>(); + + private javax.swing.JComboBox cbxDBMS; + private javax.swing.JCheckBox jcbGenerateRelationalSchema; + private javax.swing.JCheckBox jcbStandarizeNames; + private javax.swing.JPanel diagramPanel; + private javax.swing.ButtonGroup groupStrategy; + private javax.swing.JCheckBox jcbGenerateConnection; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JButton jbtnCancel; + private javax.swing.JButton jbtnGenerateFiles; + private javax.swing.JTextField jtfBaseIRI; + private javax.swing.JTextField jtfDatabase; + private javax.swing.JTextField jtfHost; + private javax.swing.JTextField jtfPassword; + private javax.swing.JTextField jtfUser; + private javax.swing.JPanel panSchemaParams; + private javax.swing.JRadioButton rbtOneTablePerClass; + private javax.swing.JRadioButton rbtOntTablePerKind; + + + + public OBDAExportView(ProjectConfigurations configurations) { + initComponents(); + + this.configurations = configurations; + + updateComponentsValues(); + } + + private void initComponents() { + // ************************************* + // Manually generated code. + // ************************************* + setSize(new Dimension(465, 500)); + + diagramPanel = new javax.swing.JPanel(); + diagramTree = new JCheckBoxTree("diagram"); + + JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); + scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + diagramPanel.add(scrollableTextAreaDiagram); + + diagramPanel.setLayout(new GridLayout(1, 1)); + diagramPanel.setPreferredSize(new Dimension(100, 100)); + + // ************************************* + // Automatically generated code. + // ************************************* + groupStrategy = new javax.swing.ButtonGroup(); + panSchemaParams = new javax.swing.JPanel(); + jPanel1 = new javax.swing.JPanel(); + rbtOneTablePerClass = new javax.swing.JRadioButton(); + rbtOntTablePerKind = new javax.swing.JRadioButton(); + jcbStandarizeNames = new javax.swing.JCheckBox(); + jLabel1 = new javax.swing.JLabel(); + jcbGenerateRelationalSchema = new javax.swing.JCheckBox(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel2 = new javax.swing.JPanel(); + cbxDBMS = new javax.swing.JComboBox<>(); + jLabel3 = new javax.swing.JLabel(); + jPanel5 = new javax.swing.JPanel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jtfHost = new javax.swing.JTextField(); + jtfUser = new javax.swing.JTextField(); + jtfDatabase = new javax.swing.JTextField(); + jtfPassword = new javax.swing.JTextField(); + jcbGenerateConnection = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jtfBaseIRI = new javax.swing.JTextField(); + jbtnGenerateFiles = new javax.swing.JButton(); + jbtnCancel = new javax.swing.JButton(); + + panSchemaParams.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters for relational schema: ")); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); + + groupStrategy.add(rbtOneTablePerClass); + rbtOneTablePerClass.setText("One Table per Class"); + + groupStrategy.add(rbtOntTablePerKind); + rbtOntTablePerKind.setSelected(true); + rbtOntTablePerKind.setText("One Table per Kind"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerClass) + .addComponent(rbtOntTablePerKind)) + .addContainerGap(52, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(rbtOneTablePerClass) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(rbtOntTablePerKind) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jcbStandarizeNames.setSelected(true); + jcbStandarizeNames.setText("Standardize database names"); + + jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); + + jcbGenerateRelationalSchema.setSelected(true); + jcbGenerateRelationalSchema.setText("Generate database script"); + + cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); + + jLabel3.setText("Name"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel3) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(cbxDBMS, 0, 145, Short.MAX_VALUE)) + .addContainerGap()) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(90, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("DBMS", jPanel2); + + jLabel4.setText("Host :"); + + jLabel5.setText("Database :"); + jLabel5.setToolTipText(""); + + jLabel6.setText("User :"); + + jLabel7.setText("Passoword :"); + + jcbGenerateConnection.setSelected(false); + jcbGenerateConnection.setText("Generate the connection"); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel6)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jtfUser) + .addComponent(jtfPassword))) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel4) + .addGap(34, 34, 34) + .addComponent(jtfHost)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jcbGenerateConnection) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfDatabase))) + .addContainerGap()) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateConnection) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(jtfHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(jtfDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(jtfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(jtfPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Conection", jPanel5); + + javax.swing.GroupLayout panSchemaParamsLayout = new javax.swing.GroupLayout(panSchemaParams); + panSchemaParams.setLayout(panSchemaParamsLayout); + panSchemaParamsLayout.setHorizontalGroup( + panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(panSchemaParamsLayout.createSequentialGroup() + .addContainerGap() + .addGroup(panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jcbStandarizeNames, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(panSchemaParamsLayout.createSequentialGroup() + .addComponent(jcbGenerateRelationalSchema) + .addGap(16, 16, 16))) + .addGroup(panSchemaParamsLayout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jTabbedPane1) + .addContainerGap()) + ); + panSchemaParamsLayout.setVerticalGroup( + panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panSchemaParamsLayout.createSequentialGroup() + .addGroup(panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(panSchemaParamsLayout.createSequentialGroup() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(15, 15, 15) + .addComponent(jcbStandarizeNames) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jcbGenerateRelationalSchema)) + .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Paramters for OBDA file: ")); + + jLabel2.setText("Base IRI:"); + + jtfBaseIRI.setText("http://example.com"); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel4Layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jtfBaseIRI))) + .addContainerGap()) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jtfBaseIRI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE) + .addContainerGap()) + ); + + jbtnGenerateFiles.setText("Generate Ontop Files"); + jbtnGenerateFiles.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnGenerateFiles.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnGenerateFiles.setPreferredSize(new java.awt.Dimension(135, 29)); + + jbtnCancel.setText("Cancel"); + jbtnCancel.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setPreferredSize(new java.awt.Dimension(135, 29)); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(41, 41, 41) + .addComponent(jbtnGenerateFiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(45, 45, 45)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(panSchemaParams, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(panSchemaParams, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jbtnGenerateFiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap()) + ); + + // ************************************* + // Manually generated code. + // ************************************* + + jbtnGenerateFiles.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jbtnGenerateFilesActionPerformed(evt); + } + }); + + jbtnCancel.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jbtnCancelActionPerformed(evt); + } + }); + + } + + private void jbtnGenerateFilesActionPerformed(java.awt.event.ActionEvent evt) { + + if(jcbGenerateConnection.isSelected() && + ( + jtfHost.getText().trim().equals("") || + jtfDatabase.getText().trim().equals("") || + jtfUser.getText().trim().equals("") || + jtfPassword.getText().trim().equals("") + ) + ) { + JOptionPane.showMessageDialog(null ,"Host, database, user and password must be filled in.", "Error", JOptionPane.ERROR_MESSAGE); + return; + } + + if( (DBMSSuported) cbxDBMS.getSelectedItem() == DBMSSuported.GENERIC_SCHEMA && jcbGenerateConnection.isSelected() ) { + JOptionPane.showMessageDialog(null ,"It is not possible to generate the connection file for the generic database.", "Error", JOptionPane.ERROR_MESSAGE); + return; + } + + saveSelectedElements(); + updateConfigurationsValues(); + Configurations.getInstance().save(); + parentContainer.close(); + OntoUMLPlugin.setOBDAExportWindowOpen(false); + ( new OBDAExportServerReques() ).start(); + } + + private void jbtnCancelActionPerformed(java.awt.event.ActionEvent evt) { + parentContainer.close(); + OntoUMLPlugin.setOBDAExportWindowOpen(false); + } + + /** Sets a direct reference to the container dialog after initialization. */ + public void setContainerDialog(IDialog dialog) { + this.parentContainer = dialog; + } + + /** Updates project configurations with components' information. */ + private void updateConfigurationsValues() { + configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); + + if( rbtOntTablePerKind.isSelected() ) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); + else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); + + configurations.setTargetDBMS( (DBMSSuported) cbxDBMS.getSelectedItem() ); + + configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); + + configurations.setStandardizeNames(jcbStandarizeNames.isSelected()); + + configurations.setGenerateSchema(jcbGenerateRelationalSchema.isSelected()); + + configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); + + configurations.setHostNameConnection(jtfHost.getText().trim()); + + configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); + + configurations.setUserNameConnection(jtfUser.getText().trim()); + + configurations.setPassword(jtfPassword.getText().trim()); + } + + /** + * Updates components with project configurations' information. + * + * @param configurations + */ + private void updateComponentsValues() { + + if(configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_KIND) + rbtOntTablePerKind.setSelected(true); + else + rbtOneTablePerClass.setSelected(true); + + if(configurations.getTargetDBMS() != null) + cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); + + if(configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) + jtfBaseIRI.setText(configurations.getExportGUFOIRI()); + + if(configurations.getExportGUFOElementsDiagramTree() != null) + diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); + + jcbStandarizeNames.setSelected(configurations.isStandardizeNames()); + + jcbGenerateRelationalSchema.setSelected(configurations.isGenerateSchema()); + + jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); + + jtfHost.setText(configurations.getHostNameConnection()); + + jtfDatabase.setText(configurations.getDatabaseNameConnection()); + + jtfUser.setText(configurations.getUserNameConnection()); + + jtfPassword.setText(configurations.getPassword()); + } + + private void saveSelectedElements() { + TreePath[] paths; + + paths = diagramTree.getCheckedPaths(); + + for (TreePath path : paths) { + Object[] object = path.getPath(); + for (Object o : object) { + + if (o instanceof DefaultMutableTreeNode) { + + DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; + + if (node.getUserObject() instanceof IModelElement) + this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); + + if (node.getUserObject() instanceof IDiagramUIModel) + this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); + } + } + } + + } + +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java new file mode 100644 index 00000000..3e82b8e7 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java @@ -0,0 +1,70 @@ +package it.unibz.inf.ontouml.vp.views; + +import java.awt.Component; + +import it.unibz.inf.ontouml.vp.model.ServerRequest; +import com.vp.plugin.view.IDialog; +import com.vp.plugin.view.IDialogHandler; + +public class ProgressDialogStandard implements IDialogHandler{ + + private IDialog mainDialog; + private ProgressPanel progressPanel; + private String title; + private int width; + private int height; + + public ProgressDialogStandard( ) { + progressPanel = new ProgressPanel( "Contacting Server..." ); + title = "Working..."; + width = progressPanel.getWidth(); + height = progressPanel.getHeight(); + } + + public ProgressDialogStandard(ServerRequest serverRequest) { + progressPanel = new ProgressPanel(serverRequest); + title = "Working..."; + width = progressPanel.getWidth(); + height = progressPanel.getHeight(); + } + + public void setTitle(String txt) { + title = txt; + } + + public void setWidth(int w) { + width = w; + } + + public void setHeight(int h) { + height = h; + } + + @Override + public boolean canClosed() { + mainDialog.close(); + return true; + } + + @Override + public Component getComponent() { + return progressPanel; + } + + @Override + public void prepare(IDialog dialog) { + mainDialog = dialog; + mainDialog.setModal(false); + mainDialog.setResizable(false); + mainDialog.setTitle(title); + dialog.setSize( width , height ); + progressPanel.setContainerDialog(mainDialog); + } + + @Override + public void shown() { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java index b3ba5636..c207ab1f 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java @@ -20,7 +20,7 @@ public class ProgressPanel extends JPanel { private JProgressBar progressBar; private JButton btnCancel; private IDialog _dialog; - + public ProgressPanel(String text) { setSize(new Dimension(200, 100)); @@ -39,6 +39,7 @@ public ProgressPanel(String text) { public ProgressPanel(ServerRequest request) { this("Contacting Server..."); + setSize(new Dimension(200, 120));//Add 20 to the height because add a button btnCancel = new JButton("Cancel"); btnCancel.addActionListener( diff --git a/src/main/resources/icons/toolbar/export_ontop.png b/src/main/resources/icons/toolbar/export_ontop.png new file mode 100644 index 0000000000000000000000000000000000000000..c09854e0364a0293ec6f8c6131323af35041536f GIT binary patch literal 32029 zcmd3NWl&sQux8A?^ z`%y*BOr4oNySw*Zy;@F~l7bWlDhVn802tDr#Z>?R7Wx(zKt_bVT)EFYKwn^-Ris3L z@-eal=m&Un5qS{+sES5=GDLuWMsfJ80N`CMEiUrKUH^C$$&aiz zf#>YD*vpLDB7rUtWMY|sEJ=h;q>0c8-(O>r`Sx$t$Impp8Qm#$;|J{A+_9A`%jwhR zkJ$Abh~i3`{@5ZkjHR^LR3H>n%jv)q&-IcNf)Ek^)kV(Dmw>f{V&dbmt8Z>?#pUHR z(8c`kAEN}BpePTCmn%fMuP=XpkAlb)f}40&q!#`3w~G-4049#Hfp48NMGfwX!t11nL5(=-X_)C_=|9&^L`I}tf4y4FAozCJf%IkL_zNSI|7QrEy7&TEm#8oqpR zbKQ%5^V2Kv{!N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zi>|h>_M-D2%(>!wupNJSi6u>@eyGi*)^z235odF!Gq5H=O82@#LFiU%|-DTPY3-YJuB^v@Tn>6awijLB&9(oG84L83-;1HTT$?G zoH@AgeKY)euZNsD0cEDsT~ju9=rNlId-L&okaW1G)yzl!fV&Q_gbsW$?qOPB<{KQ) z<=+clqXe-4zGRZg(`d5r^~*UaQfd;Kt(+8A^hKmwAsU`j+V(r>qizLHR0=)VWa4}5 zQeYAG`!RUup$`|q58MPD(sU>6&Ed<`XrxEOtbLk!~;y-Xl#7gD9x8vtH(f(Hk z@tuO`HsLqdhCOL5OSkgD16Dq;g?&>@w2_mlAIrmjX%^m_N@HgEILje_^yk<&{>?Ir z6kg1}DNd8tUt)${3iv<9N!uSY6s=cmSSZinX>2n|O)t?qJ+rcgtfE=&j@dSJp zepfeoKlY}Di^tuxu&kpt*}*3_&eC4JnZ7MWJIv0~#uq^o-@;vYA6fYA-Dtx6jEfuQ zWnT0Qt3OklvYTiledGU+aFy+u4SVl0z3RR&R+i#fx?y{X*0D5vH$nDW&%XPLLC5AS zhP;S)$!uNfN}@M7-&M}Q`l?I$70{i|)~C$C*?;pK-S9f}eNyu$o<0&~5*SEeAc27d z1`-%ZU?72k1O^fqNMIm=fdmE;7)W3sfq?`D5*SEeAc27d1`-%ZU?72k1O^fqNMIm= XfdmE;7)W3sfq?`D5*YY;Vc`D(ZB9=+ literal 0 HcmV?d00001 diff --git a/src/main/resources/icons/toolbar/export_schema.png b/src/main/resources/icons/toolbar/export_schema.png new file mode 100644 index 0000000000000000000000000000000000000000..e6dfb7d790fe4f7ab634b9a661daed1c2c7b1db7 GIT binary patch literal 41089 zcmX_nby(B?_x1`HJ-TBcT}ns^j7AX!r5mNYJ4S;@sdNe`-Q6H4-K8{0cXvFK&-4BL zF~+WI@AHat?i2Sp3s-(6kBdc#1pokWpDW0`0RTX#e?b5!I_mAjef$db26TEOF9j$W zq~1h*fS5@tNdf@n(bzXeXsFMa_6k}~003UczZbB}F3%VM$RvF(BdO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#DmJN977Wu4|t zl8T&Zt2`($l9N-;qWl|EsUBP6ZIQIiUhRu#AP`f|?56cAQ+Swwuz_{kXv|WOAZZm$ zpGZC7^{mhh4o5_eN8`Ic?)dR|t3v1*Se&FiA(i#Rl7nwxEF`9JZcev`m2xK$CJ{90ZyJPnX%d>)1Oh&3R?!l@K8kU6 zg*tjqs&Oa#QytFSyB1qtEpru?Gb%!_Lg~(yPP;3#TX_aLnDZE(E@c#Q(IeKodeJJn z7wj)8XR_;KEQzS(fKx4q=zbr}DyP(9&*3ezox_lHH0SXn;?Fi;>Dt;_9CVDJPB3Sb z1#T_fc|t_!>o?!&avJW&a*cVaz|PK~`%y^?3DN<)#1By2EM2JHY(sKzq#~D~An)M1 z?_+IGX4^70VLXi-n>vT2=JqLsYEJm+OntvYWWn7$JEkoiF#kYBL*>qgSZZdRI^vUK zLVQ1mDVoDoH?d)O#KWCmk_oTAT2}V2?lm>?_q-YGBAhbz@O&dixmGm5@o{qG0e9d7 zbnw{{^1$IVDZ;mo{L}2%7h75WKAoTX$Q~tXz#o;2N!|UT8nDpKd_uSUc~0POrgXjI zbkS<_JI1|+``n)k0AeKQK-%L*PDQcZ7%nQlh<8Pp(A(I-d_OluH^nQW^W_rl-sLrk zN|NRqgL`{j=LymkaU?Zv-Oe+a3uAm1EA#o=GH1+SU@0qol1~*r=s!)XLi9OM1x#G! zsCQa?m%Alo!d~-`U&(Git?(6A~|Ef{{cwId?Nq= literal 0 HcmV?d00001 diff --git a/src/main/resources/icons/toolbar/export_schema32.ico b/src/main/resources/icons/toolbar/export_schema32.ico new file mode 100644 index 0000000000000000000000000000000000000000..283454cdb187c644abe8119f0bc8051717283f80 GIT binary patch literal 32988 zcmeHP33yc1*&eHZ>rz|0Sz9;wp^A_MF|uSbNoMBGlCZf(TdP0RVkDV+@62QaK`|{h;xvRWZDKHQB&)a1Gf2@*!g-xn_%YtN;gRj}-;6gzP zmO0$j|8%&+gRk`L21b5*zvP@X|08&+Y&K8z{eoDv-X{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L$)B& zsMNko{$mBNcZ?p10{LZr~Xm7wi4VNmH%E8;XKZg54*$?i^A zLXKPpc>jw%4bMYAxJvt`U4b8wYYMS^v?Ej^Ugl%OisSrD-+auOC(zDvyBywxxwHaj z;!WZFQds^K!o2i#@KegJY zJl_Xu{bFDupS7RKyQ9Efa`3tI{2gujRe2r^_Y0)wt-anU*I1}S@eDDo4qnZ9zEvZz zAD(MM|9;k>3-cd0^?GjR;GQ?>-$&jjjd``FwW#i+llvnOa-@pdrID_R(^%?_G`yX8F6FTZT9R8tsJk2 z-FxK`;d1z8lIG~&Yxfu5yyVPuas7KXZ}D4GW|y_<`3S#$o@l) zY%y>3ec(N8Ld!CXaduDM+E%#Xcla^ieFXJG4r@^l+FMEa9WuiV=Ht&%xcm&WyuoA< z%TqI48?M57d;5wz4=HJ`4K2zx4}u(f zi`DJF#hPE8Z7f)Kp;k{vSNL+rPBSGfgDklQKHbI9bc&AZi1wXw5+_s-q^`(Gb}^I+ zdc?Eq9^&2~*xK%g&3e9iM$XucXQTQyf83J;`uC#KyRDz$u>FIXN#DREji0(21Uo7)ba^p2Lt>I&?FJh?_K zPydMIyBBBn%>o_20sF(#V571_7P}RE|8em8F|em{Kl;mBd9z%zz#@m|Y0qjsa+L|b zj9Xx5m}vJvCi2#fa^^LiRbg`1ZBLi$U)S-;_aUFvePQC}%OP7~A87UK z8LlmmyGv9%pq3wWZ2COti@468W=vW{dISINSbjH;UEd?aRZ$B&bshXtFBuD4ueTD! zoK8zkyc@p%hUv!sRcO0;{&3$N_IIDoJ>FV-@oO9daSX&U5XV3q191$*F%ZW<90PF- z#4!-ZKpX>c48$=I$3PqdaSX&U5XV3q191$*F%ZW<90PF-#4!-ZKpX>c48$=I$3Pqd IKYa}RKOYJg(*OVf literal 0 HcmV?d00001 diff --git a/src/main/resources/plugin.xml b/src/main/resources/plugin.xml index d09c52eb..5e6da27e 100644 --- a/src/main/resources/plugin.xml +++ b/src/main/resources/plugin.xml @@ -49,6 +49,7 @@ menuPath="it.unibz.inf.ontouml.vp.actionset1.toolbar1/it.unibz.inf.ontouml.vp.actionset1.menu1/#"> + + + + + + + + + + + + Date: Wed, 27 Jan 2021 16:18:42 +0000 Subject: [PATCH 02/10] Google Java Format --- .../unibz/inf/ontouml/vp/OntoUMLPlugin.java | 16 +- .../vp/controllers/DBExportController.java | 52 +- .../vp/controllers/DBExportServerRequest.java | 156 +-- .../vp/controllers/OBDAExportController.java | 51 +- .../controllers/OBDAExportServerReques.java | 213 +-- .../OntoUMLServerAccessController.java | 348 ++--- .../vp/model/ProjectConfigurations.java | 339 ++--- .../inf/ontouml/vp/utils/OBDAResult.java | 200 ++- .../inf/ontouml/vp/views/DBExportHandler.java | 94 +- .../inf/ontouml/vp/views/DBExportView.java | 801 +++++++----- .../ontouml/vp/views/OBDAExportHandler.java | 94 +- .../inf/ontouml/vp/views/OBDAExportView.java | 1149 ++++++++++------- .../vp/views/ProgressDialogStandard.java | 116 +- .../inf/ontouml/vp/views/ProgressPanel.java | 4 +- 14 files changed, 1963 insertions(+), 1670 deletions(-) diff --git a/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java b/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java index 40e523ec..cf4d60e5 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java @@ -75,20 +75,20 @@ public static void setConfigWindowOpen(boolean open) { public static boolean getConfigWindowOpen() { return isConfigWindowOpen; } - + public static boolean getDBExportWindowOpen() { - return isDBExportWindowOpen; + return isDBExportWindowOpen; } - + public static void setDBExportWindowOpen(boolean open) { - isDBExportWindowOpen = open; + isDBExportWindowOpen = open; } - + public static boolean getOBDAExportWindowOpen() { - return isOBDAExportWindowOpen; + return isOBDAExportWindowOpen; } - + public static void setOBDAExportWindowOpen(boolean open) { - isOBDAExportWindowOpen = open; + isOBDAExportWindowOpen = open; } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java index 1648af6d..dbbb3330 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java @@ -1,7 +1,7 @@ /** * Access class of the Generate Schema toolbar button. - * - * Author: Gustavo Ludovico Guidoni + * + *

Author: Gustavo Ludovico Guidoni */ package it.unibz.inf.ontouml.vp.controllers; @@ -13,29 +13,27 @@ public class DBExportController implements VPActionController { - @Override - public void performAction(VPAction action) { - - DBExportHandler dialog = new DBExportHandler(); - - if( OntoUMLPlugin.getDBExportWindowOpen() == true ) - return; - - OntoUMLPlugin.setDBExportWindowOpen(true); - - ApplicationManager.instance().getViewManager(). showDialog(dialog); - } - - /** - * Called when the menu containing the button is accessed allowing for action - * manipulation, such as enable/disable or selecting the button. - * - * OBS: DOES NOT apply to this class. - */ - @Override - public void update(VPAction arg0) { - // TODO Auto-generated method stub - - } - + @Override + public void performAction(VPAction action) { + + DBExportHandler dialog = new DBExportHandler(); + + if (OntoUMLPlugin.getDBExportWindowOpen() == true) return; + + OntoUMLPlugin.setDBExportWindowOpen(true); + + ApplicationManager.instance().getViewManager().showDialog(dialog); + } + + /** + * Called when the menu containing the button is accessed allowing for action manipulation, such + * as enable/disable or selecting the button. + * + *

OBS: DOES NOT apply to this class. + */ + @Override + public void update(VPAction arg0) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java index 2d96a465..a60a0cdf 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java @@ -1,5 +1,11 @@ package it.unibz.inf.ontouml.vp.controllers; +import com.vp.plugin.ApplicationManager; +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; +import it.unibz.inf.ontouml.vp.model.uml.ModelElement; +import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; +import it.unibz.inf.ontouml.vp.views.ProgressDialogStandard; import java.awt.FileDialog; import java.awt.Frame; import java.io.BufferedReader; @@ -9,82 +15,84 @@ import java.util.HashSet; import java.util.stream.Collectors; -import com.vp.plugin.ApplicationManager; +public class DBExportServerRequest extends Thread { -import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; -import it.unibz.inf.ontouml.vp.model.uml.ModelElement; -import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; -import it.unibz.inf.ontouml.vp.views.ProgressDialogStandard; + private ProgressDialogStandard loading; -public class DBExportServerRequest extends Thread{ - - private ProgressDialogStandard loading; - - private final ProjectConfigurations projectConfigurations = Configurations.getInstance().getProjectConfigurations(); - - @Override - public void run() { - HashSet elements; - try { - - loading = new ProgressDialogStandard(); - loading.setTitle("Generating schema"); - ApplicationManager.instance().getViewManager().showDialog(loading);//This class must extend Thread for the ProgressDialog to be shown properly. - - elements = Configurations.getInstance().getProjectConfigurations().getExportGUFOElementsDiagramTree(); - - final BufferedReader script = OntoUMLServerAccessController.transformToDB( - ModelElement.generateModel(elements, true), - projectConfigurations.getMappingStrategy().toString(), - projectConfigurations.getTargetDBMS().toString(), - projectConfigurations.isStandardizeNames() - ); - - loading.canClosed(); - - if (script != null) { - saveFile(script); - ViewManagerUtils.cleanAndShowMessage("Object-relational mapping performed successfully."); - } else { - ViewManagerUtils.cleanAndShowMessage("Unable to generate the files. Please check your model."); - } - - } catch (Exception e) { - e.printStackTrace(); - loading.canClosed(); - } - } - - private void saveFile(BufferedReader buffer) throws IOException { - final Configurations configs = Configurations.getInstance(); - final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); - final FileDialog fd = - new FileDialog( - (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), - "Choose destination", - FileDialog.SAVE); - - String suggestedFolderPath = projectConfigurations.getExportFolderPath(); - String exportFormatExtension = ".sql"; - String suggestedFileName = ApplicationManager.instance().getProjectManager().getProject().getName() + exportFormatExtension; - - fd.setDirectory(suggestedFolderPath); - fd.setFile(suggestedFileName); - fd.setVisible(true); - - if (fd.getDirectory() != null && fd.getFile() != null) { - final String fileDirectory = fd.getDirectory(); - final String fileName = - !fd.getFile().endsWith(exportFormatExtension) - ? fd.getFile() + exportFormatExtension - : fd.getFile(); - final String output = buffer.lines().collect(Collectors.joining("\n")); - - Files.write(Paths.get(fileDirectory, fileName), output.getBytes()); - projectConfigurations.setExportFolderPath(fileDirectory); - configs.save(); - } + private final ProjectConfigurations projectConfigurations = + Configurations.getInstance().getProjectConfigurations(); + + @Override + public void run() { + HashSet elements; + try { + + loading = new ProgressDialogStandard(); + loading.setTitle("Generating schema"); + ApplicationManager.instance() + .getViewManager() + .showDialog( + loading); // This class must extend Thread for the ProgressDialog to be shown + // properly. + + elements = + Configurations.getInstance() + .getProjectConfigurations() + .getExportGUFOElementsDiagramTree(); + + final BufferedReader script = + OntoUMLServerAccessController.transformToDB( + ModelElement.generateModel(elements, true), + projectConfigurations.getMappingStrategy().toString(), + projectConfigurations.getTargetDBMS().toString(), + projectConfigurations.isStandardizeNames()); + + loading.canClosed(); + + if (script != null) { + saveFile(script); + ViewManagerUtils.cleanAndShowMessage("Object-relational mapping performed successfully."); + } else { + ViewManagerUtils.cleanAndShowMessage( + "Unable to generate the files. Please check your model."); + } + + } catch (Exception e) { + e.printStackTrace(); + loading.canClosed(); } + } + + private void saveFile(BufferedReader buffer) throws IOException { + final Configurations configs = Configurations.getInstance(); + final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); + final FileDialog fd = + new FileDialog( + (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), + "Choose destination", + FileDialog.SAVE); + + String suggestedFolderPath = projectConfigurations.getExportFolderPath(); + String exportFormatExtension = ".sql"; + String suggestedFileName = + ApplicationManager.instance().getProjectManager().getProject().getName() + + exportFormatExtension; + fd.setDirectory(suggestedFolderPath); + fd.setFile(suggestedFileName); + fd.setVisible(true); + + if (fd.getDirectory() != null && fd.getFile() != null) { + final String fileDirectory = fd.getDirectory(); + final String fileName = + !fd.getFile().endsWith(exportFormatExtension) + ? fd.getFile() + exportFormatExtension + : fd.getFile(); + final String output = buffer.lines().collect(Collectors.joining("\n")); + + Files.write(Paths.get(fileDirectory, fileName), output.getBytes()); + projectConfigurations.setExportFolderPath(fileDirectory); + configs.save(); + } + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java index 2519b519..8c18233a 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java @@ -1,7 +1,7 @@ /** * Access class of the Integration with Ontop toolbar button. - * - * Author: Gustavo Ludovico Guidoni + * + *

Author: Gustavo Ludovico Guidoni */ package it.unibz.inf.ontouml.vp.controllers; @@ -13,28 +13,27 @@ public class OBDAExportController implements VPActionController { - @Override - public void performAction(VPAction action) { - - OBDAExportHandler dialog = new OBDAExportHandler(); - - if( OntoUMLPlugin.getOBDAExportWindowOpen() == true ) - return; - - OntoUMLPlugin.setOBDAExportWindowOpen(true); - - ApplicationManager.instance().getViewManager().showDialog (dialog); - } - - /** - * Called when the menu containing the button is accessed allowing for action - * manipulation, such as enable/disable or selecting the button. - * - * OBS: DOES NOT apply to this class. - */ - @Override - public void update(VPAction arg0) { - // TODO Auto-generated method stub - - } + @Override + public void performAction(VPAction action) { + + OBDAExportHandler dialog = new OBDAExportHandler(); + + if (OntoUMLPlugin.getOBDAExportWindowOpen() == true) return; + + OntoUMLPlugin.setOBDAExportWindowOpen(true); + + ApplicationManager.instance().getViewManager().showDialog(dialog); + } + + /** + * Called when the menu containing the button is accessed allowing for action manipulation, such + * as enable/disable or selecting the button. + * + *

OBS: DOES NOT apply to this class. + */ + @Override + public void update(VPAction arg0) { + // TODO Auto-generated method stub + + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java index 7ef4a0a0..107b241b 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java @@ -1,116 +1,123 @@ package it.unibz.inf.ontouml.vp.controllers; -import java.awt.FileDialog; -import java.awt.Frame; -import java.io.BufferedReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashSet; -import java.util.stream.Collectors; - import com.fasterxml.jackson.databind.ObjectMapper; import com.vp.plugin.ApplicationManager; - import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; import it.unibz.inf.ontouml.vp.model.uml.ModelElement; import it.unibz.inf.ontouml.vp.utils.OBDAResult; import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; import it.unibz.inf.ontouml.vp.views.ProgressDialogStandard; +import java.awt.FileDialog; +import java.awt.Frame; +import java.io.BufferedReader; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashSet; +import java.util.stream.Collectors; -public class OBDAExportServerReques extends Thread{ - - private ProgressDialogStandard loading; - - private final ProjectConfigurations projectConfigurations = Configurations.getInstance().getProjectConfigurations(); - - @Override - public void run() { - HashSet elements; - try { - - loading = new ProgressDialogStandard(); - loading.setTitle("Generating the files"); - ApplicationManager.instance().getViewManager().showDialog(loading);//This class must extend Thread for the ProgressDialog to be shown properly. - - elements = Configurations.getInstance().getProjectConfigurations().getExportGUFOElementsDiagramTree(); - - final BufferedReader buffer = OntoUMLServerAccessController.generateODBAFile( - ModelElement.generateModel(elements, true), - projectConfigurations.getMappingStrategy().toString(), - projectConfigurations.getTargetDBMS().toString(), - projectConfigurations.isStandardizeNames(), - projectConfigurations.getExportGUFOIRI(), - projectConfigurations.isGenerateSchema(), - projectConfigurations.isGenerateConnection(), - projectConfigurations.getHostNameConnection(), - projectConfigurations.getDatabaseNameConnection(), - projectConfigurations.getUserNameConnection(), - projectConfigurations.getPassword() - ); - - loading.canClosed(); - - if (buffer != null) { - saveFile(buffer); - ViewManagerUtils.cleanAndShowMessage("OBDA mapping performed successfully."); - } else { - ViewManagerUtils.cleanAndShowMessage("Unable to generate the OBDA mapping. Please check your model and parameters."); - } - - } catch (Exception e) { - e.printStackTrace(); - loading.canClosed(); - } - } - - private void saveFile(BufferedReader buffer) throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - String json = buffer.lines().collect(Collectors.joining("\n")); - - OBDAResult result = objectMapper.readValue(json, OBDAResult.class); - - final Configurations configs = Configurations.getInstance(); - final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); - final FileDialog fd = - new FileDialog( - (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), - "Choose destination", - FileDialog.SAVE); - - String suggestedFolderPath = projectConfigurations.getExportFolderPath(); - String suggestedFileName = ApplicationManager.instance().getProjectManager().getProject().getName(); - String fileName; - - fd.setDirectory(suggestedFolderPath); - fd.setFile(suggestedFileName); - fd.setVisible(true); - - if (fd.getDirectory() != null && fd.getFile() != null) { - - if(fd.getFile().indexOf('.') == -1) { - fileName = fd.getFile(); - } - else { - fileName = fd.getFile().substring(0, fd.getFile().lastIndexOf('.')); - } - - if( projectConfigurations.isGenerateSchema() ) { - Files.write(Paths.get(fd.getDirectory(), fileName+".sql"), result.getSchema().getBytes() ); - } - - if( projectConfigurations.isGenerateConnection() ) { - Files.write(Paths.get(fd.getDirectory(), fileName+".properties"), result.getConnection().getBytes() ); - } - - Files.write(Paths.get(fd.getDirectory(), fileName+".obda"), result.getObdaFile().getBytes() ); - - projectConfigurations.setExportFolderPath(fd.getDirectory()); - configs.save(); - } - +public class OBDAExportServerReques extends Thread { + + private ProgressDialogStandard loading; + + private final ProjectConfigurations projectConfigurations = + Configurations.getInstance().getProjectConfigurations(); + + @Override + public void run() { + HashSet elements; + try { + + loading = new ProgressDialogStandard(); + loading.setTitle("Generating the files"); + ApplicationManager.instance() + .getViewManager() + .showDialog( + loading); // This class must extend Thread for the ProgressDialog to be shown + // properly. + + elements = + Configurations.getInstance() + .getProjectConfigurations() + .getExportGUFOElementsDiagramTree(); + + final BufferedReader buffer = + OntoUMLServerAccessController.generateODBAFile( + ModelElement.generateModel(elements, true), + projectConfigurations.getMappingStrategy().toString(), + projectConfigurations.getTargetDBMS().toString(), + projectConfigurations.isStandardizeNames(), + projectConfigurations.getExportGUFOIRI(), + projectConfigurations.isGenerateSchema(), + projectConfigurations.isGenerateConnection(), + projectConfigurations.getHostNameConnection(), + projectConfigurations.getDatabaseNameConnection(), + projectConfigurations.getUserNameConnection(), + projectConfigurations.getPassword()); + + loading.canClosed(); + + if (buffer != null) { + saveFile(buffer); + ViewManagerUtils.cleanAndShowMessage("OBDA mapping performed successfully."); + } else { + ViewManagerUtils.cleanAndShowMessage( + "Unable to generate the OBDA mapping. Please check your model and parameters."); + } + + } catch (Exception e) { + e.printStackTrace(); + loading.canClosed(); } - + } + + private void saveFile(BufferedReader buffer) throws IOException { + ObjectMapper objectMapper = new ObjectMapper(); + String json = buffer.lines().collect(Collectors.joining("\n")); + + OBDAResult result = objectMapper.readValue(json, OBDAResult.class); + + final Configurations configs = Configurations.getInstance(); + final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); + final FileDialog fd = + new FileDialog( + (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), + "Choose destination", + FileDialog.SAVE); + + String suggestedFolderPath = projectConfigurations.getExportFolderPath(); + String suggestedFileName = + ApplicationManager.instance().getProjectManager().getProject().getName(); + String fileName; + + fd.setDirectory(suggestedFolderPath); + fd.setFile(suggestedFileName); + fd.setVisible(true); + + if (fd.getDirectory() != null && fd.getFile() != null) { + + if (fd.getFile().indexOf('.') == -1) { + fileName = fd.getFile(); + } else { + fileName = fd.getFile().substring(0, fd.getFile().lastIndexOf('.')); + } + + if (projectConfigurations.isGenerateSchema()) { + Files.write(Paths.get(fd.getDirectory(), fileName + ".sql"), result.getSchema().getBytes()); + } + + if (projectConfigurations.isGenerateConnection()) { + Files.write( + Paths.get(fd.getDirectory(), fileName + ".properties"), + result.getConnection().getBytes()); + } + + Files.write( + Paths.get(fd.getDirectory(), fileName + ".obda"), result.getObdaFile().getBytes()); + + projectConfigurations.setExportFolderPath(fd.getDirectory()); + configs.save(); + } + } } - diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java index d16e7a40..8db9c8f4 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java @@ -39,7 +39,7 @@ public class OntoUMLServerAccessController { "Error sending model verification to the server."; private static final String USER_MESSAGE_UNKNOWN_ERROR_RESPONSE = "Error receiving model verification response."; - + public static BufferedReader transformToGUFO( String model, String baseIRI, @@ -91,7 +91,7 @@ public static BufferedReader transformToGUFO( loading.shown(); try { - + final HttpURLConnection request = request(url, body); final BufferedReader responseReader = request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST @@ -287,180 +287,184 @@ private static HttpURLConnection request(String urlString, String body) return request; } - - public static BufferedReader transformToDB( - String model, - String mappingStrategy, - String targetDBMS, - boolean isStandardizeNames) throws Exception { - - final JsonObject optionsObj = new JsonObject(); - - optionsObj.addProperty("mappingStrategy", mappingStrategy); - optionsObj.addProperty("targetDBMS", targetDBMS); - optionsObj.addProperty("isStandardizeNames", isStandardizeNames); - - final JsonObject bodyObj = new JsonObject(); - bodyObj.add("options", optionsObj); - bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); - - final GsonBuilder builder = new GsonBuilder(); - final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); - final String body = gson.toJson(bodyObj); - - final ProjectConfigurations configurations = Configurations.getInstance().getProjectConfigurations(); - final String url; - - if (configurations.isCustomServerEnabled()) { - url = configurations.getServerURL() + TRANSFORM_DB_SERVICE_ENDPOINT; - } else { - url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_DB_SERVICE_ENDPOINT; - } - - try { - final HttpURLConnection request = request(url, body); - final BufferedReader responseReader = - request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST - ? new BufferedReader(new InputStreamReader(request.getInputStream())) - : new BufferedReader(new InputStreamReader(request.getErrorStream())); - - switch (request.getResponseCode()) { - case HttpURLConnection.HTTP_OK: - if (!request.getContentType().equals("text/html")) { - return responseReader; - } else { - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - } - case HttpURLConnection.HTTP_BAD_REQUEST: - ViewManagerUtils.exportToGUFOIssueDialog( - "Unable to transform the model due to an unexpected error.\n"+ - "Please check the model for any syntactical errors.\n\n"+ - "Warning: partially exporting models to gUFO may introduce syntactical errors."); - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception( - "Unable to transform the model due to an unexpected error.\n"+ - "Please check the model for any syntactical errors.\n\n"+ - "Warning: partially exporting models to gUFO may introduce syntactical errors.") - .printStackTrace(); - return null; - case HttpURLConnection.HTTP_NOT_FOUND: - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - case HttpURLConnection.HTTP_INTERNAL_ERROR: //500 - System.out.println(responseReader.lines().collect(Collectors.joining())); - ViewManagerUtils.exportToGUFOIssueDialog("Oops! Something went wrong. \n" - + "Please check the model for any syntactical errors.\n" - //+ "If the problem persists, open a ticket with a case that simulates this problem." - ); - new Exception("Server error" ).printStackTrace(); - return null; - default: - ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); - throw new Exception("Unknown error"); - } - } catch (MalformedURLException e) { - ViewManagerUtils.exportToGUFOIssueDialog("Server error."); - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; + String model, String mappingStrategy, String targetDBMS, boolean isStandardizeNames) + throws Exception { + + final JsonObject optionsObj = new JsonObject(); + + optionsObj.addProperty("mappingStrategy", mappingStrategy); + optionsObj.addProperty("targetDBMS", targetDBMS); + optionsObj.addProperty("isStandardizeNames", isStandardizeNames); + + final JsonObject bodyObj = new JsonObject(); + bodyObj.add("options", optionsObj); + bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); + + final GsonBuilder builder = new GsonBuilder(); + final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); + final String body = gson.toJson(bodyObj); + + final ProjectConfigurations configurations = + Configurations.getInstance().getProjectConfigurations(); + final String url; + + if (configurations.isCustomServerEnabled()) { + url = configurations.getServerURL() + TRANSFORM_DB_SERVICE_ENDPOINT; + } else { + url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_DB_SERVICE_ENDPOINT; + } + + try { + final HttpURLConnection request = request(url, body); + final BufferedReader responseReader = + request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST + ? new BufferedReader(new InputStreamReader(request.getInputStream())) + : new BufferedReader(new InputStreamReader(request.getErrorStream())); + + switch (request.getResponseCode()) { + case HttpURLConnection.HTTP_OK: + if (!request.getContentType().equals("text/html")) { + return responseReader; + } else { + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + } + case HttpURLConnection.HTTP_BAD_REQUEST: + ViewManagerUtils.exportToGUFOIssueDialog( + "Unable to transform the model due to an unexpected error.\n" + + "Please check the model for any syntactical errors.\n\n" + + "Warning: partially exporting models to gUFO may introduce syntactical" + + " errors."); + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception( + "Unable to transform the model due to an unexpected error.\n" + + "Please check the model for any syntactical errors.\n\n" + + "Warning: partially exporting models to gUFO may introduce syntactical" + + " errors.") + .printStackTrace(); + return null; + case HttpURLConnection.HTTP_NOT_FOUND: + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + case HttpURLConnection.HTTP_INTERNAL_ERROR: // 500 + System.out.println(responseReader.lines().collect(Collectors.joining())); + ViewManagerUtils.exportToGUFOIssueDialog( + "Oops! Something went wrong. \n" + + "Please check the model for any syntactical errors.\n" + // + "If the problem persists, open a ticket with a case that simulates this problem." + ); + new Exception("Server error").printStackTrace(); + return null; + default: + ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); + throw new Exception("Unknown error"); + } + } catch (MalformedURLException e) { + ViewManagerUtils.exportToGUFOIssueDialog("Server error."); + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; } public static BufferedReader generateODBAFile( - String model, - String mappingStrategy, - String targetDBMS, - boolean isStandardizeNames, - String baseIRI, - boolean isGenerateSchema, - boolean generateConnection, - String hostName, - String databaseName, - String userConnection, - String passwordConnection) throws Exception { - - final JsonObject optionsObj = new JsonObject(); - - optionsObj.addProperty("mappingStrategy", mappingStrategy); - optionsObj.addProperty("targetDBMS", targetDBMS); - optionsObj.addProperty("isStandardizeNames", isStandardizeNames); - optionsObj.addProperty("baseIri", baseIRI); - optionsObj.addProperty("isGenerateSchema", isGenerateSchema); - optionsObj.addProperty("generateConnection", generateConnection); - optionsObj.addProperty("hostName", hostName); - optionsObj.addProperty("databaseName", databaseName); - optionsObj.addProperty("userConnection", userConnection); - optionsObj.addProperty("passwordConnection", passwordConnection); - - final JsonObject bodyObj = new JsonObject(); - bodyObj.add("options", optionsObj); - bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); - - final GsonBuilder builder = new GsonBuilder(); - final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); - final String body = gson.toJson(bodyObj); - - final ProjectConfigurations configurations = Configurations.getInstance().getProjectConfigurations(); - final String url; - - if (configurations.isCustomServerEnabled()) { - url = configurations.getServerURL() + TRANSFORM_OBDA_SERVICE_ENDPOINT; - } else { - url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_OBDA_SERVICE_ENDPOINT; - } - try { - final HttpURLConnection request = request(url, body); - final BufferedReader responseReader = - request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST - ? new BufferedReader(new InputStreamReader(request.getInputStream())) - : new BufferedReader(new InputStreamReader(request.getErrorStream())); - - switch (request.getResponseCode()) { - case HttpURLConnection.HTTP_OK: - if (!request.getContentType().equals("text/html")) { - return responseReader; - } else { - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - } - case HttpURLConnection.HTTP_BAD_REQUEST: - ViewManagerUtils.exportToGUFOIssueDialog( - "Unable to transform the model due to an unexpected error.\n"+ - "Please check the model for any syntactical errors.\n\n"+ - "Warning: partially exporting models to gUFO may introduce syntactical errors."); - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception( - "Unable to transform the model due to an unexpected error.\n"+ - "Please check the model for any syntactical errors.\n\n"+ - "Warning: partially exporting models to gUFO may introduce syntactical errors.") - .printStackTrace(); - return null; - case HttpURLConnection.HTTP_NOT_FOUND: - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - case HttpURLConnection.HTTP_INTERNAL_ERROR: - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server error.").printStackTrace(); - return null; - default: - ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); - throw new Exception("Unknown error"); - } - } catch (MalformedURLException e) { - ViewManagerUtils.exportToGUFOIssueDialog("Server error."); - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - return null; + String model, + String mappingStrategy, + String targetDBMS, + boolean isStandardizeNames, + String baseIRI, + boolean isGenerateSchema, + boolean generateConnection, + String hostName, + String databaseName, + String userConnection, + String passwordConnection) + throws Exception { + + final JsonObject optionsObj = new JsonObject(); + + optionsObj.addProperty("mappingStrategy", mappingStrategy); + optionsObj.addProperty("targetDBMS", targetDBMS); + optionsObj.addProperty("isStandardizeNames", isStandardizeNames); + optionsObj.addProperty("baseIri", baseIRI); + optionsObj.addProperty("isGenerateSchema", isGenerateSchema); + optionsObj.addProperty("generateConnection", generateConnection); + optionsObj.addProperty("hostName", hostName); + optionsObj.addProperty("databaseName", databaseName); + optionsObj.addProperty("userConnection", userConnection); + optionsObj.addProperty("passwordConnection", passwordConnection); + + final JsonObject bodyObj = new JsonObject(); + bodyObj.add("options", optionsObj); + bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); + + final GsonBuilder builder = new GsonBuilder(); + final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); + final String body = gson.toJson(bodyObj); + + final ProjectConfigurations configurations = + Configurations.getInstance().getProjectConfigurations(); + final String url; + + if (configurations.isCustomServerEnabled()) { + url = configurations.getServerURL() + TRANSFORM_OBDA_SERVICE_ENDPOINT; + } else { + url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_OBDA_SERVICE_ENDPOINT; + } + try { + final HttpURLConnection request = request(url, body); + final BufferedReader responseReader = + request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST + ? new BufferedReader(new InputStreamReader(request.getInputStream())) + : new BufferedReader(new InputStreamReader(request.getErrorStream())); + + switch (request.getResponseCode()) { + case HttpURLConnection.HTTP_OK: + if (!request.getContentType().equals("text/html")) { + return responseReader; + } else { + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + } + case HttpURLConnection.HTTP_BAD_REQUEST: + ViewManagerUtils.exportToGUFOIssueDialog( + "Unable to transform the model due to an unexpected error.\n" + + "Please check the model for any syntactical errors.\n\n" + + "Warning: partially exporting models to gUFO may introduce syntactical" + + " errors."); + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception( + "Unable to transform the model due to an unexpected error.\n" + + "Please check the model for any syntactical errors.\n\n" + + "Warning: partially exporting models to gUFO may introduce syntactical" + + " errors.") + .printStackTrace(); + return null; + case HttpURLConnection.HTTP_NOT_FOUND: + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server not found.").printStackTrace(); + return null; + case HttpURLConnection.HTTP_INTERNAL_ERROR: + System.out.println(responseReader.lines().collect(Collectors.joining())); + new Exception("Server error.").printStackTrace(); + return null; + default: + ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); + throw new Exception("Unknown error"); + } + } catch (MalformedURLException e) { + ViewManagerUtils.exportToGUFOIssueDialog("Server error."); + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java index c73488a1..eae5c4b5 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java @@ -121,44 +121,43 @@ public class ProjectConfigurations { @SerializedName("ignoreAssociationInversionWarning") @Expose() private boolean ignoreAssociationInversionWarning; - - //Transformation properties for Relational Schema + + // Transformation properties for Relational Schema @SerializedName("mappingStrategy") @Expose() private MappingStrategy mappingStrategy; - + @SerializedName("targetDBMS") @Expose() private DBMSSuported targetDBMS; - + @SerializedName("standarizeNames") @Expose() private boolean standardizeNames; - + @SerializedName("generateSchema") @Expose() private boolean generateSchema; - + @SerializedName("generateConnection") @Expose() private boolean generateConnection; - + @SerializedName("hostNameConnection") @Expose() private String hostNameConnection; - + @SerializedName("databaseConnection") @Expose() private String databaseConnection; - + @SerializedName("userConnection") @Expose() private String userConnection; - + @SerializedName("passwordConnectino") @Expose() private String passwordConnectino; - /** Constructor without args to be called when deserializing project settings. */ public ProjectConfigurations() { @@ -197,9 +196,9 @@ public void setDefaultValues() { this.isSmartModellingEnabled = ProjectConfigurations.DEFAULT_IS_AUTOMATIC_MODELLING_ENABLED; this.ignoreAssociationInversionWarning = ProjectConfigurations.DEFAULT_IGNORE_ASSOCIATION_INVERSION_WARNING; - + this.targetDBMS = ProjectConfigurations.DEFAULT_DBMS; - this.mappingStrategy = ProjectConfigurations.DEFAULT_MAPPING_STRATEGY; + this.mappingStrategy = ProjectConfigurations.DEFAULT_MAPPING_STRATEGY; this.standardizeNames = ProjectConfigurations.DEFAULT_STANTDARDIZE_NAMES; this.generateSchema = ProjectConfigurations.DEFAULT_GENERATE_SCHEMA; this.generateConnection = ProjectConfigurations.DEFAULT_GENERATE_CONNECTION; @@ -474,158 +473,166 @@ public boolean ignoreAssociationInversionWarning() { public void setIgnoreAssociationInversionWarning(boolean ignoreAssociationInversionWarning) { this.ignoreAssociationInversionWarning = ignoreAssociationInversionWarning; } - - /** - * Informs the mapping strategy for the relational schema. - * - * @param mappingStrategy - */ - public void setMappingStrategy(MappingStrategy mappingStrategy) { - this.mappingStrategy = mappingStrategy; - } - - /** - * Returns the mapping strategy for the relational schema. - * @return MappingStrategy - */ - public MappingStrategy getMappingStrategy() { - return this.mappingStrategy; - } - - /** - * Checks whether the nomenclature will be standardized in the database. - * @return boolean - */ - public boolean isStandardizeNames() { - return standardizeNames; - } - - /** - * Informs if the nomenclature will be standardized in the database. - * @param standarizeNames - */ - public void setStandardizeNames(boolean standarizeNames) { - this.standardizeNames = standarizeNames; - } - - /** - * Returns the target DBMS for generating the files. - * @return DBMSSuported - */ - public DBMSSuported getTargetDBMS() { - return targetDBMS; - } - - /** - * Informs the target DBMS for generating the files. - * - * @param targetDBMS - */ - public void setTargetDBMS(DBMSSuported targetDBMS) { - this.targetDBMS = targetDBMS; - } - - /** - * Returns if it is necessary to generate the relational schema for the ontology. - * - * @return boolean - */ - public boolean isGenerateSchema() { - return generateSchema; - } - - /** - * Informs if it is necessary to generate the relational schema for the ontology. - * @param generateSchema - */ - public void setGenerateSchema(boolean generateSchema) { - this.generateSchema = generateSchema; - } - - /** - * Returns if it is necessary to generate the connection for the database. - * - * @return boolean - */ - public boolean isGenerateConnection() { - return generateConnection; - } - - /** - * Informs if it is necessary to generate the connection for the database. - * @param generateConnection - */ - public void setGenerateConnection(boolean generateConnection) { - this.generateConnection = generateConnection; - } - - /** - * Returns the host name connection. - * - * @return string - */ - public String getHostNameConnection() { - return hostNameConnection; - } - - /** - * Informs the host name connection. - * @param hostName - */ - public void setHostNameConnection(String hostName) { - this.hostNameConnection = hostName; - } - - /** - * Returns the database name connection. - * - * @return string - */ - public String getDatabaseNameConnection() { - return databaseConnection; - } - - /** - * Informs the database name connection. - * @param databaseName - */ - public void setDatabaseNameConnection(String databaseName) { - this.databaseConnection = databaseName; - } - - /** - * Returns the user name connection. - * - * @return string - */ - public String getUserNameConnection() { - return userConnection; - } - - /** - * Informs the user name connection. - * @param userName - */ - public void setUserNameConnection(String userName) { - this.userConnection = userName; - } - - /** - * Returns the password connection. - * - * @return string - */ - public String getPassword() { - return passwordConnectino; - } - - /** - * Informs the password connection. - * @param password - */ - public void setPassword(String password) { - this.passwordConnectino = password; - } - + /** + * Informs the mapping strategy for the relational schema. + * + * @param mappingStrategy + */ + public void setMappingStrategy(MappingStrategy mappingStrategy) { + this.mappingStrategy = mappingStrategy; + } + + /** + * Returns the mapping strategy for the relational schema. + * + * @return MappingStrategy + */ + public MappingStrategy getMappingStrategy() { + return this.mappingStrategy; + } + + /** + * Checks whether the nomenclature will be standardized in the database. + * + * @return boolean + */ + public boolean isStandardizeNames() { + return standardizeNames; + } + + /** + * Informs if the nomenclature will be standardized in the database. + * + * @param standarizeNames + */ + public void setStandardizeNames(boolean standarizeNames) { + this.standardizeNames = standarizeNames; + } + + /** + * Returns the target DBMS for generating the files. + * + * @return DBMSSuported + */ + public DBMSSuported getTargetDBMS() { + return targetDBMS; + } + + /** + * Informs the target DBMS for generating the files. + * + * @param targetDBMS + */ + public void setTargetDBMS(DBMSSuported targetDBMS) { + this.targetDBMS = targetDBMS; + } + + /** + * Returns if it is necessary to generate the relational schema for the ontology. + * + * @return boolean + */ + public boolean isGenerateSchema() { + return generateSchema; + } + + /** + * Informs if it is necessary to generate the relational schema for the ontology. + * + * @param generateSchema + */ + public void setGenerateSchema(boolean generateSchema) { + this.generateSchema = generateSchema; + } + + /** + * Returns if it is necessary to generate the connection for the database. + * + * @return boolean + */ + public boolean isGenerateConnection() { + return generateConnection; + } + + /** + * Informs if it is necessary to generate the connection for the database. + * + * @param generateConnection + */ + public void setGenerateConnection(boolean generateConnection) { + this.generateConnection = generateConnection; + } + + /** + * Returns the host name connection. + * + * @return string + */ + public String getHostNameConnection() { + return hostNameConnection; + } + + /** + * Informs the host name connection. + * + * @param hostName + */ + public void setHostNameConnection(String hostName) { + this.hostNameConnection = hostName; + } + + /** + * Returns the database name connection. + * + * @return string + */ + public String getDatabaseNameConnection() { + return databaseConnection; + } + + /** + * Informs the database name connection. + * + * @param databaseName + */ + public void setDatabaseNameConnection(String databaseName) { + this.databaseConnection = databaseName; + } + + /** + * Returns the user name connection. + * + * @return string + */ + public String getUserNameConnection() { + return userConnection; + } + + /** + * Informs the user name connection. + * + * @param userName + */ + public void setUserNameConnection(String userName) { + this.userConnection = userName; + } + + /** + * Returns the password connection. + * + * @return string + */ + public String getPassword() { + return passwordConnectino; + } + + /** + * Informs the password connection. + * + * @param password + */ + public void setPassword(String password) { + this.passwordConnectino = password; + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java b/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java index ed6c96d0..09e44c1d 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java @@ -1,107 +1,105 @@ package it.unibz.inf.ontouml.vp.utils; -import java.io.BufferedReader; -import java.io.IOException; public class OBDAResult { - private String schema; - private String obdaFile; - private String connection; - - public void setSchema(String schema) { - this.schema = schema; - } - - public String getSchema() { - return schema; - } - - public void setObdaFile(String obdaFile) { - this.obdaFile = obdaFile; - } - - public String getObdaFile() { - return obdaFile; - } - - public void setConnection(String connection) { - this.connection = connection; - } - - public String getConnection() { - return connection; - } - - /* - private String schema; - private String obdaFile; - private String connection; - private BufferedReader buffer; - - public OBDAResult(BufferedReader buffer) { - this.buffer = buffer; - putVariables(); - } - - public String getSchema() { - return schema; - } - - public String getOBDAFile() { - return obdaFile; - } - - private void putVariables() { - StringBuilder auxSchema = new StringBuilder(); - StringBuilder auxObda = new StringBuilder(); - - int value; - try { - value = buffer.read(); - - while ((char) value != '|' && value != -1) { - auxObda.append((char) value); - value = buffer.read(); - } - - while ((value = buffer.read()) != -1) { - auxSchema.append((char) value); - } - schema = auxSchema.toString().trim(); - obdaFile = auxObda.toString().trim(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - - } - } - - private void putVariables() { - StringBuilder auxVar = new StringBuilder(); - StringBuilder auxValue = new StringBuilder(); - char val; - - val = getChar(); - - if(val == '{') { - - } - - } - - private char getChar() { - int val; - try { - if ((val = buffer.read()) != -1 ) { - return (char)val; - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return '|'; - - } - */ + private String schema; + private String obdaFile; + private String connection; + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getSchema() { + return schema; + } + + public void setObdaFile(String obdaFile) { + this.obdaFile = obdaFile; + } + + public String getObdaFile() { + return obdaFile; + } + + public void setConnection(String connection) { + this.connection = connection; + } + + public String getConnection() { + return connection; + } + + /* + private String schema; + private String obdaFile; + private String connection; + private BufferedReader buffer; + + public OBDAResult(BufferedReader buffer) { + this.buffer = buffer; + putVariables(); + } + + public String getSchema() { + return schema; + } + + public String getOBDAFile() { + return obdaFile; + } + + private void putVariables() { + StringBuilder auxSchema = new StringBuilder(); + StringBuilder auxObda = new StringBuilder(); + + int value; + try { + value = buffer.read(); + + while ((char) value != '|' && value != -1) { + auxObda.append((char) value); + value = buffer.read(); + } + + while ((value = buffer.read()) != -1) { + auxSchema.append((char) value); + } + schema = auxSchema.toString().trim(); + obdaFile = auxObda.toString().trim(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + + } + } + + private void putVariables() { + StringBuilder auxVar = new StringBuilder(); + StringBuilder auxValue = new StringBuilder(); + char val; + + val = getChar(); + + if(val == '{') { + + } + + } + + private char getChar() { + int val; + try { + if ((val = buffer.read()) != -1 ) { + return (char)val; + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return '|'; + + } + */ } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java index b6ab17b4..cc61eb43 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java @@ -1,64 +1,56 @@ /** - * Class responsible for displaying the graphical interface for exporting the OntoUML model to the relational schema. - * - * Author: Gustavo Ludovico Guidoni + * Class responsible for displaying the graphical interface for exporting the OntoUML model to the + * relational schema. + * + *

Author: Gustavo Ludovico Guidoni */ package it.unibz.inf.ontouml.vp.views; -import java.awt.Component; - import com.vp.plugin.view.IDialog; import com.vp.plugin.view.IDialogHandler; - import it.unibz.inf.ontouml.vp.OntoUMLPlugin; import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; +import java.awt.Component; public class DBExportHandler implements IDialogHandler { - private DBExportView view; - - - /** - * Called when the dialog is closed by the user clicking on the close button of - * the frame. - */ - @Override - public boolean canClosed() { - OntoUMLPlugin.setDBExportWindowOpen(false); - ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); - return true; - } - - /** - * Called once before the dialog is shown. Developer should return the content - * of the dialog (similar to the content pane). - */ - @Override - public Component getComponent() { - view = new DBExportView(Configurations.getInstance().getProjectConfigurations()); - return view; - } - - /** - * Called after the getComponent(). A dialog is created on Visual Paradigm - * internally (it still not shown out). Developer can set the outlook of the - * dialog on prepare(). - */ - @Override - public void prepare(IDialog dialog) { - dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate Schema"); - dialog.setModal(false); - dialog.setResizable(false); - dialog.setSize(view.getWidth(), view.getHeight()); - view.setContainerDialog(dialog); - } - - /** - * Called when the dialog is shown. - */ - @Override - public void shown() { - // TODO Auto-generated method stub - } + private DBExportView view; + + /** Called when the dialog is closed by the user clicking on the close button of the frame. */ + @Override + public boolean canClosed() { + OntoUMLPlugin.setDBExportWindowOpen(false); + ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); + return true; + } + + /** + * Called once before the dialog is shown. Developer should return the content of the dialog + * (similar to the content pane). + */ + @Override + public Component getComponent() { + view = new DBExportView(Configurations.getInstance().getProjectConfigurations()); + return view; + } + + /** + * Called after the getComponent(). A dialog is created on Visual Paradigm internally (it still + * not shown out). Developer can set the outlook of the dialog on prepare(). + */ + @Override + public void prepare(IDialog dialog) { + dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate Schema"); + dialog.setModal(false); + dialog.setResizable(false); + dialog.setSize(view.getWidth(), view.getHeight()); + view.setContainerDialog(dialog); + } + + /** Called when the dialog is shown. */ + @Override + public void shown() { + // TODO Auto-generated method stub + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java index ea0815dc..6470a114 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java @@ -2,7 +2,7 @@ * Graphical interface designed to collect data for the transformation of OntoUml to the relational * schema. * - * Author: Gustavo Ludovico Guidoni + *

Author: Gustavo Ludovico Guidoni */ package it.unibz.inf.ontouml.vp.views; @@ -15,353 +15,474 @@ import it.unibz.inf.ontouml.vp.model.DBMSSuported; import it.unibz.inf.ontouml.vp.model.MappingStrategy; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; -import it.unibz.inf.ontouml.vp.model.ServerRequest; import java.awt.Dimension; import java.awt.GridLayout; import java.util.HashSet; - import javax.swing.DefaultComboBoxModel; import javax.swing.JScrollPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; public class DBExportView extends javax.swing.JPanel { - private static final long serialVersionUID = 1L; - - private HashSet elementsDiagramTree = new HashSet<>(); - - private IDialog parentContainer; - private ProjectConfigurations configurations; - private JCheckBoxTree diagramTree; - - private javax.swing.ButtonGroup btgMappingStrategy; - private javax.swing.JButton btnCancel; - private javax.swing.JButton btnGenerateSchema; - private javax.swing.JComboBox cbxDBMS; - private javax.swing.JCheckBox cbxStandarizeNames; - private javax.swing.JPanel diagramPanel; - private javax.swing.JLabel jLabel1; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jpanDiagram; - private javax.swing.JRadioButton rbtOneTablePerClass; - private javax.swing.JRadioButton rbtOntTablePerKind; - - public DBExportView(ProjectConfigurations configurations) { - initComponents(); - - this.configurations = configurations; - - updateComponentsValues(configurations); - } - - private void initComponents() { - - // ************************************* - // Manually generated code. - // ************************************* - setSize(new Dimension(500, 360)); - - diagramPanel = new javax.swing.JPanel(); - diagramTree = new JCheckBoxTree("diagram"); - - JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); - scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - diagramPanel.add(scrollableTextAreaDiagram); - - diagramPanel.setLayout(new GridLayout(1, 1)); - diagramPanel.setPreferredSize(new Dimension(100, 100)); - - // ************************************* - // Automatically generated code. - // ************************************* - - - btgMappingStrategy = new javax.swing.ButtonGroup(); - jPanel3 = new javax.swing.JPanel(); - btnGenerateSchema = new javax.swing.JButton(); - btnCancel = new javax.swing.JButton(); - jPanel4 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - cbxDBMS = new javax.swing.JComboBox<>(); - jPanel1 = new javax.swing.JPanel(); - rbtOneTablePerClass = new javax.swing.JRadioButton(); - rbtOntTablePerKind = new javax.swing.JRadioButton(); - cbxStandarizeNames = new javax.swing.JCheckBox(); - jLabel1 = new javax.swing.JLabel(); - jpanDiagram = new javax.swing.JPanel(); - - - jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - - btnGenerateSchema.setText("Generate Schema"); - - btnCancel.setText("Cancel"); - btnCancel.setMaximumSize(new java.awt.Dimension(117, 23)); - btnCancel.setMinimumSize(new java.awt.Dimension(117, 23)); - btnCancel.setPreferredSize(new java.awt.Dimension(117, 23)); - - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() - .addGap(48, 48, 48) - .addComponent(btnGenerateSchema, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(50, 50, 50)) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(btnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnGenerateSchema, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("DBMS: ")); - - cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(cbxDBMS, 0, 142, Short.MAX_VALUE) - .addContainerGap()) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); - - btgMappingStrategy.add(rbtOneTablePerClass); - rbtOneTablePerClass.setText("One Table per Class"); - - btgMappingStrategy.add(rbtOntTablePerKind); - rbtOntTablePerKind.setSelected(true); - rbtOntTablePerKind.setText("One Table per Kind"); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + private static final long serialVersionUID = 1L; + + private HashSet elementsDiagramTree = new HashSet<>(); + + private IDialog parentContainer; + private ProjectConfigurations configurations; + private JCheckBoxTree diagramTree; + + private javax.swing.ButtonGroup btgMappingStrategy; + private javax.swing.JButton btnCancel; + private javax.swing.JButton btnGenerateSchema; + private javax.swing.JComboBox cbxDBMS; + private javax.swing.JCheckBox cbxStandarizeNames; + private javax.swing.JPanel diagramPanel; + private javax.swing.JLabel jLabel1; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jpanDiagram; + private javax.swing.JRadioButton rbtOneTablePerClass; + private javax.swing.JRadioButton rbtOntTablePerKind; + + public DBExportView(ProjectConfigurations configurations) { + initComponents(); + + this.configurations = configurations; + + updateComponentsValues(configurations); + } + + private void initComponents() { + + // ************************************* + // Manually generated code. + // ************************************* + setSize(new Dimension(500, 360)); + + diagramPanel = new javax.swing.JPanel(); + diagramTree = new JCheckBoxTree("diagram"); + + JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); + scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + diagramPanel.add(scrollableTextAreaDiagram); + + diagramPanel.setLayout(new GridLayout(1, 1)); + diagramPanel.setPreferredSize(new Dimension(100, 100)); + + // ************************************* + // Automatically generated code. + // ************************************* + + btgMappingStrategy = new javax.swing.ButtonGroup(); + jPanel3 = new javax.swing.JPanel(); + btnGenerateSchema = new javax.swing.JButton(); + btnCancel = new javax.swing.JButton(); + jPanel4 = new javax.swing.JPanel(); + jPanel2 = new javax.swing.JPanel(); + cbxDBMS = new javax.swing.JComboBox<>(); + jPanel1 = new javax.swing.JPanel(); + rbtOneTablePerClass = new javax.swing.JRadioButton(); + rbtOntTablePerKind = new javax.swing.JRadioButton(); + cbxStandarizeNames = new javax.swing.JCheckBox(); + jLabel1 = new javax.swing.JLabel(); + jpanDiagram = new javax.swing.JPanel(); + + jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + btnGenerateSchema.setText("Generate Schema"); + + btnCancel.setText("Cancel"); + btnCancel.setMaximumSize(new java.awt.Dimension(117, 23)); + btnCancel.setMinimumSize(new java.awt.Dimension(117, 23)); + btnCancel.setPreferredSize(new java.awt.Dimension(117, 23)); + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel3Layout + .createSequentialGroup() + .addGap(48, 48, 48) + .addComponent( + btnGenerateSchema, + javax.swing.GroupLayout.PREFERRED_SIZE, + 118, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addComponent( + btnCancel, + javax.swing.GroupLayout.PREFERRED_SIZE, + 122, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(50, 50, 50))); + jPanel3Layout.setVerticalGroup( + jPanel3Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel3Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel3Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent( + btnCancel, + javax.swing.GroupLayout.PREFERRED_SIZE, + 29, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent( + btnGenerateSchema, + javax.swing.GroupLayout.PREFERRED_SIZE, + 29, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("DBMS: ")); + + cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(cbxDBMS, 0, 142, Short.MAX_VALUE) + .addContainerGap())); + jPanel2Layout.setVerticalGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + cbxDBMS, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); + + btgMappingStrategy.add(rbtOneTablePerClass); + rbtOneTablePerClass.setText("One Table per Class"); + + btgMappingStrategy.add(rbtOntTablePerKind); + rbtOntTablePerKind.setSelected(true); + rbtOntTablePerKind.setText("One Table per Kind"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerClass) + .addComponent(rbtOntTablePerKind)) + .addContainerGap(35, Short.MAX_VALUE))); + jPanel1Layout.setVerticalGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() .addComponent(rbtOneTablePerClass) - .addComponent(rbtOntTablePerKind)) - .addContainerGap(35, Short.MAX_VALUE)) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(rbtOneTablePerClass) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rbtOntTablePerKind) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - cbxStandarizeNames.setSelected(true); - cbxStandarizeNames.setText("Standardize the names for the database"); - - jLabel1.setText("eg.: 'PersonalCustomer' to 'personal_customer'."); - - jpanDiagram.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram:")); - - javax.swing.GroupLayout diagramPanelLayout = new javax.swing.GroupLayout(diagramPanel); - //diagramPanel.setLayout(diagramPanelLayout); - diagramPanelLayout.setHorizontalGroup( - diagramPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - diagramPanelLayout.setVerticalGroup( - diagramPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout jpanDiagramLayout = new javax.swing.GroupLayout(jpanDiagram); - jpanDiagram.setLayout(jpanDiagramLayout); - jpanDiagramLayout.setHorizontalGroup( - jpanDiagramLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - jpanDiagramLayout.setVerticalGroup( - jpanDiagramLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(cbxStandarizeNames, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE) - .addGroup(jPanel4Layout.createSequentialGroup() - .addGap(21, 21, 21) - .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 445, Short.MAX_VALUE)) - .addGroup(jPanel4Layout.createSequentialGroup() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(18, 18, 18) - .addComponent(jpanDiagram, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()))) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup(jPanel4Layout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jpanDiagram, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cbxStandarizeNames) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - - // ************************************* - // Manually generated code. - // ************************************* - - - btnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - - btnGenerateSchema.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnGenerateSchemaActionPerformed(evt); - } - }); - } - - /** Sets a direct reference to the container dialog after initialization. */ - public void setContainerDialog(IDialog dialog) { - parentContainer = dialog; - } - - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) { - parentContainer.close(); - OntoUMLPlugin.setDBExportWindowOpen(false); - } - - private void btnGenerateSchemaActionPerformed(java.awt.event.ActionEvent evt) { - saveSelectedElements(); - updateConfigurationsValues(configurations); - Configurations.getInstance().save(); - parentContainer.close(); - OntoUMLPlugin.setDBExportWindowOpen(false); - // Thread thread = new Thread(request); - // thread.start(); - (new DBExportServerRequest()).start(); - } - - /** Updates project configurations with components' information. */ - private void updateConfigurationsValues(ProjectConfigurations configurations) { - - configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); - - if (rbtOneTablePerClass.isSelected()) - configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); - else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); - - configurations.setTargetDBMS((DBMSSuported) cbxDBMS.getSelectedItem()); - - configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); - } - - /** - * Updates components with project configurations' information. - * - * @param configurations - */ - private void updateComponentsValues(ProjectConfigurations configurations) { - - if(configurations.getExportGUFOElementsDiagramTree() != null) - diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); - - if (configurations.getMappingStrategy() != null && !configurations.getMappingStrategy().equals("")) { - if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) - rbtOneTablePerClass.setSelected(true); - else - rbtOntTablePerKind.setSelected(true); - } - - if (configurations.getTargetDBMS() != null && !configurations.getTargetDBMS().equals("")) - cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); - - cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); - } - - private void saveSelectedElements() { - TreePath[] paths; - - paths = diagramTree.getCheckedPaths(); - - for (TreePath path : paths) { - Object[] object = path.getPath(); - for (Object o : object) { - - if (o instanceof DefaultMutableTreeNode) { - - DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; - - if (node.getUserObject() instanceof IModelElement) - this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); - - if (node.getUserObject() instanceof IDiagramUIModel) - this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); - } - } - } - - } + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(rbtOntTablePerKind) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + cbxStandarizeNames.setSelected(true); + cbxStandarizeNames.setText("Standardize the names for the database"); + + jLabel1.setText("eg.: 'PersonalCustomer' to 'personal_customer'."); + + jpanDiagram.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram:")); + + javax.swing.GroupLayout diagramPanelLayout = new javax.swing.GroupLayout(diagramPanel); + // diagramPanel.setLayout(diagramPanelLayout); + diagramPanelLayout.setHorizontalGroup( + diagramPanelLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE)); + diagramPanelLayout.setVerticalGroup( + diagramPanelLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 0, Short.MAX_VALUE)); + + javax.swing.GroupLayout jpanDiagramLayout = new javax.swing.GroupLayout(jpanDiagram); + jpanDiagram.setLayout(jpanDiagramLayout); + jpanDiagramLayout.setHorizontalGroup( + jpanDiagramLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + diagramPanel, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)); + jpanDiagramLayout.setVerticalGroup( + jpanDiagramLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + diagramPanel, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + cbxStandarizeNames, + javax.swing.GroupLayout.DEFAULT_SIZE, + 466, + Short.MAX_VALUE) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addGap(21, 21, 21) + .addComponent( + jLabel1, + javax.swing.GroupLayout.DEFAULT_SIZE, + 445, + Short.MAX_VALUE)) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addGroup( + jPanel4Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + jPanel1, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent( + jPanel2, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent( + jpanDiagram, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addContainerGap())))); + jPanel4Layout.setVerticalGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + jPanel4Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addComponent( + jPanel1, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent( + jPanel2, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent( + jpanDiagram, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbxStandarizeNames) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + jLabel1, + javax.swing.GroupLayout.PREFERRED_SIZE, + 18, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + jPanel4, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addComponent( + jPanel3, + javax.swing.GroupLayout.Alignment.TRAILING, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addContainerGap())); + layout.setVerticalGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + jPanel4, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + jPanel3, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap())); + + // ************************************* + // Manually generated code. + // ************************************* + + btnCancel.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnCancelActionPerformed(evt); + } + }); + + btnGenerateSchema.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnGenerateSchemaActionPerformed(evt); + } + }); + } + + /** Sets a direct reference to the container dialog after initialization. */ + public void setContainerDialog(IDialog dialog) { + parentContainer = dialog; + } + + private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) { + parentContainer.close(); + OntoUMLPlugin.setDBExportWindowOpen(false); + } + + private void btnGenerateSchemaActionPerformed(java.awt.event.ActionEvent evt) { + saveSelectedElements(); + updateConfigurationsValues(configurations); + Configurations.getInstance().save(); + parentContainer.close(); + OntoUMLPlugin.setDBExportWindowOpen(false); + // Thread thread = new Thread(request); + // thread.start(); + (new DBExportServerRequest()).start(); + } + + /** Updates project configurations with components' information. */ + private void updateConfigurationsValues(ProjectConfigurations configurations) { + + configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); + + if (rbtOneTablePerClass.isSelected()) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); + else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); + + configurations.setTargetDBMS((DBMSSuported) cbxDBMS.getSelectedItem()); + + configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); + } + + /** + * Updates components with project configurations' information. + * + * @param configurations + */ + private void updateComponentsValues(ProjectConfigurations configurations) { + + if (configurations.getExportGUFOElementsDiagramTree() != null) + diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); + + if (configurations.getMappingStrategy() != null + && !configurations.getMappingStrategy().equals("")) { + if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) + rbtOneTablePerClass.setSelected(true); + else rbtOntTablePerKind.setSelected(true); + } + + if (configurations.getTargetDBMS() != null && !configurations.getTargetDBMS().equals("")) + cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); + + cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); + } + + private void saveSelectedElements() { + TreePath[] paths; + + paths = diagramTree.getCheckedPaths(); + + for (TreePath path : paths) { + Object[] object = path.getPath(); + for (Object o : object) { + + if (o instanceof DefaultMutableTreeNode) { + + DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; + + if (node.getUserObject() instanceof IModelElement) + this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); + + if (node.getUserObject() instanceof IDiagramUIModel) + this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); + } + } + } + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java index 328050bd..e368f731 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java @@ -1,64 +1,56 @@ /** - * Class responsible for displaying the graphical interface for integrating the OntoUML model with Ontop. - * - * Author: Gustavo Ludovico Guidoni + * Class responsible for displaying the graphical interface for integrating the OntoUML model with + * Ontop. + * + *

Author: Gustavo Ludovico Guidoni */ package it.unibz.inf.ontouml.vp.views; -import java.awt.Component; - import com.vp.plugin.view.IDialog; import com.vp.plugin.view.IDialogHandler; - import it.unibz.inf.ontouml.vp.OntoUMLPlugin; import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; +import java.awt.Component; public class OBDAExportHandler implements IDialogHandler { - private OBDAExportView view; - - - /** - * Called when the dialog is closed by the user clicking on the close button of - * the frame. - */ - @Override - public boolean canClosed() { - OntoUMLPlugin.setOBDAExportWindowOpen(false); - ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); - return true; - } - - /** - * Called once before the dialog is shown. Developer should return the content - * of the dialog (similar to the content pane). - */ - @Override - public Component getComponent() { - view = new OBDAExportView(Configurations.getInstance().getProjectConfigurations()); - return view; - } - - /** - * Called after the getComponent(). A dialog is created on Visual Paradigm - * internally (it still not shown out). Developer can set the outlook of the - * dialog on prepare(). - */ - @Override - public void prepare(IDialog dialog) { - dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate OBDA file"); - dialog.setModal(false); - dialog.setResizable(false); - dialog.setSize(view.getWidth(), view.getHeight()); - view.setContainerDialog(dialog); - } - - /** - * Called when the dialog is shown. - */ - @Override - public void shown() { - // TODO Auto-generated method stub - } + private OBDAExportView view; + + /** Called when the dialog is closed by the user clicking on the close button of the frame. */ + @Override + public boolean canClosed() { + OntoUMLPlugin.setOBDAExportWindowOpen(false); + ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); + return true; + } + + /** + * Called once before the dialog is shown. Developer should return the content of the dialog + * (similar to the content pane). + */ + @Override + public Component getComponent() { + view = new OBDAExportView(Configurations.getInstance().getProjectConfigurations()); + return view; + } + + /** + * Called after the getComponent(). A dialog is created on Visual Paradigm internally (it still + * not shown out). Developer can set the outlook of the dialog on prepare(). + */ + @Override + public void prepare(IDialog dialog) { + dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate OBDA file"); + dialog.setModal(false); + dialog.setResizable(false); + dialog.setSize(view.getWidth(), view.getHeight()); + view.setContainerDialog(dialog); + } + + /** Called when the dialog is shown. */ + @Override + public void shown() { + // TODO Auto-generated method stub + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java index e9100d8d..25ff8ba9 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java @@ -1,507 +1,676 @@ package it.unibz.inf.ontouml.vp.views; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.util.HashSet; - -import javax.swing.DefaultComboBoxModel; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreePath; - import com.vp.plugin.diagram.IDiagramUIModel; import com.vp.plugin.model.IModelElement; import com.vp.plugin.view.IDialog; - import it.unibz.inf.ontouml.vp.OntoUMLPlugin; import it.unibz.inf.ontouml.vp.controllers.OBDAExportServerReques; +import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.model.DBMSSuported; import it.unibz.inf.ontouml.vp.model.MappingStrategy; -import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.util.HashSet; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; public class OBDAExportView extends javax.swing.JPanel { - private static final long serialVersionUID = 1L; - - private ProjectConfigurations configurations; - private JCheckBoxTree diagramTree; - private IDialog parentContainer; - private HashSet elementsDiagramTree = new HashSet<>(); - - private javax.swing.JComboBox cbxDBMS; - private javax.swing.JCheckBox jcbGenerateRelationalSchema; - private javax.swing.JCheckBox jcbStandarizeNames; - private javax.swing.JPanel diagramPanel; - private javax.swing.ButtonGroup groupStrategy; - private javax.swing.JCheckBox jcbGenerateConnection; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel7; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private javax.swing.JTabbedPane jTabbedPane1; - private javax.swing.JButton jbtnCancel; - private javax.swing.JButton jbtnGenerateFiles; - private javax.swing.JTextField jtfBaseIRI; - private javax.swing.JTextField jtfDatabase; - private javax.swing.JTextField jtfHost; - private javax.swing.JTextField jtfPassword; - private javax.swing.JTextField jtfUser; - private javax.swing.JPanel panSchemaParams; - private javax.swing.JRadioButton rbtOneTablePerClass; - private javax.swing.JRadioButton rbtOntTablePerKind; - - - - public OBDAExportView(ProjectConfigurations configurations) { - initComponents(); - - this.configurations = configurations; - - updateComponentsValues(); - } - - private void initComponents() { - // ************************************* - // Manually generated code. - // ************************************* - setSize(new Dimension(465, 500)); - - diagramPanel = new javax.swing.JPanel(); - diagramTree = new JCheckBoxTree("diagram"); - - JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); - scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - diagramPanel.add(scrollableTextAreaDiagram); - - diagramPanel.setLayout(new GridLayout(1, 1)); - diagramPanel.setPreferredSize(new Dimension(100, 100)); - - // ************************************* - // Automatically generated code. - // ************************************* - groupStrategy = new javax.swing.ButtonGroup(); - panSchemaParams = new javax.swing.JPanel(); - jPanel1 = new javax.swing.JPanel(); - rbtOneTablePerClass = new javax.swing.JRadioButton(); - rbtOntTablePerKind = new javax.swing.JRadioButton(); - jcbStandarizeNames = new javax.swing.JCheckBox(); - jLabel1 = new javax.swing.JLabel(); - jcbGenerateRelationalSchema = new javax.swing.JCheckBox(); - jTabbedPane1 = new javax.swing.JTabbedPane(); - jPanel2 = new javax.swing.JPanel(); - cbxDBMS = new javax.swing.JComboBox<>(); - jLabel3 = new javax.swing.JLabel(); - jPanel5 = new javax.swing.JPanel(); - jLabel4 = new javax.swing.JLabel(); - jLabel5 = new javax.swing.JLabel(); - jLabel6 = new javax.swing.JLabel(); - jLabel7 = new javax.swing.JLabel(); - jtfHost = new javax.swing.JTextField(); - jtfUser = new javax.swing.JTextField(); - jtfDatabase = new javax.swing.JTextField(); - jtfPassword = new javax.swing.JTextField(); - jcbGenerateConnection = new javax.swing.JCheckBox(); - jPanel4 = new javax.swing.JPanel(); - jLabel2 = new javax.swing.JLabel(); - jtfBaseIRI = new javax.swing.JTextField(); - jbtnGenerateFiles = new javax.swing.JButton(); - jbtnCancel = new javax.swing.JButton(); - - panSchemaParams.setBorder(javax.swing.BorderFactory.createTitledBorder("Parameters for relational schema: ")); - - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); - - groupStrategy.add(rbtOneTablePerClass); - rbtOneTablePerClass.setText("One Table per Class"); - - groupStrategy.add(rbtOntTablePerKind); - rbtOntTablePerKind.setSelected(true); - rbtOntTablePerKind.setText("One Table per Kind"); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + private static final long serialVersionUID = 1L; + + private ProjectConfigurations configurations; + private JCheckBoxTree diagramTree; + private IDialog parentContainer; + private HashSet elementsDiagramTree = new HashSet<>(); + + private javax.swing.JComboBox cbxDBMS; + private javax.swing.JCheckBox jcbGenerateRelationalSchema; + private javax.swing.JCheckBox jcbStandarizeNames; + private javax.swing.JPanel diagramPanel; + private javax.swing.ButtonGroup groupStrategy; + private javax.swing.JCheckBox jcbGenerateConnection; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JButton jbtnCancel; + private javax.swing.JButton jbtnGenerateFiles; + private javax.swing.JTextField jtfBaseIRI; + private javax.swing.JTextField jtfDatabase; + private javax.swing.JTextField jtfHost; + private javax.swing.JTextField jtfPassword; + private javax.swing.JTextField jtfUser; + private javax.swing.JPanel panSchemaParams; + private javax.swing.JRadioButton rbtOneTablePerClass; + private javax.swing.JRadioButton rbtOntTablePerKind; + + public OBDAExportView(ProjectConfigurations configurations) { + initComponents(); + + this.configurations = configurations; + + updateComponentsValues(); + } + + private void initComponents() { + // ************************************* + // Manually generated code. + // ************************************* + setSize(new Dimension(465, 500)); + + diagramPanel = new javax.swing.JPanel(); + diagramTree = new JCheckBoxTree("diagram"); + + JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); + scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + diagramPanel.add(scrollableTextAreaDiagram); + + diagramPanel.setLayout(new GridLayout(1, 1)); + diagramPanel.setPreferredSize(new Dimension(100, 100)); + + // ************************************* + // Automatically generated code. + // ************************************* + groupStrategy = new javax.swing.ButtonGroup(); + panSchemaParams = new javax.swing.JPanel(); + jPanel1 = new javax.swing.JPanel(); + rbtOneTablePerClass = new javax.swing.JRadioButton(); + rbtOntTablePerKind = new javax.swing.JRadioButton(); + jcbStandarizeNames = new javax.swing.JCheckBox(); + jLabel1 = new javax.swing.JLabel(); + jcbGenerateRelationalSchema = new javax.swing.JCheckBox(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel2 = new javax.swing.JPanel(); + cbxDBMS = new javax.swing.JComboBox<>(); + jLabel3 = new javax.swing.JLabel(); + jPanel5 = new javax.swing.JPanel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jtfHost = new javax.swing.JTextField(); + jtfUser = new javax.swing.JTextField(); + jtfDatabase = new javax.swing.JTextField(); + jtfPassword = new javax.swing.JTextField(); + jcbGenerateConnection = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jtfBaseIRI = new javax.swing.JTextField(); + jbtnGenerateFiles = new javax.swing.JButton(); + jbtnCancel = new javax.swing.JButton(); + + panSchemaParams.setBorder( + javax.swing.BorderFactory.createTitledBorder("Parameters for relational schema: ")); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); + + groupStrategy.add(rbtOneTablePerClass); + rbtOneTablePerClass.setText("One Table per Class"); + + groupStrategy.add(rbtOntTablePerKind); + rbtOntTablePerKind.setSelected(true); + rbtOntTablePerKind.setText("One Table per Kind"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerClass) + .addComponent(rbtOntTablePerKind)) + .addContainerGap(52, Short.MAX_VALUE))); + jPanel1Layout.setVerticalGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() .addComponent(rbtOneTablePerClass) - .addComponent(rbtOntTablePerKind)) - .addContainerGap(52, Short.MAX_VALUE)) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(rbtOneTablePerClass) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rbtOntTablePerKind) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jcbStandarizeNames.setSelected(true); - jcbStandarizeNames.setText("Standardize database names"); - - jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); - - jcbGenerateRelationalSchema.setSelected(true); - jcbGenerateRelationalSchema.setText("Generate database script"); - - cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); - - jLabel3.setText("Name"); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(jLabel3) - .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(cbxDBMS, 0, 145, Short.MAX_VALUE)) - .addContainerGap()) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(90, Short.MAX_VALUE)) - ); - - jTabbedPane1.addTab("DBMS", jPanel2); - - jLabel4.setText("Host :"); - - jLabel5.setText("Database :"); - jLabel5.setToolTipText(""); - - jLabel6.setText("User :"); - - jLabel7.setText("Passoword :"); - - jcbGenerateConnection.setSelected(false); - jcbGenerateConnection.setText("Generate the connection"); - - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(rbtOntTablePerKind) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + jcbStandarizeNames.setSelected(true); + jcbStandarizeNames.setText("Standardize database names"); + + jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); + + jcbGenerateRelationalSchema.setSelected(true); + jcbGenerateRelationalSchema.setText("Generate database script"); + + cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); + + jLabel3.setText("Name"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addComponent(jLabel3) + .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(cbxDBMS, 0, 145, Short.MAX_VALUE)) + .addContainerGap())); + jPanel2Layout.setVerticalGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + cbxDBMS, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(90, Short.MAX_VALUE))); + + jTabbedPane1.addTab("DBMS", jPanel2); + + jLabel4.setText("Host :"); + + jLabel5.setText("Database :"); + jLabel5.setToolTipText(""); + + jLabel6.setText("User :"); + + jLabel7.setText("Passoword :"); + + jcbGenerateConnection.setSelected(false); + jcbGenerateConnection.setText("Generate the connection"); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addGroup( + jPanel5Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel6)) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jtfUser) + .addComponent(jtfPassword))) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jLabel4) + .addGap(34, 34, 34) + .addComponent(jtfHost)) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jcbGenerateConnection) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfDatabase))) + .addContainerGap())); + jPanel5Layout.setVerticalGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateConnection) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent( + jtfHost, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent( + jtfDatabase, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent( + jtfUser, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) - .addComponent(jLabel6)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jtfUser) - .addComponent(jtfPassword))) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jLabel4) - .addGap(34, 34, 34) - .addComponent(jtfHost)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jcbGenerateConnection) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jLabel5) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jtfDatabase))) - .addContainerGap()) - ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateConnection) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel4) - .addComponent(jtfHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel5) - .addComponent(jtfDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel6) - .addComponent(jtfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel7) - .addComponent(jtfPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jTabbedPane1.addTab("Conection", jPanel5); - - javax.swing.GroupLayout panSchemaParamsLayout = new javax.swing.GroupLayout(panSchemaParams); - panSchemaParams.setLayout(panSchemaParamsLayout); - panSchemaParamsLayout.setHorizontalGroup( - panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(panSchemaParamsLayout.createSequentialGroup() - .addContainerGap() - .addGroup(panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(jcbStandarizeNames, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(panSchemaParamsLayout.createSequentialGroup() - .addComponent(jcbGenerateRelationalSchema) - .addGap(16, 16, 16))) - .addGroup(panSchemaParamsLayout.createSequentialGroup() - .addGap(21, 21, 21) - .addComponent(jLabel1))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jTabbedPane1) - .addContainerGap()) - ); - panSchemaParamsLayout.setVerticalGroup( - panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panSchemaParamsLayout.createSequentialGroup() - .addGroup(panSchemaParamsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(panSchemaParamsLayout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(15, 15, 15) - .addComponent(jcbStandarizeNames) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jcbGenerateRelationalSchema)) - .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 171, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Paramters for OBDA file: ")); - - jLabel2.setText("Base IRI:"); - - jtfBaseIRI.setText("http://example.com"); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel4Layout.createSequentialGroup() - .addComponent(jLabel2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jtfBaseIRI))) - .addContainerGap()) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent(jtfBaseIRI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE) - .addContainerGap()) - ); - - jbtnGenerateFiles.setText("Generate Ontop Files"); - jbtnGenerateFiles.setMaximumSize(new java.awt.Dimension(135, 29)); - jbtnGenerateFiles.setMinimumSize(new java.awt.Dimension(135, 29)); - jbtnGenerateFiles.setPreferredSize(new java.awt.Dimension(135, 29)); - - jbtnCancel.setText("Cancel"); - jbtnCancel.setMaximumSize(new java.awt.Dimension(135, 29)); - jbtnCancel.setMinimumSize(new java.awt.Dimension(135, 29)); - jbtnCancel.setPreferredSize(new java.awt.Dimension(135, 29)); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(41, 41, 41) - .addComponent(jbtnGenerateFiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(45, 45, 45)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(panSchemaParams, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(panSchemaParams, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jbtnGenerateFiles, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - - // ************************************* - // Manually generated code. - // ************************************* - - jbtnGenerateFiles.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jbtnGenerateFilesActionPerformed(evt); - } - }); - - jbtnCancel.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jbtnCancelActionPerformed(evt); - } - }); - - } - - private void jbtnGenerateFilesActionPerformed(java.awt.event.ActionEvent evt) { - - if(jcbGenerateConnection.isSelected() && - ( - jtfHost.getText().trim().equals("") || - jtfDatabase.getText().trim().equals("") || - jtfUser.getText().trim().equals("") || - jtfPassword.getText().trim().equals("") - ) - ) { - JOptionPane.showMessageDialog(null ,"Host, database, user and password must be filled in.", "Error", JOptionPane.ERROR_MESSAGE); - return; - } - - if( (DBMSSuported) cbxDBMS.getSelectedItem() == DBMSSuported.GENERIC_SCHEMA && jcbGenerateConnection.isSelected() ) { - JOptionPane.showMessageDialog(null ,"It is not possible to generate the connection file for the generic database.", "Error", JOptionPane.ERROR_MESSAGE); - return; - } - - saveSelectedElements(); - updateConfigurationsValues(); - Configurations.getInstance().save(); - parentContainer.close(); - OntoUMLPlugin.setOBDAExportWindowOpen(false); - ( new OBDAExportServerReques() ).start(); - } - - private void jbtnCancelActionPerformed(java.awt.event.ActionEvent evt) { - parentContainer.close(); - OntoUMLPlugin.setOBDAExportWindowOpen(false); - } - - /** Sets a direct reference to the container dialog after initialization. */ - public void setContainerDialog(IDialog dialog) { - this.parentContainer = dialog; - } - - /** Updates project configurations with components' information. */ - private void updateConfigurationsValues() { - configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); - - if( rbtOntTablePerKind.isSelected() ) - configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); - else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); - - configurations.setTargetDBMS( (DBMSSuported) cbxDBMS.getSelectedItem() ); - - configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); - - configurations.setStandardizeNames(jcbStandarizeNames.isSelected()); - - configurations.setGenerateSchema(jcbGenerateRelationalSchema.isSelected()); - - configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); - - configurations.setHostNameConnection(jtfHost.getText().trim()); - - configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); - - configurations.setUserNameConnection(jtfUser.getText().trim()); - - configurations.setPassword(jtfPassword.getText().trim()); - } - - /** - * Updates components with project configurations' information. - * - * @param configurations - */ - private void updateComponentsValues() { - - if(configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_KIND) - rbtOntTablePerKind.setSelected(true); - else - rbtOneTablePerClass.setSelected(true); - - if(configurations.getTargetDBMS() != null) - cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); - - if(configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) - jtfBaseIRI.setText(configurations.getExportGUFOIRI()); - - if(configurations.getExportGUFOElementsDiagramTree() != null) - diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); - - jcbStandarizeNames.setSelected(configurations.isStandardizeNames()); - - jcbGenerateRelationalSchema.setSelected(configurations.isGenerateSchema()); - - jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); - - jtfHost.setText(configurations.getHostNameConnection()); - - jtfDatabase.setText(configurations.getDatabaseNameConnection()); - - jtfUser.setText(configurations.getUserNameConnection()); - - jtfPassword.setText(configurations.getPassword()); - } - - private void saveSelectedElements() { - TreePath[] paths; - - paths = diagramTree.getCheckedPaths(); - - for (TreePath path : paths) { - Object[] object = path.getPath(); - for (Object o : object) { - - if (o instanceof DefaultMutableTreeNode) { - - DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; - - if (node.getUserObject() instanceof IModelElement) - this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); - - if (node.getUserObject() instanceof IDiagramUIModel) - this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); - } - } - } - - } + .addComponent( + jtfPassword, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + jTabbedPane1.addTab("Conection", jPanel5); + + javax.swing.GroupLayout panSchemaParamsLayout = new javax.swing.GroupLayout(panSchemaParams); + panSchemaParams.setLayout(panSchemaParamsLayout); + panSchemaParamsLayout.setHorizontalGroup( + panSchemaParamsLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + panSchemaParamsLayout + .createSequentialGroup() + .addContainerGap() + .addGroup( + panSchemaParamsLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + jPanel1, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup( + panSchemaParamsLayout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent( + jcbStandarizeNames, + javax.swing.GroupLayout.Alignment.LEADING, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addGroup( + panSchemaParamsLayout + .createSequentialGroup() + .addComponent(jcbGenerateRelationalSchema) + .addGap(16, 16, 16))) + .addGroup( + panSchemaParamsLayout + .createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jTabbedPane1) + .addContainerGap())); + panSchemaParamsLayout.setVerticalGroup( + panSchemaParamsLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + panSchemaParamsLayout + .createSequentialGroup() + .addGroup( + panSchemaParamsLayout + .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup( + panSchemaParamsLayout + .createSequentialGroup() + .addComponent( + jPanel1, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(15, 15, 15) + .addComponent(jcbStandarizeNames) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jcbGenerateRelationalSchema)) + .addComponent( + jTabbedPane1, + javax.swing.GroupLayout.PREFERRED_SIZE, + 171, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Paramters for OBDA file: ")); + + jLabel2.setText("Base IRI:"); + + jtfBaseIRI.setText("http://example.com"); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + diagramPanel, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jtfBaseIRI))) + .addContainerGap())); + jPanel4Layout.setVerticalGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + jPanel4Layout + .createSequentialGroup() + .addGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent( + jtfBaseIRI, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE) + .addContainerGap())); + + jbtnGenerateFiles.setText("Generate Ontop Files"); + jbtnGenerateFiles.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnGenerateFiles.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnGenerateFiles.setPreferredSize(new java.awt.Dimension(135, 29)); + + jbtnCancel.setText("Cancel"); + jbtnCancel.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setPreferredSize(new java.awt.Dimension(135, 29)); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addGap(41, 41, 41) + .addComponent( + jbtnGenerateFiles, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addComponent( + jbtnCancel, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(45, 45, 45)) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + panSchemaParams, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addContainerGap()) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + jPanel4, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addContainerGap())); + layout.setVerticalGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addComponent( + panSchemaParams, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + jPanel4, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent( + jbtnCancel, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent( + jbtnGenerateFiles, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap())); + + // ************************************* + // Manually generated code. + // ************************************* + + jbtnGenerateFiles.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jbtnGenerateFilesActionPerformed(evt); + } + }); + + jbtnCancel.addActionListener( + new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jbtnCancelActionPerformed(evt); + } + }); + } + + private void jbtnGenerateFilesActionPerformed(java.awt.event.ActionEvent evt) { + + if (jcbGenerateConnection.isSelected() + && (jtfHost.getText().trim().equals("") + || jtfDatabase.getText().trim().equals("") + || jtfUser.getText().trim().equals("") + || jtfPassword.getText().trim().equals(""))) { + JOptionPane.showMessageDialog( + null, + "Host, database, user and password must be filled in.", + "Error", + JOptionPane.ERROR_MESSAGE); + return; + } + + if ((DBMSSuported) cbxDBMS.getSelectedItem() == DBMSSuported.GENERIC_SCHEMA + && jcbGenerateConnection.isSelected()) { + JOptionPane.showMessageDialog( + null, + "It is not possible to generate the connection file for the generic database.", + "Error", + JOptionPane.ERROR_MESSAGE); + return; + } + + saveSelectedElements(); + updateConfigurationsValues(); + Configurations.getInstance().save(); + parentContainer.close(); + OntoUMLPlugin.setOBDAExportWindowOpen(false); + (new OBDAExportServerReques()).start(); + } + + private void jbtnCancelActionPerformed(java.awt.event.ActionEvent evt) { + parentContainer.close(); + OntoUMLPlugin.setOBDAExportWindowOpen(false); + } + + /** Sets a direct reference to the container dialog after initialization. */ + public void setContainerDialog(IDialog dialog) { + this.parentContainer = dialog; + } + + /** Updates project configurations with components' information. */ + private void updateConfigurationsValues() { + configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); + + if (rbtOntTablePerKind.isSelected()) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); + else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); + + configurations.setTargetDBMS((DBMSSuported) cbxDBMS.getSelectedItem()); + + configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); + + configurations.setStandardizeNames(jcbStandarizeNames.isSelected()); + + configurations.setGenerateSchema(jcbGenerateRelationalSchema.isSelected()); + + configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); + + configurations.setHostNameConnection(jtfHost.getText().trim()); + + configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); + + configurations.setUserNameConnection(jtfUser.getText().trim()); + + configurations.setPassword(jtfPassword.getText().trim()); + } + + /** + * Updates components with project configurations' information. + * + * @param configurations + */ + private void updateComponentsValues() { + + if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_KIND) + rbtOntTablePerKind.setSelected(true); + else rbtOneTablePerClass.setSelected(true); + + if (configurations.getTargetDBMS() != null) + cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); + + if (configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) + jtfBaseIRI.setText(configurations.getExportGUFOIRI()); + + if (configurations.getExportGUFOElementsDiagramTree() != null) + diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); + + jcbStandarizeNames.setSelected(configurations.isStandardizeNames()); + + jcbGenerateRelationalSchema.setSelected(configurations.isGenerateSchema()); + + jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); + + jtfHost.setText(configurations.getHostNameConnection()); + + jtfDatabase.setText(configurations.getDatabaseNameConnection()); + + jtfUser.setText(configurations.getUserNameConnection()); + + jtfPassword.setText(configurations.getPassword()); + } + + private void saveSelectedElements() { + TreePath[] paths; + + paths = diagramTree.getCheckedPaths(); + + for (TreePath path : paths) { + Object[] object = path.getPath(); + for (Object o : object) { + + if (o instanceof DefaultMutableTreeNode) { + + DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; + + if (node.getUserObject() instanceof IModelElement) + this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); + if (node.getUserObject() instanceof IDiagramUIModel) + this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); + } + } + } + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java index 3e82b8e7..48d6c8ac 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java @@ -1,70 +1,68 @@ package it.unibz.inf.ontouml.vp.views; -import java.awt.Component; - -import it.unibz.inf.ontouml.vp.model.ServerRequest; import com.vp.plugin.view.IDialog; import com.vp.plugin.view.IDialogHandler; +import it.unibz.inf.ontouml.vp.model.ServerRequest; +import java.awt.Component; + +public class ProgressDialogStandard implements IDialogHandler { + + private IDialog mainDialog; + private ProgressPanel progressPanel; + private String title; + private int width; + private int height; + + public ProgressDialogStandard() { + progressPanel = new ProgressPanel("Contacting Server..."); + title = "Working..."; + width = progressPanel.getWidth(); + height = progressPanel.getHeight(); + } + + public ProgressDialogStandard(ServerRequest serverRequest) { + progressPanel = new ProgressPanel(serverRequest); + title = "Working..."; + width = progressPanel.getWidth(); + height = progressPanel.getHeight(); + } + + public void setTitle(String txt) { + title = txt; + } + + public void setWidth(int w) { + width = w; + } -public class ProgressDialogStandard implements IDialogHandler{ + public void setHeight(int h) { + height = h; + } - private IDialog mainDialog; - private ProgressPanel progressPanel; - private String title; - private int width; - private int height; - - public ProgressDialogStandard( ) { - progressPanel = new ProgressPanel( "Contacting Server..." ); - title = "Working..."; - width = progressPanel.getWidth(); - height = progressPanel.getHeight(); - } - - public ProgressDialogStandard(ServerRequest serverRequest) { - progressPanel = new ProgressPanel(serverRequest); - title = "Working..."; - width = progressPanel.getWidth(); - height = progressPanel.getHeight(); - } - - public void setTitle(String txt) { - title = txt; - } - - public void setWidth(int w) { - width = w; - } - - public void setHeight(int h) { - height = h; - } - - @Override - public boolean canClosed() { - mainDialog.close(); - return true; - } + @Override + public boolean canClosed() { + mainDialog.close(); + return true; + } - @Override - public Component getComponent() { - return progressPanel; - } + @Override + public Component getComponent() { + return progressPanel; + } - @Override - public void prepare(IDialog dialog) { - mainDialog = dialog; - mainDialog.setModal(false); - mainDialog.setResizable(false); - mainDialog.setTitle(title); - dialog.setSize( width , height ); - progressPanel.setContainerDialog(mainDialog); - } + @Override + public void prepare(IDialog dialog) { + mainDialog = dialog; + mainDialog.setModal(false); + mainDialog.setResizable(false); + mainDialog.setTitle(title); + dialog.setSize(width, height); + progressPanel.setContainerDialog(mainDialog); + } - @Override - public void shown() { - // TODO Auto-generated method stub - - } + @Override + public void shown() { + // TODO Auto-generated method stub + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java index c207ab1f..2ff3e051 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java @@ -20,7 +20,7 @@ public class ProgressPanel extends JPanel { private JProgressBar progressBar; private JButton btnCancel; private IDialog _dialog; - + public ProgressPanel(String text) { setSize(new Dimension(200, 100)); @@ -39,7 +39,7 @@ public ProgressPanel(String text) { public ProgressPanel(ServerRequest request) { this("Contacting Server..."); - setSize(new Dimension(200, 120));//Add 20 to the height because add a button + setSize(new Dimension(200, 120)); // Add 20 to the height because add a button btnCancel = new JButton("Cancel"); btnCancel.addActionListener( From bfbb83e0872cd45af2b1ddd6a7f4f770906d869f Mon Sep 17 00:00:00 2001 From: Claudenir Fonseca Date: Tue, 20 Apr 2021 19:43:22 +0200 Subject: [PATCH 03/10] Bugfix expection on invert association --- .../inf/ontouml/vp/model/uml/Property.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Property.java b/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Property.java index f881d088..c71494ba 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Property.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Property.java @@ -420,13 +420,23 @@ public String getType() { } public static void removeRedefinedProperties(IAssociationEnd associationEnd) { - Stream.of(associationEnd.toRedefinedPropertyArray()) - .forEach(redefined -> associationEnd.removeRedefinedProperty(redefined)); + var array = associationEnd.toRedefinedPropertyArray(); + + if (array == null) { + return; + } + + Stream.of(array).forEach(redefined -> associationEnd.removeRedefinedProperty(redefined)); } public static void removeSubsettedProperties(IAssociationEnd associationEnd) { - Stream.of(associationEnd.toSubsettedPropertyArray()) - .forEach(subsetted -> associationEnd.removeSubsettedProperty(subsetted)); + var array = associationEnd.toSubsettedPropertyArray(); + + if (array == null) { + return; + } + + Stream.of(array).forEach(subsetted -> associationEnd.removeSubsettedProperty(subsetted)); } public static void addRedefinedProperties( From a9a8b5363e9a6b1c0d1c0df721fb532c9c19e56d Mon Sep 17 00:00:00 2001 From: Claudenir Fonseca Date: Tue, 20 Apr 2021 20:00:49 +0200 Subject: [PATCH 04/10] Bugfix undesired overriding of restrictions on mode classes --- .../java/it/unibz/inf/ontouml/vp/model/uml/Class.java | 2 +- .../java/it/unibz/inf/ontouml/vp/utils/RestrictedTo.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Class.java b/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Class.java index da5dd0f2..25f4b26a 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Class.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/uml/Class.java @@ -465,7 +465,7 @@ public static void setRestrictedTo(IClass _class, String restrictions) { } private static void setDefaultRestrictedTo(IClass element, String stereotypeName) { - String currentRestrictedTo = getRestrictedTo(element); + List currentRestrictedTo = getRestrictedToList(element); if (RestrictedTo.shouldOverrideRestrictedTo(stereotypeName, currentRestrictedTo)) { final String defaultNature = RestrictedTo.getDefaultRestrictedTo(stereotypeName); diff --git a/src/main/java/it/unibz/inf/ontouml/vp/utils/RestrictedTo.java b/src/main/java/it/unibz/inf/ontouml/vp/utils/RestrictedTo.java index 93750d52..91e62b07 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/utils/RestrictedTo.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/utils/RestrictedTo.java @@ -82,7 +82,7 @@ public static List possibleRestrictedToValues(String stereotype) { } } - public static boolean shouldOverrideRestrictedTo(String stereotype, String restrictedTo) { + public static boolean shouldOverrideRestrictedTo(String stereotype, List restrictedTo) { switch (stereotype) { case Stereotype.TYPE: case Stereotype.EVENT: @@ -92,11 +92,15 @@ public static boolean shouldOverrideRestrictedTo(String stereotype, String restr case Stereotype.QUANTITY: case Stereotype.RELATOR: case Stereotype.QUALITY: - case Stereotype.MODE: case Stereotype.ENUMERATION: case Stereotype.DATATYPE: case Stereotype.ABSTRACT: return true; + case Stereotype.MODE: + return restrictedTo.stream() + .anyMatch( + restriction -> + !INTRINSIC_MODE.equals(restriction) && !EXTRINSIC_MODE.equals(restriction)); case Stereotype.CATEGORY: case Stereotype.MIXIN: case Stereotype.ROLE_MIXIN: From 5cbb0320573f991e763b66548e22abac45142a26 Mon Sep 17 00:00:00 2001 From: Claudenir Fonseca Date: Tue, 20 Apr 2021 20:03:19 +0200 Subject: [PATCH 05/10] Update version to 0.5.1 --- pom.xml | 2 +- src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java | 2 +- src/main/resources/plugin.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index a4d16255..0551771b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ it.unibz.inf.ontouml ontouml-vp-plugin - 0.5.0 + 0.5.1 OntoUML 2 Plugin for Visual Paradigm diff --git a/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java b/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java index e8472a7b..b3facc9e 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/OntoUMLPlugin.java @@ -16,7 +16,7 @@ */ public class OntoUMLPlugin implements VPPlugin { - public static final String PLUGIN_VERSION_RELEASE = "0.5.0"; + public static final String PLUGIN_VERSION_RELEASE = "0.5.1"; public static final String PLUGIN_ID = "it.unibz.inf.ontouml.vp"; public static final String PLUGIN_NAME = "OntoUML Plugin"; public static final String PLUGIN_REPO = "https://github.com/OntoUML/ontouml-vp-plugin/"; diff --git a/src/main/resources/plugin.xml b/src/main/resources/plugin.xml index 3d062c8d..1d3c8a28 100644 --- a/src/main/resources/plugin.xml +++ b/src/main/resources/plugin.xml @@ -1,6 +1,6 @@ From 54b16e2c4c8c6a0a398d92202456711b12b670ca Mon Sep 17 00:00:00 2001 From: Gustavo L Guidoni Date: Thu, 29 Apr 2021 15:22:30 -0300 Subject: [PATCH 06/10] Version 0.0.1. Without the code needed to identify the data received from the server. --- .../vp/controllers/DBExportController.java | 39 - .../vp/controllers/DBExportServerRequest.java | 98 --- .../vp/controllers/DbMappingController.java | 138 ++++ .../controllers/DbMappingDialogHandler.java | 98 +++ .../vp/controllers/OBDAExportController.java | 39 - .../controllers/OBDAExportServerReques.java | 123 ---- .../OntoUMLServerAccessController.java | 233 +----- .../ontouml/vp/model/DbMappingOptions.java | 149 ++++ .../vp/model/DbMappingToDbServiceResult.java | 31 + .../{DBMSSuported.java => DbmsSupported.java} | 4 +- .../inf/ontouml/vp/model/MappingStrategy.java | 3 +- .../vp/model/ProjectConfigurations.java | 86 ++- .../inf/ontouml/vp/utils/OBDAResult.java | 105 --- .../inf/ontouml/vp/views/DBExportHandler.java | 56 -- .../inf/ontouml/vp/views/DBExportView.java | 488 ------------- .../inf/ontouml/vp/views/DbMappingView.java | 510 +++++++++++++ .../ontouml/vp/views/OBDAExportHandler.java | 56 -- .../inf/ontouml/vp/views/OBDAExportView.java | 676 ------------------ .../vp/views/ProgressDialogStandard.java | 68 -- .../inf/ontouml/vp/views/ProgressPanel.java | 20 +- src/main/resources/plugin.xml | 24 + 21 files changed, 1071 insertions(+), 1973 deletions(-) delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java rename src/main/java/it/unibz/inf/ontouml/vp/model/{DBMSSuported.java => DbmsSupported.java} (82%) delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java deleted file mode 100644 index dbbb3330..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportController.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Access class of the Generate Schema toolbar button. - * - *

Author: Gustavo Ludovico Guidoni - */ -package it.unibz.inf.ontouml.vp.controllers; - -import com.vp.plugin.ApplicationManager; -import com.vp.plugin.action.VPAction; -import com.vp.plugin.action.VPActionController; -import it.unibz.inf.ontouml.vp.OntoUMLPlugin; -import it.unibz.inf.ontouml.vp.views.DBExportHandler; - -public class DBExportController implements VPActionController { - - @Override - public void performAction(VPAction action) { - - DBExportHandler dialog = new DBExportHandler(); - - if (OntoUMLPlugin.getDBExportWindowOpen() == true) return; - - OntoUMLPlugin.setDBExportWindowOpen(true); - - ApplicationManager.instance().getViewManager().showDialog(dialog); - } - - /** - * Called when the menu containing the button is accessed allowing for action manipulation, such - * as enable/disable or selecting the button. - * - *

OBS: DOES NOT apply to this class. - */ - @Override - public void update(VPAction arg0) { - // TODO Auto-generated method stub - - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java deleted file mode 100644 index a60a0cdf..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DBExportServerRequest.java +++ /dev/null @@ -1,98 +0,0 @@ -package it.unibz.inf.ontouml.vp.controllers; - -import com.vp.plugin.ApplicationManager; -import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; -import it.unibz.inf.ontouml.vp.model.uml.ModelElement; -import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; -import it.unibz.inf.ontouml.vp.views.ProgressDialogStandard; -import java.awt.FileDialog; -import java.awt.Frame; -import java.io.BufferedReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashSet; -import java.util.stream.Collectors; - -public class DBExportServerRequest extends Thread { - - private ProgressDialogStandard loading; - - private final ProjectConfigurations projectConfigurations = - Configurations.getInstance().getProjectConfigurations(); - - @Override - public void run() { - HashSet elements; - try { - - loading = new ProgressDialogStandard(); - loading.setTitle("Generating schema"); - ApplicationManager.instance() - .getViewManager() - .showDialog( - loading); // This class must extend Thread for the ProgressDialog to be shown - // properly. - - elements = - Configurations.getInstance() - .getProjectConfigurations() - .getExportGUFOElementsDiagramTree(); - - final BufferedReader script = - OntoUMLServerAccessController.transformToDB( - ModelElement.generateModel(elements, true), - projectConfigurations.getMappingStrategy().toString(), - projectConfigurations.getTargetDBMS().toString(), - projectConfigurations.isStandardizeNames()); - - loading.canClosed(); - - if (script != null) { - saveFile(script); - ViewManagerUtils.cleanAndShowMessage("Object-relational mapping performed successfully."); - } else { - ViewManagerUtils.cleanAndShowMessage( - "Unable to generate the files. Please check your model."); - } - - } catch (Exception e) { - e.printStackTrace(); - loading.canClosed(); - } - } - - private void saveFile(BufferedReader buffer) throws IOException { - final Configurations configs = Configurations.getInstance(); - final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); - final FileDialog fd = - new FileDialog( - (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), - "Choose destination", - FileDialog.SAVE); - - String suggestedFolderPath = projectConfigurations.getExportFolderPath(); - String exportFormatExtension = ".sql"; - String suggestedFileName = - ApplicationManager.instance().getProjectManager().getProject().getName() - + exportFormatExtension; - - fd.setDirectory(suggestedFolderPath); - fd.setFile(suggestedFileName); - fd.setVisible(true); - - if (fd.getDirectory() != null && fd.getFile() != null) { - final String fileDirectory = fd.getDirectory(); - final String fileName = - !fd.getFile().endsWith(exportFormatExtension) - ? fd.getFile() + exportFormatExtension - : fd.getFile(); - final String output = buffer.lines().collect(Collectors.joining("\n")); - - Files.write(Paths.get(fileDirectory, fileName), output.getBytes()); - projectConfigurations.setExportFolderPath(fileDirectory); - configs.save(); - } - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java new file mode 100644 index 00000000..0093a87e --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java @@ -0,0 +1,138 @@ +package it.unibz.inf.ontouml.vp.controllers; + +import java.awt.FileDialog; +import java.awt.Frame; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +import com.vp.plugin.ApplicationManager; +import com.vp.plugin.action.VPAction; +import com.vp.plugin.action.VPActionController; + +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.DbMappingOptions; +import it.unibz.inf.ontouml.vp.model.DbMappingToDbServiceResult; +import it.unibz.inf.ontouml.vp.model.GufoExportOptions; +import it.unibz.inf.ontouml.vp.model.GufoTransformationServiceResult; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; +import it.unibz.inf.ontouml.vp.model.vp2ontouml.Uml2OntoumlTransformer; +import it.unibz.inf.ontouml.vp.utils.SimpleServiceWorker; +import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; + +public class DbMappingController implements VPActionController { + + private static final String MESSAGE_MODEL_EXPORTED = "Model exported successfully."; + + private Configurations configurations; + private ProjectConfigurations projectConfigurations; + private String schemaFormat = ".sql"; + private String obdaFormat = ".obda"; + private String propertiesFormat = ".properties"; + private Path schemaFilePath; + private Path obdaFilePath; + private Path propertiesFilePath; + + @Override + public void performAction(VPAction action) { + schemaFilePath = null; + obdaFilePath = null; + propertiesFilePath = null; + configurations = Configurations.getInstance(); + projectConfigurations = configurations.getProjectConfigurations(); + DbMappingDialogHandler mappingDialog = new DbMappingDialogHandler(projectConfigurations); + mappingDialog.showDialog(); + + if (mappingDialog.wasCancelled()) { + ViewManagerUtils.log("Request cancelled by the user."); + return; + } + + putFilePath(); + + new SimpleServiceWorker(this::task).execute(); + } + + private List task(SimpleServiceWorker context) { + try { + if (schemaFilePath == null) { + context.cancel(true); + return List.of(); + } + + final String project = Uml2OntoumlTransformer.transformAndSerialize(); + final String options = new DbMappingOptions(projectConfigurations).toJson(); + final DbMappingToDbServiceResult result = OntoUMLServerAccessController.requestMappingToDB(project, options); + + if (!context.isCancelled()) { + //Files.write(schemaFilePath, "schema".getBytes()); + //Files.write(obdaFilePath, "OBDA".getBytes()); + //Files.write(propertiesFilePath, "properties".getBytes()); + Files.write(schemaFilePath, result.getSchema().getBytes()); + Files.write(obdaFilePath, result.getObda().getBytes()); + Files.write(propertiesFilePath, result.getProperties().getBytes()); + saveFilePath(); + ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); + return List.of(MESSAGE_MODEL_EXPORTED); + } + + return List.of(); + + } catch (IOException e) { + if (!context.isCancelled()) { + ViewManagerUtils.log(e.getMessage()); + } + e.printStackTrace(); + return List.of(e.getMessage()); + } + } + + private void putFilePath() { + final FileDialog fileDialog; + final Frame rootFrame = (Frame) ApplicationManager.instance().getViewManager().getRootFrame(); + final String suggestedFolderPath = projectConfigurations.getDbMappingFolderPath(); + String suggestedFileName = projectConfigurations.getDbMappingFileName(); + + if (suggestedFileName.isEmpty()) { + suggestedFileName = ApplicationManager.instance().getProjectManager().getProject().getName(); + } + + final String title = "Choose file destination"; + fileDialog = new FileDialog(rootFrame, title, FileDialog.SAVE); + + fileDialog.setFile(suggestedFileName); + fileDialog.setDirectory(suggestedFolderPath); + fileDialog.setMultipleMode(false); + fileDialog.setVisible(true); + + final String fileDirectory = fileDialog.getDirectory(); + final String fileName = fileDialog.getFile(); + + if (fileDirectory != null && fileName != null) { + schemaFilePath = Paths.get(fileDirectory, fileName + schemaFormat); + obdaFilePath = Paths.get(fileDirectory, fileName + obdaFormat); + propertiesFilePath = Paths.get(fileDirectory, fileName + propertiesFormat); + } + } + + private void saveFilePath() { + final Path directoryPath = schemaFilePath.getParent(); + final String directoryPathName = directoryPath.toAbsolutePath().getFileName().toString(); + final String filePathName = schemaFilePath.getFileName().toString(); + + projectConfigurations.setDbMappingFolderPath(directoryPathName); + projectConfigurations.setDbMappingFileName(filePathName); + configurations.save(); + } + + /** + * Called when the menu containing the button is accessed allowing for action manipulation, such + * as enable/disable or selecting the button. + * + *

OBS: DOES NOT apply to this class. + */ + @Override + public void update(VPAction action) {} + } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java new file mode 100644 index 00000000..9b0e9205 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java @@ -0,0 +1,98 @@ +package it.unibz.inf.ontouml.vp.controllers; + +import java.awt.Component; + +import com.vp.plugin.ApplicationManager; +import com.vp.plugin.ViewManager; +import com.vp.plugin.view.IDialog; +import com.vp.plugin.view.IDialogHandler; + +import it.unibz.inf.ontouml.vp.OntoUMLPlugin; +import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; +import it.unibz.inf.ontouml.vp.views.DbMappingView; + +public class DbMappingDialogHandler implements IDialogHandler { + + private IDialog dialog; + private final DbMappingView view; + private final ViewManager viewManager; + private boolean wasShown = false; + private boolean wasClosed = false; + private boolean wasCancelled = false; + + public DbMappingDialogHandler(ProjectConfigurations projectConfigurations) { + view = new DbMappingView(projectConfigurations); + viewManager = ApplicationManager.instance().getViewManager(); + + view.onExport( + e -> { + view.updateConfigurationsValues(projectConfigurations); + Configurations.getInstance().save(); + closeDialog(); + }); + view.onCancel( + e -> { + wasCancelled = true; + closeDialog(); + }); + } + + /** + * Called once before the dialog is shown. Developer should return the content of the dialog + * (similar to the content pane). + */ + @Override + public Component getComponent() { + return view; + } + + /** + * Called after the getComponent(). A dialog is created on Visual Paradigm internally (it still + * not shown out). Developer can set the outlook of the dialog on prepare(). + */ + @Override + public void prepare(IDialog dialog) { + this.dialog = dialog; + dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME); + dialog.setModal(true); + dialog.setResizable(false); //true + dialog.setSize(view.getWidth(), view.getHeight() + 20); + dialog.pack(); + } + + /** Called when the dialog is shown. */ + @Override + public void shown() {} + + /** Called when the dialog is closed by the user clicking on the close button of the frame. */ + @Override + public boolean canClosed() { + wasCancelled = true; + wasClosed = true; + return true; + } + + public void showDialog() { + if (!wasClosed) { + wasShown = true; + viewManager.showDialog(this); + } + } + + public void closeDialog() { + if (wasClosed) { + System.out.println("Mapping to ER dialog was already closed."); + } else if (!wasShown) { + System.out.println("Mapping to ER dialog was never shown. Setting wasClosed to \"true\""); + } else { + System.out.println("Closing mapping do ER dialog."); + dialog.close(); + } + wasClosed = true; + } + + public boolean wasCancelled() { + return wasCancelled; + } + } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java deleted file mode 100644 index 8c18233a..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportController.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Access class of the Integration with Ontop toolbar button. - * - *

Author: Gustavo Ludovico Guidoni - */ -package it.unibz.inf.ontouml.vp.controllers; - -import com.vp.plugin.ApplicationManager; -import com.vp.plugin.action.VPAction; -import com.vp.plugin.action.VPActionController; -import it.unibz.inf.ontouml.vp.OntoUMLPlugin; -import it.unibz.inf.ontouml.vp.views.OBDAExportHandler; - -public class OBDAExportController implements VPActionController { - - @Override - public void performAction(VPAction action) { - - OBDAExportHandler dialog = new OBDAExportHandler(); - - if (OntoUMLPlugin.getOBDAExportWindowOpen() == true) return; - - OntoUMLPlugin.setOBDAExportWindowOpen(true); - - ApplicationManager.instance().getViewManager().showDialog(dialog); - } - - /** - * Called when the menu containing the button is accessed allowing for action manipulation, such - * as enable/disable or selecting the button. - * - *

OBS: DOES NOT apply to this class. - */ - @Override - public void update(VPAction arg0) { - // TODO Auto-generated method stub - - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java deleted file mode 100644 index 107b241b..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OBDAExportServerReques.java +++ /dev/null @@ -1,123 +0,0 @@ -package it.unibz.inf.ontouml.vp.controllers; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.vp.plugin.ApplicationManager; -import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; -import it.unibz.inf.ontouml.vp.model.uml.ModelElement; -import it.unibz.inf.ontouml.vp.utils.OBDAResult; -import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; -import it.unibz.inf.ontouml.vp.views.ProgressDialogStandard; -import java.awt.FileDialog; -import java.awt.Frame; -import java.io.BufferedReader; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.HashSet; -import java.util.stream.Collectors; - -public class OBDAExportServerReques extends Thread { - - private ProgressDialogStandard loading; - - private final ProjectConfigurations projectConfigurations = - Configurations.getInstance().getProjectConfigurations(); - - @Override - public void run() { - HashSet elements; - try { - - loading = new ProgressDialogStandard(); - loading.setTitle("Generating the files"); - ApplicationManager.instance() - .getViewManager() - .showDialog( - loading); // This class must extend Thread for the ProgressDialog to be shown - // properly. - - elements = - Configurations.getInstance() - .getProjectConfigurations() - .getExportGUFOElementsDiagramTree(); - - final BufferedReader buffer = - OntoUMLServerAccessController.generateODBAFile( - ModelElement.generateModel(elements, true), - projectConfigurations.getMappingStrategy().toString(), - projectConfigurations.getTargetDBMS().toString(), - projectConfigurations.isStandardizeNames(), - projectConfigurations.getExportGUFOIRI(), - projectConfigurations.isGenerateSchema(), - projectConfigurations.isGenerateConnection(), - projectConfigurations.getHostNameConnection(), - projectConfigurations.getDatabaseNameConnection(), - projectConfigurations.getUserNameConnection(), - projectConfigurations.getPassword()); - - loading.canClosed(); - - if (buffer != null) { - saveFile(buffer); - ViewManagerUtils.cleanAndShowMessage("OBDA mapping performed successfully."); - } else { - ViewManagerUtils.cleanAndShowMessage( - "Unable to generate the OBDA mapping. Please check your model and parameters."); - } - - } catch (Exception e) { - e.printStackTrace(); - loading.canClosed(); - } - } - - private void saveFile(BufferedReader buffer) throws IOException { - ObjectMapper objectMapper = new ObjectMapper(); - String json = buffer.lines().collect(Collectors.joining("\n")); - - OBDAResult result = objectMapper.readValue(json, OBDAResult.class); - - final Configurations configs = Configurations.getInstance(); - final ProjectConfigurations projectConfigurations = configs.getProjectConfigurations(); - final FileDialog fd = - new FileDialog( - (Frame) ApplicationManager.instance().getViewManager().getRootFrame(), - "Choose destination", - FileDialog.SAVE); - - String suggestedFolderPath = projectConfigurations.getExportFolderPath(); - String suggestedFileName = - ApplicationManager.instance().getProjectManager().getProject().getName(); - String fileName; - - fd.setDirectory(suggestedFolderPath); - fd.setFile(suggestedFileName); - fd.setVisible(true); - - if (fd.getDirectory() != null && fd.getFile() != null) { - - if (fd.getFile().indexOf('.') == -1) { - fileName = fd.getFile(); - } else { - fileName = fd.getFile().substring(0, fd.getFile().lastIndexOf('.')); - } - - if (projectConfigurations.isGenerateSchema()) { - Files.write(Paths.get(fd.getDirectory(), fileName + ".sql"), result.getSchema().getBytes()); - } - - if (projectConfigurations.isGenerateConnection()) { - Files.write( - Paths.get(fd.getDirectory(), fileName + ".properties"), - result.getConnection().getBytes()); - } - - Files.write( - Paths.get(fd.getDirectory(), fileName + ".obda"), result.getObdaFile().getBytes()); - - projectConfigurations.setExportFolderPath(fd.getDirectory()); - configs.save(); - } - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java index 3e39c912..6ca32084 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import it.unibz.inf.ontouml.vp.model.Configurations; +import it.unibz.inf.ontouml.vp.model.DbMappingToDbServiceResult; import it.unibz.inf.ontouml.vp.model.GufoTransformationServiceResult; import it.unibz.inf.ontouml.vp.model.ModularizationServiceResult; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; @@ -26,10 +27,9 @@ public class OntoUMLServerAccessController { private static final String TRANSFORM_GUFO_SERVICE_ENDPOINT = "/v1/transform/gufo"; - private static final String TRANSFORM_DB_SERVICE_ENDPOINT = "/v1/transform/db"; - private static final String TRANSFORM_OBDA_SERVICE_ENDPOINT = "/v1/transform/obda"; private static final String VERIFICATION_SERVICE_ENDPOINT = "/v1/verify"; private static final String MODULARIZATION_SERVICE_ENDPOINT = "/v1/modularize"; + private static final String MAPPING_TO_DB_SERVICE_ENDPOINT = "/v1/mapping/db"; private static final String USER_MESSAGE_BAD_REQUEST = "There was a internal plugin error and the service could not be completed."; private static final String USER_MESSAGE_REQUEST_WITH_SYNTACTICAL_ERRORS = @@ -38,22 +38,7 @@ public class OntoUMLServerAccessController { private static final String USER_MESSAGE_CONNECTION_ERROR = "Unable to reach the server."; private static final String USER_MESSAGE_INTERNAL_ERROR = "Internal server error."; private static final String USER_MESSAGE_UNKNOWN_ERROR_RESPONSE = - "Error receiving model verification response."; - - public static BufferedReader transformToGUFO( - String model, - String baseIRI, - String format, - String uriFormatBy, - String inverse, - String object, - String analysis, - String packages, - String elementMapping, - String packageMapping, - IDialogHandler loading) - throws Exception { - final JsonObject optionsObj = new JsonObject(); + "Error receiving service response."; private static String getServiceRequestBody(String project) { return "{\"options\": null, \"project\": " + project + "}"; @@ -84,6 +69,15 @@ private static String getTransformationToGufoRequestUrl() { : ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_GUFO_SERVICE_ENDPOINT; } + private static String getMappingToErRequestUrl() { + final ProjectConfigurations config = Configurations.getInstance().getProjectConfigurations(); + return config.isCustomServerEnabled() + ? config.getServerURL() + MAPPING_TO_DB_SERVICE_ENDPOINT + : ProjectConfigurations.DEFAULT_SERVER_URL + MAPPING_TO_DB_SERVICE_ENDPOINT; + } + + + private static > T parseResponse( HttpURLConnection connection, Class _class) throws IOException { if (connection.getResponseCode() >= HttpURLConnection.HTTP_BAD_REQUEST) { @@ -94,13 +88,11 @@ private static > T parseResponse( throw new IOException(USER_MESSAGE_UNKNOWN_ERROR_RESPONSE); } - try { - - final HttpURLConnection request = request(url, body); - final BufferedReader responseReader = - request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST - ? new BufferedReader(new InputStreamReader(request.getInputStream())) - : new BufferedReader(new InputStreamReader(request.getErrorStream())); + final BufferedReader reader = + new BufferedReader(new InputStreamReader(connection.getInputStream())); + final String json = reader.lines().parallel().collect(Collectors.joining("\n")); + return new ObjectMapper().readValue(json, _class); + } private static boolean hasJsonContentType(HttpURLConnection connection) { return connection.getContentType().contains("application/json"); @@ -132,6 +124,15 @@ public static GufoTransformationServiceResult requestModelTransformationToGufo( return parseResponse(connection, GufoTransformationServiceResult.class); } + + public static DbMappingToDbServiceResult requestMappingToDB( + String project, String options) throws IOException { + final String url = getMappingToErRequestUrl(); + final String body = getServiceRequestBody(project, options); + final HttpURLConnection connection = request(url, body); + + return parseResponse(connection, DbMappingToDbServiceResult.class); + } private static HttpURLConnection request(String url, String body) throws IOException { try { @@ -209,184 +210,4 @@ private static HttpURLConnection performRequest(String urlString, String body) return request; } - - public static BufferedReader transformToDB( - String model, String mappingStrategy, String targetDBMS, boolean isStandardizeNames) - throws Exception { - - final JsonObject optionsObj = new JsonObject(); - - optionsObj.addProperty("mappingStrategy", mappingStrategy); - optionsObj.addProperty("targetDBMS", targetDBMS); - optionsObj.addProperty("isStandardizeNames", isStandardizeNames); - - final JsonObject bodyObj = new JsonObject(); - bodyObj.add("options", optionsObj); - bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); - - final GsonBuilder builder = new GsonBuilder(); - final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); - final String body = gson.toJson(bodyObj); - - final ProjectConfigurations configurations = - Configurations.getInstance().getProjectConfigurations(); - final String url; - - if (configurations.isCustomServerEnabled()) { - url = configurations.getServerURL() + TRANSFORM_DB_SERVICE_ENDPOINT; - } else { - url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_DB_SERVICE_ENDPOINT; - } - - try { - final HttpURLConnection request = request(url, body); - final BufferedReader responseReader = - request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST - ? new BufferedReader(new InputStreamReader(request.getInputStream())) - : new BufferedReader(new InputStreamReader(request.getErrorStream())); - - switch (request.getResponseCode()) { - case HttpURLConnection.HTTP_OK: - if (!request.getContentType().equals("text/html")) { - return responseReader; - } else { - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - } - case HttpURLConnection.HTTP_BAD_REQUEST: - ViewManagerUtils.exportToGUFOIssueDialog( - "Unable to transform the model due to an unexpected error.\n" - + "Please check the model for any syntactical errors.\n\n" - + "Warning: partially exporting models to gUFO may introduce syntactical" - + " errors."); - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception( - "Unable to transform the model due to an unexpected error.\n" - + "Please check the model for any syntactical errors.\n\n" - + "Warning: partially exporting models to gUFO may introduce syntactical" - + " errors.") - .printStackTrace(); - return null; - case HttpURLConnection.HTTP_NOT_FOUND: - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - case HttpURLConnection.HTTP_INTERNAL_ERROR: // 500 - System.out.println(responseReader.lines().collect(Collectors.joining())); - ViewManagerUtils.exportToGUFOIssueDialog( - "Oops! Something went wrong. \n" - + "Please check the model for any syntactical errors.\n" - // + "If the problem persists, open a ticket with a case that simulates this problem." - ); - new Exception("Server error").printStackTrace(); - return null; - default: - ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); - throw new Exception("Unknown error"); - } - } catch (MalformedURLException e) { - ViewManagerUtils.exportToGUFOIssueDialog("Server error."); - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - - public static BufferedReader generateODBAFile( - String model, - String mappingStrategy, - String targetDBMS, - boolean isStandardizeNames, - String baseIRI, - boolean isGenerateSchema, - boolean generateConnection, - String hostName, - String databaseName, - String userConnection, - String passwordConnection) - throws Exception { - - final JsonObject optionsObj = new JsonObject(); - - optionsObj.addProperty("mappingStrategy", mappingStrategy); - optionsObj.addProperty("targetDBMS", targetDBMS); - optionsObj.addProperty("isStandardizeNames", isStandardizeNames); - optionsObj.addProperty("baseIri", baseIRI); - optionsObj.addProperty("isGenerateSchema", isGenerateSchema); - optionsObj.addProperty("generateConnection", generateConnection); - optionsObj.addProperty("hostName", hostName); - optionsObj.addProperty("databaseName", databaseName); - optionsObj.addProperty("userConnection", userConnection); - optionsObj.addProperty("passwordConnection", passwordConnection); - - final JsonObject bodyObj = new JsonObject(); - bodyObj.add("options", optionsObj); - bodyObj.add("model", new JsonParser().parse(model).getAsJsonObject()); - - final GsonBuilder builder = new GsonBuilder(); - final Gson gson = builder.serializeNulls().setPrettyPrinting().create(); - final String body = gson.toJson(bodyObj); - - final ProjectConfigurations configurations = - Configurations.getInstance().getProjectConfigurations(); - final String url; - - if (configurations.isCustomServerEnabled()) { - url = configurations.getServerURL() + TRANSFORM_OBDA_SERVICE_ENDPOINT; - } else { - url = ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_OBDA_SERVICE_ENDPOINT; - } - try { - final HttpURLConnection request = request(url, body); - final BufferedReader responseReader = - request.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST - ? new BufferedReader(new InputStreamReader(request.getInputStream())) - : new BufferedReader(new InputStreamReader(request.getErrorStream())); - - switch (request.getResponseCode()) { - case HttpURLConnection.HTTP_OK: - if (!request.getContentType().equals("text/html")) { - return responseReader; - } else { - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - } - case HttpURLConnection.HTTP_BAD_REQUEST: - ViewManagerUtils.exportToGUFOIssueDialog( - "Unable to transform the model due to an unexpected error.\n" - + "Please check the model for any syntactical errors.\n\n" - + "Warning: partially exporting models to gUFO may introduce syntactical" - + " errors."); - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception( - "Unable to transform the model due to an unexpected error.\n" - + "Please check the model for any syntactical errors.\n\n" - + "Warning: partially exporting models to gUFO may introduce syntactical" - + " errors.") - .printStackTrace(); - return null; - case HttpURLConnection.HTTP_NOT_FOUND: - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server not found.").printStackTrace(); - return null; - case HttpURLConnection.HTTP_INTERNAL_ERROR: - System.out.println(responseReader.lines().collect(Collectors.joining())); - new Exception("Server error.").printStackTrace(); - return null; - default: - ViewManagerUtils.exportToGUFOIssueDialog("Unexpected error."); - throw new Exception("Unknown error"); - } - } catch (MalformedURLException e) { - ViewManagerUtils.exportToGUFOIssueDialog("Server error."); - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - return null; - } -} +} \ No newline at end of file diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java new file mode 100644 index 00000000..4243cc47 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java @@ -0,0 +1,149 @@ +package it.unibz.inf.ontouml.vp.model; + +import java.io.IOException; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class DbMappingOptions { + + private MappingStrategy mappingStrategy; + private DbmsSupported targetDBMS; + private boolean isStandardizeNames; + private String baseIri; + private boolean generateSchema; + private boolean generateConnection; + private String hostName; + private String databaseName; + private String userConnection; + private String passwordConnection; + private boolean enumFieldToLookupTable; + private JsonNode customElementMapping; + + public DbMappingOptions() {} + + public DbMappingOptions(ProjectConfigurations projectConfigurations) { + + this.mappingStrategy = projectConfigurations.getMappingStrategy(); + this.targetDBMS = projectConfigurations.getTargetDBMS(); + this.isStandardizeNames = projectConfigurations.isStandardizeNames(); + this.baseIri = projectConfigurations.getExportGUFOIRI(); + this.generateSchema = projectConfigurations.isGenerateSchema(); + this.generateConnection = projectConfigurations.isGenerateConnection(); + this.hostName = projectConfigurations.getHostNameConnection(); + this.databaseName = projectConfigurations.getDatabaseNameConnection(); + this.userConnection = projectConfigurations.getUserNameConnection(); + this.passwordConnection = projectConfigurations.getPassword(); + this.enumFieldToLookupTable = projectConfigurations.isEnumFieldToLookupTable(); + + + ObjectMapper mapper = new ObjectMapper(); + try { + customElementMapping = mapper.readTree(projectConfigurations.getExportGUFOElementMapping()); + } catch (IOException e) { + System.err.println("Unable to read project configurations."); + e.printStackTrace(); + } + } + + public MappingStrategy getMappingStrategy() { + return mappingStrategy; + } + + public void setMappingStrategy(MappingStrategy mappingStrategy) { + this.mappingStrategy = mappingStrategy; + } + + public DbmsSupported getTargetDBMS() { + return targetDBMS; + } + + public void setTargetDBMS(DbmsSupported targetDBMS) { + this.targetDBMS = targetDBMS; + } + + public boolean isStandardizeNames() { + return isStandardizeNames; + } + + public void setStandardizeNames(boolean isStandardizeNames) { + this.isStandardizeNames = isStandardizeNames; + } + + public String getBaseIri() { + return baseIri; + } + + public void setBaseIri(String baseIri) { + this.baseIri = baseIri; + } + + public boolean isGenerateSchema() { + return generateSchema; + } + + public void setGenerateSchema(boolean generateSchema) { + this.generateSchema = generateSchema; + } + + public boolean isGenerateConnection() { + return generateConnection; + } + + public void setGenerateConnection(boolean generateConnection) { + this.generateConnection = generateConnection; + } + + public String getHostName() { + return hostName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + + public String getDatabaseName() { + return databaseName; + } + + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + public String getUserConnection() { + return userConnection; + } + + public void setUserConnection(String userConnection) { + this.userConnection = userConnection; + } + + public String getPasswordConnection() { + return passwordConnection; + } + + public void setPasswordConnection(String passwordConnection) { + this.passwordConnection = passwordConnection; + } + + public boolean isEnumFieldToLookupTable() { + return enumFieldToLookupTable; + } + + public void setEnumFieldToLookupTable(boolean enumFieldToLookupTable) { + this.enumFieldToLookupTable = enumFieldToLookupTable; + } + + public JsonNode getCustomElementMapping() { + return customElementMapping; + } + + public void setCustomElementMapping(JsonNode customElementMapping) { + this.customElementMapping = customElementMapping; + } + + public String toJson() throws JsonProcessingException { + return new ObjectMapper().writeValueAsString(this); + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java new file mode 100644 index 00000000..68168526 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java @@ -0,0 +1,31 @@ +package it.unibz.inf.ontouml.vp.model; + +import java.util.List; + +public class DbMappingToDbServiceResult extends ServiceResult { + + public DbMappingToDbServiceResult(String result, List issues) { + super(result, issues); + } + + public DbMappingToDbServiceResult() { + super(); + } + + public String getSchema() { + return "schema"; + } + + public String getObda() { + return "obda"; + } + + public String getProperties() { + return "properties"; + } + + @Override + public String getMessage() { + return "The mapping to database was concluded"; + } + } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DBMSSuported.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbmsSupported.java similarity index 82% rename from src/main/java/it/unibz/inf/ontouml/vp/model/DBMSSuported.java rename to src/main/java/it/unibz/inf/ontouml/vp/model/DbmsSupported.java index f4b58ff0..4fb6efac 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/DBMSSuported.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DbmsSupported.java @@ -1,6 +1,6 @@ package it.unibz.inf.ontouml.vp.model; -public enum DBMSSuported { +public enum DbmsSupported { GENERIC_SCHEMA("Generic Schema"), MYSQL("MySql"), H2("H2"), @@ -10,7 +10,7 @@ public enum DBMSSuported { private final String display; - private DBMSSuported(String s) { + private DbmsSupported(String s) { display = s; } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java b/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java index 06ce700b..43b16098 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java @@ -3,7 +3,8 @@ public enum MappingStrategy { ONE_TABLE_PER_CLASS("One Table per Class"), - ONE_TABLE_PER_KIND("One Table per Kind"); + ONE_TABLE_PER_KIND("One Table per Kind"), + ONE_TABLE_PER_CONCRETE_CLASS("One Table per Concrete Class"); private final String display; diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java index 9022981d..b7c1f47b 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java @@ -25,11 +25,14 @@ public class ProjectConfigurations { public static final String DEFAULT_EXPORT_FILENAME = ""; public static final String DEFAULT_GUFO_EXPORT_PATH = System.getProperty("user.home"); public static final String DEFAULT_GUFO_EXPORT_FILENAME = ""; - public static final DBMSSuported DEFAULT_DBMS = DBMSSuported.GENERIC_SCHEMA; + public static final DbmsSupported DEFAULT_DBMS = DbmsSupported.GENERIC_SCHEMA; public static final MappingStrategy DEFAULT_MAPPING_STRATEGY = MappingStrategy.ONE_TABLE_PER_KIND; public static final boolean DEFAULT_STANTDARDIZE_NAMES = true; public static final boolean DEFAULT_GENERATE_SCHEMA = true; public static final boolean DEFAULT_GENERATE_CONNECTION = false; + public static final String DEFAULT_DB_MAPPING_PATH = System.getProperty("user.home"); + public static final String DEFAULT_DB_MAPPING_FILE_NAME = ""; + public static final boolean DEFAULT_IS_ENUMARATION_TO_LOOKUP_TABLE = false; @SerializedName("projectId") @Expose() @@ -130,7 +133,7 @@ public class ProjectConfigurations { @SerializedName("targetDBMS") @Expose() - private DBMSSuported targetDBMS; + private DbmsSupported targetDBMS; @SerializedName("standarizeNames") @Expose() @@ -159,6 +162,20 @@ public class ProjectConfigurations { @SerializedName("passwordConnectino") @Expose() private String passwordConnectino; + + @SerializedName("dbMappingFileName") + @Expose() + private String dbMappingFileName; + + @SerializedName("dbMappingFolderPath") + @Expose() + private String dbMappingFolderPath; + + @SerializedName("enumFieldToLookupTable") + @Expose() + private boolean enumFieldToLookupTable; + + /** Constructor without args to be called when deserializing project settings. */ public ProjectConfigurations() { @@ -203,7 +220,10 @@ public void setDefaultValues() { this.standardizeNames = ProjectConfigurations.DEFAULT_STANTDARDIZE_NAMES; this.generateSchema = ProjectConfigurations.DEFAULT_GENERATE_SCHEMA; this.generateConnection = ProjectConfigurations.DEFAULT_GENERATE_CONNECTION; - } + this.dbMappingFileName = ProjectConfigurations.DEFAULT_DB_MAPPING_FILE_NAME; + this.dbMappingFolderPath = ProjectConfigurations.DEFAULT_DB_MAPPING_PATH; + this.enumFieldToLookupTable = ProjectConfigurations.DEFAULT_IS_ENUMARATION_TO_LOOKUP_TABLE; + } /** * Returns the related project's ID. @@ -516,7 +536,7 @@ public void setStandardizeNames(boolean standarizeNames) { * * @return DBMSSuported */ - public DBMSSuported getTargetDBMS() { + public DbmsSupported getTargetDBMS() { return targetDBMS; } @@ -525,7 +545,7 @@ public DBMSSuported getTargetDBMS() { * * @param targetDBMS */ - public void setTargetDBMS(DBMSSuported targetDBMS) { + public void setTargetDBMS(DbmsSupported targetDBMS) { this.targetDBMS = targetDBMS; } @@ -636,4 +656,60 @@ public String getPassword() { public void setPassword(String password) { this.passwordConnectino = password; } + + /** + * Returns the file name for mapping to ER. + * + * @return + */ + public String getDbMappingFileName() { + return this.dbMappingFileName; + }; + + /** + * Informs the file name for mapping to ER. + * + * @param string + */ + public void setDbMappingFileName(String dbMappingFileName) { + this.dbMappingFileName = dbMappingFileName; + } + + /** + * Returns the directory to save the files mapping. + * + * @return String + */ + public String getDbMappingFolderPath() { + return this.dbMappingFolderPath; + } + + /** + * Informs the directory for mapping to ER. + * + * @param string + */ + public void setDbMappingFolderPath(String dbMappingFolderPath) { + this.dbMappingFolderPath = dbMappingFolderPath; + } + + /** + * Returns if it is necessary to generate a table for the enumeration type fields. + * + * @return boolean + */ + public boolean isEnumFieldToLookupTable() { + return this.enumFieldToLookupTable; + } + + /** + * Informs if it is necessary to generate a table for the enumeration type fields. + * + * @param boolean + */ + public void setEnumFieldToLookupTable(boolean isEnumFieldToLookupTable) { + this.enumFieldToLookupTable = isEnumFieldToLookupTable; + } + + } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java b/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java deleted file mode 100644 index 09e44c1d..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/utils/OBDAResult.java +++ /dev/null @@ -1,105 +0,0 @@ -package it.unibz.inf.ontouml.vp.utils; - - -public class OBDAResult { - - private String schema; - private String obdaFile; - private String connection; - - public void setSchema(String schema) { - this.schema = schema; - } - - public String getSchema() { - return schema; - } - - public void setObdaFile(String obdaFile) { - this.obdaFile = obdaFile; - } - - public String getObdaFile() { - return obdaFile; - } - - public void setConnection(String connection) { - this.connection = connection; - } - - public String getConnection() { - return connection; - } - - /* - private String schema; - private String obdaFile; - private String connection; - private BufferedReader buffer; - - public OBDAResult(BufferedReader buffer) { - this.buffer = buffer; - putVariables(); - } - - public String getSchema() { - return schema; - } - - public String getOBDAFile() { - return obdaFile; - } - - private void putVariables() { - StringBuilder auxSchema = new StringBuilder(); - StringBuilder auxObda = new StringBuilder(); - - int value; - try { - value = buffer.read(); - - while ((char) value != '|' && value != -1) { - auxObda.append((char) value); - value = buffer.read(); - } - - while ((value = buffer.read()) != -1) { - auxSchema.append((char) value); - } - schema = auxSchema.toString().trim(); - obdaFile = auxObda.toString().trim(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - - } - } - - private void putVariables() { - StringBuilder auxVar = new StringBuilder(); - StringBuilder auxValue = new StringBuilder(); - char val; - - val = getChar(); - - if(val == '{') { - - } - - } - - private char getChar() { - int val; - try { - if ((val = buffer.read()) != -1 ) { - return (char)val; - } - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return '|'; - - } - */ -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java deleted file mode 100644 index cc61eb43..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Class responsible for displaying the graphical interface for exporting the OntoUML model to the - * relational schema. - * - *

Author: Gustavo Ludovico Guidoni - */ -package it.unibz.inf.ontouml.vp.views; - -import com.vp.plugin.view.IDialog; -import com.vp.plugin.view.IDialogHandler; -import it.unibz.inf.ontouml.vp.OntoUMLPlugin; -import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; -import java.awt.Component; - -public class DBExportHandler implements IDialogHandler { - - private DBExportView view; - - /** Called when the dialog is closed by the user clicking on the close button of the frame. */ - @Override - public boolean canClosed() { - OntoUMLPlugin.setDBExportWindowOpen(false); - ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); - return true; - } - - /** - * Called once before the dialog is shown. Developer should return the content of the dialog - * (similar to the content pane). - */ - @Override - public Component getComponent() { - view = new DBExportView(Configurations.getInstance().getProjectConfigurations()); - return view; - } - - /** - * Called after the getComponent(). A dialog is created on Visual Paradigm internally (it still - * not shown out). Developer can set the outlook of the dialog on prepare(). - */ - @Override - public void prepare(IDialog dialog) { - dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate Schema"); - dialog.setModal(false); - dialog.setResizable(false); - dialog.setSize(view.getWidth(), view.getHeight()); - view.setContainerDialog(dialog); - } - - /** Called when the dialog is shown. */ - @Override - public void shown() { - // TODO Auto-generated method stub - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java deleted file mode 100644 index 6470a114..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/DBExportView.java +++ /dev/null @@ -1,488 +0,0 @@ -/** - * Graphical interface designed to collect data for the transformation of OntoUml to the relational - * schema. - * - *

Author: Gustavo Ludovico Guidoni - */ -package it.unibz.inf.ontouml.vp.views; - -import com.vp.plugin.diagram.IDiagramUIModel; -import com.vp.plugin.model.IModelElement; -import com.vp.plugin.view.IDialog; -import it.unibz.inf.ontouml.vp.OntoUMLPlugin; -import it.unibz.inf.ontouml.vp.controllers.DBExportServerRequest; -import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.model.DBMSSuported; -import it.unibz.inf.ontouml.vp.model.MappingStrategy; -import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.util.HashSet; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JScrollPane; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreePath; - -public class DBExportView extends javax.swing.JPanel { - private static final long serialVersionUID = 1L; - - private HashSet elementsDiagramTree = new HashSet<>(); - - private IDialog parentContainer; - private ProjectConfigurations configurations; - private JCheckBoxTree diagramTree; - - private javax.swing.ButtonGroup btgMappingStrategy; - private javax.swing.JButton btnCancel; - private javax.swing.JButton btnGenerateSchema; - private javax.swing.JComboBox cbxDBMS; - private javax.swing.JCheckBox cbxStandarizeNames; - private javax.swing.JPanel diagramPanel; - private javax.swing.JLabel jLabel1; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jpanDiagram; - private javax.swing.JRadioButton rbtOneTablePerClass; - private javax.swing.JRadioButton rbtOntTablePerKind; - - public DBExportView(ProjectConfigurations configurations) { - initComponents(); - - this.configurations = configurations; - - updateComponentsValues(configurations); - } - - private void initComponents() { - - // ************************************* - // Manually generated code. - // ************************************* - setSize(new Dimension(500, 360)); - - diagramPanel = new javax.swing.JPanel(); - diagramTree = new JCheckBoxTree("diagram"); - - JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); - scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - diagramPanel.add(scrollableTextAreaDiagram); - - diagramPanel.setLayout(new GridLayout(1, 1)); - diagramPanel.setPreferredSize(new Dimension(100, 100)); - - // ************************************* - // Automatically generated code. - // ************************************* - - btgMappingStrategy = new javax.swing.ButtonGroup(); - jPanel3 = new javax.swing.JPanel(); - btnGenerateSchema = new javax.swing.JButton(); - btnCancel = new javax.swing.JButton(); - jPanel4 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - cbxDBMS = new javax.swing.JComboBox<>(); - jPanel1 = new javax.swing.JPanel(); - rbtOneTablePerClass = new javax.swing.JRadioButton(); - rbtOntTablePerKind = new javax.swing.JRadioButton(); - cbxStandarizeNames = new javax.swing.JCheckBox(); - jLabel1 = new javax.swing.JLabel(); - jpanDiagram = new javax.swing.JPanel(); - - jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - - btnGenerateSchema.setText("Generate Schema"); - - btnCancel.setText("Cancel"); - btnCancel.setMaximumSize(new java.awt.Dimension(117, 23)); - btnCancel.setMinimumSize(new java.awt.Dimension(117, 23)); - btnCancel.setPreferredSize(new java.awt.Dimension(117, 23)); - - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel3Layout - .createSequentialGroup() - .addGap(48, 48, 48) - .addComponent( - btnGenerateSchema, - javax.swing.GroupLayout.PREFERRED_SIZE, - 118, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addComponent( - btnCancel, - javax.swing.GroupLayout.PREFERRED_SIZE, - 122, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(50, 50, 50))); - jPanel3Layout.setVerticalGroup( - jPanel3Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel3Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel3Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent( - btnCancel, - javax.swing.GroupLayout.PREFERRED_SIZE, - 29, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( - btnGenerateSchema, - javax.swing.GroupLayout.PREFERRED_SIZE, - 29, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - - jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("DBMS: ")); - - cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(cbxDBMS, 0, 142, Short.MAX_VALUE) - .addContainerGap())); - jPanel2Layout.setVerticalGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addContainerGap() - .addComponent( - cbxDBMS, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); - - btgMappingStrategy.add(rbtOneTablePerClass); - rbtOneTablePerClass.setText("One Table per Class"); - - btgMappingStrategy.add(rbtOntTablePerKind); - rbtOntTablePerKind.setSelected(true); - rbtOntTablePerKind.setText("One Table per Kind"); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel1Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rbtOneTablePerClass) - .addComponent(rbtOntTablePerKind)) - .addContainerGap(35, Short.MAX_VALUE))); - jPanel1Layout.setVerticalGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel1Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(rbtOneTablePerClass) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rbtOntTablePerKind) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - cbxStandarizeNames.setSelected(true); - cbxStandarizeNames.setText("Standardize the names for the database"); - - jLabel1.setText("eg.: 'PersonalCustomer' to 'personal_customer'."); - - jpanDiagram.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram:")); - - javax.swing.GroupLayout diagramPanelLayout = new javax.swing.GroupLayout(diagramPanel); - // diagramPanel.setLayout(diagramPanelLayout); - diagramPanelLayout.setHorizontalGroup( - diagramPanelLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE)); - diagramPanelLayout.setVerticalGroup( - diagramPanelLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 0, Short.MAX_VALUE)); - - javax.swing.GroupLayout jpanDiagramLayout = new javax.swing.GroupLayout(jpanDiagram); - jpanDiagram.setLayout(jpanDiagramLayout); - jpanDiagramLayout.setHorizontalGroup( - jpanDiagramLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - diagramPanel, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)); - jpanDiagramLayout.setVerticalGroup( - jpanDiagramLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - diagramPanel, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel4Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - cbxStandarizeNames, - javax.swing.GroupLayout.DEFAULT_SIZE, - 466, - Short.MAX_VALUE) - .addGroup( - jPanel4Layout - .createSequentialGroup() - .addGap(21, 21, 21) - .addComponent( - jLabel1, - javax.swing.GroupLayout.DEFAULT_SIZE, - 445, - Short.MAX_VALUE)) - .addGroup( - jPanel4Layout - .createSequentialGroup() - .addGroup( - jPanel4Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - jPanel1, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( - jPanel2, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(18, 18, 18) - .addComponent( - jpanDiagram, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addContainerGap())))); - jPanel4Layout.setVerticalGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - jPanel4Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup( - jPanel4Layout - .createSequentialGroup() - .addComponent( - jPanel1, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent( - jPanel2, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent( - jpanDiagram, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cbxStandarizeNames) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - jLabel1, - javax.swing.GroupLayout.PREFERRED_SIZE, - 18, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - jPanel4, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addComponent( - jPanel3, - javax.swing.GroupLayout.Alignment.TRAILING, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)) - .addContainerGap())); - layout.setVerticalGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - layout - .createSequentialGroup() - .addContainerGap() - .addComponent( - jPanel4, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - jPanel3, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap())); - - // ************************************* - // Manually generated code. - // ************************************* - - btnCancel.addActionListener( - new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnCancelActionPerformed(evt); - } - }); - - btnGenerateSchema.addActionListener( - new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnGenerateSchemaActionPerformed(evt); - } - }); - } - - /** Sets a direct reference to the container dialog after initialization. */ - public void setContainerDialog(IDialog dialog) { - parentContainer = dialog; - } - - private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) { - parentContainer.close(); - OntoUMLPlugin.setDBExportWindowOpen(false); - } - - private void btnGenerateSchemaActionPerformed(java.awt.event.ActionEvent evt) { - saveSelectedElements(); - updateConfigurationsValues(configurations); - Configurations.getInstance().save(); - parentContainer.close(); - OntoUMLPlugin.setDBExportWindowOpen(false); - // Thread thread = new Thread(request); - // thread.start(); - (new DBExportServerRequest()).start(); - } - - /** Updates project configurations with components' information. */ - private void updateConfigurationsValues(ProjectConfigurations configurations) { - - configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); - - if (rbtOneTablePerClass.isSelected()) - configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); - else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); - - configurations.setTargetDBMS((DBMSSuported) cbxDBMS.getSelectedItem()); - - configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); - } - - /** - * Updates components with project configurations' information. - * - * @param configurations - */ - private void updateComponentsValues(ProjectConfigurations configurations) { - - if (configurations.getExportGUFOElementsDiagramTree() != null) - diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); - - if (configurations.getMappingStrategy() != null - && !configurations.getMappingStrategy().equals("")) { - if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) - rbtOneTablePerClass.setSelected(true); - else rbtOntTablePerKind.setSelected(true); - } - - if (configurations.getTargetDBMS() != null && !configurations.getTargetDBMS().equals("")) - cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); - - cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); - } - - private void saveSelectedElements() { - TreePath[] paths; - - paths = diagramTree.getCheckedPaths(); - - for (TreePath path : paths) { - Object[] object = path.getPath(); - for (Object o : object) { - - if (o instanceof DefaultMutableTreeNode) { - - DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; - - if (node.getUserObject() instanceof IModelElement) - this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); - - if (node.getUserObject() instanceof IDiagramUIModel) - this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); - } - } - } - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java new file mode 100644 index 00000000..db070adf --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java @@ -0,0 +1,510 @@ +package it.unibz.inf.ontouml.vp.views; + +import com.vp.plugin.diagram.IDiagramUIModel; +import com.vp.plugin.model.IModelElement; +import it.unibz.inf.ontouml.vp.model.DbmsSupported; +import it.unibz.inf.ontouml.vp.model.MappingStrategy; +import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; + +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.event.ActionListener; +import java.util.HashSet; + +import javax.swing.DefaultComboBoxModel; +import javax.swing.JScrollPane; +import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreePath; + + +public class DbMappingView extends javax.swing.JPanel { + + private static final long serialVersionUID = 1L; + + private HashSet elementsDiagramTree = new HashSet<>(); + + //private IDialog parentContainer; + + private JCheckBoxTree diagramTree; + private javax.swing.JComboBox cbxDBMS; + private javax.swing.JCheckBox cbxStandarizeNames; + private javax.swing.JCheckBox cxbEnumToLookupTable; + private javax.swing.JPanel diagramPanel; + private javax.swing.ButtonGroup groupStrategy; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel6; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JButton jbtnCancel; + private javax.swing.JButton jbtnOk; + private javax.swing.JCheckBox jcbGenerateConnection; + private javax.swing.JCheckBox jcbGenerateObda; + private javax.swing.JCheckBox jcbGenerateSchema; + private javax.swing.JTextField jtfBaseIRI; + private javax.swing.JTextField jtfDatabase; + private javax.swing.JTextField jtfHost; + private javax.swing.JTextField jtfPassword; + private javax.swing.JTextField jtfUser; + private javax.swing.JRadioButton rbtOneTablePerClass; + private javax.swing.JRadioButton rbtOneTablePerConcreteClass; + private javax.swing.JRadioButton rbtOneTablePerKind; + + + public DbMappingView(ProjectConfigurations configurations) { + initComponents(); + + updateComponentsValues(configurations); + } + + private void initComponents() { + + // ************************************* + // Manually generated code. + // ************************************* + setSize(new Dimension(500, 360)); + + diagramPanel = new javax.swing.JPanel(); + diagramTree = new JCheckBoxTree("diagram"); + + JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); + scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + diagramPanel.add(scrollableTextAreaDiagram); + + diagramPanel.setLayout(new GridLayout(1, 1)); + diagramPanel.setPreferredSize(new Dimension(100, 100)); + + // ************************************* + // Automatically generated code. + // ************************************* + + + groupStrategy = new javax.swing.ButtonGroup(); + jPanel3 = new javax.swing.JPanel(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel2 = new javax.swing.JPanel(); + jcbGenerateSchema = new javax.swing.JCheckBox(); + jPanel1 = new javax.swing.JPanel(); + rbtOneTablePerClass = new javax.swing.JRadioButton(); + rbtOneTablePerConcreteClass = new javax.swing.JRadioButton(); + rbtOneTablePerKind = new javax.swing.JRadioButton(); + jLabel3 = new javax.swing.JLabel(); + cbxDBMS = new javax.swing.JComboBox<>(); + cbxStandarizeNames = new javax.swing.JCheckBox(); + jLabel1 = new javax.swing.JLabel(); + cxbEnumToLookupTable = new javax.swing.JCheckBox(); + jPanel6 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jtfBaseIRI = new javax.swing.JTextField(); + jcbGenerateObda = new javax.swing.JCheckBox(); + jPanel5 = new javax.swing.JPanel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jtfHost = new javax.swing.JTextField(); + jtfUser = new javax.swing.JTextField(); + jtfDatabase = new javax.swing.JTextField(); + jtfPassword = new javax.swing.JTextField(); + jcbGenerateConnection = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + jbtnCancel = new javax.swing.JButton(); + jbtnOk = new javax.swing.JButton(); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram to be mapped: ")); + + diagramPanel.setBackground(new java.awt.Color(255, 255, 255)); + diagramPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + diagramPanel.setName(""); // NOI18N + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(diagramPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + ); + jPanel3Layout.setVerticalGroup( + jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(diagramPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE) + ); + + jcbGenerateSchema.setSelected(true); + jcbGenerateSchema.setText("Generate relational schema"); + jcbGenerateSchema.setActionCommand("Generate database script"); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); + + groupStrategy.add(rbtOneTablePerClass); + rbtOneTablePerClass.setText("One Table per Class"); + + groupStrategy.add(rbtOneTablePerConcreteClass); + rbtOneTablePerConcreteClass.setText("One Table per Concrete Class"); + + groupStrategy.add(rbtOneTablePerKind); + rbtOneTablePerKind.setSelected(true); + rbtOneTablePerKind.setText("One Table per Kind"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerKind) + .addComponent(rbtOneTablePerConcreteClass) + .addComponent(rbtOneTablePerClass)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(rbtOneTablePerClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(rbtOneTablePerConcreteClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(rbtOneTablePerKind) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jLabel3.setText("DBMS"); + + cbxDBMS.setModel(new DefaultComboBoxModel(DbmsSupported.values())); + + cbxStandarizeNames.setSelected(true); + cbxStandarizeNames.setText("Standardize database names"); + + jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); + + cxbEnumToLookupTable.setText("Enumeration field to lookup table"); + cxbEnumToLookupTable.setActionCommand("Enumeration field to lookup table"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jcbGenerateSchema)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3) + .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1)) + .addComponent(cxbEnumToLookupTable, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) + .addComponent(cbxStandarizeNames, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateSchema) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cxbEnumToLookupTable) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbxStandarizeNames) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addGap(0, 8, Short.MAX_VALUE)) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + ); + + jTabbedPane1.addTab("Relational Schema", jPanel2); + + jLabel2.setText("Base IRI:"); + + jtfBaseIRI.setText("http://example.com"); + + jcbGenerateObda.setSelected(true); + jcbGenerateObda.setText("Generate OBDA file"); + + javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); + jPanel6.setLayout(jPanel6Layout); + jPanel6Layout.setHorizontalGroup( + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addComponent(jcbGenerateObda) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel6Layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfBaseIRI, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE))) + .addContainerGap()) + ); + jPanel6Layout.setVerticalGroup( + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateObda) + .addGap(18, 18, 18) + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jtfBaseIRI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(91, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("OBDA", jPanel6); + + jLabel4.setText("Host :"); + + jLabel5.setText("Database :"); + jLabel5.setToolTipText(""); + + jLabel6.setText("User :"); + + jLabel7.setText("Passoword :"); + + jcbGenerateConnection.setSelected(true); + jcbGenerateConnection.setText("Generate the connection"); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel6)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jtfUser) + .addComponent(jtfPassword))) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel4) + .addGap(34, 34, 34) + .addComponent(jtfHost)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jcbGenerateConnection) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfDatabase))) + .addContainerGap()) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateConnection) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(jtfHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(jtfDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(jtfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(jtfPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + jTabbedPane1.addTab("Conection", jPanel5); + + jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + jbtnCancel.setText("Cancel"); + jbtnCancel.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setPreferredSize(new java.awt.Dimension(135, 29)); + + jbtnOk.setText("Do Mapping"); + jbtnOk.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnOk.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnOk.setPreferredSize(new java.awt.Dimension(135, 29)); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(jbtnOk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54) + .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + jPanel4Layout.setVerticalGroup( + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jbtnOk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jTabbedPane1) + .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jTabbedPane1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); + } + + /** + * Updates components with project configurations' information. + * + * @param configurations + */ + private void updateComponentsValues(ProjectConfigurations configurations) { + + if(configurations.getExportGUFOElementsDiagramTree() != null) + diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); + + if (configurations.getMappingStrategy() != null) { + if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) + rbtOneTablePerClass.setSelected(true); + else if(configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS) + rbtOneTablePerConcreteClass.setSelected(true); + else rbtOneTablePerKind.setSelected(true); + } + + if (configurations.getTargetDBMS() != null) + cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); + + cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); + + jcbGenerateSchema.setSelected(configurations.isGenerateSchema()); + + jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); + + jtfHost.setText(configurations.getHostNameConnection()); + + jtfDatabase.setText(configurations.getDatabaseNameConnection()); + + jtfUser.setText(configurations.getUserNameConnection()); + + jtfPassword.setText(configurations.getPassword()); + + if(configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) + jtfBaseIRI.setText(configurations.getExportGUFOIRI()); + } + + /** Updates project configurations with components' information. */ + public void updateConfigurationsValues(ProjectConfigurations configurations) { + saveSelectedElements(); + + configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); + + configurations.setGenerateSchema(jcbGenerateSchema.isSelected()); + + if (rbtOneTablePerClass.isSelected()) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); + else if(rbtOneTablePerConcreteClass.isSelected()) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS); + else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); + + configurations.setTargetDBMS((DbmsSupported) cbxDBMS.getSelectedItem()); + + configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); + + configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); + + configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); + + configurations.setHostNameConnection(jtfHost.getText().trim()); + + configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); + + configurations.setUserNameConnection(jtfUser.getText().trim()); + + configurations.setPassword(jtfPassword.getText().trim()); + } + + private void saveSelectedElements() { + TreePath[] paths; + + paths = diagramTree.getCheckedPaths(); + + for (TreePath path : paths) { + Object[] object = path.getPath(); + for (Object o : object) { + + if (o instanceof DefaultMutableTreeNode) { + + DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; + + if (node.getUserObject() instanceof IModelElement) + this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); + + if (node.getUserObject() instanceof IDiagramUIModel) + this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); + } + } + } + } + + public void onExport(ActionListener onExportAction) { + ActionListener[] currentListeners = jbtnOk.getActionListeners(); + + for (int i = 0; currentListeners != null && i < currentListeners.length; i++) { + jbtnOk.removeActionListener(currentListeners[i]); + } + + jbtnOk.addActionListener(onExportAction); + } + + public void onCancel(ActionListener onCancelAction) { + ActionListener[] currentListeners = jbtnCancel.getActionListeners(); + + for (int i = 0; currentListeners != null && i < currentListeners.length; i++) { + jbtnCancel.removeActionListener(currentListeners[i]); + } + + jbtnCancel.addActionListener(onCancelAction); + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java deleted file mode 100644 index e368f731..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportHandler.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Class responsible for displaying the graphical interface for integrating the OntoUML model with - * Ontop. - * - *

Author: Gustavo Ludovico Guidoni - */ -package it.unibz.inf.ontouml.vp.views; - -import com.vp.plugin.view.IDialog; -import com.vp.plugin.view.IDialogHandler; -import it.unibz.inf.ontouml.vp.OntoUMLPlugin; -import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; -import java.awt.Component; - -public class OBDAExportHandler implements IDialogHandler { - - private OBDAExportView view; - - /** Called when the dialog is closed by the user clicking on the close button of the frame. */ - @Override - public boolean canClosed() { - OntoUMLPlugin.setOBDAExportWindowOpen(false); - ViewManagerUtils.cleanAndShowMessage("Request cancelled by the user."); - return true; - } - - /** - * Called once before the dialog is shown. Developer should return the content of the dialog - * (similar to the content pane). - */ - @Override - public Component getComponent() { - view = new OBDAExportView(Configurations.getInstance().getProjectConfigurations()); - return view; - } - - /** - * Called after the getComponent(). A dialog is created on Visual Paradigm internally (it still - * not shown out). Developer can set the outlook of the dialog on prepare(). - */ - @Override - public void prepare(IDialog dialog) { - dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME + " Generate OBDA file"); - dialog.setModal(false); - dialog.setResizable(false); - dialog.setSize(view.getWidth(), view.getHeight()); - view.setContainerDialog(dialog); - } - - /** Called when the dialog is shown. */ - @Override - public void shown() { - // TODO Auto-generated method stub - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java deleted file mode 100644 index 25ff8ba9..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/OBDAExportView.java +++ /dev/null @@ -1,676 +0,0 @@ -package it.unibz.inf.ontouml.vp.views; - -import com.vp.plugin.diagram.IDiagramUIModel; -import com.vp.plugin.model.IModelElement; -import com.vp.plugin.view.IDialog; -import it.unibz.inf.ontouml.vp.OntoUMLPlugin; -import it.unibz.inf.ontouml.vp.controllers.OBDAExportServerReques; -import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.model.DBMSSuported; -import it.unibz.inf.ontouml.vp.model.MappingStrategy; -import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.util.HashSet; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreePath; - -public class OBDAExportView extends javax.swing.JPanel { - - private static final long serialVersionUID = 1L; - - private ProjectConfigurations configurations; - private JCheckBoxTree diagramTree; - private IDialog parentContainer; - private HashSet elementsDiagramTree = new HashSet<>(); - - private javax.swing.JComboBox cbxDBMS; - private javax.swing.JCheckBox jcbGenerateRelationalSchema; - private javax.swing.JCheckBox jcbStandarizeNames; - private javax.swing.JPanel diagramPanel; - private javax.swing.ButtonGroup groupStrategy; - private javax.swing.JCheckBox jcbGenerateConnection; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel7; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private javax.swing.JTabbedPane jTabbedPane1; - private javax.swing.JButton jbtnCancel; - private javax.swing.JButton jbtnGenerateFiles; - private javax.swing.JTextField jtfBaseIRI; - private javax.swing.JTextField jtfDatabase; - private javax.swing.JTextField jtfHost; - private javax.swing.JTextField jtfPassword; - private javax.swing.JTextField jtfUser; - private javax.swing.JPanel panSchemaParams; - private javax.swing.JRadioButton rbtOneTablePerClass; - private javax.swing.JRadioButton rbtOntTablePerKind; - - public OBDAExportView(ProjectConfigurations configurations) { - initComponents(); - - this.configurations = configurations; - - updateComponentsValues(); - } - - private void initComponents() { - // ************************************* - // Manually generated code. - // ************************************* - setSize(new Dimension(465, 500)); - - diagramPanel = new javax.swing.JPanel(); - diagramTree = new JCheckBoxTree("diagram"); - - JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); - scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - diagramPanel.add(scrollableTextAreaDiagram); - - diagramPanel.setLayout(new GridLayout(1, 1)); - diagramPanel.setPreferredSize(new Dimension(100, 100)); - - // ************************************* - // Automatically generated code. - // ************************************* - groupStrategy = new javax.swing.ButtonGroup(); - panSchemaParams = new javax.swing.JPanel(); - jPanel1 = new javax.swing.JPanel(); - rbtOneTablePerClass = new javax.swing.JRadioButton(); - rbtOntTablePerKind = new javax.swing.JRadioButton(); - jcbStandarizeNames = new javax.swing.JCheckBox(); - jLabel1 = new javax.swing.JLabel(); - jcbGenerateRelationalSchema = new javax.swing.JCheckBox(); - jTabbedPane1 = new javax.swing.JTabbedPane(); - jPanel2 = new javax.swing.JPanel(); - cbxDBMS = new javax.swing.JComboBox<>(); - jLabel3 = new javax.swing.JLabel(); - jPanel5 = new javax.swing.JPanel(); - jLabel4 = new javax.swing.JLabel(); - jLabel5 = new javax.swing.JLabel(); - jLabel6 = new javax.swing.JLabel(); - jLabel7 = new javax.swing.JLabel(); - jtfHost = new javax.swing.JTextField(); - jtfUser = new javax.swing.JTextField(); - jtfDatabase = new javax.swing.JTextField(); - jtfPassword = new javax.swing.JTextField(); - jcbGenerateConnection = new javax.swing.JCheckBox(); - jPanel4 = new javax.swing.JPanel(); - jLabel2 = new javax.swing.JLabel(); - jtfBaseIRI = new javax.swing.JTextField(); - jbtnGenerateFiles = new javax.swing.JButton(); - jbtnCancel = new javax.swing.JButton(); - - panSchemaParams.setBorder( - javax.swing.BorderFactory.createTitledBorder("Parameters for relational schema: ")); - - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); - - groupStrategy.add(rbtOneTablePerClass); - rbtOneTablePerClass.setText("One Table per Class"); - - groupStrategy.add(rbtOntTablePerKind); - rbtOntTablePerKind.setSelected(true); - rbtOntTablePerKind.setText("One Table per Kind"); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel1Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rbtOneTablePerClass) - .addComponent(rbtOntTablePerKind)) - .addContainerGap(52, Short.MAX_VALUE))); - jPanel1Layout.setVerticalGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel1Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(rbtOneTablePerClass) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rbtOntTablePerKind) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - jcbStandarizeNames.setSelected(true); - jcbStandarizeNames.setText("Standardize database names"); - - jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); - - jcbGenerateRelationalSchema.setSelected(true); - jcbGenerateRelationalSchema.setText("Generate database script"); - - cbxDBMS.setModel(new DefaultComboBoxModel(DBMSSuported.values())); - - jLabel3.setText("Name"); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addComponent(jLabel3) - .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(cbxDBMS, 0, 145, Short.MAX_VALUE)) - .addContainerGap())); - jPanel2Layout.setVerticalGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - cbxDBMS, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(90, Short.MAX_VALUE))); - - jTabbedPane1.addTab("DBMS", jPanel2); - - jLabel4.setText("Host :"); - - jLabel5.setText("Database :"); - jLabel5.setToolTipText(""); - - jLabel6.setText("User :"); - - jLabel7.setText("Passoword :"); - - jcbGenerateConnection.setSelected(false); - jcbGenerateConnection.setText("Generate the connection"); - - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addGroup( - jPanel5Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel7) - .addComponent(jLabel6)) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jtfUser) - .addComponent(jtfPassword))) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addComponent(jLabel4) - .addGap(34, 34, 34) - .addComponent(jtfHost)) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addComponent(jcbGenerateConnection) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addComponent(jLabel5) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jtfDatabase))) - .addContainerGap())); - jPanel5Layout.setVerticalGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateConnection) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel4) - .addComponent( - jtfHost, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel5) - .addComponent( - jtfDatabase, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel6) - .addComponent( - jtfUser, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel7) - .addComponent( - jtfPassword, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - jTabbedPane1.addTab("Conection", jPanel5); - - javax.swing.GroupLayout panSchemaParamsLayout = new javax.swing.GroupLayout(panSchemaParams); - panSchemaParams.setLayout(panSchemaParamsLayout); - panSchemaParamsLayout.setHorizontalGroup( - panSchemaParamsLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - panSchemaParamsLayout - .createSequentialGroup() - .addContainerGap() - .addGroup( - panSchemaParamsLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - jPanel1, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup( - panSchemaParamsLayout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent( - jcbStandarizeNames, - javax.swing.GroupLayout.Alignment.LEADING, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addGroup( - panSchemaParamsLayout - .createSequentialGroup() - .addComponent(jcbGenerateRelationalSchema) - .addGap(16, 16, 16))) - .addGroup( - panSchemaParamsLayout - .createSequentialGroup() - .addGap(21, 21, 21) - .addComponent(jLabel1))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jTabbedPane1) - .addContainerGap())); - panSchemaParamsLayout.setVerticalGroup( - panSchemaParamsLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - panSchemaParamsLayout - .createSequentialGroup() - .addGroup( - panSchemaParamsLayout - .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup( - panSchemaParamsLayout - .createSequentialGroup() - .addComponent( - jPanel1, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(15, 15, 15) - .addComponent(jcbStandarizeNames) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jcbGenerateRelationalSchema)) - .addComponent( - jTabbedPane1, - javax.swing.GroupLayout.PREFERRED_SIZE, - 171, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Paramters for OBDA file: ")); - - jLabel2.setText("Base IRI:"); - - jtfBaseIRI.setText("http://example.com"); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel4Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - diagramPanel, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addGroup( - jPanel4Layout - .createSequentialGroup() - .addComponent(jLabel2) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jtfBaseIRI))) - .addContainerGap())); - jPanel4Layout.setVerticalGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - jPanel4Layout - .createSequentialGroup() - .addGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent( - jtfBaseIRI, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - diagramPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 125, Short.MAX_VALUE) - .addContainerGap())); - - jbtnGenerateFiles.setText("Generate Ontop Files"); - jbtnGenerateFiles.setMaximumSize(new java.awt.Dimension(135, 29)); - jbtnGenerateFiles.setMinimumSize(new java.awt.Dimension(135, 29)); - jbtnGenerateFiles.setPreferredSize(new java.awt.Dimension(135, 29)); - - jbtnCancel.setText("Cancel"); - jbtnCancel.setMaximumSize(new java.awt.Dimension(135, 29)); - jbtnCancel.setMinimumSize(new java.awt.Dimension(135, 29)); - jbtnCancel.setPreferredSize(new java.awt.Dimension(135, 29)); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - layout - .createSequentialGroup() - .addGap(41, 41, 41) - .addComponent( - jbtnGenerateFiles, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addComponent( - jbtnCancel, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(45, 45, 45)) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - layout - .createSequentialGroup() - .addContainerGap() - .addComponent( - panSchemaParams, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addContainerGap()) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - layout - .createSequentialGroup() - .addContainerGap() - .addComponent( - jPanel4, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addContainerGap())); - layout.setVerticalGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - layout - .createSequentialGroup() - .addComponent( - panSchemaParams, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - jPanel4, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent( - jbtnCancel, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( - jbtnGenerateFiles, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap())); - - // ************************************* - // Manually generated code. - // ************************************* - - jbtnGenerateFiles.addActionListener( - new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jbtnGenerateFilesActionPerformed(evt); - } - }); - - jbtnCancel.addActionListener( - new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jbtnCancelActionPerformed(evt); - } - }); - } - - private void jbtnGenerateFilesActionPerformed(java.awt.event.ActionEvent evt) { - - if (jcbGenerateConnection.isSelected() - && (jtfHost.getText().trim().equals("") - || jtfDatabase.getText().trim().equals("") - || jtfUser.getText().trim().equals("") - || jtfPassword.getText().trim().equals(""))) { - JOptionPane.showMessageDialog( - null, - "Host, database, user and password must be filled in.", - "Error", - JOptionPane.ERROR_MESSAGE); - return; - } - - if ((DBMSSuported) cbxDBMS.getSelectedItem() == DBMSSuported.GENERIC_SCHEMA - && jcbGenerateConnection.isSelected()) { - JOptionPane.showMessageDialog( - null, - "It is not possible to generate the connection file for the generic database.", - "Error", - JOptionPane.ERROR_MESSAGE); - return; - } - - saveSelectedElements(); - updateConfigurationsValues(); - Configurations.getInstance().save(); - parentContainer.close(); - OntoUMLPlugin.setOBDAExportWindowOpen(false); - (new OBDAExportServerReques()).start(); - } - - private void jbtnCancelActionPerformed(java.awt.event.ActionEvent evt) { - parentContainer.close(); - OntoUMLPlugin.setOBDAExportWindowOpen(false); - } - - /** Sets a direct reference to the container dialog after initialization. */ - public void setContainerDialog(IDialog dialog) { - this.parentContainer = dialog; - } - - /** Updates project configurations with components' information. */ - private void updateConfigurationsValues() { - configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); - - if (rbtOntTablePerKind.isSelected()) - configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); - else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); - - configurations.setTargetDBMS((DBMSSuported) cbxDBMS.getSelectedItem()); - - configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); - - configurations.setStandardizeNames(jcbStandarizeNames.isSelected()); - - configurations.setGenerateSchema(jcbGenerateRelationalSchema.isSelected()); - - configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); - - configurations.setHostNameConnection(jtfHost.getText().trim()); - - configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); - - configurations.setUserNameConnection(jtfUser.getText().trim()); - - configurations.setPassword(jtfPassword.getText().trim()); - } - - /** - * Updates components with project configurations' information. - * - * @param configurations - */ - private void updateComponentsValues() { - - if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_KIND) - rbtOntTablePerKind.setSelected(true); - else rbtOneTablePerClass.setSelected(true); - - if (configurations.getTargetDBMS() != null) - cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); - - if (configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) - jtfBaseIRI.setText(configurations.getExportGUFOIRI()); - - if (configurations.getExportGUFOElementsDiagramTree() != null) - diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); - - jcbStandarizeNames.setSelected(configurations.isStandardizeNames()); - - jcbGenerateRelationalSchema.setSelected(configurations.isGenerateSchema()); - - jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); - - jtfHost.setText(configurations.getHostNameConnection()); - - jtfDatabase.setText(configurations.getDatabaseNameConnection()); - - jtfUser.setText(configurations.getUserNameConnection()); - - jtfPassword.setText(configurations.getPassword()); - } - - private void saveSelectedElements() { - TreePath[] paths; - - paths = diagramTree.getCheckedPaths(); - - for (TreePath path : paths) { - Object[] object = path.getPath(); - for (Object o : object) { - - if (o instanceof DefaultMutableTreeNode) { - - DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; - - if (node.getUserObject() instanceof IModelElement) - this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); - - if (node.getUserObject() instanceof IDiagramUIModel) - this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); - } - } - } - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java deleted file mode 100644 index 48d6c8ac..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressDialogStandard.java +++ /dev/null @@ -1,68 +0,0 @@ -package it.unibz.inf.ontouml.vp.views; - -import com.vp.plugin.view.IDialog; -import com.vp.plugin.view.IDialogHandler; -import it.unibz.inf.ontouml.vp.model.ServerRequest; -import java.awt.Component; - -public class ProgressDialogStandard implements IDialogHandler { - - private IDialog mainDialog; - private ProgressPanel progressPanel; - private String title; - private int width; - private int height; - - public ProgressDialogStandard() { - progressPanel = new ProgressPanel("Contacting Server..."); - title = "Working..."; - width = progressPanel.getWidth(); - height = progressPanel.getHeight(); - } - - public ProgressDialogStandard(ServerRequest serverRequest) { - progressPanel = new ProgressPanel(serverRequest); - title = "Working..."; - width = progressPanel.getWidth(); - height = progressPanel.getHeight(); - } - - public void setTitle(String txt) { - title = txt; - } - - public void setWidth(int w) { - width = w; - } - - public void setHeight(int h) { - height = h; - } - - @Override - public boolean canClosed() { - mainDialog.close(); - return true; - } - - @Override - public Component getComponent() { - return progressPanel; - } - - @Override - public void prepare(IDialog dialog) { - mainDialog = dialog; - mainDialog.setModal(false); - mainDialog.setResizable(false); - mainDialog.setTitle(title); - dialog.setSize(width, height); - progressPanel.setContainerDialog(mainDialog); - } - - @Override - public void shown() { - // TODO Auto-generated method stub - - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java index d25702a4..80e236d3 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java @@ -17,13 +17,8 @@ public class ProgressPanel extends JPanel { private static final long serialVersionUID = 1L; - private JLabel label; - private JProgressBar progressBar; - private JButton btnCancel; - private IDialog _dialog; - - public ProgressPanel(String text) { - setSize(new Dimension(200, 100)); + private final JProgressBar progressBar; + private final JButton btnCancel; public ProgressPanel() { super(); @@ -44,9 +39,12 @@ public ProgressPanel() { add(btnCancel); } - public ProgressPanel(ServerRequest request) { - this("Contacting Server..."); - setSize(new Dimension(200, 120)); // Add 20 to the height because add a button + public void startUpdatingProgressBarString(Supplier shouldStop) { + new SwingWorker, String>() { + protected void process(List chunks) { + String latest = chunks.get(chunks.size() - 1); + progressBar.setString(latest); + } protected List doInBackground() throws Exception { List circles = @@ -78,4 +76,4 @@ public void setCancelAction(ActionListener cancelAction) { btnCancel.addActionListener(cancelAction); } -} +} \ No newline at end of file diff --git a/src/main/resources/plugin.xml b/src/main/resources/plugin.xml index 3d062c8d..f6704090 100644 --- a/src/main/resources/plugin.xml +++ b/src/main/resources/plugin.xml @@ -124,6 +124,30 @@ ribbonPath="Project/Export/#"> + + + + + + + + From bb91c0ae98c17e8d36f892f89f9f95ee3e2c9583 Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Thu, 29 Apr 2021 18:29:58 +0000 Subject: [PATCH 07/10] Google Java Format --- .../vp/controllers/DbMappingController.java | 243 ++-- .../controllers/DbMappingDialogHandler.java | 152 ++- .../OntoUMLServerAccessController.java | 30 +- .../ontouml/vp/model/DbMappingOptions.java | 280 ++-- .../vp/model/DbMappingToDbServiceResult.java | 50 +- .../vp/model/ProjectConfigurations.java | 45 +- .../inf/ontouml/vp/views/DbMappingView.java | 1153 ++++++++++------- .../inf/ontouml/vp/views/ProgressPanel.java | 2 +- 8 files changed, 1059 insertions(+), 896 deletions(-) diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java index 0093a87e..750b02cd 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java @@ -1,138 +1,135 @@ package it.unibz.inf.ontouml.vp.controllers; -import java.awt.FileDialog; -import java.awt.Frame; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.List; - import com.vp.plugin.ApplicationManager; import com.vp.plugin.action.VPAction; import com.vp.plugin.action.VPActionController; - import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.model.DbMappingOptions; import it.unibz.inf.ontouml.vp.model.DbMappingToDbServiceResult; -import it.unibz.inf.ontouml.vp.model.GufoExportOptions; -import it.unibz.inf.ontouml.vp.model.GufoTransformationServiceResult; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; import it.unibz.inf.ontouml.vp.model.vp2ontouml.Uml2OntoumlTransformer; import it.unibz.inf.ontouml.vp.utils.SimpleServiceWorker; import it.unibz.inf.ontouml.vp.utils.ViewManagerUtils; +import java.awt.FileDialog; +import java.awt.Frame; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; public class DbMappingController implements VPActionController { - private static final String MESSAGE_MODEL_EXPORTED = "Model exported successfully."; - - private Configurations configurations; - private ProjectConfigurations projectConfigurations; - private String schemaFormat = ".sql"; - private String obdaFormat = ".obda"; - private String propertiesFormat = ".properties"; - private Path schemaFilePath; - private Path obdaFilePath; - private Path propertiesFilePath; - - @Override - public void performAction(VPAction action) { - schemaFilePath = null; - obdaFilePath = null; - propertiesFilePath = null; - configurations = Configurations.getInstance(); - projectConfigurations = configurations.getProjectConfigurations(); - DbMappingDialogHandler mappingDialog = new DbMappingDialogHandler(projectConfigurations); - mappingDialog.showDialog(); - - if (mappingDialog.wasCancelled()) { - ViewManagerUtils.log("Request cancelled by the user."); - return; - } - - putFilePath(); - - new SimpleServiceWorker(this::task).execute(); - } - - private List task(SimpleServiceWorker context) { - try { - if (schemaFilePath == null) { - context.cancel(true); - return List.of(); - } - - final String project = Uml2OntoumlTransformer.transformAndSerialize(); - final String options = new DbMappingOptions(projectConfigurations).toJson(); - final DbMappingToDbServiceResult result = OntoUMLServerAccessController.requestMappingToDB(project, options); - - if (!context.isCancelled()) { - //Files.write(schemaFilePath, "schema".getBytes()); - //Files.write(obdaFilePath, "OBDA".getBytes()); - //Files.write(propertiesFilePath, "properties".getBytes()); - Files.write(schemaFilePath, result.getSchema().getBytes()); - Files.write(obdaFilePath, result.getObda().getBytes()); - Files.write(propertiesFilePath, result.getProperties().getBytes()); - saveFilePath(); - ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); - return List.of(MESSAGE_MODEL_EXPORTED); - } - - return List.of(); - - } catch (IOException e) { - if (!context.isCancelled()) { - ViewManagerUtils.log(e.getMessage()); - } - e.printStackTrace(); - return List.of(e.getMessage()); - } - } - - private void putFilePath() { - final FileDialog fileDialog; - final Frame rootFrame = (Frame) ApplicationManager.instance().getViewManager().getRootFrame(); - final String suggestedFolderPath = projectConfigurations.getDbMappingFolderPath(); - String suggestedFileName = projectConfigurations.getDbMappingFileName(); - - if (suggestedFileName.isEmpty()) { - suggestedFileName = ApplicationManager.instance().getProjectManager().getProject().getName(); - } - - final String title = "Choose file destination"; - fileDialog = new FileDialog(rootFrame, title, FileDialog.SAVE); - - fileDialog.setFile(suggestedFileName); - fileDialog.setDirectory(suggestedFolderPath); - fileDialog.setMultipleMode(false); - fileDialog.setVisible(true); - - final String fileDirectory = fileDialog.getDirectory(); - final String fileName = fileDialog.getFile(); - - if (fileDirectory != null && fileName != null) { - schemaFilePath = Paths.get(fileDirectory, fileName + schemaFormat); - obdaFilePath = Paths.get(fileDirectory, fileName + obdaFormat); - propertiesFilePath = Paths.get(fileDirectory, fileName + propertiesFormat); - } - } - - private void saveFilePath() { - final Path directoryPath = schemaFilePath.getParent(); - final String directoryPathName = directoryPath.toAbsolutePath().getFileName().toString(); - final String filePathName = schemaFilePath.getFileName().toString(); - - projectConfigurations.setDbMappingFolderPath(directoryPathName); - projectConfigurations.setDbMappingFileName(filePathName); - configurations.save(); - } - - /** - * Called when the menu containing the button is accessed allowing for action manipulation, such - * as enable/disable or selecting the button. - * - *

OBS: DOES NOT apply to this class. - */ - @Override - public void update(VPAction action) {} - } + private static final String MESSAGE_MODEL_EXPORTED = "Model exported successfully."; + + private Configurations configurations; + private ProjectConfigurations projectConfigurations; + private String schemaFormat = ".sql"; + private String obdaFormat = ".obda"; + private String propertiesFormat = ".properties"; + private Path schemaFilePath; + private Path obdaFilePath; + private Path propertiesFilePath; + + @Override + public void performAction(VPAction action) { + schemaFilePath = null; + obdaFilePath = null; + propertiesFilePath = null; + configurations = Configurations.getInstance(); + projectConfigurations = configurations.getProjectConfigurations(); + DbMappingDialogHandler mappingDialog = new DbMappingDialogHandler(projectConfigurations); + mappingDialog.showDialog(); + + if (mappingDialog.wasCancelled()) { + ViewManagerUtils.log("Request cancelled by the user."); + return; + } + + putFilePath(); + + new SimpleServiceWorker(this::task).execute(); + } + + private List task(SimpleServiceWorker context) { + try { + if (schemaFilePath == null) { + context.cancel(true); + return List.of(); + } + + final String project = Uml2OntoumlTransformer.transformAndSerialize(); + final String options = new DbMappingOptions(projectConfigurations).toJson(); + final DbMappingToDbServiceResult result = + OntoUMLServerAccessController.requestMappingToDB(project, options); + + if (!context.isCancelled()) { + // Files.write(schemaFilePath, "schema".getBytes()); + // Files.write(obdaFilePath, "OBDA".getBytes()); + // Files.write(propertiesFilePath, "properties".getBytes()); + Files.write(schemaFilePath, result.getSchema().getBytes()); + Files.write(obdaFilePath, result.getObda().getBytes()); + Files.write(propertiesFilePath, result.getProperties().getBytes()); + saveFilePath(); + ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); + return List.of(MESSAGE_MODEL_EXPORTED); + } + + return List.of(); + + } catch (IOException e) { + if (!context.isCancelled()) { + ViewManagerUtils.log(e.getMessage()); + } + e.printStackTrace(); + return List.of(e.getMessage()); + } + } + + private void putFilePath() { + final FileDialog fileDialog; + final Frame rootFrame = (Frame) ApplicationManager.instance().getViewManager().getRootFrame(); + final String suggestedFolderPath = projectConfigurations.getDbMappingFolderPath(); + String suggestedFileName = projectConfigurations.getDbMappingFileName(); + + if (suggestedFileName.isEmpty()) { + suggestedFileName = ApplicationManager.instance().getProjectManager().getProject().getName(); + } + + final String title = "Choose file destination"; + fileDialog = new FileDialog(rootFrame, title, FileDialog.SAVE); + + fileDialog.setFile(suggestedFileName); + fileDialog.setDirectory(suggestedFolderPath); + fileDialog.setMultipleMode(false); + fileDialog.setVisible(true); + + final String fileDirectory = fileDialog.getDirectory(); + final String fileName = fileDialog.getFile(); + + if (fileDirectory != null && fileName != null) { + schemaFilePath = Paths.get(fileDirectory, fileName + schemaFormat); + obdaFilePath = Paths.get(fileDirectory, fileName + obdaFormat); + propertiesFilePath = Paths.get(fileDirectory, fileName + propertiesFormat); + } + } + + private void saveFilePath() { + final Path directoryPath = schemaFilePath.getParent(); + final String directoryPathName = directoryPath.toAbsolutePath().getFileName().toString(); + final String filePathName = schemaFilePath.getFileName().toString(); + + projectConfigurations.setDbMappingFolderPath(directoryPathName); + projectConfigurations.setDbMappingFileName(filePathName); + configurations.save(); + } + + /** + * Called when the menu containing the button is accessed allowing for action manipulation, such + * as enable/disable or selecting the button. + * + *

OBS: DOES NOT apply to this class. + */ + @Override + public void update(VPAction action) {} +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java index 9b0e9205..e0bda4d0 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java @@ -1,98 +1,96 @@ package it.unibz.inf.ontouml.vp.controllers; -import java.awt.Component; - import com.vp.plugin.ApplicationManager; import com.vp.plugin.ViewManager; import com.vp.plugin.view.IDialog; import com.vp.plugin.view.IDialogHandler; - import it.unibz.inf.ontouml.vp.OntoUMLPlugin; import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; import it.unibz.inf.ontouml.vp.views.DbMappingView; +import java.awt.Component; -public class DbMappingDialogHandler implements IDialogHandler { +public class DbMappingDialogHandler implements IDialogHandler { - private IDialog dialog; - private final DbMappingView view; - private final ViewManager viewManager; - private boolean wasShown = false; - private boolean wasClosed = false; - private boolean wasCancelled = false; + private IDialog dialog; + private final DbMappingView view; + private final ViewManager viewManager; + private boolean wasShown = false; + private boolean wasClosed = false; + private boolean wasCancelled = false; - public DbMappingDialogHandler(ProjectConfigurations projectConfigurations) { - view = new DbMappingView(projectConfigurations); - viewManager = ApplicationManager.instance().getViewManager(); + public DbMappingDialogHandler(ProjectConfigurations projectConfigurations) { + view = new DbMappingView(projectConfigurations); + viewManager = ApplicationManager.instance().getViewManager(); - view.onExport( - e -> { - view.updateConfigurationsValues(projectConfigurations); - Configurations.getInstance().save(); - closeDialog(); - }); - view.onCancel( - e -> { - wasCancelled = true; - closeDialog(); - }); - } + view.onExport( + e -> { + view.updateConfigurationsValues(projectConfigurations); + Configurations.getInstance().save(); + closeDialog(); + }); + view.onCancel( + e -> { + wasCancelled = true; + closeDialog(); + }); + } - /** - * Called once before the dialog is shown. Developer should return the content of the dialog - * (similar to the content pane). - */ - @Override - public Component getComponent() { - return view; - } + /** + * Called once before the dialog is shown. Developer should return the content of the dialog + * (similar to the content pane). + */ + @Override + public Component getComponent() { + return view; + } - /** - * Called after the getComponent(). A dialog is created on Visual Paradigm internally (it still - * not shown out). Developer can set the outlook of the dialog on prepare(). - */ - @Override - public void prepare(IDialog dialog) { - this.dialog = dialog; - dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME); - dialog.setModal(true); - dialog.setResizable(false); //true - dialog.setSize(view.getWidth(), view.getHeight() + 20); - dialog.pack(); - } + /** + * Called after the getComponent(). A dialog is created on Visual Paradigm internally (it still + * not shown out). Developer can set the outlook of the dialog on prepare(). + */ + @Override + public void prepare(IDialog dialog) { + this.dialog = dialog; + dialog.setTitle(OntoUMLPlugin.PLUGIN_NAME); + dialog.setModal(true); + dialog.setResizable(false); // true + dialog.setSize(view.getWidth(), view.getHeight() + 20); + dialog.pack(); + } - /** Called when the dialog is shown. */ - @Override - public void shown() {} + /** Called when the dialog is shown. */ + @Override + public void shown() {} - /** Called when the dialog is closed by the user clicking on the close button of the frame. */ - @Override - public boolean canClosed() { - wasCancelled = true; - wasClosed = true; - return true; - } + /** Called when the dialog is closed by the user clicking on the close button of the frame. */ + @Override + public boolean canClosed() { + wasCancelled = true; + wasClosed = true; + return true; + } - public void showDialog() { - if (!wasClosed) { - wasShown = true; - viewManager.showDialog(this); - } - } + public void showDialog() { + if (!wasClosed) { + wasShown = true; + viewManager.showDialog(this); + } + } - public void closeDialog() { - if (wasClosed) { - System.out.println("Mapping to ER dialog was already closed."); - } else if (!wasShown) { - System.out.println("Mapping to ER dialog was never shown. Setting wasClosed to \"true\""); - } else { - System.out.println("Closing mapping do ER dialog."); - dialog.close(); - } - wasClosed = true; - } + public void closeDialog() { + if (wasClosed) { + System.out.println("Mapping to ER dialog was already closed."); + } else if (!wasShown) { + System.out.println("Mapping to ER dialog was never shown. Setting wasClosed to \"true\""); + } else { + System.out.println("Closing mapping do ER dialog."); + dialog.close(); + } + wasClosed = true; + } - public boolean wasCancelled() { - return wasCancelled; - } - } + public boolean wasCancelled() { + return wasCancelled; + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java index 6ca32084..4be9e665 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java @@ -70,13 +70,11 @@ private static String getTransformationToGufoRequestUrl() { } private static String getMappingToErRequestUrl() { - final ProjectConfigurations config = Configurations.getInstance().getProjectConfigurations(); - return config.isCustomServerEnabled() - ? config.getServerURL() + MAPPING_TO_DB_SERVICE_ENDPOINT - : ProjectConfigurations.DEFAULT_SERVER_URL + MAPPING_TO_DB_SERVICE_ENDPOINT; - } - - + final ProjectConfigurations config = Configurations.getInstance().getProjectConfigurations(); + return config.isCustomServerEnabled() + ? config.getServerURL() + MAPPING_TO_DB_SERVICE_ENDPOINT + : ProjectConfigurations.DEFAULT_SERVER_URL + MAPPING_TO_DB_SERVICE_ENDPOINT; + } private static > T parseResponse( HttpURLConnection connection, Class _class) throws IOException { @@ -124,14 +122,14 @@ public static GufoTransformationServiceResult requestModelTransformationToGufo( return parseResponse(connection, GufoTransformationServiceResult.class); } - - public static DbMappingToDbServiceResult requestMappingToDB( - String project, String options) throws IOException { - final String url = getMappingToErRequestUrl(); - final String body = getServiceRequestBody(project, options); - final HttpURLConnection connection = request(url, body); - - return parseResponse(connection, DbMappingToDbServiceResult.class); + + public static DbMappingToDbServiceResult requestMappingToDB(String project, String options) + throws IOException { + final String url = getMappingToErRequestUrl(); + final String body = getServiceRequestBody(project, options); + final HttpURLConnection connection = request(url, body); + + return parseResponse(connection, DbMappingToDbServiceResult.class); } private static HttpURLConnection request(String url, String body) throws IOException { @@ -210,4 +208,4 @@ private static HttpURLConnection performRequest(String urlString, String body) return request; } -} \ No newline at end of file +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java index 4243cc47..5da8c8e5 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java @@ -1,149 +1,147 @@ package it.unibz.inf.ontouml.vp.model; -import java.io.IOException; - import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; public class DbMappingOptions { - - private MappingStrategy mappingStrategy; - private DbmsSupported targetDBMS; - private boolean isStandardizeNames; - private String baseIri; - private boolean generateSchema; - private boolean generateConnection; - private String hostName; - private String databaseName; - private String userConnection; - private String passwordConnection; - private boolean enumFieldToLookupTable; - private JsonNode customElementMapping; - - public DbMappingOptions() {} - - public DbMappingOptions(ProjectConfigurations projectConfigurations) { - - this.mappingStrategy = projectConfigurations.getMappingStrategy(); - this.targetDBMS = projectConfigurations.getTargetDBMS(); - this.isStandardizeNames = projectConfigurations.isStandardizeNames(); - this.baseIri = projectConfigurations.getExportGUFOIRI(); - this.generateSchema = projectConfigurations.isGenerateSchema(); - this.generateConnection = projectConfigurations.isGenerateConnection(); - this.hostName = projectConfigurations.getHostNameConnection(); - this.databaseName = projectConfigurations.getDatabaseNameConnection(); - this.userConnection = projectConfigurations.getUserNameConnection(); - this.passwordConnection = projectConfigurations.getPassword(); - this.enumFieldToLookupTable = projectConfigurations.isEnumFieldToLookupTable(); - - - ObjectMapper mapper = new ObjectMapper(); - try { - customElementMapping = mapper.readTree(projectConfigurations.getExportGUFOElementMapping()); - } catch (IOException e) { - System.err.println("Unable to read project configurations."); - e.printStackTrace(); - } - } - - public MappingStrategy getMappingStrategy() { - return mappingStrategy; - } - - public void setMappingStrategy(MappingStrategy mappingStrategy) { - this.mappingStrategy = mappingStrategy; - } - - public DbmsSupported getTargetDBMS() { - return targetDBMS; - } - - public void setTargetDBMS(DbmsSupported targetDBMS) { - this.targetDBMS = targetDBMS; - } - - public boolean isStandardizeNames() { - return isStandardizeNames; - } - - public void setStandardizeNames(boolean isStandardizeNames) { - this.isStandardizeNames = isStandardizeNames; - } - - public String getBaseIri() { - return baseIri; - } - - public void setBaseIri(String baseIri) { - this.baseIri = baseIri; - } - - public boolean isGenerateSchema() { - return generateSchema; - } - - public void setGenerateSchema(boolean generateSchema) { - this.generateSchema = generateSchema; - } - - public boolean isGenerateConnection() { - return generateConnection; - } - - public void setGenerateConnection(boolean generateConnection) { - this.generateConnection = generateConnection; - } - - public String getHostName() { - return hostName; - } - - public void setHostName(String hostName) { - this.hostName = hostName; - } - - public String getDatabaseName() { - return databaseName; - } - - public void setDatabaseName(String databaseName) { - this.databaseName = databaseName; - } - - public String getUserConnection() { - return userConnection; - } - - public void setUserConnection(String userConnection) { - this.userConnection = userConnection; - } - - public String getPasswordConnection() { - return passwordConnection; - } - - public void setPasswordConnection(String passwordConnection) { - this.passwordConnection = passwordConnection; - } - - public boolean isEnumFieldToLookupTable() { - return enumFieldToLookupTable; - } - - public void setEnumFieldToLookupTable(boolean enumFieldToLookupTable) { - this.enumFieldToLookupTable = enumFieldToLookupTable; - } - - public JsonNode getCustomElementMapping() { - return customElementMapping; - } - - public void setCustomElementMapping(JsonNode customElementMapping) { - this.customElementMapping = customElementMapping; - } - - public String toJson() throws JsonProcessingException { - return new ObjectMapper().writeValueAsString(this); - } + + private MappingStrategy mappingStrategy; + private DbmsSupported targetDBMS; + private boolean isStandardizeNames; + private String baseIri; + private boolean generateSchema; + private boolean generateConnection; + private String hostName; + private String databaseName; + private String userConnection; + private String passwordConnection; + private boolean enumFieldToLookupTable; + private JsonNode customElementMapping; + + public DbMappingOptions() {} + + public DbMappingOptions(ProjectConfigurations projectConfigurations) { + + this.mappingStrategy = projectConfigurations.getMappingStrategy(); + this.targetDBMS = projectConfigurations.getTargetDBMS(); + this.isStandardizeNames = projectConfigurations.isStandardizeNames(); + this.baseIri = projectConfigurations.getExportGUFOIRI(); + this.generateSchema = projectConfigurations.isGenerateSchema(); + this.generateConnection = projectConfigurations.isGenerateConnection(); + this.hostName = projectConfigurations.getHostNameConnection(); + this.databaseName = projectConfigurations.getDatabaseNameConnection(); + this.userConnection = projectConfigurations.getUserNameConnection(); + this.passwordConnection = projectConfigurations.getPassword(); + this.enumFieldToLookupTable = projectConfigurations.isEnumFieldToLookupTable(); + + ObjectMapper mapper = new ObjectMapper(); + try { + customElementMapping = mapper.readTree(projectConfigurations.getExportGUFOElementMapping()); + } catch (IOException e) { + System.err.println("Unable to read project configurations."); + e.printStackTrace(); + } + } + + public MappingStrategy getMappingStrategy() { + return mappingStrategy; + } + + public void setMappingStrategy(MappingStrategy mappingStrategy) { + this.mappingStrategy = mappingStrategy; + } + + public DbmsSupported getTargetDBMS() { + return targetDBMS; + } + + public void setTargetDBMS(DbmsSupported targetDBMS) { + this.targetDBMS = targetDBMS; + } + + public boolean isStandardizeNames() { + return isStandardizeNames; + } + + public void setStandardizeNames(boolean isStandardizeNames) { + this.isStandardizeNames = isStandardizeNames; + } + + public String getBaseIri() { + return baseIri; + } + + public void setBaseIri(String baseIri) { + this.baseIri = baseIri; + } + + public boolean isGenerateSchema() { + return generateSchema; + } + + public void setGenerateSchema(boolean generateSchema) { + this.generateSchema = generateSchema; + } + + public boolean isGenerateConnection() { + return generateConnection; + } + + public void setGenerateConnection(boolean generateConnection) { + this.generateConnection = generateConnection; + } + + public String getHostName() { + return hostName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } + + public String getDatabaseName() { + return databaseName; + } + + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + public String getUserConnection() { + return userConnection; + } + + public void setUserConnection(String userConnection) { + this.userConnection = userConnection; + } + + public String getPasswordConnection() { + return passwordConnection; + } + + public void setPasswordConnection(String passwordConnection) { + this.passwordConnection = passwordConnection; + } + + public boolean isEnumFieldToLookupTable() { + return enumFieldToLookupTable; + } + + public void setEnumFieldToLookupTable(boolean enumFieldToLookupTable) { + this.enumFieldToLookupTable = enumFieldToLookupTable; + } + + public JsonNode getCustomElementMapping() { + return customElementMapping; + } + + public void setCustomElementMapping(JsonNode customElementMapping) { + this.customElementMapping = customElementMapping; + } + + public String toJson() throws JsonProcessingException { + return new ObjectMapper().writeValueAsString(this); + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java index 68168526..a0bccc69 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java @@ -4,28 +4,28 @@ public class DbMappingToDbServiceResult extends ServiceResult { - public DbMappingToDbServiceResult(String result, List issues) { - super(result, issues); - } - - public DbMappingToDbServiceResult() { - super(); - } - - public String getSchema() { - return "schema"; - } - - public String getObda() { - return "obda"; - } - - public String getProperties() { - return "properties"; - } - - @Override - public String getMessage() { - return "The mapping to database was concluded"; - } - } + public DbMappingToDbServiceResult(String result, List issues) { + super(result, issues); + } + + public DbMappingToDbServiceResult() { + super(); + } + + public String getSchema() { + return "schema"; + } + + public String getObda() { + return "obda"; + } + + public String getProperties() { + return "properties"; + } + + @Override + public String getMessage() { + return "The mapping to database was concluded"; + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java index b7c1f47b..899317f7 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java @@ -162,20 +162,18 @@ public class ProjectConfigurations { @SerializedName("passwordConnectino") @Expose() private String passwordConnectino; - + @SerializedName("dbMappingFileName") @Expose() private String dbMappingFileName; - + @SerializedName("dbMappingFolderPath") @Expose() private String dbMappingFolderPath; - + @SerializedName("enumFieldToLookupTable") @Expose() private boolean enumFieldToLookupTable; - - /** Constructor without args to be called when deserializing project settings. */ public ProjectConfigurations() { @@ -223,7 +221,7 @@ public void setDefaultValues() { this.dbMappingFileName = ProjectConfigurations.DEFAULT_DB_MAPPING_FILE_NAME; this.dbMappingFolderPath = ProjectConfigurations.DEFAULT_DB_MAPPING_PATH; this.enumFieldToLookupTable = ProjectConfigurations.DEFAULT_IS_ENUMARATION_TO_LOOKUP_TABLE; - } + } /** * Returns the related project's ID. @@ -656,60 +654,59 @@ public String getPassword() { public void setPassword(String password) { this.passwordConnectino = password; } - + /** * Returns the file name for mapping to ER. * - * @return + * @return */ public String getDbMappingFileName() { - return this.dbMappingFileName; - }; - + return this.dbMappingFileName; + } + ; + /** * Informs the file name for mapping to ER. * * @param string */ public void setDbMappingFileName(String dbMappingFileName) { - this.dbMappingFileName = dbMappingFileName; + this.dbMappingFileName = dbMappingFileName; } - + /** * Returns the directory to save the files mapping. * * @return String */ public String getDbMappingFolderPath() { - return this.dbMappingFolderPath; + return this.dbMappingFolderPath; } - + /** * Informs the directory for mapping to ER. * * @param string */ public void setDbMappingFolderPath(String dbMappingFolderPath) { - this.dbMappingFolderPath = dbMappingFolderPath; + this.dbMappingFolderPath = dbMappingFolderPath; } - + /** * Returns if it is necessary to generate a table for the enumeration type fields. * - * @return boolean + * @return boolean */ public boolean isEnumFieldToLookupTable() { - return this.enumFieldToLookupTable; + return this.enumFieldToLookupTable; } - + /** * Informs if it is necessary to generate a table for the enumeration type fields. * - * @param boolean + * @param boolean */ public void setEnumFieldToLookupTable(boolean isEnumFieldToLookupTable) { - this.enumFieldToLookupTable = isEnumFieldToLookupTable; + this.enumFieldToLookupTable = isEnumFieldToLookupTable; } - - } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java index db070adf..bafe645c 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java @@ -5,506 +5,681 @@ import it.unibz.inf.ontouml.vp.model.DbmsSupported; import it.unibz.inf.ontouml.vp.model.MappingStrategy; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; - import java.awt.Dimension; import java.awt.GridLayout; import java.awt.event.ActionListener; import java.util.HashSet; - import javax.swing.DefaultComboBoxModel; import javax.swing.JScrollPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; - public class DbMappingView extends javax.swing.JPanel { - - private static final long serialVersionUID = 1L; - - private HashSet elementsDiagramTree = new HashSet<>(); - - //private IDialog parentContainer; - - private JCheckBoxTree diagramTree; - private javax.swing.JComboBox cbxDBMS; - private javax.swing.JCheckBox cbxStandarizeNames; - private javax.swing.JCheckBox cxbEnumToLookupTable; - private javax.swing.JPanel diagramPanel; - private javax.swing.ButtonGroup groupStrategy; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabel7; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private javax.swing.JPanel jPanel6; - private javax.swing.JTabbedPane jTabbedPane1; - private javax.swing.JButton jbtnCancel; - private javax.swing.JButton jbtnOk; - private javax.swing.JCheckBox jcbGenerateConnection; - private javax.swing.JCheckBox jcbGenerateObda; - private javax.swing.JCheckBox jcbGenerateSchema; - private javax.swing.JTextField jtfBaseIRI; - private javax.swing.JTextField jtfDatabase; - private javax.swing.JTextField jtfHost; - private javax.swing.JTextField jtfPassword; - private javax.swing.JTextField jtfUser; - private javax.swing.JRadioButton rbtOneTablePerClass; - private javax.swing.JRadioButton rbtOneTablePerConcreteClass; - private javax.swing.JRadioButton rbtOneTablePerKind; - - - public DbMappingView(ProjectConfigurations configurations) { - initComponents(); - - updateComponentsValues(configurations); - } - - private void initComponents() { - - // ************************************* - // Manually generated code. - // ************************************* - setSize(new Dimension(500, 360)); - - diagramPanel = new javax.swing.JPanel(); - diagramTree = new JCheckBoxTree("diagram"); - - JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); - scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - diagramPanel.add(scrollableTextAreaDiagram); - - diagramPanel.setLayout(new GridLayout(1, 1)); - diagramPanel.setPreferredSize(new Dimension(100, 100)); - - // ************************************* - // Automatically generated code. - // ************************************* - - - groupStrategy = new javax.swing.ButtonGroup(); - jPanel3 = new javax.swing.JPanel(); - jTabbedPane1 = new javax.swing.JTabbedPane(); - jPanel2 = new javax.swing.JPanel(); - jcbGenerateSchema = new javax.swing.JCheckBox(); - jPanel1 = new javax.swing.JPanel(); - rbtOneTablePerClass = new javax.swing.JRadioButton(); - rbtOneTablePerConcreteClass = new javax.swing.JRadioButton(); - rbtOneTablePerKind = new javax.swing.JRadioButton(); - jLabel3 = new javax.swing.JLabel(); - cbxDBMS = new javax.swing.JComboBox<>(); - cbxStandarizeNames = new javax.swing.JCheckBox(); - jLabel1 = new javax.swing.JLabel(); - cxbEnumToLookupTable = new javax.swing.JCheckBox(); - jPanel6 = new javax.swing.JPanel(); - jLabel2 = new javax.swing.JLabel(); - jtfBaseIRI = new javax.swing.JTextField(); - jcbGenerateObda = new javax.swing.JCheckBox(); - jPanel5 = new javax.swing.JPanel(); - jLabel4 = new javax.swing.JLabel(); - jLabel5 = new javax.swing.JLabel(); - jLabel6 = new javax.swing.JLabel(); - jLabel7 = new javax.swing.JLabel(); - jtfHost = new javax.swing.JTextField(); - jtfUser = new javax.swing.JTextField(); - jtfDatabase = new javax.swing.JTextField(); - jtfPassword = new javax.swing.JTextField(); - jcbGenerateConnection = new javax.swing.JCheckBox(); - jPanel4 = new javax.swing.JPanel(); - jbtnCancel = new javax.swing.JButton(); - jbtnOk = new javax.swing.JButton(); - - jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram to be mapped: ")); - - diagramPanel.setBackground(new java.awt.Color(255, 255, 255)); - diagramPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - diagramPanel.setName(""); // NOI18N - - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(diagramPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(diagramPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 144, Short.MAX_VALUE) - ); - - jcbGenerateSchema.setSelected(true); - jcbGenerateSchema.setText("Generate relational schema"); - jcbGenerateSchema.setActionCommand("Generate database script"); - - jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); - - groupStrategy.add(rbtOneTablePerClass); - rbtOneTablePerClass.setText("One Table per Class"); - - groupStrategy.add(rbtOneTablePerConcreteClass); - rbtOneTablePerConcreteClass.setText("One Table per Concrete Class"); - - groupStrategy.add(rbtOneTablePerKind); - rbtOneTablePerKind.setSelected(true); - rbtOneTablePerKind.setText("One Table per Kind"); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + + private static final long serialVersionUID = 1L; + + private HashSet elementsDiagramTree = new HashSet<>(); + + // private IDialog parentContainer; + + private JCheckBoxTree diagramTree; + private javax.swing.JComboBox cbxDBMS; + private javax.swing.JCheckBox cbxStandarizeNames; + private javax.swing.JCheckBox cxbEnumToLookupTable; + private javax.swing.JPanel diagramPanel; + private javax.swing.ButtonGroup groupStrategy; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; + private javax.swing.JLabel jLabel7; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JPanel jPanel3; + private javax.swing.JPanel jPanel4; + private javax.swing.JPanel jPanel5; + private javax.swing.JPanel jPanel6; + private javax.swing.JTabbedPane jTabbedPane1; + private javax.swing.JButton jbtnCancel; + private javax.swing.JButton jbtnOk; + private javax.swing.JCheckBox jcbGenerateConnection; + private javax.swing.JCheckBox jcbGenerateObda; + private javax.swing.JCheckBox jcbGenerateSchema; + private javax.swing.JTextField jtfBaseIRI; + private javax.swing.JTextField jtfDatabase; + private javax.swing.JTextField jtfHost; + private javax.swing.JTextField jtfPassword; + private javax.swing.JTextField jtfUser; + private javax.swing.JRadioButton rbtOneTablePerClass; + private javax.swing.JRadioButton rbtOneTablePerConcreteClass; + private javax.swing.JRadioButton rbtOneTablePerKind; + + public DbMappingView(ProjectConfigurations configurations) { + initComponents(); + + updateComponentsValues(configurations); + } + + private void initComponents() { + + // ************************************* + // Manually generated code. + // ************************************* + setSize(new Dimension(500, 360)); + + diagramPanel = new javax.swing.JPanel(); + diagramTree = new JCheckBoxTree("diagram"); + + JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); + scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + + diagramPanel.add(scrollableTextAreaDiagram); + + diagramPanel.setLayout(new GridLayout(1, 1)); + diagramPanel.setPreferredSize(new Dimension(100, 100)); + + // ************************************* + // Automatically generated code. + // ************************************* + + groupStrategy = new javax.swing.ButtonGroup(); + jPanel3 = new javax.swing.JPanel(); + jTabbedPane1 = new javax.swing.JTabbedPane(); + jPanel2 = new javax.swing.JPanel(); + jcbGenerateSchema = new javax.swing.JCheckBox(); + jPanel1 = new javax.swing.JPanel(); + rbtOneTablePerClass = new javax.swing.JRadioButton(); + rbtOneTablePerConcreteClass = new javax.swing.JRadioButton(); + rbtOneTablePerKind = new javax.swing.JRadioButton(); + jLabel3 = new javax.swing.JLabel(); + cbxDBMS = new javax.swing.JComboBox<>(); + cbxStandarizeNames = new javax.swing.JCheckBox(); + jLabel1 = new javax.swing.JLabel(); + cxbEnumToLookupTable = new javax.swing.JCheckBox(); + jPanel6 = new javax.swing.JPanel(); + jLabel2 = new javax.swing.JLabel(); + jtfBaseIRI = new javax.swing.JTextField(); + jcbGenerateObda = new javax.swing.JCheckBox(); + jPanel5 = new javax.swing.JPanel(); + jLabel4 = new javax.swing.JLabel(); + jLabel5 = new javax.swing.JLabel(); + jLabel6 = new javax.swing.JLabel(); + jLabel7 = new javax.swing.JLabel(); + jtfHost = new javax.swing.JTextField(); + jtfUser = new javax.swing.JTextField(); + jtfDatabase = new javax.swing.JTextField(); + jtfPassword = new javax.swing.JTextField(); + jcbGenerateConnection = new javax.swing.JCheckBox(); + jPanel4 = new javax.swing.JPanel(); + jbtnCancel = new javax.swing.JButton(); + jbtnOk = new javax.swing.JButton(); + + jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram to be mapped: ")); + + diagramPanel.setBackground(new java.awt.Color(255, 255, 255)); + diagramPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + diagramPanel.setName(""); // NOI18N + + javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); + jPanel3.setLayout(jPanel3Layout); + jPanel3Layout.setHorizontalGroup( + jPanel3Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + diagramPanel, + javax.swing.GroupLayout.Alignment.TRAILING, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)); + jPanel3Layout.setVerticalGroup( + jPanel3Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + diagramPanel, + javax.swing.GroupLayout.Alignment.TRAILING, + javax.swing.GroupLayout.DEFAULT_SIZE, + 144, + Short.MAX_VALUE)); + + jcbGenerateSchema.setSelected(true); + jcbGenerateSchema.setText("Generate relational schema"); + jcbGenerateSchema.setActionCommand("Generate database script"); + + jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); + + groupStrategy.add(rbtOneTablePerClass); + rbtOneTablePerClass.setText("One Table per Class"); + + groupStrategy.add(rbtOneTablePerConcreteClass); + rbtOneTablePerConcreteClass.setText("One Table per Concrete Class"); + + groupStrategy.add(rbtOneTablePerKind); + rbtOneTablePerKind.setSelected(true); + rbtOneTablePerKind.setText("One Table per Kind"); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerKind) + .addComponent(rbtOneTablePerConcreteClass) + .addComponent(rbtOneTablePerClass)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel1Layout.setVerticalGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + rbtOneTablePerClass, + javax.swing.GroupLayout.PREFERRED_SIZE, + 23, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent( + rbtOneTablePerConcreteClass, + javax.swing.GroupLayout.PREFERRED_SIZE, + 23, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rbtOneTablePerKind) - .addComponent(rbtOneTablePerConcreteClass) - .addComponent(rbtOneTablePerClass)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(rbtOneTablePerClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rbtOneTablePerConcreteClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rbtOneTablePerKind) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jLabel3.setText("DBMS"); - - cbxDBMS.setModel(new DefaultComboBoxModel(DbmsSupported.values())); - - cbxStandarizeNames.setSelected(true); - cbxStandarizeNames.setText("Standardize database names"); - - jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); - - cxbEnumToLookupTable.setText("Enumeration field to lookup table"); - cxbEnumToLookupTable.setActionCommand("Enumeration field to lookup table"); - - javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jcbGenerateSchema)) - .addGap(18, 18, 18) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jLabel3) - .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGap(21, 21, 21) - .addComponent(jLabel1)) - .addComponent(cxbEnumToLookupTable, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) - .addComponent(cbxStandarizeNames, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateSchema) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cxbEnumToLookupTable) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cbxStandarizeNames) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1) - .addGap(0, 8, Short.MAX_VALUE)) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - ); - - jTabbedPane1.addTab("Relational Schema", jPanel2); - - jLabel2.setText("Base IRI:"); - - jtfBaseIRI.setText("http://example.com"); - - jcbGenerateObda.setSelected(true); - jcbGenerateObda.setText("Generate OBDA file"); - - javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); - jPanel6.setLayout(jPanel6Layout); - jPanel6Layout.setHorizontalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() - .addComponent(jcbGenerateObda) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(jPanel6Layout.createSequentialGroup() - .addComponent(jLabel2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jtfBaseIRI, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE))) - .addContainerGap()) - ); - jPanel6Layout.setVerticalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateObda) - .addGap(18, 18, 18) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent(jtfBaseIRI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(91, Short.MAX_VALUE)) - ); - - jTabbedPane1.addTab("OBDA", jPanel6); - - jLabel4.setText("Host :"); - - jLabel5.setText("Database :"); - jLabel5.setToolTipText(""); - - jLabel6.setText("User :"); - - jLabel7.setText("Passoword :"); - - jcbGenerateConnection.setSelected(true); - jcbGenerateConnection.setText("Generate the connection"); - - javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); - jPanel5.setLayout(jPanel5Layout); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + jLabel3.setText("DBMS"); + + cbxDBMS.setModel(new DefaultComboBoxModel(DbmsSupported.values())); + + cbxStandarizeNames.setSelected(true); + cbxStandarizeNames.setText("Standardize database names"); + + jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); + + cxbEnumToLookupTable.setText("Enumeration field to lookup table"); + cxbEnumToLookupTable.setActionCommand("Enumeration field to lookup table"); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + jPanel1, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jcbGenerateSchema)) + .addGap(18, 18, 18) + .addGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(jLabel3) + .addComponent( + cbxDBMS, + javax.swing.GroupLayout.PREFERRED_SIZE, + 158, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1)) + .addComponent( + cxbEnumToLookupTable, + javax.swing.GroupLayout.DEFAULT_SIZE, + 184, + Short.MAX_VALUE) + .addComponent( + cbxStandarizeNames, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel2Layout.setVerticalGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateSchema) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + cbxDBMS, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cxbEnumToLookupTable) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbxStandarizeNames) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addGap(0, 8, Short.MAX_VALUE)) + .addComponent( + jPanel1, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)))); + + jTabbedPane1.addTab("Relational Schema", jPanel2); + + jLabel2.setText("Base IRI:"); + + jtfBaseIRI.setText("http://example.com"); + + jcbGenerateObda.setSelected(true); + jcbGenerateObda.setText("Generate OBDA file"); + + javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); + jPanel6.setLayout(jPanel6Layout); + jPanel6Layout.setHorizontalGroup( + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel6Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel6Layout + .createSequentialGroup() + .addComponent(jcbGenerateObda) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup( + jPanel6Layout + .createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent( + jtfBaseIRI, + javax.swing.GroupLayout.DEFAULT_SIZE, + 336, + Short.MAX_VALUE))) + .addContainerGap())); + jPanel6Layout.setVerticalGroup( + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + jPanel6Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateObda) + .addGap(18, 18, 18) + .addGroup( + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent( + jtfBaseIRI, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(91, Short.MAX_VALUE))); + + jTabbedPane1.addTab("OBDA", jPanel6); + + jLabel4.setText("Host :"); + + jLabel5.setText("Database :"); + jLabel5.setToolTipText(""); + + jLabel6.setText("User :"); + + jLabel7.setText("Passoword :"); + + jcbGenerateConnection.setSelected(true); + jcbGenerateConnection.setText("Generate the connection"); + + javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); + jPanel5.setLayout(jPanel5Layout); + jPanel5Layout.setHorizontalGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addGroup( + jPanel5Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel6)) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jtfUser) + .addComponent(jtfPassword))) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jLabel4) + .addGap(34, 34, 34) + .addComponent(jtfHost)) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jcbGenerateConnection) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfDatabase))) + .addContainerGap())); + jPanel5Layout.setVerticalGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(jcbGenerateConnection) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent( + jtfHost, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent( + jtfDatabase, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent( + jtfUser, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) - .addComponent(jLabel6)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jtfUser) - .addComponent(jtfPassword))) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jLabel4) - .addGap(34, 34, 34) - .addComponent(jtfHost)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jcbGenerateConnection) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jLabel5) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jtfDatabase))) - .addContainerGap()) - ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateConnection) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel4) - .addComponent(jtfHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel5) - .addComponent(jtfDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel6) - .addComponent(jtfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel7) - .addComponent(jtfPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - jTabbedPane1.addTab("Conection", jPanel5); - - jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - - jbtnCancel.setText("Cancel"); - jbtnCancel.setMaximumSize(new java.awt.Dimension(135, 29)); - jbtnCancel.setMinimumSize(new java.awt.Dimension(135, 29)); - jbtnCancel.setPreferredSize(new java.awt.Dimension(135, 29)); - - jbtnOk.setText("Do Mapping"); - jbtnOk.setMaximumSize(new java.awt.Dimension(135, 29)); - jbtnOk.setMinimumSize(new java.awt.Dimension(135, 29)); - jbtnOk.setPreferredSize(new java.awt.Dimension(135, 29)); - - javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() - .addGap(36, 36, 36) - .addComponent(jbtnOk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(54, 54, 54) - .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jbtnOk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); - this.setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent( + jtfPassword, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + jTabbedPane1.addTab("Conection", jPanel5); + + jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder()); + + jbtnCancel.setText("Cancel"); + jbtnCancel.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnCancel.setPreferredSize(new java.awt.Dimension(135, 29)); + + jbtnOk.setText("Do Mapping"); + jbtnOk.setMaximumSize(new java.awt.Dimension(135, 29)); + jbtnOk.setMinimumSize(new java.awt.Dimension(135, 29)); + jbtnOk.setPreferredSize(new java.awt.Dimension(135, 29)); + + javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); + jPanel4.setLayout(jPanel4Layout); + jPanel4Layout.setHorizontalGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + jPanel4Layout + .createSequentialGroup() + .addGap(36, 36, 36) + .addComponent( + jbtnOk, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(54, 54, 54) + .addComponent( + jbtnCancel, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel4Layout.setVerticalGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent( + jbtnCancel, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent( + jbtnOk, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + jPanel3, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addComponent(jTabbedPane1) + .addComponent( + jPanel4, + javax.swing.GroupLayout.Alignment.TRAILING, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addContainerGap())); + layout.setVerticalGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + jPanel3, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jTabbedPane1) - .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jTabbedPane1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - } - - /** - * Updates components with project configurations' information. - * - * @param configurations - */ - private void updateComponentsValues(ProjectConfigurations configurations) { - - if(configurations.getExportGUFOElementsDiagramTree() != null) - diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); - - if (configurations.getMappingStrategy() != null) { - if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) - rbtOneTablePerClass.setSelected(true); - else if(configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS) - rbtOneTablePerConcreteClass.setSelected(true); - else rbtOneTablePerKind.setSelected(true); - } - - if (configurations.getTargetDBMS() != null) - cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); - - cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); - - jcbGenerateSchema.setSelected(configurations.isGenerateSchema()); - - jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); - - jtfHost.setText(configurations.getHostNameConnection()); - - jtfDatabase.setText(configurations.getDatabaseNameConnection()); - - jtfUser.setText(configurations.getUserNameConnection()); - - jtfPassword.setText(configurations.getPassword()); - - if(configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) - jtfBaseIRI.setText(configurations.getExportGUFOIRI()); - } - - /** Updates project configurations with components' information. */ - public void updateConfigurationsValues(ProjectConfigurations configurations) { - saveSelectedElements(); - - configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); - - configurations.setGenerateSchema(jcbGenerateSchema.isSelected()); - - if (rbtOneTablePerClass.isSelected()) - configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); - else if(rbtOneTablePerConcreteClass.isSelected()) - configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS); - else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); - - configurations.setTargetDBMS((DbmsSupported) cbxDBMS.getSelectedItem()); - - configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); - - configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); - - configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); - - configurations.setHostNameConnection(jtfHost.getText().trim()); - - configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); - - configurations.setUserNameConnection(jtfUser.getText().trim()); - - configurations.setPassword(jtfPassword.getText().trim()); - } - - private void saveSelectedElements() { - TreePath[] paths; - - paths = diagramTree.getCheckedPaths(); - - for (TreePath path : paths) { - Object[] object = path.getPath(); - for (Object o : object) { - - if (o instanceof DefaultMutableTreeNode) { - - DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; - - if (node.getUserObject() instanceof IModelElement) - this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); - - if (node.getUserObject() instanceof IDiagramUIModel) - this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); - } - } - } - } - - public void onExport(ActionListener onExportAction) { - ActionListener[] currentListeners = jbtnOk.getActionListeners(); - - for (int i = 0; currentListeners != null && i < currentListeners.length; i++) { - jbtnOk.removeActionListener(currentListeners[i]); - } - - jbtnOk.addActionListener(onExportAction); - } - - public void onCancel(ActionListener onCancelAction) { - ActionListener[] currentListeners = jbtnCancel.getActionListeners(); - - for (int i = 0; currentListeners != null && i < currentListeners.length; i++) { - jbtnCancel.removeActionListener(currentListeners[i]); - } - - jbtnCancel.addActionListener(onCancelAction); - } + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + jPanel4, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap())); + } + + /** + * Updates components with project configurations' information. + * + * @param configurations + */ + private void updateComponentsValues(ProjectConfigurations configurations) { + + if (configurations.getExportGUFOElementsDiagramTree() != null) + diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); + + if (configurations.getMappingStrategy() != null) { + if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) + rbtOneTablePerClass.setSelected(true); + else if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS) + rbtOneTablePerConcreteClass.setSelected(true); + else rbtOneTablePerKind.setSelected(true); + } + + if (configurations.getTargetDBMS() != null) + cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); + + cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); + + jcbGenerateSchema.setSelected(configurations.isGenerateSchema()); + + jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); + + jtfHost.setText(configurations.getHostNameConnection()); + + jtfDatabase.setText(configurations.getDatabaseNameConnection()); + + jtfUser.setText(configurations.getUserNameConnection()); + + jtfPassword.setText(configurations.getPassword()); + + if (configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) + jtfBaseIRI.setText(configurations.getExportGUFOIRI()); + } + + /** Updates project configurations with components' information. */ + public void updateConfigurationsValues(ProjectConfigurations configurations) { + saveSelectedElements(); + + configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); + + configurations.setGenerateSchema(jcbGenerateSchema.isSelected()); + + if (rbtOneTablePerClass.isSelected()) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); + else if (rbtOneTablePerConcreteClass.isSelected()) + configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS); + else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); + + configurations.setTargetDBMS((DbmsSupported) cbxDBMS.getSelectedItem()); + + configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); + + configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); + + configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); + + configurations.setHostNameConnection(jtfHost.getText().trim()); + + configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); + + configurations.setUserNameConnection(jtfUser.getText().trim()); + + configurations.setPassword(jtfPassword.getText().trim()); + } + + private void saveSelectedElements() { + TreePath[] paths; + + paths = diagramTree.getCheckedPaths(); + + for (TreePath path : paths) { + Object[] object = path.getPath(); + for (Object o : object) { + + if (o instanceof DefaultMutableTreeNode) { + + DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; + + if (node.getUserObject() instanceof IModelElement) + this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); + + if (node.getUserObject() instanceof IDiagramUIModel) + this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); + } + } + } + } + + public void onExport(ActionListener onExportAction) { + ActionListener[] currentListeners = jbtnOk.getActionListeners(); + + for (int i = 0; currentListeners != null && i < currentListeners.length; i++) { + jbtnOk.removeActionListener(currentListeners[i]); + } + + jbtnOk.addActionListener(onExportAction); + } + + public void onCancel(ActionListener onCancelAction) { + ActionListener[] currentListeners = jbtnCancel.getActionListeners(); + + for (int i = 0; currentListeners != null && i < currentListeners.length; i++) { + jbtnCancel.removeActionListener(currentListeners[i]); + } + + jbtnCancel.addActionListener(onCancelAction); + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java index 80e236d3..bbc31b0f 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/ProgressPanel.java @@ -76,4 +76,4 @@ public void setCancelAction(ActionListener cancelAction) { btnCancel.addActionListener(cancelAction); } -} \ No newline at end of file +} From ed02c79c8159a8217d6154424ad54fd22d27e3bf Mon Sep 17 00:00:00 2001 From: Claudenir Fonseca Date: Mon, 3 May 2021 14:21:52 +0200 Subject: [PATCH 08/10] WIP: update transform to db feature --- .../vp/controllers/DbMappingController.java | 15 ++--- .../OntoUMLServerAccessController.java | 65 +++++-------------- .../ontouml/vp/model/DbMappingOptions.java | 14 ++-- .../vp/model/DbMappingToDbServiceResult.java | 31 --------- .../inf/ontouml/vp/model/DbmsSupported.java | 3 + .../inf/ontouml/vp/model/MappingStrategy.java | 3 + .../ontouml/vp/model/Ontouml2DbResult.java | 44 +++++++++++++ .../vp/model/Ontouml2DbServiceResult.java | 19 ++++++ src/main/resources/plugin.xml | 8 +-- 9 files changed, 100 insertions(+), 102 deletions(-) delete mode 100644 src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbResult.java create mode 100644 src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbServiceResult.java diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java index 750b02cd..e1a45274 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java @@ -5,7 +5,7 @@ import com.vp.plugin.action.VPActionController; import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.model.DbMappingOptions; -import it.unibz.inf.ontouml.vp.model.DbMappingToDbServiceResult; +import it.unibz.inf.ontouml.vp.model.Ontouml2DbServiceResult; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; import it.unibz.inf.ontouml.vp.model.vp2ontouml.Uml2OntoumlTransformer; import it.unibz.inf.ontouml.vp.utils.SimpleServiceWorker; @@ -60,16 +60,13 @@ private List task(SimpleServiceWorker context) { final String project = Uml2OntoumlTransformer.transformAndSerialize(); final String options = new DbMappingOptions(projectConfigurations).toJson(); - final DbMappingToDbServiceResult result = - OntoUMLServerAccessController.requestMappingToDB(project, options); + final Ontouml2DbServiceResult serviceResult = + OntoUMLServerAccessController.requestModelTransformationToDb(project, options); if (!context.isCancelled()) { - // Files.write(schemaFilePath, "schema".getBytes()); - // Files.write(obdaFilePath, "OBDA".getBytes()); - // Files.write(propertiesFilePath, "properties".getBytes()); - Files.write(schemaFilePath, result.getSchema().getBytes()); - Files.write(obdaFilePath, result.getObda().getBytes()); - Files.write(propertiesFilePath, result.getProperties().getBytes()); + Files.write(schemaFilePath, serviceResult.getResult().getSchema().getBytes()); + Files.write(obdaFilePath, serviceResult.getResult().getObda().getBytes()); + Files.write(propertiesFilePath, serviceResult.getResult().getConnection().getBytes()); saveFilePath(); ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); return List.of(MESSAGE_MODEL_EXPORTED); diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java index 4be9e665..a8fbdda5 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java @@ -2,9 +2,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import it.unibz.inf.ontouml.vp.model.Configurations; -import it.unibz.inf.ontouml.vp.model.DbMappingToDbServiceResult; import it.unibz.inf.ontouml.vp.model.GufoTransformationServiceResult; import it.unibz.inf.ontouml.vp.model.ModularizationServiceResult; +import it.unibz.inf.ontouml.vp.model.Ontouml2DbServiceResult; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; import it.unibz.inf.ontouml.vp.model.ServiceResult; import it.unibz.inf.ontouml.vp.model.VerificationServiceResult; @@ -26,10 +26,11 @@ */ public class OntoUMLServerAccessController { + private static final String MODULARIZATION_SERVICE_ENDPOINT = "/v1/modularize"; private static final String TRANSFORM_GUFO_SERVICE_ENDPOINT = "/v1/transform/gufo"; + private static final String TRANSFORM_DB_SERVICE_ENDPOINT = "/v1/transform/db"; private static final String VERIFICATION_SERVICE_ENDPOINT = "/v1/verify"; - private static final String MODULARIZATION_SERVICE_ENDPOINT = "/v1/modularize"; - private static final String MAPPING_TO_DB_SERVICE_ENDPOINT = "/v1/mapping/db"; + private static final String USER_MESSAGE_BAD_REQUEST = "There was a internal plugin error and the service could not be completed."; private static final String USER_MESSAGE_REQUEST_WITH_SYNTACTICAL_ERRORS = @@ -48,32 +49,27 @@ private static String getServiceRequestBody(String project, String options) { return "{\"options\": " + options + ", \"project\": " + project + "}"; } - private static String getModularizationRequestUrl() { + private static String getServerUrl() { final ProjectConfigurations config = Configurations.getInstance().getProjectConfigurations(); return config.isCustomServerEnabled() - ? config.getServerURL() + MODULARIZATION_SERVICE_ENDPOINT - : ProjectConfigurations.DEFAULT_SERVER_URL + MODULARIZATION_SERVICE_ENDPOINT; + ? config.getServerURL() + : ProjectConfigurations.DEFAULT_SERVER_URL; + } + + private static String getModularizationRequestUrl() { + return getServerUrl() + MODULARIZATION_SERVICE_ENDPOINT; } private static String getVerificationRequestUrl() { - final ProjectConfigurations config = Configurations.getInstance().getProjectConfigurations(); - return config.isCustomServerEnabled() - ? config.getServerURL() + VERIFICATION_SERVICE_ENDPOINT - : ProjectConfigurations.DEFAULT_SERVER_URL + VERIFICATION_SERVICE_ENDPOINT; + return getServerUrl() + VERIFICATION_SERVICE_ENDPOINT; } private static String getTransformationToGufoRequestUrl() { - final ProjectConfigurations config = Configurations.getInstance().getProjectConfigurations(); - return config.isCustomServerEnabled() - ? config.getServerURL() + TRANSFORM_GUFO_SERVICE_ENDPOINT - : ProjectConfigurations.DEFAULT_SERVER_URL + TRANSFORM_GUFO_SERVICE_ENDPOINT; + return getServerUrl() + TRANSFORM_GUFO_SERVICE_ENDPOINT; } private static String getMappingToErRequestUrl() { - final ProjectConfigurations config = Configurations.getInstance().getProjectConfigurations(); - return config.isCustomServerEnabled() - ? config.getServerURL() + MAPPING_TO_DB_SERVICE_ENDPOINT - : ProjectConfigurations.DEFAULT_SERVER_URL + MAPPING_TO_DB_SERVICE_ENDPOINT; + return getServerUrl() + TRANSFORM_DB_SERVICE_ENDPOINT; } private static > T parseResponse( @@ -123,13 +119,13 @@ public static GufoTransformationServiceResult requestModelTransformationToGufo( return parseResponse(connection, GufoTransformationServiceResult.class); } - public static DbMappingToDbServiceResult requestMappingToDB(String project, String options) - throws IOException { + public static Ontouml2DbServiceResult requestModelTransformationToDb( + String project, String options) throws IOException { final String url = getMappingToErRequestUrl(); final String body = getServiceRequestBody(project, options); final HttpURLConnection connection = request(url, body); - return parseResponse(connection, DbMappingToDbServiceResult.class); + return parseResponse(connection, Ontouml2DbServiceResult.class); } private static HttpURLConnection request(String url, String body) throws IOException { @@ -162,33 +158,6 @@ private static HttpURLConnection request(String url, String body) throws IOExcep } } - // public static GufoTransformationServiceResult requestProjectTransformationToGufo( - // String project, String options) { - // final String body = getServiceRequestBody(project, options); - // final String url = getTransformationToGufoRequestUrl(); - // - // try { - // final HttpURLConnection connection = performRequest(url, body); - // - // switch (connection.getResponseCode()) { - // case HttpURLConnection.HTTP_OK: - // if (hasJsonContentType(connection)) { - // return parseResponse(connection, GufoTransformationServiceResult.class); - // } - // case HttpURLConnection.HTTP_BAD_REQUEST: - // case HttpURLConnection.HTTP_NOT_FOUND: - // case HttpURLConnection.HTTP_INTERNAL_ERROR: - // default: - // System.err.println("Attention! Transformation request was not processed correctly"); - // System.err.println("Status Code: " + connection.getResponseCode()); - // } - // } catch (IOException ioException) { - // ioException.printStackTrace(); - // } - // - // return null; - // } - private static HttpURLConnection performRequest(String urlString, String body) throws IOException { final URL url = new URL(urlString); diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java index 5da8c8e5..572534a4 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingOptions.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; public class DbMappingOptions { @@ -34,15 +33,10 @@ public DbMappingOptions(ProjectConfigurations projectConfigurations) { this.databaseName = projectConfigurations.getDatabaseNameConnection(); this.userConnection = projectConfigurations.getUserNameConnection(); this.passwordConnection = projectConfigurations.getPassword(); - this.enumFieldToLookupTable = projectConfigurations.isEnumFieldToLookupTable(); - - ObjectMapper mapper = new ObjectMapper(); - try { - customElementMapping = mapper.readTree(projectConfigurations.getExportGUFOElementMapping()); - } catch (IOException e) { - System.err.println("Unable to read project configurations."); - e.printStackTrace(); - } + // this.enumFieldToLookupTable = projectConfigurations.isEnumFieldToLookupTable(); + this.enumFieldToLookupTable = true; + + // TODO: re-introduce element mapping when partial export is available again } public MappingStrategy getMappingStrategy() { diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java deleted file mode 100644 index a0bccc69..00000000 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/DbMappingToDbServiceResult.java +++ /dev/null @@ -1,31 +0,0 @@ -package it.unibz.inf.ontouml.vp.model; - -import java.util.List; - -public class DbMappingToDbServiceResult extends ServiceResult { - - public DbMappingToDbServiceResult(String result, List issues) { - super(result, issues); - } - - public DbMappingToDbServiceResult() { - super(); - } - - public String getSchema() { - return "schema"; - } - - public String getObda() { - return "obda"; - } - - public String getProperties() { - return "properties"; - } - - @Override - public String getMessage() { - return "The mapping to database was concluded"; - } -} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/DbmsSupported.java b/src/main/java/it/unibz/inf/ontouml/vp/model/DbmsSupported.java index 4fb6efac..ea4874b4 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/DbmsSupported.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/DbmsSupported.java @@ -1,5 +1,7 @@ package it.unibz.inf.ontouml.vp.model; +import com.fasterxml.jackson.annotation.JsonValue; + public enum DbmsSupported { GENERIC_SCHEMA("Generic Schema"), MYSQL("MySql"), @@ -14,6 +16,7 @@ private DbmsSupported(String s) { display = s; } + @JsonValue @Override public String toString() { return display; diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java b/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java index 43b16098..895f327c 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/MappingStrategy.java @@ -1,6 +1,8 @@ /** Author: Gustavo Ludovico Guidoni */ package it.unibz.inf.ontouml.vp.model; +import com.fasterxml.jackson.annotation.JsonValue; + public enum MappingStrategy { ONE_TABLE_PER_CLASS("One Table per Class"), ONE_TABLE_PER_KIND("One Table per Kind"), @@ -12,6 +14,7 @@ private MappingStrategy(String s) { display = s; } + @JsonValue @Override public String toString() { return display; diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbResult.java b/src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbResult.java new file mode 100644 index 00000000..541098b0 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbResult.java @@ -0,0 +1,44 @@ +package it.unibz.inf.ontouml.vp.model; + +public class Ontouml2DbResult { + + private String schema; + private String obda; + private String connection; + + Ontouml2DbResult() { + this.schema = null; + this.obda = null; + this.connection = null; + } + + Ontouml2DbResult(String schema, String odba, String connection) { + this.schema = schema; + this.obda = odba; + this.connection = connection; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getObda() { + return obda; + } + + public void setObda(String obda) { + this.obda = obda; + } + + public String getConnection() { + return connection; + } + + public void setConnection(String connection) { + this.connection = connection; + } +} diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbServiceResult.java b/src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbServiceResult.java new file mode 100644 index 00000000..87933907 --- /dev/null +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/Ontouml2DbServiceResult.java @@ -0,0 +1,19 @@ +package it.unibz.inf.ontouml.vp.model; + +import java.util.List; + +public class Ontouml2DbServiceResult extends ServiceResult { + + public Ontouml2DbServiceResult(Ontouml2DbResult result, List issues) { + super(result, issues); + } + + public Ontouml2DbServiceResult() { + super(); + } + + @Override + public String getMessage() { + return "The mapping to database was concluded"; + } +} diff --git a/src/main/resources/plugin.xml b/src/main/resources/plugin.xml index 9d653e98..a3a8ffff 100644 --- a/src/main/resources/plugin.xml +++ b/src/main/resources/plugin.xml @@ -128,11 +128,11 @@ @@ -188,6 +188,7 @@ - --> From df14da2acda6db4a780e4ce812a3e40b6bfb466f Mon Sep 17 00:00:00 2001 From: Gustavo L Guidoni Date: Thu, 20 May 2021 13:58:35 -0300 Subject: [PATCH 09/10] Correction of the communication with the ontouml2db transformation. --- .../vp/controllers/DbMappingController.java | 38 +- .../controllers/DbMappingDialogHandler.java | 8 +- .../OntoUMLServerAccessController.java | 17 +- .../vp/model/ProjectConfigurations.java | 62 +- .../inf/ontouml/vp/views/DbMappingView.java | 702 ++++++------------ 5 files changed, 344 insertions(+), 483 deletions(-) diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java index e1a45274..5a70b1fe 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java @@ -45,18 +45,18 @@ public void performAction(VPAction action) { ViewManagerUtils.log("Request cancelled by the user."); return; } - putFilePath(); - new SimpleServiceWorker(this::task).execute(); } private List task(SimpleServiceWorker context) { - try { + try { if (schemaFilePath == null) { context.cancel(true); return List.of(); } + + saveFilePath(); final String project = Uml2OntoumlTransformer.transformAndSerialize(); final String options = new DbMappingOptions(projectConfigurations).toJson(); @@ -64,12 +64,17 @@ private List task(SimpleServiceWorker context) { OntoUMLServerAccessController.requestModelTransformationToDb(project, options); if (!context.isCancelled()) { - Files.write(schemaFilePath, serviceResult.getResult().getSchema().getBytes()); - Files.write(obdaFilePath, serviceResult.getResult().getObda().getBytes()); - Files.write(propertiesFilePath, serviceResult.getResult().getConnection().getBytes()); - saveFilePath(); - ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); - return List.of(MESSAGE_MODEL_EXPORTED); + if(projectConfigurations.isGenerateSchema()) { + Files.write(schemaFilePath, serviceResult.getResult().getSchema().getBytes()); + } + if(projectConfigurations.isGenerateObda()) { + Files.write(obdaFilePath, serviceResult.getResult().getObda().getBytes()); + } + if(projectConfigurations.isGenerateConnection()) { + Files.write(propertiesFilePath, serviceResult.getResult().getConnection().getBytes()); + } + ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); + return List.of(MESSAGE_MODEL_EXPORTED); } return List.of(); @@ -83,7 +88,7 @@ private List task(SimpleServiceWorker context) { } } - private void putFilePath() { + private boolean putFilePath() { final FileDialog fileDialog; final Frame rootFrame = (Frame) ApplicationManager.instance().getViewManager().getRootFrame(); final String suggestedFolderPath = projectConfigurations.getDbMappingFolderPath(); @@ -102,19 +107,22 @@ private void putFilePath() { fileDialog.setVisible(true); final String fileDirectory = fileDialog.getDirectory(); - final String fileName = fileDialog.getFile(); + final String fileName = removeFileExtension(fileDialog.getFile()); if (fileDirectory != null && fileName != null) { schemaFilePath = Paths.get(fileDirectory, fileName + schemaFormat); obdaFilePath = Paths.get(fileDirectory, fileName + obdaFormat); propertiesFilePath = Paths.get(fileDirectory, fileName + propertiesFormat); + return true; + }else { + return false; } } private void saveFilePath() { final Path directoryPath = schemaFilePath.getParent(); final String directoryPathName = directoryPath.toAbsolutePath().getFileName().toString(); - final String filePathName = schemaFilePath.getFileName().toString(); + final String filePathName = removeFileExtension(schemaFilePath.getFileName().toString()); projectConfigurations.setDbMappingFolderPath(directoryPathName); projectConfigurations.setDbMappingFileName(filePathName); @@ -129,4 +137,10 @@ private void saveFilePath() { */ @Override public void update(VPAction action) {} + + private String removeFileExtension(String fileName) { + if(fileName.lastIndexOf('.') > 0) + return fileName.substring(0, fileName.lastIndexOf('.')); + else return fileName; + } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java index e0bda4d0..0c044173 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java @@ -25,9 +25,11 @@ public DbMappingDialogHandler(ProjectConfigurations projectConfigurations) { view.onExport( e -> { - view.updateConfigurationsValues(projectConfigurations); - Configurations.getInstance().save(); - closeDialog(); + if(view.checkValidParamters()){ + view.updateConfigurationsValues(projectConfigurations); + Configurations.getInstance().save(); + closeDialog(); + } }); view.onCancel( e -> { diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java index a8fbdda5..597e56d2 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java @@ -11,12 +11,20 @@ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; +import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.HttpURLConnection; +import java.net.Socket; import java.net.SocketException; import java.net.URL; import java.util.stream.Collectors; + +import com.mashape.unirest.http.*; +import com.mashape.unirest.http.exceptions.UnirestException; + +import java.io.*; + /** * Class responsible for making requests to the OntoUML Server based on standard end points and * configured server URL. @@ -130,6 +138,8 @@ public static Ontouml2DbServiceResult requestModelTransformationToDb( private static HttpURLConnection request(String url, String body) throws IOException { try { + System.out.println(body); + final HttpURLConnection connection = performRequest(url, body); switch (connection.getResponseCode()) { @@ -137,7 +147,7 @@ private static HttpURLConnection request(String url, String body) throws IOExcep return connection; case HttpURLConnection.HTTP_BAD_REQUEST: if (!url.contains("verify")) { - // failed because the project contains syntactical errors + // failed because the project contains syntactical errors throw new IOException(USER_MESSAGE_REQUEST_WITH_SYNTACTICAL_ERRORS); } else { throw new IOException(USER_MESSAGE_BAD_REQUEST); @@ -150,6 +160,7 @@ private static HttpURLConnection request(String url, String body) throws IOExcep throw new IOException(USER_MESSAGE_UNKNOWN_ERROR_RESPONSE); } } catch (SocketException e) { + throw new IOException(USER_MESSAGE_CONNECTION_ERROR); } catch (IOException e) { throw e; @@ -159,8 +170,10 @@ private static HttpURLConnection request(String url, String body) throws IOExcep } private static HttpURLConnection performRequest(String urlString, String body) - throws IOException { + throws IOException, UnirestException { + final URL url = new URL(urlString); + final HttpURLConnection request = (HttpURLConnection) url.openConnection(); request.setRequestMethod("POST"); diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java index 899317f7..12442e89 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java @@ -25,15 +25,19 @@ public class ProjectConfigurations { public static final String DEFAULT_EXPORT_FILENAME = ""; public static final String DEFAULT_GUFO_EXPORT_PATH = System.getProperty("user.home"); public static final String DEFAULT_GUFO_EXPORT_FILENAME = ""; + //***** DAFAULTS por Export to DB *************** public static final DbmsSupported DEFAULT_DBMS = DbmsSupported.GENERIC_SCHEMA; public static final MappingStrategy DEFAULT_MAPPING_STRATEGY = MappingStrategy.ONE_TABLE_PER_KIND; public static final boolean DEFAULT_STANTDARDIZE_NAMES = true; + public static final boolean DEFAULT_GENERATE_INDEXES = false; public static final boolean DEFAULT_GENERATE_SCHEMA = true; + public static final boolean DEFAULT_GENERATE_OBDA = true; public static final boolean DEFAULT_GENERATE_CONNECTION = false; public static final String DEFAULT_DB_MAPPING_PATH = System.getProperty("user.home"); public static final String DEFAULT_DB_MAPPING_FILE_NAME = ""; public static final boolean DEFAULT_IS_ENUMARATION_TO_LOOKUP_TABLE = false; - +//*********************************************** + @SerializedName("projectId") @Expose() private String id; @@ -143,6 +147,10 @@ public class ProjectConfigurations { @Expose() private boolean generateSchema; + @SerializedName("generateObda") + @Expose() + private boolean generateObda; + @SerializedName("generateConnection") @Expose() private boolean generateConnection; @@ -174,6 +182,12 @@ public class ProjectConfigurations { @SerializedName("enumFieldToLookupTable") @Expose() private boolean enumFieldToLookupTable; + + @SerializedName("generateIndexes") + @Expose() + private boolean generateIndexes; + + /** Constructor without args to be called when deserializing project settings. */ public ProjectConfigurations() { @@ -216,7 +230,9 @@ public void setDefaultValues() { this.targetDBMS = ProjectConfigurations.DEFAULT_DBMS; this.mappingStrategy = ProjectConfigurations.DEFAULT_MAPPING_STRATEGY; this.standardizeNames = ProjectConfigurations.DEFAULT_STANTDARDIZE_NAMES; + this.generateIndexes = ProjectConfigurations.DEFAULT_GENERATE_INDEXES; this.generateSchema = ProjectConfigurations.DEFAULT_GENERATE_SCHEMA; + this.generateObda = ProjectConfigurations.DEFAULT_GENERATE_OBDA; this.generateConnection = ProjectConfigurations.DEFAULT_GENERATE_CONNECTION; this.dbMappingFileName = ProjectConfigurations.DEFAULT_DB_MAPPING_FILE_NAME; this.dbMappingFolderPath = ProjectConfigurations.DEFAULT_DB_MAPPING_PATH; @@ -553,7 +569,7 @@ public void setTargetDBMS(DbmsSupported targetDBMS) { * @return boolean */ public boolean isGenerateSchema() { - return generateSchema; + return this.generateSchema; } /** @@ -565,6 +581,24 @@ public void setGenerateSchema(boolean generateSchema) { this.generateSchema = generateSchema; } + /** + * Returns if it is necessary to generate the OBDA file for the ontology. + * + * @return boolean + */ + public boolean isGenerateObda() { + return this.generateObda; + } + + /** + * Informs if it is necessary to generate the OBDA file for the ontology. + * + * @param generateSchema + */ + public void setGenerateObda(boolean generateObda) { + this.generateObda = generateObda; + } + /** * Returns if it is necessary to generate the connection for the database. * @@ -693,7 +727,7 @@ public void setDbMappingFolderPath(String dbMappingFolderPath) { } /** - * Returns if it is necessary to generate a table for the enumeration type fields. + * Returns if it is necessary generate a table for the enumeration type fields. * * @return boolean */ @@ -702,11 +736,31 @@ public boolean isEnumFieldToLookupTable() { } /** - * Informs if it is necessary to generate a table for the enumeration type fields. + * Informs if it is necessary generate a table for the enumeration type fields. * * @param boolean */ public void setEnumFieldToLookupTable(boolean isEnumFieldToLookupTable) { this.enumFieldToLookupTable = isEnumFieldToLookupTable; } + + + /** + * Returns if it is necessary generate the index for the schema. + * + * @return boolean + */ + public boolean isGenerateIndex() { + return this.generateIndexes; + } + + /** + * Informs if it is necessary generate the indexes for the schema. + * + * @param boolean + */ + public void setGenerateIndexes(boolean generateIndexes) { + this.generateIndexes = generateIndexes; + } + } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java index bafe645c..5f770544 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java @@ -1,32 +1,24 @@ package it.unibz.inf.ontouml.vp.views; -import com.vp.plugin.diagram.IDiagramUIModel; -import com.vp.plugin.model.IModelElement; import it.unibz.inf.ontouml.vp.model.DbmsSupported; import it.unibz.inf.ontouml.vp.model.MappingStrategy; import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; import java.awt.Dimension; -import java.awt.GridLayout; import java.awt.event.ActionListener; -import java.util.HashSet; import javax.swing.DefaultComboBoxModel; -import javax.swing.JScrollPane; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreePath; +import javax.swing.JOptionPane; public class DbMappingView extends javax.swing.JPanel { private static final long serialVersionUID = 1L; - private HashSet elementsDiagramTree = new HashSet<>(); - - // private IDialog parentContainer; - - private JCheckBoxTree diagramTree; private javax.swing.JComboBox cbxDBMS; private javax.swing.JCheckBox cbxStandarizeNames; + private javax.swing.JCheckBox cxbCreateIndex; private javax.swing.JCheckBox cxbEnumToLookupTable; - private javax.swing.JPanel diagramPanel; + private javax.swing.JCheckBox cxbGenerateConnection; + private javax.swing.JCheckBox cxbGenerateObda; + private javax.swing.JCheckBox cxbGenerateSchema; private javax.swing.ButtonGroup groupStrategy; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; @@ -37,16 +29,12 @@ public class DbMappingView extends javax.swing.JPanel { private javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JButton jbtnCancel; private javax.swing.JButton jbtnOk; - private javax.swing.JCheckBox jcbGenerateConnection; - private javax.swing.JCheckBox jcbGenerateObda; - private javax.swing.JCheckBox jcbGenerateSchema; private javax.swing.JTextField jtfBaseIRI; private javax.swing.JTextField jtfDatabase; private javax.swing.JTextField jtfHost; @@ -59,7 +47,7 @@ public class DbMappingView extends javax.swing.JPanel { public DbMappingView(ProjectConfigurations configurations) { initComponents(); - updateComponentsValues(configurations); + setComponentsValues(configurations); } private void initComponents() { @@ -69,27 +57,15 @@ private void initComponents() { // ************************************* setSize(new Dimension(500, 360)); - diagramPanel = new javax.swing.JPanel(); - diagramTree = new JCheckBoxTree("diagram"); - - JScrollPane scrollableTextAreaDiagram = new JScrollPane(diagramTree); - scrollableTextAreaDiagram.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); - scrollableTextAreaDiagram.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); - - diagramPanel.add(scrollableTextAreaDiagram); - - diagramPanel.setLayout(new GridLayout(1, 1)); - diagramPanel.setPreferredSize(new Dimension(100, 100)); - + // ************************************* // Automatically generated code. // ************************************* groupStrategy = new javax.swing.ButtonGroup(); - jPanel3 = new javax.swing.JPanel(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel2 = new javax.swing.JPanel(); - jcbGenerateSchema = new javax.swing.JCheckBox(); + cxbGenerateSchema = new javax.swing.JCheckBox(); jPanel1 = new javax.swing.JPanel(); rbtOneTablePerClass = new javax.swing.JRadioButton(); rbtOneTablePerConcreteClass = new javax.swing.JRadioButton(); @@ -99,10 +75,11 @@ private void initComponents() { cbxStandarizeNames = new javax.swing.JCheckBox(); jLabel1 = new javax.swing.JLabel(); cxbEnumToLookupTable = new javax.swing.JCheckBox(); + cxbCreateIndex = new javax.swing.JCheckBox(); jPanel6 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jtfBaseIRI = new javax.swing.JTextField(); - jcbGenerateObda = new javax.swing.JCheckBox(); + cxbGenerateObda = new javax.swing.JCheckBox(); jPanel5 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); @@ -112,41 +89,14 @@ private void initComponents() { jtfUser = new javax.swing.JTextField(); jtfDatabase = new javax.swing.JTextField(); jtfPassword = new javax.swing.JTextField(); - jcbGenerateConnection = new javax.swing.JCheckBox(); + cxbGenerateConnection = new javax.swing.JCheckBox(); jPanel4 = new javax.swing.JPanel(); jbtnCancel = new javax.swing.JButton(); jbtnOk = new javax.swing.JButton(); - jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Diagram to be mapped: ")); - - diagramPanel.setBackground(new java.awt.Color(255, 255, 255)); - diagramPanel.setBorder(javax.swing.BorderFactory.createEtchedBorder()); - diagramPanel.setName(""); // NOI18N - - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - diagramPanel, - javax.swing.GroupLayout.Alignment.TRAILING, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)); - jPanel3Layout.setVerticalGroup( - jPanel3Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - diagramPanel, - javax.swing.GroupLayout.Alignment.TRAILING, - javax.swing.GroupLayout.DEFAULT_SIZE, - 144, - Short.MAX_VALUE)); - - jcbGenerateSchema.setSelected(true); - jcbGenerateSchema.setText("Generate relational schema"); - jcbGenerateSchema.setActionCommand("Generate database script"); + cxbGenerateSchema.setSelected(true); + cxbGenerateSchema.setText("Generate relational schema"); + cxbGenerateSchema.setActionCommand("Generate database script"); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Mapping Strategy: ")); @@ -159,44 +109,35 @@ private void initComponents() { groupStrategy.add(rbtOneTablePerKind); rbtOneTablePerKind.setSelected(true); rbtOneTablePerKind.setText("One Table per Kind"); + rbtOneTablePerKind.addItemListener(new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { + rbtOneTablePerKindItemStateChanged(evt); + } + }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel1Layout - .createSequentialGroup() - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rbtOneTablePerKind) - .addComponent(rbtOneTablePerConcreteClass) - .addComponent(rbtOneTablePerClass)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerClass) + .addComponent(rbtOneTablePerConcreteClass) + .addComponent(rbtOneTablePerKind)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); jPanel1Layout.setVerticalGroup( - jPanel1Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel1Layout - .createSequentialGroup() - .addContainerGap() - .addComponent( - rbtOneTablePerClass, - javax.swing.GroupLayout.PREFERRED_SIZE, - 23, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent( - rbtOneTablePerConcreteClass, - javax.swing.GroupLayout.PREFERRED_SIZE, - 23, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(rbtOneTablePerKind) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addComponent(rbtOneTablePerClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(rbtOneTablePerConcreteClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(rbtOneTablePerKind) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); jLabel3.setText("DBMS"); @@ -207,91 +148,60 @@ private void initComponents() { jLabel1.setText("eg.: 'BirthDate' to 'birth_date'"); + cxbEnumToLookupTable.setSelected(true); cxbEnumToLookupTable.setText("Enumeration field to lookup table"); - cxbEnumToLookupTable.setActionCommand("Enumeration field to lookup table"); + + cxbCreateIndex.setSelected(false); + cxbCreateIndex.setText("Create indexes"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - jPanel1, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jcbGenerateSchema)) - .addGap(18, 18, 18) - .addGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(jLabel3) - .addComponent( - cbxDBMS, - javax.swing.GroupLayout.PREFERRED_SIZE, - 158, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addGap(21, 21, 21) - .addComponent(jLabel1)) - .addComponent( - cxbEnumToLookupTable, - javax.swing.GroupLayout.DEFAULT_SIZE, - 184, - Short.MAX_VALUE) - .addComponent( - cbxStandarizeNames, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cxbGenerateSchema)) + .addGap(18, 18, 18) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(cbxDBMS, 0, 158, Short.MAX_VALUE) + .addGap(26, 26, 26)) + .addComponent(cxbEnumToLookupTable, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) + .addComponent(cbxStandarizeNames, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cxbCreateIndex, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addGroup(jPanel2Layout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1))) + .addGap(0, 0, Short.MAX_VALUE))) + .addGap(18, 18, 18)) + ); jPanel2Layout.setVerticalGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateSchema) + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addComponent(cxbGenerateSchema) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cxbEnumToLookupTable) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup( - jPanel2Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel2Layout - .createSequentialGroup() - .addComponent(jLabel3) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - cbxDBMS, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cxbEnumToLookupTable) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cbxStandarizeNames) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1) - .addGap(0, 8, Short.MAX_VALUE)) - .addComponent( - jPanel1, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)))); + .addComponent(cbxStandarizeNames) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 5, Short.MAX_VALUE) + .addComponent(cxbCreateIndex) + .addContainerGap()) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + ); jTabbedPane1.addTab("Relational Schema", jPanel2); @@ -299,58 +209,36 @@ private void initComponents() { jtfBaseIRI.setText("http://example.com"); - jcbGenerateObda.setSelected(true); - jcbGenerateObda.setText("Generate OBDA file"); + cxbGenerateObda.setSelected(true); + cxbGenerateObda.setText("Generate OBDA file"); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( - jPanel6Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel6Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel6Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel6Layout - .createSequentialGroup() - .addComponent(jcbGenerateObda) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup( - jPanel6Layout - .createSequentialGroup() - .addComponent(jLabel2) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent( - jtfBaseIRI, - javax.swing.GroupLayout.DEFAULT_SIZE, - 336, - Short.MAX_VALUE))) - .addContainerGap())); + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel6Layout.createSequentialGroup() + .addComponent(cxbGenerateObda) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel6Layout.createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfBaseIRI, javax.swing.GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE))) + .addContainerGap()) + ); jPanel6Layout.setVerticalGroup( - jPanel6Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - jPanel6Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateObda) - .addGap(18, 18, 18) - .addGroup( - jPanel6Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent( - jtfBaseIRI, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(91, Short.MAX_VALUE))); + jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() + .addContainerGap() + .addComponent(cxbGenerateObda) + .addGap(18, 18, 18) + .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent(jtfBaseIRI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(118, Short.MAX_VALUE)) + ); jTabbedPane1.addTab("OBDA", jPanel6); @@ -363,106 +251,60 @@ private void initComponents() { jLabel7.setText("Passoword :"); - jcbGenerateConnection.setSelected(true); - jcbGenerateConnection.setText("Generate the connection"); + cxbGenerateConnection.setSelected(true); + cxbGenerateConnection.setText("Generate the connection"); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addGroup( - jPanel5Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel7) - .addComponent(jLabel6)) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jtfUser) - .addComponent(jtfPassword))) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addComponent(jLabel4) - .addGap(34, 34, 34) - .addComponent(jtfHost)) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addComponent(jcbGenerateConnection) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addComponent(jLabel5) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jtfDatabase))) - .addContainerGap())); - jPanel5Layout.setVerticalGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel5Layout - .createSequentialGroup() - .addContainerGap() - .addComponent(jcbGenerateConnection) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel4) - .addComponent( - jtfHost, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel5) - .addComponent( - jtfDatabase, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel6)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel6) - .addComponent( - jtfUser, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup( - jPanel5Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel7) - .addComponent( - jtfPassword, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jtfUser) + .addComponent(jtfPassword))) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel4) + .addGap(34, 34, 34) + .addComponent(jtfHost)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(cxbGenerateConnection) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel5Layout.createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfDatabase))) + .addContainerGap()) + ); + jPanel5Layout.setVerticalGroup( + jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel5Layout.createSequentialGroup() + .addContainerGap() + .addComponent(cxbGenerateConnection) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent(jtfHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent(jtfDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent(jtfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent(jtfPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); jTabbedPane1.addTab("Conection", jPanel5); @@ -481,142 +323,93 @@ private void initComponents() { javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - jPanel4Layout - .createSequentialGroup() - .addGap(36, 36, 36) - .addComponent( - jbtnOk, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(54, 54, 54) - .addComponent( - jbtnCancel, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(jbtnOk, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(61, 61, 61) + .addComponent(jbtnCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(57, 57, 57)) + ); jPanel4Layout.setVerticalGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - jPanel4Layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - jPanel4Layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent( - jbtnCancel, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( - jbtnOk, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel4Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jbtnOk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - layout - .createSequentialGroup() - .addContainerGap() - .addGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent( - jPanel3, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE) - .addComponent(jTabbedPane1) - .addComponent( - jPanel4, - javax.swing.GroupLayout.Alignment.TRAILING, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)) - .addContainerGap())); + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTabbedPane1) + .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + ); layout.setVerticalGroup( - layout - .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - layout - .createSequentialGroup() - .addContainerGap() - .addComponent( - jPanel3, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jTabbedPane1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent( - jPanel4, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap())); + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addContainerGap() + .addComponent(jTabbedPane1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap()) + ); } + + private void rbtOneTablePerKindItemStateChanged(java.awt.event.ItemEvent evt) { + if(rbtOneTablePerKind.isSelected()) { + cxbCreateIndex.setEnabled(true); + cxbCreateIndex.setSelected(true); + }else { + cxbCreateIndex.setSelected(false); + cxbCreateIndex.setEnabled(false); + } + } + /** * Updates components with project configurations' information. * * @param configurations */ - private void updateComponentsValues(ProjectConfigurations configurations) { - - if (configurations.getExportGUFOElementsDiagramTree() != null) - diagramTree.setNodesCheck(configurations.getExportGUFOElementsDiagramTree()); - - if (configurations.getMappingStrategy() != null) { - if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) - rbtOneTablePerClass.setSelected(true); - else if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS) - rbtOneTablePerConcreteClass.setSelected(true); - else rbtOneTablePerKind.setSelected(true); - } - - if (configurations.getTargetDBMS() != null) - cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); - + private void setComponentsValues(ProjectConfigurations configurations) { + cxbGenerateSchema.setSelected(configurations.isGenerateSchema()); + cxbGenerateObda.setSelected(configurations.isGenerateObda()); + cxbGenerateConnection.setSelected(configurations.isGenerateConnection()); + + if (configurations.getMappingStrategy() != null) { + if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) + rbtOneTablePerClass.setSelected(true); + else if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS) + rbtOneTablePerConcreteClass.setSelected(true); + else rbtOneTablePerKind.setSelected(true); + } + + cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); - - jcbGenerateSchema.setSelected(configurations.isGenerateSchema()); - - jcbGenerateConnection.setSelected(configurations.isGenerateConnection()); - + jtfBaseIRI.setText(configurations.getExportGUFOIRI()); + cxbCreateIndex.setSelected(configurations.isGenerateIndex()); jtfHost.setText(configurations.getHostNameConnection()); - jtfDatabase.setText(configurations.getDatabaseNameConnection()); - jtfUser.setText(configurations.getUserNameConnection()); - jtfPassword.setText(configurations.getPassword()); - - if (configurations.getExportGUFOIRI() != null && !configurations.getExportGUFOIRI().equals("")) - jtfBaseIRI.setText(configurations.getExportGUFOIRI()); + cxbEnumToLookupTable.setSelected(configurations.isEnumFieldToLookupTable()); } /** Updates project configurations with components' information. */ + public void updateConfigurationsValues(ProjectConfigurations configurations) { - saveSelectedElements(); - - configurations.setExportGUFOElementsDiagramTree(elementsDiagramTree); - - configurations.setGenerateSchema(jcbGenerateSchema.isSelected()); - + configurations.setGenerateSchema(cxbGenerateSchema.isSelected()); + configurations.setGenerateObda(cxbGenerateObda.isSelected()); + configurations.setGenerateConnection(cxbGenerateConnection.isSelected()); + if (rbtOneTablePerClass.isSelected()) configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); else if (rbtOneTablePerConcreteClass.isSelected()) @@ -624,43 +417,14 @@ else if (rbtOneTablePerConcreteClass.isSelected()) else configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_KIND); configurations.setTargetDBMS((DbmsSupported) cbxDBMS.getSelectedItem()); - configurations.setStandardizeNames(cbxStandarizeNames.isSelected()); - configurations.setExportGUFOIRI(jtfBaseIRI.getText().trim()); - - configurations.setGenerateConnection(jcbGenerateConnection.isSelected()); - + configurations.setGenerateIndexes(cxbCreateIndex.isSelected()); configurations.setHostNameConnection(jtfHost.getText().trim()); - configurations.setDatabaseNameConnection(jtfDatabase.getText().trim()); - configurations.setUserNameConnection(jtfUser.getText().trim()); - configurations.setPassword(jtfPassword.getText().trim()); - } - - private void saveSelectedElements() { - TreePath[] paths; - - paths = diagramTree.getCheckedPaths(); - - for (TreePath path : paths) { - Object[] object = path.getPath(); - for (Object o : object) { - - if (o instanceof DefaultMutableTreeNode) { - - DefaultMutableTreeNode node = (DefaultMutableTreeNode) o; - - if (node.getUserObject() instanceof IModelElement) - this.elementsDiagramTree.add(((IModelElement) node.getUserObject()).getId()); - - if (node.getUserObject() instanceof IDiagramUIModel) - this.elementsDiagramTree.add(((IDiagramUIModel) node.getUserObject()).getId()); - } - } - } + configurations.setEnumFieldToLookupTable(cxbEnumToLookupTable.isSelected()); } public void onExport(ActionListener onExportAction) { @@ -682,4 +446,18 @@ public void onCancel(ActionListener onCancelAction) { jbtnCancel.addActionListener(onCancelAction); } + + public boolean checkValidParamters() { + if( (DbmsSupported) cbxDBMS.getSelectedItem() == DbmsSupported.GENERIC_SCHEMA && !cxbEnumToLookupTable.isSelected()) { + JOptionPane.showMessageDialog(this, "You can not create an enumeration field to a generic database.", "Error", JOptionPane.ERROR_MESSAGE); + return false; + } + + if(!cxbGenerateSchema.isSelected() && !cxbGenerateObda.isSelected() && !cxbGenerateConnection.isSelected()) { + JOptionPane.showMessageDialog(this, "You must select at least one file to be generated (schema, OBDA or connection).", "Error", JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } } From e394639d7f5c4bb485cd9193ccee1f3f8c43320f Mon Sep 17 00:00:00 2001 From: github-actions <> Date: Thu, 20 May 2021 17:02:13 +0000 Subject: [PATCH 10/10] Google Java Format --- .../vp/controllers/DbMappingController.java | 37 +- .../controllers/DbMappingDialogHandler.java | 10 +- .../OntoUMLServerAccessController.java | 23 +- .../vp/model/ProjectConfigurations.java | 18 +- .../inf/ontouml/vp/views/DbMappingView.java | 589 ++++++++++++------ 5 files changed, 424 insertions(+), 253 deletions(-) diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java index 5a70b1fe..5d64fbb8 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingController.java @@ -50,12 +50,12 @@ public void performAction(VPAction action) { } private List task(SimpleServiceWorker context) { - try { + try { if (schemaFilePath == null) { context.cancel(true); return List.of(); } - + saveFilePath(); final String project = Uml2OntoumlTransformer.transformAndSerialize(); @@ -64,17 +64,17 @@ private List task(SimpleServiceWorker context) { OntoUMLServerAccessController.requestModelTransformationToDb(project, options); if (!context.isCancelled()) { - if(projectConfigurations.isGenerateSchema()) { - Files.write(schemaFilePath, serviceResult.getResult().getSchema().getBytes()); - } - if(projectConfigurations.isGenerateObda()) { - Files.write(obdaFilePath, serviceResult.getResult().getObda().getBytes()); - } - if(projectConfigurations.isGenerateConnection()) { - Files.write(propertiesFilePath, serviceResult.getResult().getConnection().getBytes()); - } - ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); - return List.of(MESSAGE_MODEL_EXPORTED); + if (projectConfigurations.isGenerateSchema()) { + Files.write(schemaFilePath, serviceResult.getResult().getSchema().getBytes()); + } + if (projectConfigurations.isGenerateObda()) { + Files.write(obdaFilePath, serviceResult.getResult().getObda().getBytes()); + } + if (projectConfigurations.isGenerateConnection()) { + Files.write(propertiesFilePath, serviceResult.getResult().getConnection().getBytes()); + } + ViewManagerUtils.log(MESSAGE_MODEL_EXPORTED); + return List.of(MESSAGE_MODEL_EXPORTED); } return List.of(); @@ -114,8 +114,8 @@ private boolean putFilePath() { obdaFilePath = Paths.get(fileDirectory, fileName + obdaFormat); propertiesFilePath = Paths.get(fileDirectory, fileName + propertiesFormat); return true; - }else { - return false; + } else { + return false; } } @@ -137,10 +137,9 @@ private void saveFilePath() { */ @Override public void update(VPAction action) {} - + private String removeFileExtension(String fileName) { - if(fileName.lastIndexOf('.') > 0) - return fileName.substring(0, fileName.lastIndexOf('.')); - else return fileName; + if (fileName.lastIndexOf('.') > 0) return fileName.substring(0, fileName.lastIndexOf('.')); + else return fileName; } } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java index 0c044173..4888105c 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/DbMappingDialogHandler.java @@ -25,11 +25,11 @@ public DbMappingDialogHandler(ProjectConfigurations projectConfigurations) { view.onExport( e -> { - if(view.checkValidParamters()){ - view.updateConfigurationsValues(projectConfigurations); - Configurations.getInstance().save(); - closeDialog(); - } + if (view.checkValidParamters()) { + view.updateConfigurationsValues(projectConfigurations); + Configurations.getInstance().save(); + closeDialog(); + } }); view.onCancel( e -> { diff --git a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java index 597e56d2..d4ecb20b 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/controllers/OntoUMLServerAccessController.java @@ -1,6 +1,8 @@ package it.unibz.inf.ontouml.vp.controllers; import com.fasterxml.jackson.databind.ObjectMapper; +import com.mashape.unirest.http.*; +import com.mashape.unirest.http.exceptions.UnirestException; import it.unibz.inf.ontouml.vp.model.Configurations; import it.unibz.inf.ontouml.vp.model.GufoTransformationServiceResult; import it.unibz.inf.ontouml.vp.model.ModularizationServiceResult; @@ -8,23 +10,16 @@ import it.unibz.inf.ontouml.vp.model.ProjectConfigurations; import it.unibz.inf.ontouml.vp.model.ServiceResult; import it.unibz.inf.ontouml.vp.model.VerificationServiceResult; +import java.io.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; -import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.HttpURLConnection; -import java.net.Socket; import java.net.SocketException; import java.net.URL; import java.util.stream.Collectors; - -import com.mashape.unirest.http.*; -import com.mashape.unirest.http.exceptions.UnirestException; - -import java.io.*; - /** * Class responsible for making requests to the OntoUML Server based on standard end points and * configured server URL. @@ -138,8 +133,8 @@ public static Ontouml2DbServiceResult requestModelTransformationToDb( private static HttpURLConnection request(String url, String body) throws IOException { try { - System.out.println(body); - + System.out.println(body); + final HttpURLConnection connection = performRequest(url, body); switch (connection.getResponseCode()) { @@ -147,7 +142,7 @@ private static HttpURLConnection request(String url, String body) throws IOExcep return connection; case HttpURLConnection.HTTP_BAD_REQUEST: if (!url.contains("verify")) { - // failed because the project contains syntactical errors + // failed because the project contains syntactical errors throw new IOException(USER_MESSAGE_REQUEST_WITH_SYNTACTICAL_ERRORS); } else { throw new IOException(USER_MESSAGE_BAD_REQUEST); @@ -160,7 +155,7 @@ private static HttpURLConnection request(String url, String body) throws IOExcep throw new IOException(USER_MESSAGE_UNKNOWN_ERROR_RESPONSE); } } catch (SocketException e) { - + throw new IOException(USER_MESSAGE_CONNECTION_ERROR); } catch (IOException e) { throw e; @@ -171,9 +166,9 @@ private static HttpURLConnection request(String url, String body) throws IOExcep private static HttpURLConnection performRequest(String urlString, String body) throws IOException, UnirestException { - + final URL url = new URL(urlString); - + final HttpURLConnection request = (HttpURLConnection) url.openConnection(); request.setRequestMethod("POST"); diff --git a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java index 12442e89..82382c19 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/model/ProjectConfigurations.java @@ -25,7 +25,7 @@ public class ProjectConfigurations { public static final String DEFAULT_EXPORT_FILENAME = ""; public static final String DEFAULT_GUFO_EXPORT_PATH = System.getProperty("user.home"); public static final String DEFAULT_GUFO_EXPORT_FILENAME = ""; - //***** DAFAULTS por Export to DB *************** + // ***** DAFAULTS por Export to DB *************** public static final DbmsSupported DEFAULT_DBMS = DbmsSupported.GENERIC_SCHEMA; public static final MappingStrategy DEFAULT_MAPPING_STRATEGY = MappingStrategy.ONE_TABLE_PER_KIND; public static final boolean DEFAULT_STANTDARDIZE_NAMES = true; @@ -36,8 +36,8 @@ public class ProjectConfigurations { public static final String DEFAULT_DB_MAPPING_PATH = System.getProperty("user.home"); public static final String DEFAULT_DB_MAPPING_FILE_NAME = ""; public static final boolean DEFAULT_IS_ENUMARATION_TO_LOOKUP_TABLE = false; -//*********************************************** - + // *********************************************** + @SerializedName("projectId") @Expose() private String id; @@ -150,7 +150,7 @@ public class ProjectConfigurations { @SerializedName("generateObda") @Expose() private boolean generateObda; - + @SerializedName("generateConnection") @Expose() private boolean generateConnection; @@ -182,12 +182,10 @@ public class ProjectConfigurations { @SerializedName("enumFieldToLookupTable") @Expose() private boolean enumFieldToLookupTable; - + @SerializedName("generateIndexes") @Expose() private boolean generateIndexes; - - /** Constructor without args to be called when deserializing project settings. */ public ProjectConfigurations() { @@ -598,7 +596,7 @@ public boolean isGenerateObda() { public void setGenerateObda(boolean generateObda) { this.generateObda = generateObda; } - + /** * Returns if it is necessary to generate the connection for the database. * @@ -743,8 +741,7 @@ public boolean isEnumFieldToLookupTable() { public void setEnumFieldToLookupTable(boolean isEnumFieldToLookupTable) { this.enumFieldToLookupTable = isEnumFieldToLookupTable; } - - + /** * Returns if it is necessary generate the index for the schema. * @@ -762,5 +759,4 @@ public boolean isGenerateIndex() { public void setGenerateIndexes(boolean generateIndexes) { this.generateIndexes = generateIndexes; } - } diff --git a/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java index 5f770544..f81cb854 100644 --- a/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java +++ b/src/main/java/it/unibz/inf/ontouml/vp/views/DbMappingView.java @@ -57,7 +57,6 @@ private void initComponents() { // ************************************* setSize(new Dimension(500, 360)); - // ************************************* // Automatically generated code. // ************************************* @@ -109,35 +108,50 @@ private void initComponents() { groupStrategy.add(rbtOneTablePerKind); rbtOneTablePerKind.setSelected(true); rbtOneTablePerKind.setText("One Table per Kind"); - rbtOneTablePerKind.addItemListener(new java.awt.event.ItemListener() { - public void itemStateChanged(java.awt.event.ItemEvent evt) { + rbtOneTablePerKind.addItemListener( + new java.awt.event.ItemListener() { + public void itemStateChanged(java.awt.event.ItemEvent evt) { rbtOneTablePerKindItemStateChanged(evt); - } - }); + } + }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rbtOneTablePerClass) - .addComponent(rbtOneTablePerConcreteClass) - .addComponent(rbtOneTablePerKind)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rbtOneTablePerClass) + .addComponent(rbtOneTablePerConcreteClass) + .addComponent(rbtOneTablePerKind)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(rbtOneTablePerClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(rbtOneTablePerConcreteClass, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(rbtOneTablePerKind) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); + jPanel1Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel1Layout + .createSequentialGroup() + .addContainerGap() + .addComponent( + rbtOneTablePerClass, + javax.swing.GroupLayout.PREFERRED_SIZE, + 23, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent( + rbtOneTablePerConcreteClass, + javax.swing.GroupLayout.PREFERRED_SIZE, + 23, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(18, 18, 18) + .addComponent(rbtOneTablePerKind) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jLabel3.setText("DBMS"); @@ -157,51 +171,103 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(cxbGenerateSchema)) - .addGap(18, 18, 18) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(cbxDBMS, 0, 158, Short.MAX_VALUE) - .addGap(26, 26, 26)) - .addComponent(cxbEnumToLookupTable, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) - .addComponent(cbxStandarizeNames, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(cxbCreateIndex, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addGroup(jPanel2Layout.createSequentialGroup() - .addGap(21, 21, 21) - .addComponent(jLabel1))) - .addGap(0, 0, Short.MAX_VALUE))) - .addGap(18, 18, 18)) - ); + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent( + jPanel1, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(cxbGenerateSchema)) + .addGap(18, 18, 18) + .addGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addComponent(cbxDBMS, 0, 158, Short.MAX_VALUE) + .addGap(26, 26, 26)) + .addComponent( + cxbEnumToLookupTable, + javax.swing.GroupLayout.DEFAULT_SIZE, + 184, + Short.MAX_VALUE) + .addComponent( + cbxStandarizeNames, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addComponent( + cxbCreateIndex, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addGroup( + jPanel2Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabel1))) + .addGap(0, 0, Short.MAX_VALUE))) + .addGap(18, 18, 18))); jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(cxbGenerateSchema) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addComponent(jLabel3) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cbxDBMS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cxbEnumToLookupTable) + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(cxbGenerateSchema) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(cbxStandarizeNames) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 5, Short.MAX_VALUE) - .addComponent(cxbCreateIndex) - .addContainerGap()) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - ); + .addGroup( + jPanel2Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel2Layout + .createSequentialGroup() + .addComponent(jLabel3) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + cbxDBMS, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cxbEnumToLookupTable) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(cbxStandarizeNames) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabel1) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED, + 5, + Short.MAX_VALUE) + .addComponent(cxbCreateIndex) + .addContainerGap()) + .addComponent( + jPanel1, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)))); jTabbedPane1.addTab("Relational Schema", jPanel2); @@ -215,30 +281,52 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel6Layout.createSequentialGroup() - .addComponent(cxbGenerateObda) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(jPanel6Layout.createSequentialGroup() - .addComponent(jLabel2) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jtfBaseIRI, javax.swing.GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE))) - .addContainerGap()) - ); + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel6Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel6Layout + .createSequentialGroup() + .addComponent(cxbGenerateObda) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup( + jPanel6Layout + .createSequentialGroup() + .addComponent(jLabel2) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent( + jtfBaseIRI, + javax.swing.GroupLayout.DEFAULT_SIZE, + 348, + Short.MAX_VALUE))) + .addContainerGap())); jPanel6Layout.setVerticalGroup( - jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup() - .addContainerGap() - .addComponent(cxbGenerateObda) - .addGap(18, 18, 18) - .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent(jtfBaseIRI, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(118, Short.MAX_VALUE)) - ); + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + jPanel6Layout + .createSequentialGroup() + .addContainerGap() + .addComponent(cxbGenerateObda) + .addGap(18, 18, 18) + .addGroup( + jPanel6Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel2) + .addComponent( + jtfBaseIRI, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(118, Short.MAX_VALUE))); jTabbedPane1.addTab("OBDA", jPanel6); @@ -257,54 +345,100 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel7) - .addComponent(jLabel6)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jtfUser) - .addComponent(jtfPassword))) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jLabel4) - .addGap(34, 34, 34) - .addComponent(jtfHost)) - .addGroup(jPanel5Layout.createSequentialGroup() + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addGroup( + jPanel5Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel6)) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup( + javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jtfUser) + .addComponent(jtfPassword))) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jLabel4) + .addGap(34, 34, 34) + .addComponent(jtfHost)) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(cxbGenerateConnection) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addComponent(jLabel5) + .addPreferredGap( + javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jtfDatabase))) + .addContainerGap())); + jPanel5Layout.setVerticalGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel5Layout + .createSequentialGroup() + .addContainerGap() .addComponent(cxbGenerateConnection) - .addGap(0, 0, Short.MAX_VALUE)) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jtfDatabase))) - .addContainerGap()) - ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addContainerGap() - .addComponent(cxbGenerateConnection) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel4) - .addComponent(jtfHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel5) - .addComponent(jtfDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel6) - .addComponent(jtfUser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel7) - .addComponent(jtfPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel4) + .addComponent( + jtfHost, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel5) + .addComponent( + jtfDatabase, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel6) + .addComponent( + jtfUser, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup( + jPanel5Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabel7) + .addComponent( + jtfPassword, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jTabbedPane1.addTab("Conection", jPanel5); @@ -323,74 +457,111 @@ public void itemStateChanged(java.awt.event.ItemEvent evt) { javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() - .addGap(36, 36, 36) - .addComponent(jbtnOk, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(61, 61, 61) - .addComponent(jbtnCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(57, 57, 57)) - ); + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + javax.swing.GroupLayout.Alignment.TRAILING, + jPanel4Layout + .createSequentialGroup() + .addGap(36, 36, 36) + .addComponent( + jbtnOk, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addGap(61, 61, 61) + .addComponent( + jbtnCancel, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE) + .addGap(57, 57, 57))); jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jbtnCancel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jbtnOk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + jPanel4Layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + jPanel4Layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent( + jbtnCancel, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent( + jbtnOk, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jTabbedPane1) - .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()) - ); + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addContainerGap() + .addGroup( + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jTabbedPane1) + .addComponent( + jPanel4, + javax.swing.GroupLayout.Alignment.TRAILING, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + Short.MAX_VALUE)) + .addContainerGap())); layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jTabbedPane1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); + layout + .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup( + layout + .createSequentialGroup() + .addContainerGap() + .addComponent(jTabbedPane1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent( + jPanel4, + javax.swing.GroupLayout.PREFERRED_SIZE, + javax.swing.GroupLayout.DEFAULT_SIZE, + javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap())); + } + + private void rbtOneTablePerKindItemStateChanged(java.awt.event.ItemEvent evt) { + if (rbtOneTablePerKind.isSelected()) { + cxbCreateIndex.setEnabled(true); + cxbCreateIndex.setSelected(true); + } else { + cxbCreateIndex.setSelected(false); + cxbCreateIndex.setEnabled(false); + } } - - private void rbtOneTablePerKindItemStateChanged(java.awt.event.ItemEvent evt) { - if(rbtOneTablePerKind.isSelected()) { - cxbCreateIndex.setEnabled(true); - cxbCreateIndex.setSelected(true); - }else { - cxbCreateIndex.setSelected(false); - cxbCreateIndex.setEnabled(false); - } - } - /** * Updates components with project configurations' information. * * @param configurations */ private void setComponentsValues(ProjectConfigurations configurations) { - cxbGenerateSchema.setSelected(configurations.isGenerateSchema()); - cxbGenerateObda.setSelected(configurations.isGenerateObda()); - cxbGenerateConnection.setSelected(configurations.isGenerateConnection()); - - if (configurations.getMappingStrategy() != null) { - if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) - rbtOneTablePerClass.setSelected(true); - else if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS) - rbtOneTablePerConcreteClass.setSelected(true); - else rbtOneTablePerKind.setSelected(true); - } + cxbGenerateSchema.setSelected(configurations.isGenerateSchema()); + cxbGenerateObda.setSelected(configurations.isGenerateObda()); + cxbGenerateConnection.setSelected(configurations.isGenerateConnection()); + + if (configurations.getMappingStrategy() != null) { + if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CLASS) + rbtOneTablePerClass.setSelected(true); + else if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CONCRETE_CLASS) + rbtOneTablePerConcreteClass.setSelected(true); + else rbtOneTablePerKind.setSelected(true); + } cbxDBMS.setSelectedItem(configurations.getTargetDBMS()); cbxStandarizeNames.setSelected(configurations.isStandardizeNames()); @@ -404,12 +575,11 @@ else if (configurations.getMappingStrategy() == MappingStrategy.ONE_TABLE_PER_CO } /** Updates project configurations with components' information. */ - public void updateConfigurationsValues(ProjectConfigurations configurations) { configurations.setGenerateSchema(cxbGenerateSchema.isSelected()); configurations.setGenerateObda(cxbGenerateObda.isSelected()); configurations.setGenerateConnection(cxbGenerateConnection.isSelected()); - + if (rbtOneTablePerClass.isSelected()) configurations.setMappingStrategy(MappingStrategy.ONE_TABLE_PER_CLASS); else if (rbtOneTablePerConcreteClass.isSelected()) @@ -446,18 +616,29 @@ public void onCancel(ActionListener onCancelAction) { jbtnCancel.addActionListener(onCancelAction); } - + public boolean checkValidParamters() { - if( (DbmsSupported) cbxDBMS.getSelectedItem() == DbmsSupported.GENERIC_SCHEMA && !cxbEnumToLookupTable.isSelected()) { - JOptionPane.showMessageDialog(this, "You can not create an enumeration field to a generic database.", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - - if(!cxbGenerateSchema.isSelected() && !cxbGenerateObda.isSelected() && !cxbGenerateConnection.isSelected()) { - JOptionPane.showMessageDialog(this, "You must select at least one file to be generated (schema, OBDA or connection).", "Error", JOptionPane.ERROR_MESSAGE); - return false; - } - - return true; + if ((DbmsSupported) cbxDBMS.getSelectedItem() == DbmsSupported.GENERIC_SCHEMA + && !cxbEnumToLookupTable.isSelected()) { + JOptionPane.showMessageDialog( + this, + "You can not create an enumeration field to a generic database.", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + if (!cxbGenerateSchema.isSelected() + && !cxbGenerateObda.isSelected() + && !cxbGenerateConnection.isSelected()) { + JOptionPane.showMessageDialog( + this, + "You must select at least one file to be generated (schema, OBDA or connection).", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; } }