From aa8829a2b256a7f7a009f465d8609d0be3a03fca Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Thu, 1 Feb 2018 16:17:41 +0000 Subject: [PATCH] JAL-2890 added flag telling if parameters have been validated --- src/jalview/ext/cipres/TreeJob.java | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/jalview/ext/cipres/TreeJob.java b/src/jalview/ext/cipres/TreeJob.java index 52ebbc0..8bdc9c2 100644 --- a/src/jalview/ext/cipres/TreeJob.java +++ b/src/jalview/ext/cipres/TreeJob.java @@ -7,6 +7,7 @@ import java.util.Map; import org.ngbw.directclient.CiApplication; import org.ngbw.directclient.CiCipresException; import org.ngbw.directclient.CiClient; +import org.ngbw.directclient.CiJob; import org.ngbw.restdatatypes.ErrorData; import org.ngbw.restdatatypes.ParamError; @@ -23,6 +24,8 @@ public class TreeJob private Map metadata = new HashMap<>(); + private boolean paramsValidated = false; + public TreeJob() { cipresClient = new CiClient( @@ -55,6 +58,7 @@ public class TreeJob public void addInputParameter(String parameter, String value) { inputParams.put(parameter, value); + paramsValidated = false; } @@ -68,6 +72,7 @@ public class TreeJob public void addToolParameters(String parameter, Collection values) { vParams.put(parameter, values); + paramsValidated = false; } /** @@ -81,6 +86,7 @@ public class TreeJob public void addMetadata(String metadataHeader, String value) { metadata.put(metadataHeader, value); + paramsValidated = false; } public void clearAllParameters() @@ -114,9 +120,15 @@ public class TreeJob { try { - cipresClient.validateJob(toolName, vParams, inputParams, metadata); + CiJob validateJob = cipresClient + .validateJob(toolName, vParams, inputParams, metadata); + validateJob.show(true); // currently outputs just to console, should be + // graphical + paramsValidated = true; + } catch (CiCipresException ce) { + paramsValidated = false; // parameters gave an error. ErrorData ed = ce.getErrorData(); System.out.println( "Cipres error while trying to validate parameters, code=" @@ -134,5 +146,15 @@ public class TreeJob } + public void submitJob(String toolName) + { + if (!paramsValidated) + { + validateJobParams(toolName); // validate before running some expensive job + // first + } + + } + } -- 1.7.10.2