From a91a52548e49110430612f5f08c7e2a1c3a3453f Mon Sep 17 00:00:00 2001 From: Jim Blake Date: Tue, 15 Apr 2014 17:12:55 -0400 Subject: [PATCH] Cleanup - remove obsolete VitroQuery and related classes. --- .../vitro/webapp/search/beans/VitroQuery.java | 55 ------------------- .../search/beans/VitroQueryFactory.java | 10 ---- .../search/beans/VitroQueryWrapper.java | 43 --------------- .../controller/PagedSearchController.java | 14 +---- 4 files changed, 1 insertion(+), 121 deletions(-) delete mode 100644 webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQuery.java delete mode 100644 webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryFactory.java delete mode 100644 webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQuery.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQuery.java deleted file mode 100644 index 96da868d7..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQuery.java +++ /dev/null @@ -1,55 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.search.beans; - -import java.util.Collections; -import java.util.Map; - -import org.joda.time.DateTime; - -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.search.SearchException; - -public abstract class VitroQuery { - /** - * The parameter name for http requests. - */ - public static final String QUERY_PARAMETER_NAME = "querytext"; - public static final String QUERY_PARAMETER_EARLIEST = "earliest"; - public static final String QUERY_PARAMETER_LATEST = "latest"; - public static final String QUERY_PARAMETER_IGNORE_TIMESTAMP= "ignore_timestamp"; - - DateTime earliest; - DateTime latest; - Map parameters = null; - - /** - * Make a VitroQuery with the request parameters - * for when the query needs to be created. - */ - public VitroQuery(VitroRequest request){ - parameters =request.getParameterMap(); - if( parameters == null ) - parameters = Collections.EMPTY_MAP; - } - - /** - * Gets the parameters that were passed into this query from the - * HttpRequest so they can be displayed to the user on return to a - * search form. - * - * @return - */ - public Map getParameters(){ - return parameters; - } - - public abstract String getTerms(); - - /** - * This is intended to return an specilized query object - * for your implementation of the search. - * @return - */ - public abstract Object getQuery() throws SearchException; -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryFactory.java deleted file mode 100644 index 2d3d016dc..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryFactory.java +++ /dev/null @@ -1,10 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.search.beans; - -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.search.SearchException; - -public interface VitroQueryFactory { - public VitroQuery getQuery(VitroRequest req) throws SearchException; -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java deleted file mode 100644 index 7507d37b5..000000000 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/beans/VitroQueryWrapper.java +++ /dev/null @@ -1,43 +0,0 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.search.beans; - -/** - * VitroQueryWrapper holds the information about the last query that the - * user made. - * - * @author bdc34 - * - */ -public class VitroQueryWrapper { - private VitroQuery query = null; - private int requestCount = 0; - private long searchTime = 0; - - - public VitroQueryWrapper(VitroQuery q, int reqCount, long d){ - this.setSearchTime(d); - this.setQuery(q); - this.setRequestCount(reqCount); - } - - public long getSearchTime() { - return searchTime; - } - public void setSearchTime(long searchTime) { - this.searchTime = searchTime; - } - public VitroQuery getQuery() { - return query; - } - public void setQuery(VitroQuery query) { - this.query = query; - } - public int getRequestCount() { - return requestCount; - } - public void setRequestCount(int requestCount) { - this.requestCount = requestCount; - } - -} diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java index e863a2ff8..b777733b3 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/PagedSearchController.java @@ -48,10 +48,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache; import edu.cornell.mannlib.vitro.webapp.i18n.I18n; import edu.cornell.mannlib.vitro.webapp.search.IndexConstants; -import edu.cornell.mannlib.vitro.webapp.search.SearchException; import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; -import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQuery; -import edu.cornell.mannlib.vitro.webapp.search.beans.VitroQueryFactory; import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.LinkTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult.IndividualSearchResult; @@ -163,7 +160,7 @@ public class PagedSearchController extends FreemarkerHttpServlet { int startIndex = getStartIndex(vreq); int hitsPerPage = getHitsPerPage( vreq ); - String queryText = vreq.getParameter(VitroQuery.QUERY_PARAMETER_NAME); + String queryText = vreq.getParameter(PARAM_QUERY_TEXT); log.debug("Query text is \""+ queryText + "\""); @@ -673,15 +670,6 @@ public class PagedSearchController extends FreemarkerHttpServlet { public static final int MAX_QUERY_LENGTH = 500; - public VitroQueryFactory getQueryFactory() { - throw new Error("PagedSearchController.getQueryFactory() is unimplemented"); - } - - @SuppressWarnings("rawtypes") - public List search(VitroQuery query) throws SearchException { - throw new Error("PagedSearchController.search() is unimplemented"); - } - protected boolean isRequestedFormatXml(VitroRequest req){ if( req != null ){ String param = req.getParameter(PARAM_XML_REQUEST);