From: <hs...@us...> - 2011-05-04 18:02:29
|
Revision: 827 http://treebase.svn.sourceforge.net/treebase/?rev=827&view=rev Author: hshyket Date: 2011-05-04 18:02:23 +0000 (Wed, 04 May 2011) Log Message: ----------- Updating matrix search so that no matrices appear whose studies are not published. Doing the same thing for tree search with the addition of not displaying any orphaned trees. Modified Paths: -------------- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java 2011-05-03 19:21:24 UTC (rev 826) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/MatrixSearchController.java 2011-05-04 18:02:23 UTC (rev 827) @@ -223,12 +223,12 @@ } - // XXX need to filter out orphaned matrices + // XXX need to filter out orphaned matrices or matrices whose studies are unpublished Collection<Matrix> orphanedMatrices = new HashSet<Matrix>(); for ( Matrix m : matches ) { - if ( m.getStudy() == null ) { + if ( m.getStudy() == null || (m.getStudy().isPublished() == false) ) { orphanedMatrices.add(m); - } + } } matches.removeAll(orphanedMatrices); return matches; Modified: trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java =================================================================== --- trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2011-05-03 19:21:24 UTC (rev 826) +++ trunk/treebase-web/src/main/java/org/cipres/treebase/web/controllers/TreeSearchController.java 2011-05-04 18:02:23 UTC (rev 827) @@ -14,6 +14,7 @@ import org.apache.log4j.Logger; import org.cipres.treebase.TreebaseUtil; import org.cipres.treebase.RangeExpression.MalformedRangeExpression; +import org.cipres.treebase.domain.matrix.Matrix; import org.cipres.treebase.domain.search.SearchResults; import org.cipres.treebase.domain.search.SearchResultsType; import org.cipres.treebase.domain.search.TreeSearchResults; @@ -101,6 +102,16 @@ } else { throw new Error("Unknown search button name '" + buttonName + "'"); } + + // XXX need to filter out orphaned matrices or matrices whose studies are unpublished + Collection<PhyloTree> orphanedTrees = new HashSet<PhyloTree>(); + for ( PhyloTree t : matches ) { + if (t.getStudy() == null || (t.getStudy().isPublished() == false)){ + orphanedTrees.add(t); + } + } + matches.removeAll(orphanedTrees); + SearchResults<PhyloTree> newRes = intersectSearchResults(oldRes, new TreeSearchResults(matches), new RequestMessageSetter(request), "No matching trees found"); saveSearchResults(request, newRes); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |