1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.jws2; |
22 |
|
|
23 |
|
import jalview.analysis.AlignSeq; |
24 |
|
import jalview.bin.Console; |
25 |
|
import jalview.datamodel.Alignment; |
26 |
|
import jalview.datamodel.AlignmentI; |
27 |
|
import jalview.datamodel.AlignmentOrder; |
28 |
|
import jalview.datamodel.AlignmentView; |
29 |
|
import jalview.datamodel.HiddenColumns; |
30 |
|
import jalview.datamodel.Sequence; |
31 |
|
import jalview.datamodel.SequenceI; |
32 |
|
import jalview.gui.AlignFrame; |
33 |
|
import jalview.gui.Desktop; |
34 |
|
import jalview.gui.SplitFrame; |
35 |
|
import jalview.gui.WebserviceInfo; |
36 |
|
import jalview.util.MessageManager; |
37 |
|
import jalview.ws.AWsJob; |
38 |
|
import jalview.ws.JobStateSummary; |
39 |
|
import jalview.ws.WSClientI; |
40 |
|
import jalview.ws.jws2.dm.JabaWsParamSet; |
41 |
|
import jalview.ws.params.WsParamSetI; |
42 |
|
|
43 |
|
import java.util.ArrayList; |
44 |
|
import java.util.Hashtable; |
45 |
|
import java.util.List; |
46 |
|
import java.util.Map; |
47 |
|
import java.util.Vector; |
48 |
|
|
49 |
|
import javax.swing.JInternalFrame; |
50 |
|
|
51 |
|
import compbio.data.msa.MsaWS; |
52 |
|
import compbio.metadata.Argument; |
53 |
|
import compbio.metadata.ChunkHolder; |
54 |
|
import compbio.metadata.JobStatus; |
55 |
|
import compbio.metadata.Preset; |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 349 (349) |
Complexity: 85 |
Complexity Density: 0.35 |
|
57 |
|
class MsaWSThread extends AWS2Thread implements WSClientI |
58 |
|
{ |
59 |
|
boolean submitGaps = false; |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
boolean preserveOrder = true; |
64 |
|
|
65 |
|
|
66 |
|
|
|
|
| 0% |
Uncovered Elements: 190 (190) |
Complexity: 61 |
Complexity Density: 0.58 |
|
67 |
|
class MsaWSJob extends JWs2Job |
68 |
|
{ |
69 |
|
long lastChunk = 0; |
70 |
|
|
71 |
|
WsParamSetI preset = null; |
72 |
|
|
73 |
|
List<Argument> arguments = null; |
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
ArrayList<compbio.data.sequence.FastaSequence> seqs = new ArrayList<compbio.data.sequence.FastaSequence>(); |
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
compbio.data.sequence.Alignment alignment; |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
private boolean returnInput = false; |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
@param |
93 |
|
|
94 |
|
@param |
95 |
|
|
96 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
97 |
0 |
public MsaWSJob(int jobNum, SequenceI[] inSeqs)... |
98 |
|
{ |
99 |
0 |
this.jobnum = jobNum; |
100 |
0 |
if (!prepareInput(inSeqs, 2)) |
101 |
|
{ |
102 |
0 |
submitted = true; |
103 |
0 |
subjobComplete = true; |
104 |
0 |
returnInput = true; |
105 |
|
} |
106 |
|
|
107 |
|
} |
108 |
|
|
109 |
|
Hashtable<String, Map> SeqNames = new Hashtable(); |
110 |
|
|
111 |
|
Vector<String[]> emptySeqs = new Vector(); |
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
@param |
117 |
|
|
118 |
|
@param |
119 |
|
|
120 |
|
@return |
121 |
|
|
122 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 10 |
Complexity Density: 0.53 |
|
123 |
0 |
private boolean prepareInput(SequenceI[] seqs, int minlen)... |
124 |
|
{ |
125 |
0 |
int nseqs = 0; |
126 |
0 |
if (minlen < 0) |
127 |
|
{ |
128 |
0 |
throw new Error(MessageManager.getString( |
129 |
|
"error.implementation_error_minlen_must_be_greater_zero")); |
130 |
|
} |
131 |
0 |
for (int i = 0; i < seqs.length; i++) |
132 |
|
{ |
133 |
0 |
if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) |
134 |
|
{ |
135 |
0 |
nseqs++; |
136 |
|
} |
137 |
|
} |
138 |
0 |
boolean valid = nseqs > 1; |
139 |
0 |
compbio.data.sequence.FastaSequence seq; |
140 |
0 |
for (int i = 0, n = 0; i < seqs.length; i++) |
141 |
|
{ |
142 |
|
|
143 |
0 |
String newname = jalview.analysis.SeqsetUtils.unique_name(i); |
144 |
|
|
145 |
|
|
146 |
|
|
147 |
0 |
SeqNames.put(newname, |
148 |
|
jalview.analysis.SeqsetUtils.SeqCharacterHash(seqs[i])); |
149 |
0 |
if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1) |
150 |
|
{ |
151 |
|
|
152 |
0 |
seq = new compbio.data.sequence.FastaSequence(newname, |
153 |
0 |
(submitGaps) ? seqs[i].getSequenceAsString() |
154 |
|
: AlignSeq.extractGaps( |
155 |
|
jalview.util.Comparison.GapChars, |
156 |
|
seqs[i].getSequenceAsString())); |
157 |
0 |
this.seqs.add(seq); |
158 |
|
} |
159 |
|
else |
160 |
|
{ |
161 |
0 |
String empty = null; |
162 |
0 |
if (seqs[i].getEnd() >= seqs[i].getStart()) |
163 |
|
{ |
164 |
0 |
empty = (submitGaps) ? seqs[i].getSequenceAsString() |
165 |
|
: AlignSeq.extractGaps(jalview.util.Comparison.GapChars, |
166 |
|
seqs[i].getSequenceAsString()); |
167 |
|
} |
168 |
0 |
emptySeqs.add(new String[] { newname, empty }); |
169 |
|
} |
170 |
|
} |
171 |
0 |
return valid; |
172 |
|
} |
173 |
|
|
174 |
|
|
175 |
|
|
176 |
|
@return |
177 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 6 |
Complexity Density: 2 |
|
178 |
0 |
@Override... |
179 |
|
public boolean hasResults() |
180 |
|
{ |
181 |
0 |
if (subjobComplete && isFinished() && (alignment != null |
182 |
|
|| (emptySeqs != null && emptySeqs.size() > 0))) |
183 |
|
{ |
184 |
0 |
return true; |
185 |
|
} |
186 |
0 |
return false; |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
|
@return |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 78 (78) |
Complexity: 18 |
Complexity Density: 0.39 |
|
197 |
0 |
public Object[] getAlignment()... |
198 |
|
{ |
199 |
|
|
200 |
0 |
if (hasResults()) |
201 |
|
{ |
202 |
0 |
SequenceI[] alseqs = null; |
203 |
0 |
char alseq_gapchar = '-'; |
204 |
0 |
int alseq_l = 0; |
205 |
0 |
if (alignment.getSequences().size() > 0) |
206 |
|
{ |
207 |
0 |
alseqs = new SequenceI[alignment.getSequences().size()]; |
208 |
0 |
for (compbio.data.sequence.FastaSequence seq : alignment |
209 |
|
.getSequences()) |
210 |
|
{ |
211 |
0 |
alseqs[alseq_l++] = new Sequence(seq.getId(), |
212 |
|
seq.getSequence()); |
213 |
|
} |
214 |
0 |
alseq_gapchar = alignment.getMetadata().getGapchar(); |
215 |
|
|
216 |
|
} |
217 |
|
|
218 |
0 |
if (emptySeqs.size() > 0) |
219 |
|
{ |
220 |
0 |
SequenceI[] t_alseqs = new SequenceI[alseq_l + emptySeqs.size()]; |
221 |
|
|
222 |
0 |
int i, w = 0; |
223 |
0 |
if (alseq_l > 0) |
224 |
|
{ |
225 |
0 |
for (i = 0, w = alseqs[0].getLength(); i < alseq_l; i++) |
226 |
|
{ |
227 |
0 |
if (w < alseqs[i].getLength()) |
228 |
|
{ |
229 |
0 |
w = alseqs[i].getLength(); |
230 |
|
} |
231 |
0 |
t_alseqs[i] = alseqs[i]; |
232 |
0 |
alseqs[i] = null; |
233 |
|
} |
234 |
|
} |
235 |
|
|
236 |
0 |
int ow = w, nw = w; |
237 |
0 |
for (i = 0, w = emptySeqs.size(); i < w; i++) |
238 |
|
{ |
239 |
0 |
String[] es = emptySeqs.get(i); |
240 |
0 |
if (es != null && es[1] != null) |
241 |
|
{ |
242 |
0 |
int sw = es[1].length(); |
243 |
0 |
if (nw < sw) |
244 |
|
{ |
245 |
0 |
nw = sw; |
246 |
|
} |
247 |
|
} |
248 |
|
} |
249 |
|
|
250 |
0 |
StringBuffer insbuff = new StringBuffer(w); |
251 |
0 |
for (i = 0; i < nw; i++) |
252 |
|
{ |
253 |
0 |
insbuff.append(alseq_gapchar); |
254 |
|
} |
255 |
0 |
if (ow < nw) |
256 |
|
{ |
257 |
0 |
for (i = 0; i < alseq_l; i++) |
258 |
|
{ |
259 |
0 |
int sw = t_alseqs[i].getLength(); |
260 |
0 |
if (nw > sw) |
261 |
|
{ |
262 |
|
|
263 |
0 |
alseqs[i].setSequence(t_alseqs[i].getSequenceAsString() |
264 |
|
+ insbuff.substring(0, sw - nw)); |
265 |
|
} |
266 |
|
} |
267 |
|
} |
268 |
0 |
for (i = 0, w = emptySeqs.size(); i < w; i++) |
269 |
|
{ |
270 |
0 |
String[] es = emptySeqs.get(i); |
271 |
0 |
if (es[1] == null) |
272 |
|
{ |
273 |
0 |
t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence(es[0], |
274 |
|
insbuff.toString(), 1, 0); |
275 |
|
} |
276 |
|
else |
277 |
|
{ |
278 |
0 |
if (es[1].length() < nw) |
279 |
|
{ |
280 |
0 |
t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence( |
281 |
|
es[0], |
282 |
|
es[1] + insbuff.substring(0, nw - es[1].length()), |
283 |
|
1, 1 + es[1].length()); |
284 |
|
} |
285 |
|
else |
286 |
|
{ |
287 |
0 |
t_alseqs[i + alseq_l] = new jalview.datamodel.Sequence( |
288 |
|
es[0], es[1]); |
289 |
|
} |
290 |
|
} |
291 |
|
} |
292 |
0 |
alseqs = t_alseqs; |
293 |
|
} |
294 |
0 |
AlignmentOrder msaorder = new AlignmentOrder(alseqs); |
295 |
|
|
296 |
0 |
jalview.analysis.AlignmentSorter.recoverOrder(alseqs); |
297 |
|
|
298 |
0 |
jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs); |
299 |
0 |
return new Object[] { alseqs, msaorder }; |
300 |
|
} |
301 |
0 |
return null; |
302 |
|
} |
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
307 |
0 |
void cancel()... |
308 |
|
{ |
309 |
0 |
cancelled = true; |
310 |
0 |
subjobComplete = true; |
311 |
0 |
alignment = null; |
312 |
|
} |
313 |
|
|
314 |
|
|
315 |
|
|
316 |
|
@return |
317 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
318 |
0 |
@Override... |
319 |
|
public boolean hasValidInput() |
320 |
|
{ |
321 |
|
|
322 |
|
|
323 |
0 |
if (seqs != null && seqs.size() >= 2) |
324 |
|
{ |
325 |
0 |
return true; |
326 |
|
} |
327 |
0 |
return false; |
328 |
|
} |
329 |
|
|
330 |
|
StringBuffer jobProgress = new StringBuffer(); |
331 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
332 |
0 |
public void setStatus(String string)... |
333 |
|
{ |
334 |
0 |
jobProgress.setLength(0); |
335 |
0 |
jobProgress.append(string); |
336 |
|
} |
337 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
338 |
0 |
@Override... |
339 |
|
public String getStatus() |
340 |
|
{ |
341 |
0 |
return jobProgress.toString(); |
342 |
|
} |
343 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
344 |
0 |
@Override... |
345 |
|
public boolean hasStatus() |
346 |
|
{ |
347 |
0 |
return jobProgress != null; |
348 |
|
} |
349 |
|
|
350 |
|
|
351 |
|
@return |
352 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
353 |
0 |
public long getLastChunk()... |
354 |
|
{ |
355 |
0 |
return lastChunk; |
356 |
|
} |
357 |
|
|
358 |
|
|
359 |
|
@param |
360 |
|
|
361 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
362 |
0 |
public void setLastChunk(long lastChunk)... |
363 |
|
{ |
364 |
0 |
this.lastChunk = lastChunk; |
365 |
|
} |
366 |
|
|
367 |
|
String alignmentProgram = null; |
368 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
369 |
0 |
public String getAlignmentProgram()... |
370 |
|
{ |
371 |
0 |
return alignmentProgram; |
372 |
|
} |
373 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
374 |
0 |
public boolean hasArguments()... |
375 |
|
{ |
376 |
0 |
return (arguments != null && arguments.size() > 0) |
377 |
|
|| (preset != null && preset instanceof JabaWsParamSet); |
378 |
|
} |
379 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 5 |
Complexity Density: 0.83 |
|
380 |
0 |
public List<Argument> getJabaArguments()... |
381 |
|
{ |
382 |
0 |
List<Argument> newargs = new ArrayList<Argument>(); |
383 |
0 |
if (preset != null && preset instanceof JabaWsParamSet) |
384 |
|
{ |
385 |
0 |
newargs.addAll(((JabaWsParamSet) preset).getjabaArguments()); |
386 |
|
} |
387 |
0 |
if (arguments != null && arguments.size() > 0) |
388 |
|
{ |
389 |
0 |
newargs.addAll(arguments); |
390 |
|
} |
391 |
0 |
return newargs; |
392 |
|
} |
393 |
|
|
394 |
|
|
395 |
|
|
396 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 6 |
Complexity Density: 0.6 |
|
397 |
0 |
public void addInitialStatus()... |
398 |
|
{ |
399 |
0 |
if (preset != null) |
400 |
|
{ |
401 |
0 |
jobProgress.append("Using " |
402 |
0 |
+ (preset instanceof JabaPreset ? "Server" : "User") |
403 |
|
+ "Preset: " + preset.getName()); |
404 |
0 |
if (preset instanceof JabaWsParamSet) |
405 |
|
{ |
406 |
0 |
for (Argument opt : ((JabaWsParamSet) preset).getjabaArguments()) |
407 |
|
{ |
408 |
0 |
jobProgress.append( |
409 |
|
opt.getName() + " " + opt.getDefaultValue() + "\n"); |
410 |
|
} |
411 |
|
} |
412 |
|
} |
413 |
0 |
if (arguments != null && arguments.size() > 0) |
414 |
|
{ |
415 |
0 |
jobProgress.append("With custom parameters : \n"); |
416 |
|
|
417 |
0 |
for (Argument opt : arguments) |
418 |
|
{ |
419 |
0 |
jobProgress.append( |
420 |
|
opt.getName() + " " + opt.getDefaultValue() + "\n"); |
421 |
|
} |
422 |
|
} |
423 |
0 |
jobProgress.append("\nJob Output:\n"); |
424 |
|
} |
425 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
426 |
0 |
public boolean isPresetJob()... |
427 |
|
{ |
428 |
0 |
return preset != null && preset instanceof JabaPreset; |
429 |
|
} |
430 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
431 |
0 |
public Preset getServerPreset()... |
432 |
|
{ |
433 |
0 |
return (isPresetJob()) ? ((JabaPreset) preset).p : null; |
434 |
|
} |
435 |
|
} |
436 |
|
|
437 |
|
String alTitle; |
438 |
|
|
439 |
|
AlignmentI dataset; |
440 |
|
|
441 |
|
|
442 |
|
|
443 |
|
@SuppressWarnings("unchecked") |
444 |
|
MsaWS server = null; |
445 |
|
|
446 |
|
|
447 |
|
|
448 |
|
|
449 |
|
@param |
450 |
|
|
451 |
|
@param |
452 |
|
|
453 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
454 |
0 |
private MsaWSThread(MsaWS server, String wsUrl, WebserviceInfo wsinfo,... |
455 |
|
jalview.gui.AlignFrame alFrame, AlignmentView alview, |
456 |
|
String wsname, boolean subgaps, boolean presorder) |
457 |
|
{ |
458 |
0 |
super(alFrame, wsinfo, alview, wsname, wsUrl); |
459 |
0 |
this.server = server; |
460 |
0 |
this.submitGaps = subgaps; |
461 |
0 |
this.preserveOrder = presorder; |
462 |
|
} |
463 |
|
|
464 |
|
|
465 |
|
|
466 |
|
|
467 |
|
@param |
468 |
|
|
469 |
|
@param |
470 |
|
|
471 |
|
@param |
472 |
|
|
473 |
|
@param |
474 |
|
|
475 |
|
@param |
476 |
|
|
477 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 6 |
Complexity Density: 0.29 |
|
478 |
0 |
MsaWSThread(MsaWS server2, WsParamSetI preset, List<Argument> paramset,... |
479 |
|
String wsUrl, WebserviceInfo wsinfo, |
480 |
|
jalview.gui.AlignFrame alFrame, String wsname, String title, |
481 |
|
AlignmentView _msa, boolean subgaps, boolean presorder, |
482 |
|
AlignmentI seqset) |
483 |
|
{ |
484 |
0 |
this(server2, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder); |
485 |
0 |
OutputHeader = wsInfo.getProgressText(); |
486 |
0 |
alTitle = title; |
487 |
0 |
dataset = seqset; |
488 |
|
|
489 |
0 |
SequenceI[][] conmsa = _msa.getVisibleContigs('-'); |
490 |
0 |
if (conmsa != null) |
491 |
|
{ |
492 |
0 |
int nvalid = 0, njobs = conmsa.length; |
493 |
0 |
jobs = new MsaWSJob[njobs]; |
494 |
0 |
for (int j = 0; j < njobs; j++) |
495 |
|
{ |
496 |
0 |
if (j != 0) |
497 |
|
{ |
498 |
0 |
jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]); |
499 |
|
} |
500 |
|
else |
501 |
|
{ |
502 |
0 |
jobs[j] = new MsaWSJob(0, conmsa[j]); |
503 |
|
} |
504 |
0 |
if (((MsaWSJob) jobs[j]).hasValidInput()) |
505 |
|
{ |
506 |
0 |
nvalid++; |
507 |
|
} |
508 |
0 |
((MsaWSJob) jobs[j]).preset = preset; |
509 |
0 |
((MsaWSJob) jobs[j]).arguments = paramset; |
510 |
0 |
((MsaWSJob) jobs[j]).alignmentProgram = wsname; |
511 |
0 |
if (njobs > 0) |
512 |
|
{ |
513 |
0 |
wsinfo.setProgressName("region " + jobs[j].getJobnum(), |
514 |
|
jobs[j].getJobnum()); |
515 |
|
} |
516 |
0 |
wsinfo.setProgressText(jobs[j].getJobnum(), OutputHeader); |
517 |
|
} |
518 |
0 |
validInput = nvalid > 0; |
519 |
|
} |
520 |
|
} |
521 |
|
|
522 |
|
boolean validInput = false; |
523 |
|
|
524 |
|
|
525 |
|
|
526 |
|
@return |
527 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
528 |
0 |
public boolean hasValidInput()... |
529 |
|
{ |
530 |
0 |
return validInput; |
531 |
|
} |
532 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
533 |
0 |
@Override... |
534 |
|
public boolean isCancellable() |
535 |
|
{ |
536 |
0 |
return true; |
537 |
|
} |
538 |
|
|
|
|
| 0% |
Uncovered Elements: 34 (34) |
Complexity: 9 |
Complexity Density: 0.38 |
|
539 |
0 |
@Override... |
540 |
|
public void cancelJob() |
541 |
|
{ |
542 |
0 |
if (!jobComplete && jobs != null) |
543 |
|
{ |
544 |
0 |
boolean cancelled = true; |
545 |
0 |
for (int job = 0; job < jobs.length; job++) |
546 |
|
{ |
547 |
0 |
if (jobs[job].isSubmitted() && !jobs[job].isSubjobComplete()) |
548 |
|
{ |
549 |
0 |
String cancelledMessage = ""; |
550 |
0 |
try |
551 |
|
{ |
552 |
0 |
boolean cancelledJob = server.cancelJob(jobs[job].getJobId()); |
553 |
0 |
if (true) |
554 |
|
{ |
555 |
|
|
556 |
|
|
557 |
|
|
558 |
|
|
559 |
0 |
cancelledMessage = "Job cancelled."; |
560 |
0 |
((MsaWSJob) jobs[job]).cancel(); |
561 |
|
|
562 |
0 |
wsInfo.setStatus(jobs[job].getJobnum(), |
563 |
|
WebserviceInfo.STATE_CANCELLED_OK); |
564 |
|
} |
565 |
|
else |
566 |
|
{ |
567 |
|
|
568 |
0 |
cancelledMessage += "Server cannot cancel this job. just close the window.\n"; |
569 |
0 |
cancelled = false; |
570 |
|
|
571 |
|
|
572 |
|
} |
573 |
|
} catch (Exception exc) |
574 |
|
{ |
575 |
0 |
cancelledMessage += ("\nProblems cancelling the job : Exception received...\n" |
576 |
|
+ exc + "\n"); |
577 |
0 |
Console.warn( |
578 |
|
"Exception whilst cancelling " + jobs[job].getJobId(), |
579 |
|
exc); |
580 |
|
} |
581 |
0 |
wsInfo.setProgressText(jobs[job].getJobnum(), |
582 |
|
OutputHeader + cancelledMessage + "\n"); |
583 |
|
} |
584 |
|
else |
585 |
|
{ |
586 |
|
|
587 |
0 |
jobs[job].setSubjobComplete(true); |
588 |
0 |
wsInfo.setStatus(jobs[job].getJobnum(), |
589 |
|
WebserviceInfo.STATE_CANCELLED_OK); |
590 |
|
|
591 |
|
} |
592 |
|
} |
593 |
0 |
if (cancelled) |
594 |
|
{ |
595 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK); |
596 |
0 |
jobComplete = true; |
597 |
|
} |
598 |
0 |
this.interrupt(); |
599 |
|
} |
600 |
|
else |
601 |
|
{ |
602 |
0 |
if (!jobComplete) |
603 |
|
{ |
604 |
0 |
wsInfo.setProgressText(OutputHeader |
605 |
|
+ "Server cannot cancel this job because it has not been submitted properly. just close the window.\n"); |
606 |
|
} |
607 |
|
} |
608 |
|
} |
609 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
610 |
0 |
@Override... |
611 |
|
public void pollJob(AWsJob job) throws Exception |
612 |
|
{ |
613 |
|
|
614 |
0 |
MsaWSJob j = ((MsaWSJob) job); |
615 |
|
|
616 |
|
|
617 |
|
|
618 |
0 |
j.setjobStatus(server.getJobStatus(job.getJobId())); |
619 |
0 |
updateJobProgress(j); |
620 |
|
} |
621 |
|
|
622 |
|
|
623 |
|
|
624 |
|
@param |
625 |
|
@return |
626 |
|
@throws |
627 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 5 |
Complexity Density: 0.33 |
|
628 |
0 |
protected boolean updateJobProgress(MsaWSJob j) throws Exception... |
629 |
|
{ |
630 |
0 |
StringBuffer response = j.jobProgress; |
631 |
0 |
long lastchunk = j.getLastChunk(); |
632 |
0 |
boolean changed = false; |
633 |
0 |
do |
634 |
|
{ |
635 |
0 |
j.setLastChunk(lastchunk); |
636 |
0 |
ChunkHolder chunk = server.pullExecStatistics(j.getJobId(), |
637 |
|
lastchunk); |
638 |
0 |
if (chunk != null) |
639 |
|
{ |
640 |
0 |
changed |= chunk.getChunk().length() > 0; |
641 |
0 |
response.append(chunk.getChunk()); |
642 |
0 |
lastchunk = chunk.getNextPosition(); |
643 |
0 |
try |
644 |
|
{ |
645 |
0 |
Thread.sleep(50); |
646 |
|
} catch (InterruptedException x) |
647 |
|
{ |
648 |
|
} |
649 |
0 |
; |
650 |
|
} |
651 |
0 |
; |
652 |
0 |
} while (lastchunk >= 0 && j.getLastChunk() != lastchunk); |
653 |
0 |
return changed; |
654 |
|
} |
655 |
|
|
|
|
| 0% |
Uncovered Elements: 65 (65) |
Complexity: 15 |
Complexity Density: 0.31 |
|
656 |
0 |
@Override... |
657 |
|
public void StartJob(AWsJob job) |
658 |
|
{ |
659 |
0 |
Exception lex = null; |
660 |
|
|
661 |
0 |
if (!(job instanceof MsaWSJob)) |
662 |
|
{ |
663 |
0 |
throw new Error(MessageManager.formatMessage( |
664 |
|
"error.implementation_error_msawbjob_called", new String[] |
665 |
|
{ job.getClass().toString() })); |
666 |
|
} |
667 |
0 |
MsaWSJob j = (MsaWSJob) job; |
668 |
0 |
if (j.isSubmitted()) |
669 |
|
{ |
670 |
0 |
if (Console.isDebugEnabled()) |
671 |
|
{ |
672 |
0 |
Console.debug( |
673 |
|
"Tried to submit an already submitted job " + j.getJobId()); |
674 |
|
} |
675 |
0 |
return; |
676 |
|
} |
677 |
|
|
678 |
|
|
679 |
0 |
if (j.seqs == null || j.seqs.size() == 0) |
680 |
|
{ |
681 |
|
|
682 |
0 |
j.setjobStatus(JobStatus.FINISHED); |
683 |
0 |
j.setStatus(MessageManager.getString("label.empty_alignment_job")); |
684 |
|
} |
685 |
0 |
try |
686 |
|
{ |
687 |
0 |
j.addInitialStatus(); |
688 |
|
|
689 |
0 |
if (j.isPresetJob()) |
690 |
|
{ |
691 |
0 |
j.setJobId(server.presetAlign(j.seqs, j.getServerPreset())); |
692 |
|
} |
693 |
0 |
else if (j.hasArguments()) |
694 |
|
{ |
695 |
0 |
j.setJobId(server.customAlign(j.seqs, j.getJabaArguments())); |
696 |
|
} |
697 |
|
else |
698 |
|
{ |
699 |
0 |
j.setJobId(server.align(j.seqs)); |
700 |
|
} |
701 |
|
|
702 |
0 |
if (j.getJobId() != null) |
703 |
|
{ |
704 |
0 |
j.setSubmitted(true); |
705 |
0 |
j.setSubjobComplete(false); |
706 |
|
|
707 |
0 |
return; |
708 |
|
} |
709 |
|
else |
710 |
|
{ |
711 |
0 |
throw new Exception(MessageManager.formatMessage( |
712 |
|
"exception.web_service_returned_null_try_later", |
713 |
|
new String[] |
714 |
|
{ WsUrl })); |
715 |
|
} |
716 |
|
} catch (compbio.metadata.UnsupportedRuntimeException _lex) |
717 |
|
{ |
718 |
0 |
lex = _lex; |
719 |
0 |
wsInfo.appendProgressText(MessageManager.formatMessage( |
720 |
|
"info.job_couldnt_be_run_server_doesnt_support_program", |
721 |
|
new String[] |
722 |
|
{ _lex.getMessage() })); |
723 |
0 |
wsInfo.warnUser(_lex.getMessage(), |
724 |
|
MessageManager.getString("warn.service_not_supported")); |
725 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); |
726 |
0 |
wsInfo.setStatus(j.getJobnum(), |
727 |
|
WebserviceInfo.STATE_STOPPED_SERVERERROR); |
728 |
|
} catch (compbio.metadata.LimitExceededException _lex) |
729 |
|
{ |
730 |
0 |
lex = _lex; |
731 |
0 |
wsInfo.appendProgressText(MessageManager.formatMessage( |
732 |
|
"info.job_couldnt_be_run_exceeded_hard_limit", new String[] |
733 |
|
{ _lex.getMessage() })); |
734 |
0 |
wsInfo.warnUser(_lex.getMessage(), |
735 |
|
MessageManager.getString("warn.input_is_too_big")); |
736 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); |
737 |
0 |
wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_ERROR); |
738 |
|
} catch (compbio.metadata.WrongParameterException _lex) |
739 |
|
{ |
740 |
0 |
lex = _lex; |
741 |
0 |
wsInfo.warnUser(_lex.getMessage(), |
742 |
|
MessageManager.getString("warn.invalid_job_param_set")); |
743 |
0 |
wsInfo.appendProgressText(MessageManager.formatMessage( |
744 |
|
"info.job_couldnt_be_run_incorrect_param_setting", |
745 |
|
new String[] |
746 |
|
{ _lex.getMessage() })); |
747 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); |
748 |
0 |
wsInfo.setStatus(j.getJobnum(), WebserviceInfo.STATE_STOPPED_ERROR); |
749 |
|
} catch (Error e) |
750 |
|
{ |
751 |
|
|
752 |
0 |
jalview.bin.Console.errPrintln(WebServiceName |
753 |
|
+ "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" |
754 |
|
+ "When contacting Server:" + WsUrl + "\n"); |
755 |
0 |
e.printStackTrace(System.err); |
756 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); |
757 |
0 |
wsInfo.setStatus(j.getJobnum(), |
758 |
|
WebserviceInfo.STATE_STOPPED_SERVERERROR); |
759 |
|
} catch (Exception e) |
760 |
|
{ |
761 |
|
|
762 |
0 |
jalview.bin.Console.errPrintln(WebServiceName |
763 |
|
+ "Client: Failed to submit the sequences for alignment (probably a server side problem)\n" |
764 |
|
+ "When contacting Server:" + WsUrl + "\n"); |
765 |
0 |
e.printStackTrace(System.err); |
766 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR); |
767 |
0 |
wsInfo.setStatus(j.getJobnum(), |
768 |
|
WebserviceInfo.STATE_STOPPED_SERVERERROR); |
769 |
|
} finally |
770 |
|
{ |
771 |
0 |
if (!j.isSubmitted()) |
772 |
|
{ |
773 |
|
|
774 |
|
|
775 |
|
|
776 |
0 |
j.setAllowedServerExceptions(0); |
777 |
0 |
wsInfo.appendProgressText(j.getJobnum(), MessageManager.getString( |
778 |
|
"info.failed_to_submit_sequences_for_alignment")); |
779 |
|
} |
780 |
|
} |
781 |
|
} |
782 |
|
|
|
|
| 0% |
Uncovered Elements: 72 (72) |
Complexity: 20 |
Complexity Density: 0.38 |
|
783 |
0 |
@Override... |
784 |
|
public void parseResult() |
785 |
|
{ |
786 |
0 |
long progbar = System.currentTimeMillis(); |
787 |
0 |
wsInfo.setProgressBar( |
788 |
|
MessageManager.getString("status.collecting_job_results"), |
789 |
|
progbar); |
790 |
0 |
int results = 0; |
791 |
0 |
JobStateSummary finalState = new JobStateSummary(); |
792 |
0 |
try |
793 |
|
{ |
794 |
0 |
for (int j = 0; j < jobs.length; j++) |
795 |
|
{ |
796 |
0 |
MsaWSJob msjob = ((MsaWSJob) jobs[j]); |
797 |
0 |
if (jobs[j].isFinished() && msjob.alignment == null) |
798 |
|
{ |
799 |
0 |
int nunchanged = 3, nexcept = 3; |
800 |
0 |
boolean jpchanged = false, jpex = false; |
801 |
0 |
do |
802 |
|
{ |
803 |
0 |
try |
804 |
|
{ |
805 |
0 |
jpchanged = updateJobProgress(msjob); |
806 |
0 |
jpex = false; |
807 |
0 |
if (jpchanged) |
808 |
|
{ |
809 |
0 |
nexcept = 3; |
810 |
|
} |
811 |
|
} catch (Exception e) |
812 |
|
{ |
813 |
|
|
814 |
0 |
Console.warn( |
815 |
|
"Exception when retrieving remaining Job progress data for job " |
816 |
|
+ msjob.getJobId() + " on server " + WsUrl); |
817 |
0 |
e.printStackTrace(); |
818 |
0 |
nexcept--; |
819 |
0 |
nunchanged = 3; |
820 |
|
|
821 |
0 |
jpex = true; |
822 |
0 |
jpchanged = false; |
823 |
|
} |
824 |
0 |
if (!jpchanged) |
825 |
|
{ |
826 |
0 |
try |
827 |
|
{ |
828 |
0 |
Thread.sleep(jpex ? 2400 : 1200); |
829 |
|
|
830 |
|
} catch (Exception ex) |
831 |
|
{ |
832 |
|
} |
833 |
0 |
; |
834 |
0 |
nunchanged--; |
835 |
|
} |
836 |
0 |
} while (nunchanged > 0 && nexcept > 0); |
837 |
|
|
838 |
0 |
if (Console.isDebugEnabled()) |
839 |
|
{ |
840 |
0 |
jalview.bin.Console.outPrintln("Job Execution file for job: " |
841 |
|
+ msjob.getJobId() + " on server " + WsUrl); |
842 |
0 |
jalview.bin.Console.outPrintln(msjob.getStatus()); |
843 |
0 |
jalview.bin.Console.outPrintln("*** End of status"); |
844 |
|
|
845 |
|
} |
846 |
0 |
try |
847 |
|
{ |
848 |
0 |
msjob.alignment = server.getResult(msjob.getJobId()); |
849 |
|
} catch (compbio.metadata.ResultNotAvailableException e) |
850 |
|
{ |
851 |
|
|
852 |
|
|
853 |
0 |
Console.debug( |
854 |
|
"Results not available for finished job - marking as broken job.", |
855 |
|
e); |
856 |
0 |
msjob.jobProgress.append( |
857 |
|
"\nResult not available. Probably due to invalid input or parameter settings. Server error message below:\n\n" |
858 |
|
+ e.getLocalizedMessage()); |
859 |
0 |
msjob.setjobStatus(JobStatus.FAILED); |
860 |
|
} catch (Exception e) |
861 |
|
{ |
862 |
0 |
Console.error("Couldn't get Alignment for job.", e); |
863 |
|
|
864 |
0 |
msjob.setjobStatus(JobStatus.UNDEFINED); |
865 |
|
} |
866 |
|
} |
867 |
0 |
finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]); |
868 |
0 |
if (jobs[j].isSubmitted() && jobs[j].isSubjobComplete() |
869 |
|
&& jobs[j].hasResults()) |
870 |
|
{ |
871 |
0 |
results++; |
872 |
0 |
compbio.data.sequence.Alignment alignment = ((MsaWSJob) jobs[j]).alignment; |
873 |
0 |
if (alignment != null) |
874 |
|
{ |
875 |
|
|
876 |
|
|
877 |
|
|
878 |
|
|
879 |
|
|
880 |
|
|
881 |
|
|
882 |
|
|
883 |
|
|
884 |
|
} |
885 |
|
} |
886 |
|
} |
887 |
|
} catch (Exception ex) |
888 |
|
{ |
889 |
|
|
890 |
0 |
Console.error( |
891 |
|
"Unexpected exception when processing results for " + alTitle, |
892 |
|
ex); |
893 |
0 |
wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR); |
894 |
|
} |
895 |
0 |
if (results > 0) |
896 |
|
{ |
897 |
0 |
wsInfo.showResultsNewFrame |
898 |
|
.addActionListener(new java.awt.event.ActionListener() |
899 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
900 |
0 |
@Override... |
901 |
|
public void actionPerformed(java.awt.event.ActionEvent evt) |
902 |
|
{ |
903 |
0 |
displayResults(true); |
904 |
|
} |
905 |
|
}); |
906 |
0 |
wsInfo.mergeResults |
907 |
|
.addActionListener(new java.awt.event.ActionListener() |
908 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
909 |
0 |
@Override... |
910 |
|
public void actionPerformed(java.awt.event.ActionEvent evt) |
911 |
|
{ |
912 |
0 |
displayResults(false); |
913 |
|
} |
914 |
|
}); |
915 |
0 |
wsInfo.setResultsReady(); |
916 |
|
} |
917 |
|
else |
918 |
|
{ |
919 |
0 |
wsInfo.setFinishedNoResults(); |
920 |
|
} |
921 |
0 |
updateGlobalStatus(finalState); |
922 |
0 |
wsInfo.setProgressBar(null, progbar); |
923 |
|
} |
924 |
|
|
925 |
|
|
926 |
|
|
927 |
|
|
928 |
|
|
929 |
|
@param |
930 |
|
|
|
|
| 0% |
Uncovered Elements: 41 (41) |
Complexity: 7 |
Complexity Density: 0.24 |
|
931 |
0 |
void displayResults(boolean newFrame)... |
932 |
|
{ |
933 |
|
|
934 |
0 |
List<AlignmentOrder> alorders = new ArrayList<AlignmentOrder>(); |
935 |
0 |
SequenceI[][] results = new SequenceI[jobs.length][]; |
936 |
0 |
AlignmentOrder[] orders = new AlignmentOrder[jobs.length]; |
937 |
0 |
String lastProgram = null; |
938 |
0 |
MsaWSJob msjob; |
939 |
0 |
for (int j = 0; j < jobs.length; j++) |
940 |
|
{ |
941 |
0 |
if (jobs[j].hasResults()) |
942 |
|
{ |
943 |
0 |
msjob = (MsaWSJob) jobs[j]; |
944 |
0 |
Object[] res = msjob.getAlignment(); |
945 |
0 |
lastProgram = msjob.getAlignmentProgram(); |
946 |
0 |
alorders.add((AlignmentOrder) res[1]); |
947 |
0 |
results[j] = (SequenceI[]) res[0]; |
948 |
0 |
orders[j] = (AlignmentOrder) res[1]; |
949 |
|
|
950 |
|
|
951 |
|
} |
952 |
|
else |
953 |
|
{ |
954 |
0 |
results[j] = null; |
955 |
|
} |
956 |
|
} |
957 |
0 |
Object[] newview = input.getUpdatedView(results, orders, getGapChar()); |
958 |
|
|
959 |
0 |
for (int j = 0; j < jobs.length; j++) |
960 |
|
{ |
961 |
0 |
results[j] = null; |
962 |
0 |
orders[j] = null; |
963 |
|
} |
964 |
0 |
SequenceI[] alignment = (SequenceI[]) newview[0]; |
965 |
0 |
HiddenColumns hidden = (HiddenColumns) newview[1]; |
966 |
0 |
Alignment al = new Alignment(alignment); |
967 |
|
|
968 |
0 |
if (lastProgram != null) |
969 |
|
{ |
970 |
0 |
al.setProperty("Alignment Program", lastProgram); |
971 |
|
} |
972 |
|
|
973 |
0 |
if (dataset != null) |
974 |
|
{ |
975 |
0 |
al.setDataset(dataset); |
976 |
|
} |
977 |
|
|
978 |
0 |
propagateDatasetMappings(al); |
979 |
|
|
980 |
|
|
981 |
0 |
if (newFrame) |
982 |
|
{ |
983 |
0 |
displayInNewFrame(al, alorders, hidden); |
984 |
|
|
985 |
|
} |
986 |
|
else |
987 |
|
{ |
988 |
|
|
989 |
0 |
jalview.bin.Console.outPrintln("MERGE WITH OLD FRAME"); |
990 |
|
|
991 |
|
|
992 |
|
|
993 |
|
} |
994 |
|
} |
995 |
|
|
996 |
|
|
997 |
|
|
998 |
|
|
999 |
|
@param |
1000 |
|
@param |
1001 |
|
@param |
1002 |
|
|
|
|
| 0% |
Uncovered Elements: 31 (31) |
Complexity: 8 |
Complexity Density: 0.38 |
|
1003 |
0 |
protected void displayInNewFrame(AlignmentI al,... |
1004 |
|
List<AlignmentOrder> alorders, HiddenColumns hidden) |
1005 |
|
{ |
1006 |
0 |
AlignFrame af = new AlignFrame(al, hidden, AlignFrame.DEFAULT_WIDTH, |
1007 |
|
AlignFrame.DEFAULT_HEIGHT); |
1008 |
|
|
1009 |
|
|
1010 |
0 |
af.getFeatureRenderer().transferSettings(this.featureSettings); |
1011 |
|
|
1012 |
0 |
if (alorders.size() > 0) |
1013 |
|
{ |
1014 |
0 |
addSortByMenuItems(af, alorders); |
1015 |
|
} |
1016 |
|
|
1017 |
|
|
1018 |
|
|
1019 |
|
|
1020 |
|
|
1021 |
|
|
1022 |
|
|
1023 |
0 |
AlignFrame requestedBy = getRequestingAlignFrame(); |
1024 |
0 |
if (requestedBy != null && requestedBy.getSplitViewContainer() != null |
1025 |
|
&& requestedBy.getSplitViewContainer() |
1026 |
|
.getComplement(requestedBy) != null) |
1027 |
|
{ |
1028 |
0 |
AlignmentI complement = requestedBy.getSplitViewContainer() |
1029 |
|
.getComplement(requestedBy); |
1030 |
0 |
String complementTitle = requestedBy.getSplitViewContainer() |
1031 |
|
.getComplementTitle(requestedBy); |
1032 |
|
|
1033 |
|
|
1034 |
0 |
AlignmentI copyComplement = new Alignment(complement); |
1035 |
|
|
1036 |
0 |
copyComplement.setGapCharacter(complement.getGapCharacter()); |
1037 |
|
|
1038 |
0 |
copyComplement.setDataset(complement.getDataset()); |
1039 |
0 |
copyComplement.alignAs(al); |
1040 |
0 |
if (copyComplement.getHeight() > 0) |
1041 |
|
{ |
1042 |
0 |
af.setTitle(alTitle); |
1043 |
0 |
AlignFrame af2 = new AlignFrame(copyComplement, |
1044 |
|
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); |
1045 |
0 |
af2.setTitle(complementTitle); |
1046 |
0 |
String linkedTitle = MessageManager |
1047 |
|
.getString("label.linked_view_title"); |
1048 |
0 |
JInternalFrame splitFrame = new SplitFrame( |
1049 |
0 |
al.isNucleotide() ? af : af2, al.isNucleotide() ? af2 : af); |
1050 |
0 |
Desktop.addInternalFrame(splitFrame, linkedTitle, -1, -1); |
1051 |
0 |
return; |
1052 |
|
} |
1053 |
|
} |
1054 |
|
|
1055 |
|
|
1056 |
|
|
1057 |
|
|
1058 |
0 |
Desktop.addInternalFrame(af, alTitle, AlignFrame.DEFAULT_WIDTH, |
1059 |
|
AlignFrame.DEFAULT_HEIGHT); |
1060 |
|
} |
1061 |
|
|
1062 |
|
|
1063 |
|
|
1064 |
|
|
1065 |
|
@param |
1066 |
|
@param |
1067 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 8 |
Complexity Density: 0.47 |
|
1068 |
0 |
protected void addSortByMenuItems(AlignFrame af,... |
1069 |
|
List<AlignmentOrder> alorders) |
1070 |
|
{ |
1071 |
|
|
1072 |
0 |
if (alorders.size() == 1) |
1073 |
|
{ |
1074 |
0 |
af.addSortByOrderMenuItem(WebServiceName + " Ordering", |
1075 |
|
alorders.get(0)); |
1076 |
|
} |
1077 |
|
else |
1078 |
|
{ |
1079 |
|
|
1080 |
0 |
List<String> names = new ArrayList<String>(); |
1081 |
0 |
for (int i = 0, l = alorders.size(); i < l; i++) |
1082 |
|
{ |
1083 |
0 |
String orderName = " Region " + i; |
1084 |
0 |
int j = i + 1; |
1085 |
|
|
1086 |
0 |
while (j < l) |
1087 |
|
{ |
1088 |
0 |
if (alorders.get(i).equals(alorders.get(j))) |
1089 |
|
{ |
1090 |
0 |
alorders.remove(j); |
1091 |
0 |
l--; |
1092 |
0 |
orderName += "," + j; |
1093 |
|
} |
1094 |
|
else |
1095 |
|
{ |
1096 |
0 |
j++; |
1097 |
|
} |
1098 |
|
} |
1099 |
|
|
1100 |
0 |
if (i == 0 && j == 1) |
1101 |
|
{ |
1102 |
0 |
names.add(""); |
1103 |
|
} |
1104 |
|
else |
1105 |
|
{ |
1106 |
0 |
names.add(orderName); |
1107 |
|
} |
1108 |
|
} |
1109 |
0 |
for (int i = 0, l = alorders.size(); i < l; i++) |
1110 |
|
{ |
1111 |
0 |
af.addSortByOrderMenuItem( |
1112 |
|
WebServiceName + (names.get(i)) + " Ordering", |
1113 |
|
alorders.get(i)); |
1114 |
|
} |
1115 |
|
} |
1116 |
|
} |
1117 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1118 |
0 |
@Override... |
1119 |
|
public boolean canMergeResults() |
1120 |
|
{ |
1121 |
0 |
return false; |
1122 |
|
} |
1123 |
|
} |