From c381ebac85d64217a708363fee2f4fc48f4bf17c Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 26 Mar 2019 15:06:29 +0000 Subject: [PATCH] Minor update git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@178694 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/generator/AlgorithmGenerator.java | 116 +----------------- 1 file changed, 6 insertions(+), 110 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/AlgorithmGenerator.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/AlgorithmGenerator.java index 126dc23..44d110b 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/AlgorithmGenerator.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/AlgorithmGenerator.java @@ -103,58 +103,6 @@ public class AlgorithmGenerator { code.add(" }"); code.add(" }"); - /* - * code.add(" String[] "+ nameEnum + " = {"); String[] - * values = globalVariable.getDefaultValue().split( "\\|"); - * if (values.length < 1) { - * - * } else { for (int i = 0; i < values.length; i++) { if (i - * == values.length - 1) { code.add(" \"" + values[i] - * + "\""); } else { code.add(" \"" + values[i] + - * "\","); } } } code.add(" };"); - */ - /* - * code.add(" public static enum opGV" + - * globalVariable.getId() + " {"); String[] values = - * globalVariable.getDefaultValue().split( "\\|"); if - * (values.length < 1) { - * - * } else { for (int i = 0; i < values.length; i++) { String - * identifier = values[i].trim(); - * identifier=identifier.replaceAll("\\s+",""); - * - * if (i == values.length - 1) { code.add(" " + - * identifier + "(\"" + values[i] + "\");"); } else { - * code.add(" " + identifier + "(\"" + values[i] + - * "\"),"); } } } - * - * code.add(" "); - * code.add(" private final String id;"); - * code.add(" "); code.add(" private opGV" + - * globalVariable.getId() + "(final String id) {"); - * code.add(" this.id = id;"); code.add(" }"); - * code.add(" "); code.add(" @Override"); - * code.add(" public String toString() {"); - * code.add(" return id;"); code.add(" }"); - * code.add(" "); - * code.add(" public String getId() {"); - * code.add(" return id;"); code.add(" }"); - * code.add(" "); - * - * code.add(" public opIO" + globalVariable.getId() + - * " getIdentifier(String identifier){"); code. - * add(" if(identifier==null|| identifier.isEmpty()){" - * ); code.add(" return null;"); - * code.add(" }"); code.add(" "); - * code.add(" for(opIO" + globalVariable.getId() + - * " value:opIO" + globalVariable.getId() + ".values()){"); - * code. - * add(" if(value.id.compareTo(identifier)==0){" - * ); code.add(" return value;"); - * code.add(" }"); code.add(" }"); - * code.add(" return null;"); code.add(" }"); - * code.add(" "); code.add(" }"); - */ } } @@ -180,57 +128,6 @@ public class AlgorithmGenerator { code.add(" }"); code.add(" }"); - /* - * code.add(" String[] opIO" + inputOutputVariable.getId() - * + " = {"); String[] values = - * inputOutputVariable.getDefaultValue() .split("\\|"); if - * (values.length < 1) { - * - * } else { for (int i = 0; i < values.length; i++) { if (i - * == values.length - 1) { code.add(" \"" + values[i] - * + "\""); } else { code.add(" \"" + values[i] + - * "\","); } } } code.add(" };"); - */ - - /* - * code.add(" public static enum opIO" - * - * + inputOutputVariable.getId() + " {"); String[] values = - * inputOutputVariable.getDefaultValue() .split("\\|"); if - * (values.length < 1) { - * - * } else { for (int i = 0; i < values.length; i++) { String - * identifier = values[i].trim(); identifier = - * identifier.replaceAll("\\s+", ""); if (i == values.length - * - 1) { code.add(" " + identifier + "(\"" + - * values[i] + "\");"); } else { code.add(" " + - * identifier + "(\"" + values[i] + "\"),"); } } } - * code.add(" "); - * code.add(" private final String id;"); - * code.add(" "); code.add(" private opIO" + - * inputOutputVariable.getId() + "(final String id) {"); - * code.add(" this.id = id;"); code.add(" }"); - * code.add(" "); code.add(" @Override"); - * code.add(" public String toString() {"); - * code.add(" return id;"); code.add(" }"); - * code.add(" "); - * code.add(" public String getId() {"); - * code.add(" return id;"); code.add(" }"); - * code.add(" "); code.add(" public opIO" + - * inputOutputVariable.getId() + - * " getIdentifier(String identifier){"); code. - * add(" if(identifier==null|| identifier.isEmpty()){" - * ); code.add(" return null;"); - * code.add(" }"); code.add(" "); - * code.add(" for(opIO" + - * inputOutputVariable.getId() + " value:opIO" + - * inputOutputVariable.getId() + ".values()){"); code. - * add(" if(value.id.compareTo(identifier)==0){" - * ); code.add(" return value;"); - * code.add(" }"); code.add(" }"); - * code.add(" return null;"); code.add(" }"); - * code.add(" "); code.add(" }"); - */ } } @@ -257,13 +154,13 @@ public class AlgorithmGenerator { } } - + code.add(""); - + for (GlobalVariables globalVariable : project.getInputData().getListGlobalVariables()) { code.add(" inputvariables.add(\"" + globalVariable.getName() + "\");"); } - + for (InputOutputVariables selVariable : project.getInputData().getListInputOutputVariables()) { if (selVariable != null && selVariable.getDataType() != null) { switch (selVariable.getIoType()) { @@ -347,7 +244,7 @@ public class AlgorithmGenerator { } } } - logger.debug("Algorithm Description: "+algorithmDescription); + logger.debug("Algorithm Description: " + algorithmDescription); return algorithmDescription; } @@ -494,14 +391,13 @@ public class AlgorithmGenerator { } } - //TODO private String retrieveMainScriptRelativePath() { logger.debug("ProjectInfo: " + project); String projectPath = project.getProjectFolder().getFolder().getPath(); String mainCodePath = project.getMainCode().getItemDescription().getPath(); - String projectFolderName=project.getProjectFolder().getFolder().getName(); + String projectFolderName = project.getProjectFolder().getFolder().getName(); logger.debug("ProjectPath: " + projectPath); - logger.debug("Project Folder Name: "+projectFolderName); + logger.debug("Project Folder Name: " + projectFolderName); logger.debug("MainCodePath: " + mainCodePath); String relativePath = project.getProjectFolder().getFolder().getName()