From 9bc61da27f002adc7f129f993904ff3b0a8c4eb0 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 6 Sep 2010 11:08:50 +0000 Subject: [PATCH] pass user preset arguments to job --- src/jalview/ws/jws2/MsaWSClient.java | 65 ++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index e025df6..7df3a98 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -112,34 +112,44 @@ public class MsaWSClient extends Jws2Client return; } server = sh.service; - if (preset!=null) { - if (preset instanceof JabaPreset){ - this.preset = ((JabaPreset)preset).p; - } else - if (preset instanceof JabaWsParamSet) { - JabaWsParamSet pset = ((JabaWsParamSet)preset); - if (arguments!=null && arguments.size()>0) + if (preset != null) + { + if (preset instanceof JabaPreset) + { + this.preset = ((JabaPreset) preset).p; + } + else if (preset instanceof JabaWsParamSet) + { + List newargs = new ArrayList(); + JabaWsParamSet pset = ((JabaWsParamSet) preset); + for (Option opt : pset.getjabaArguments()) + { + newargs.add(opt); + } + if (arguments != null && arguments.size() > 0) + { + // merge arguments with preset's own arguments. + for (Argument opt : arguments) { - // merge arguments with preset's own arguments. - List oldargs = arguments; - arguments = new ArrayList(); - for (Option opt : pset.getjabaArguments()) { - arguments.add(opt); - } - for (Argument opt: oldargs) - { - arguments.add(opt); - } + newargs.add(opt); } - - }else{ - throw new Error("Implementation error: Can only instantiate Jaba parameter sets."); + } + paramset = newargs; } + else + { + throw new Error( + "Implementation error: Can only instantiate Jaba parameter sets."); + } + } + else + { + // just provided with a bunch of arguments + this.paramset = arguments; } - this.paramset = arguments; if (editParams) { - if (sh.paramStore==null) + if (sh.paramStore == null) { sh.paramStore = new JabaParamStore(sh); } @@ -149,11 +159,14 @@ public class MsaWSClient extends Jws2Client return; } WsParamSetI prset = jobParams.getPreset(); - if (prset==null) + if (prset == null) + { + paramset = JabaParamStore.getJabafromJwsArgs(jobParams + .getJobParams()); + } + else { - paramset = JabaParamStore.getJabafromJwsArgs(jobParams.getJobParams()); - } else { - this.preset = ((JabaPreset)prset).p; + this.preset = ((JabaPreset) prset).p; paramset = null; // no user supplied parameters. } } -- 1.7.10.2