From a2c7841e6480b0ad058cbe5b6040a3e7a5a9c484 Mon Sep 17 00:00:00 2001 From: patil Date: Mon, 1 Jul 2024 17:05:47 +0200 Subject: [PATCH] Resolution of review comment and display of results-directory --- coverage/src/test/java/Coverage/Coverage.java | 2 +- .../view/applicationdisplay/DisplayTab.java | 13 +- .../applicationdisplay/GeneralLayout.java | 3 +- .../boutiquesTools/BoutiquesApplication.java | 17 +- .../boutiquesParsing/BoutiquesParser.java | 2 +- .../main/resources/vm/gwendia-standalone.vm | 179 +++++++++--------- 6 files changed, 111 insertions(+), 105 deletions(-) diff --git a/coverage/src/test/java/Coverage/Coverage.java b/coverage/src/test/java/Coverage/Coverage.java index 06d65d3a8..86f1b0ac8 100644 --- a/coverage/src/test/java/Coverage/Coverage.java +++ b/coverage/src/test/java/Coverage/Coverage.java @@ -1,4 +1,4 @@ -package coverage; +package Coverage; import org.junit.jupiter.api.Test; diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java index 6a6958fd7..b8490a287 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/DisplayTab.java @@ -170,11 +170,13 @@ private static void verifyBoutiquesTool(BoutiquesApplication boutiquesTool) * display warning message if any. * * @param application BoutiquesApplication object to cehck warning message + * @throws ApplicationImporterException * **/ - private static void checkvipdot(BoutiquesApplication application) { + private static void checkvipdot(BoutiquesApplication application) throws ApplicationImporterException { Set commandLineFlags = application.getCommandLineFlag(); Set vipDotInputIds = application.getVipDotInputIds(); - Set commonValues = new HashSet<>(application.getVipDotInputIds()); + Set inputIds = application.getinputIds(); + Set commonValues = new HashSet<>(vipDotInputIds); commonValues.retainAll(commandLineFlags); @@ -182,15 +184,12 @@ private static void checkvipdot(BoutiquesApplication application) { String warningMessage = "" + String.join(", ", commonValues) + " appears as command-line flag input(s), it should not be included in Dot iteration. Importing it may cause functionality issues, although the application will still be imported."; Layout.getInstance().setWarningMessage(warningMessage); } - - // Extract the IDs from inputs - Set inputIds = application.getInputs().stream().map(BoutiquesInput::getId).collect(Collectors.toSet()); // Check if all vipDotInputIds are in inputs if (!inputIds.containsAll(vipDotInputIds)) { Set incorrectInputs = new HashSet<>(vipDotInputIds); incorrectInputs.removeAll(inputIds); - String warningMessage = "" + String.join(", ", incorrectInputs) + " appears in vipDotInputIds but not in inputs. Please ensure all ids are correct."; - Layout.getInstance().setWarningMessage(warningMessage); + String errorMessage = "" + String.join(", ", incorrectInputs) + " appears in vipDotInputIds but not in inputs. Please ensure all ids are correct."; + throw new ApplicationImporterException(errorMessage); } } diff --git a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/GeneralLayout.java b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/GeneralLayout.java index 441808528..22f44a5d9 100644 --- a/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/GeneralLayout.java +++ b/vip-application-importer/src/main/java/fr/insalyon/creatis/vip/applicationimporter/client/view/applicationdisplay/GeneralLayout.java @@ -78,6 +78,7 @@ public void setTool(BoutiquesApplication bt) { dockerIndex.setValue(bt.getContainerIndex()); schemaVersion.setValue(bt.getSchemaVersion()); vipContainer.setValue(bt.getVipContainer()); - dotInputs.setValue(String.join(", ", bt.getVipDotInputIds())); + String dotInputsValue = String.join(", ", bt.getVipDotInputIds()); + dotInputs.setValue(dotInputsValue + (bt.getVipDotIncludesResultsDir() ? (dotInputsValue.isEmpty() ? "results-directory" : ", results-directory") : "")); } } diff --git a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/bean/boutiquesTools/BoutiquesApplication.java b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/bean/boutiquesTools/BoutiquesApplication.java index 3325cc292..7ed6be189 100644 --- a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/bean/boutiquesTools/BoutiquesApplication.java +++ b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/bean/boutiquesTools/BoutiquesApplication.java @@ -42,7 +42,8 @@ public class BoutiquesApplication implements IsSerializable { private Map tags = new HashMap<>(); private String jsonFile; private Set vipDotInputIds; - private String resultDirs; + private Set inputIds; + private boolean vipDotIncludesResultsDir; private BoutiquesApplicationExtensions boutiquesExtensions; @@ -248,8 +249,14 @@ public Set getCommandLineFlag() { .collect(Collectors.toSet()); } - public String getVipDotResultDirs() { - return resultDirs; + public Set getinputIds() { + return this.getInputs().stream() + .map(BoutiquesInput::getId) + .collect(Collectors.toSet()); + } + + public boolean getVipDotIncludesResultsDir() { + return vipDotIncludesResultsDir; } public void addInput(BoutiquesInput input){ @@ -308,7 +315,7 @@ public void setVipDotInputIds(Set inputIds) { this.vipDotInputIds = inputIds; } - public void setVipDotResultDirs(String resultDirs) { - this.resultDirs = resultDirs; + public void setVipDotIncludesResultsDir(boolean vipDotIncludesResultsDir) { + this.vipDotIncludesResultsDir = vipDotIncludesResultsDir; } } diff --git a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/view/boutiquesParsing/BoutiquesParser.java b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/view/boutiquesParsing/BoutiquesParser.java index ef3ecbdbd..400d40956 100644 --- a/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/view/boutiquesParsing/BoutiquesParser.java +++ b/vip-application/src/main/java/fr/insalyon/creatis/vip/application/client/view/boutiquesParsing/BoutiquesParser.java @@ -116,7 +116,7 @@ public BoutiquesApplication parseApplication(String descriptor) throws InvalidBo if (customObject != null) { application.setVipContainer(getStringValue(customObject, "vip:imagepath", true)); application.setVipDotInputIds(getArrayValueAsStringSet(customObject, "vip:dot", true)); - application.setVipDotResultDirs(getStringValue(customObject, "vip:dot-result-directory", true)); + application.setVipDotIncludesResultsDir(getBooleanValue(customObject, "vip:dot-with-results-directory", true)); } // Json descriptor application.setJsonFile(parsedDescriptor.toString()); diff --git a/vip-portal/src/main/resources/vm/gwendia-standalone.vm b/vip-portal/src/main/resources/vm/gwendia-standalone.vm index 36c49bbfa..e57a24789 100644 --- a/vip-portal/src/main/resources/vm/gwendia-standalone.vm +++ b/vip-portal/src/main/resources/vm/gwendia-standalone.vm @@ -5,112 +5,111 @@ Directory where the results will be stored. - #foreach( $input in $tool.getInputs() ) - #set($type="string") - #if($input.getType().getCamelName()=="File") - #set($type="URI") - #end - #if($input.getType().getCamelName()=="Flag") - #if($input.getDefaultValue() && $input.getDefaultValue()!="") - - #else - - #end - #else - #if($input.getDefaultValue() && $input.getDefaultValue()!="") - #if($input.getType().getCamelName()=="Number" && $input.isInteger()) - - #else - - #end - #else - #if($input.isOptional()==true) - - #else - - #end - #end - #end - #if($input.getDescription()) - $esc.xml($input.getDescription()) - #else - - #end - +#foreach( $input in $tool.getInputs() ) + #set($type="string") + #if($input.getType().getCamelName()=="File") + #set($type="URI") + #end + #if($input.getType().getCamelName()=="Flag") + #if($input.getDefaultValue() && $input.getDefaultValue()!="") + + #else + #end - #foreach($output in $tool.getOutputFiles()) - + #else + #if($input.getDefaultValue() && $input.getDefaultValue()!="") + #if($input.getType().getCamelName()=="Number" && $input.isInteger()) + + #else + + #end + #else + #if($input.isOptional()==true) + + #else + + #end #end + #end + #if($input.getDescription()) + $esc.xml($input.getDescription()) + #else + + #end + +#end +#foreach($output in $tool.getOutputFiles()) + +#end - - /*----------Beginning of Beanshell------------*/ - import java.text.DateFormat; - import java.text.SimpleDateFormat; - import java.util.Date; + /*----------Beginning of Beanshell------------*/ +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; - String result = dir.toString(); - if ( result.startsWith("/") || result.startsWith("lfn:") ) { - DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy_HH:mm:ss"); - result = result + "/" + (dateFormat.format(System.currentTimeMillis())); - } - /*------------End of Beanshell------------*/ +String result = dir.toString(); +if ( result.startsWith("/") || result.startsWith("lfn:") ) { + DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy_HH:mm:ss"); + result = result + "/" + (dateFormat.format(System.currentTimeMillis())); +} +/*------------End of Beanshell------------*/ - #foreach($input in $tool.getInputs()) - #if($input.getType().getCamelName()=="File" ) - - #else - - #end - #end - #foreach( $output in $tool.getOutputFiles() ) - - #end - - - #if($tools.getVipDotResultDirs) - - - #foreach($input in $tool.getInputs()) - #if($tool.getVipDotInputIds().contains($input.getId())) - - #end - #end - - #else - - #foreach($input in $tool.getInputs()) - #if(!$tool.getVipDotInputIds().contains($input.getId())) - - #end - #end - #end - #if($tool.getVipDotInputIds() && !$tool.getVipDotInputIds().isEmpty() && !$tools.getVipDotResultDirs) - - #foreach($dotInput in $tool.getVipDotInputIds()) - - #end - - #end - - +#foreach($input in $tool.getInputs()) + #if($input.getType().getCamelName()=="File" ) + + #else + + #end +#end +#foreach( $output in $tool.getOutputFiles() ) + +#end + + +#if($tools.getVipDotResultDirs) + + +#foreach($input in $tool.getInputs()) + #if($tool.getVipDotInputIds().contains($input.getId())) + + #end +#end + +#else + +#foreach($input in $tool.getInputs()) + #if(!$tool.getVipDotInputIds().contains($input.getId())) + + #end +#end +#end +#if($tool.getVipDotInputIds() && !$tool.getVipDotInputIds().isEmpty() && !$tools.getVipDotResultDirs) + +#foreach($dotInput in $tool.getVipDotInputIds()) + +#end + +#end + + - #foreach( $input in $tool.getInputs() ) - - #end - #foreach($output in $tool.getOutputFiles()) - - #end +#foreach( $input in $tool.getInputs() ) + +#end +#foreach($output in $tool.getOutputFiles()) + +#end - + \ No newline at end of file