}
}
LOGGER.info("doSearch old results contained " + oldRes.size() + " item(s)");
Collection<PhyloTree> newRes;
PhyloTreeService treeService = getSearchService().getPhyloTreeService();
TaxonVariant[] taxonVariant = new TaxonVariant[taxon.length];
List<String> resolutionError = new LinkedList<String> ();
for (int i=0; i<taxon.length; i++) {
if (taxon[i] == null) continue;
if (taxon[i].equals(""))
resolutionError.add("TaxonVariant name " + i + " missing");
Set<TaxonVariant> tvSet = getTaxonLabelService().findTaxonVariantByName(taxon[i]);
taxonVariant[i] = tvSet.isEmpty() ? null : tvSet.iterator().next(); // FIXME: This is not really the right behavior
if (taxonVariant[i] == null)
resolutionError.add("Couldn't resolve TaxonVariant '" + taxon[i] + "'");
else
LOGGER.debug("input '" + taxon[i] + "' resolved to TV " + taxonVariant[i].getId() + " ('" + taxonVariant[i].getFullName() + "')");
}
if (! resolutionError.isEmpty()) {
addMessages(request, resolutionError);
return new ModelAndView("search/treeTopSearch", Constants.RESULT_SET, oldRes);
}
switch (searchType) {
case topology3Search:
checkTaxa(taxonVariant, 3);
newRes = treeService.findByTopology3(taxonVariant[0], taxonVariant[1], taxonVariant[2]);
break;
case topology4aSearch:
checkTaxa(taxonVariant, 4);
newRes = treeService.findByTopology4a(taxonVariant[0], taxonVariant[1], taxonVariant[2], taxonVariant[3]);
break;
case topology4sSearch:
checkTaxa(taxonVariant, 4);
newRes = treeService.findByTopology4s(taxonVariant[0], taxonVariant[1], taxonVariant[2], taxonVariant[3]);
break;
default:
throw new Error ("Unknown search type '" + searchType + "'");
}