-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom properties vip:dot #480
Changes from 8 commits
694a964
26440b8
ac94b72
f7619a2
f78e43e
301a78b
72795d4
357563f
a2c7841
11992a0
9a9297c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,9 @@ | |
*/ | ||
package fr.insalyon.creatis.vip.applicationimporter.client.view.applicationdisplay; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import com.google.gwt.user.client.rpc.AsyncCallback; | ||
import com.smartgwt.client.widgets.Canvas; | ||
import com.smartgwt.client.widgets.IButton; | ||
|
@@ -39,6 +42,7 @@ | |
import com.smartgwt.client.widgets.layout.HLayout; | ||
import com.smartgwt.client.widgets.layout.VLayout; | ||
import com.smartgwt.client.widgets.tab.Tab; | ||
|
||
import fr.insalyon.creatis.vip.application.client.bean.boutiquesTools.BoutiquesApplication; | ||
import fr.insalyon.creatis.vip.application.client.view.boutiquesParsing.BoutiquesParser; | ||
import fr.insalyon.creatis.vip.application.client.view.boutiquesParsing.InvalidBoutiquesDescriptorException; | ||
|
@@ -49,6 +53,7 @@ | |
import fr.insalyon.creatis.vip.core.client.view.layout.Layout; | ||
import fr.insalyon.creatis.vip.core.client.view.util.WidgetUtil; | ||
|
||
|
||
public class DisplayTab extends Tab { | ||
|
||
// Layouts | ||
|
@@ -158,6 +163,35 @@ private static void verifyBoutiquesTool(BoutiquesApplication boutiquesTool) | |
if (boutiquesTool.getAuthor() == null) { | ||
throw new ApplicationImporterException("Boutiques file must have an author"); | ||
} | ||
checkvipdot(boutiquesTool); | ||
} | ||
|
||
/** | ||
* display warning message if any. | ||
* | ||
* @param application BoutiquesApplication object to cehck warning message | ||
* **/ | ||
private static void checkvipdot(BoutiquesApplication application) { | ||
Set<String> commandLineFlags = application.getCommandLineFlag(); | ||
Set<String> vipDotInputIds = application.getVipDotInputIds(); | ||
Set<String> commonValues = new HashSet<>(application.getVipDotInputIds()); | ||
|
||
commonValues.retainAll(commandLineFlags); | ||
|
||
if (!commonValues.isEmpty()) { | ||
String warningMessage = "<b>" + String.join(", ", commonValues) + "</b> 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<String> inputIds = application.getInputs().stream().map(BoutiquesInput::getId).collect(Collectors.toSet()); | ||
// Check if all vipDotInputIds are in inputs | ||
if (!inputIds.containsAll(vipDotInputIds)) { | ||
Set<String> incorrectInputs = new HashSet<>(vipDotInputIds); | ||
incorrectInputs.removeAll(inputIds); | ||
String warningMessage = "<b>" + String.join(", ", incorrectInputs) + "</b> appears in vipDotInputIds but not in inputs. Please ensure all ids are correct."; | ||
Layout.getInstance().setWarningMessage(warningMessage); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in this case, it should be a error with an exception thrown. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. throwing ApplicationImporterException |
||
} | ||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
package fr.insalyon.creatis.vip.application.client.bean.boutiquesTools; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.Map; | ||
|
@@ -10,6 +11,8 @@ | |
|
||
import com.google.gwt.user.client.rpc.IsSerializable; | ||
|
||
import fr.insalyon.creatis.vip.application.client.bean.boutiquesTools.BoutiquesInput.InputType; | ||
|
||
/** | ||
* Representation of an application Boutiques descriptor | ||
* | ||
|
@@ -38,6 +41,8 @@ public class BoutiquesApplication implements IsSerializable { | |
private Set<BoutiquesOutputFile> outputFiles = new HashSet<>(); | ||
private Map<String, String> tags = new HashMap<>(); | ||
private String jsonFile; | ||
private Set<String> vipDotInputIds; | ||
private String resultDirs; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename field and getter/setter with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed to boolean vipDotIncludesResultsDir |
||
|
||
private BoutiquesApplicationExtensions boutiquesExtensions; | ||
|
||
|
@@ -229,6 +234,24 @@ public String getVipContainer() { | |
return vipContainer; | ||
} | ||
|
||
public Set<String> getVipDotInputIds() { | ||
if (vipDotInputIds == null) { | ||
return Collections.emptySet(); | ||
} | ||
return vipDotInputIds; | ||
} | ||
|
||
public Set<String> getCommandLineFlag() { | ||
return inputs.stream() | ||
.filter(i -> InputType.FLAG.equals(i.getType())) | ||
.map(BoutiquesInput::getId) | ||
.collect(Collectors.toSet()); | ||
} | ||
|
||
public String getVipDotResultDirs() { | ||
return resultDirs; | ||
} | ||
|
||
public void addInput(BoutiquesInput input){ | ||
this.inputs.add(input); | ||
} | ||
|
@@ -280,4 +303,12 @@ public void addTag(String key, String value) { | |
public void setVipContainer(String vipContainer) { | ||
this.vipContainer = vipContainer; | ||
} | ||
} | ||
|
||
public void setVipDotInputIds(Set<String> inputIds) { | ||
this.vipDotInputIds = inputIds; | ||
} | ||
|
||
public void setVipDotResultDirs(String resultDirs) { | ||
this.resultDirs = resultDirs; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,8 +114,9 @@ public BoutiquesApplication parseApplication(String descriptor) throws InvalidBo | |
// Custom property | ||
JSONObject customObject = getObjectValue(parsedDescriptor, "custom", true); | ||
if (customObject != null) { | ||
String vipImagePath = getStringValue(customObject, "vip:imagepath", true); | ||
application.setVipContainer(vipImagePath); | ||
application.setVipContainer(getStringValue(customObject, "vip:imagepath", true)); | ||
application.setVipDotInputIds(getArrayValueAsStringSet(customObject, "vip:dot", true)); | ||
application.setVipDotResultDirs(getStringValue(customObject, "vip:dot-result-directory", true)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rename to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change to vip:dot-with-results-directory and adapt to the method getBooleanValue |
||
} | ||
// Json descriptor | ||
application.setJsonFile(parsedDescriptor.toString()); | ||
|
@@ -241,6 +242,4 @@ private BoutiquesOutputFile parseBoutiquesOutputFile(JSONObject outputFile) | |
bof.setCommandLineFlag(commandLineFlag); | ||
return bof; | ||
} | ||
|
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,78 +5,99 @@ | |
<source name="results-directory" type="URI" optional="false" default="/vip/Home" pretty-name="Results directory"> | ||
<source-comment>Directory where the results will be stored.</source-comment> | ||
</source> | ||
#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()!="") | ||
<source name="$input.getId()" type="string" optional="$input.isOptional()" default="$input.getDefaultValue()" vip-type-restriction="flag" pretty-name="$input.getName()"> | ||
#else | ||
<source name="$input.getId()" type="string" optional="$input.isOptional()" default="false" vip-type-restriction="flag" pretty-name="$input.getName()"> | ||
#foreach( $input in $tool.getInputs() ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thnk VS or something else changed the indentation of velocity code and it generetad a lot of diff. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed, restore original indentation. |
||
#set($type="string") | ||
#if($input.getType().getCamelName()=="File") | ||
#set($type="URI") | ||
#end | ||
#if($input.getType().getCamelName()=="Flag") | ||
#if($input.getDefaultValue() && $input.getDefaultValue()!="") | ||
<source name="$input.getId()" type="string" optional="$input.isOptional()" default="$input.getDefaultValue()" vip-type-restriction="flag" pretty-name="$input.getName()"> | ||
#else | ||
<source name="$input.getId()" type="string" optional="$input.isOptional()" default="false" vip-type-restriction="flag" pretty-name="$input.getName()"> | ||
#end | ||
#else | ||
#if($input.getDefaultValue() && $input.getDefaultValue()!="") | ||
#if($input.getType().getCamelName()=="Number" && $input.isInteger()) | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" default="$input.getDefaultValue().intValue()" pretty-name="$input.getName()"> | ||
#else | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" default="$input.getDefaultValue()" pretty-name="$input.getName()"> | ||
#end | ||
#else | ||
#if($input.isOptional()==true) | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" default="No_value_provided" pretty-name="$input.getName()"> | ||
#else | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" pretty-name="$input.getName()"> | ||
#end | ||
#end | ||
#end | ||
#if($input.getDescription()) | ||
<source-comment>$esc.xml($input.getDescription())</source-comment> | ||
#else | ||
<source-comment></source-comment> | ||
#end | ||
</source> | ||
#end | ||
#else | ||
#if($input.getDefaultValue() && $input.getDefaultValue()!="") | ||
#if($input.getType().getCamelName()=="Number" && $input.isInteger()) | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" default="$input.getDefaultValue().intValue()" pretty-name="$input.getName()"> | ||
#else | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" default="$input.getDefaultValue()" pretty-name="$input.getName()"> | ||
#end | ||
#else | ||
#if($input.isOptional()==true) | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" default="No_value_provided" pretty-name="$input.getName()"> | ||
#else | ||
<source name="$input.getId()" type="$type" optional="$input.isOptional()" pretty-name="$input.getName()"> | ||
#end | ||
#foreach($output in $tool.getOutputFiles()) | ||
<sink name="$output.getId()" type="URI" /> | ||
#end | ||
#end | ||
#if($input.getDescription()) | ||
<source-comment>$esc.xml($input.getDescription())</source-comment> | ||
#else | ||
<source-comment></source-comment> | ||
#end | ||
</source> | ||
#end | ||
#foreach($output in $tool.getOutputFiles()) | ||
<sink name="$output.getId()" type="URI" /> | ||
#end | ||
</interface> | ||
<processors> | ||
<processor name="append-date" > | ||
<in name="dir" type="URI" depth="0" /> | ||
<out name="result" type="string" depth="0" /> | ||
<beanshell>/*----------Beginning of Beanshell------------*/ | ||
import java.text.DateFormat; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
<beanshell> | ||
/*----------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------------*/ | ||
</beanshell> | ||
</processor> | ||
<processor name="$tool.getName()" > | ||
<in name="results-directory" type="string" depth="0"/> | ||
#foreach($input in $tool.getInputs()) | ||
#if($input.getType().getCamelName()=="File" ) | ||
<in name="$input.getId()" type="URI" depth="0"/> | ||
#else | ||
<in name="$input.getId()" type="string" depth="0"/> | ||
#end | ||
#end | ||
#foreach( $output in $tool.getOutputFiles() ) | ||
<out name="$output.getId()" type="URI" depth="0"/> | ||
#end | ||
#foreach($input in $tool.getInputs()) | ||
#if($input.getType().getCamelName()=="File" ) | ||
<in name="$input.getId()" type="URI" depth="0"/> | ||
#else | ||
<in name="$input.getId()" type="string" depth="0"/> | ||
#end | ||
#end | ||
#foreach( $output in $tool.getOutputFiles() ) | ||
<out name="$output.getId()" type="URI" depth="0"/> | ||
#end | ||
<iterationstrategy> | ||
<cross> | ||
<port name="results-directory" /> | ||
#foreach($input in $tool.getInputs()) | ||
<port name="$input.getId()"/> | ||
#end | ||
#if($tools.getVipDotResultDirs) | ||
<dot> | ||
<port name="results-directory" /> | ||
#foreach($input in $tool.getInputs()) | ||
#if($tool.getVipDotInputIds().contains($input.getId())) | ||
<port name="$input.getId()"/> | ||
#end | ||
#end | ||
</dot> | ||
#else | ||
<port name="results-directory" /> | ||
#foreach($input in $tool.getInputs()) | ||
#if(!$tool.getVipDotInputIds().contains($input.getId())) | ||
<port name="$input.getId()"/> | ||
#end | ||
#end | ||
#end | ||
#if($tool.getVipDotInputIds() && !$tool.getVipDotInputIds().isEmpty() && !$tools.getVipDotResultDirs) | ||
<dot> | ||
#foreach($dotInput in $tool.getVipDotInputIds()) | ||
<port name="$dotInput"/> | ||
#end | ||
</dot> | ||
#end | ||
</cross> | ||
</iterationstrategy> | ||
<gasw descriptor="$fileAccessProtocol:$tool.getGASWLFN()"/> | ||
|
@@ -85,11 +106,11 @@ if ( result.startsWith("/") || result.startsWith("lfn:") ) { | |
<links> | ||
<link from="results-directory" to="append-date:dir" /> | ||
<link from="append-date:result" to="$tool.getName():results-directory" /> | ||
#foreach( $input in $tool.getInputs() ) | ||
<link from="$input.getId()" to="$tool.getName():$input.getId()" /> | ||
#end | ||
#foreach($output in $tool.getOutputFiles()) | ||
<link from="$tool.getName():$output.getId()" to="$output.getId()" /> | ||
#end | ||
#foreach( $input in $tool.getInputs() ) | ||
<link from="$input.getId()" to="$tool.getName():$input.getId()" /> | ||
#end | ||
#foreach($output in $tool.getOutputFiles()) | ||
<link from="$tool.getName():$output.getId()" to="$output.getId()" /> | ||
#end | ||
</links> | ||
</workflow> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may add this as a BoutiquesApplication method. (optionally)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the getinputIds method to BoutiquesApplication