From: <bra...@us...> - 2007-04-17 21:56:39
|
Revision: 1726 http://archive-access.svn.sourceforge.net/archive-access/?rev=1726&view=rev Author: bradtofel Date: 2007-04-17 14:56:37 -0700 (Tue, 17 Apr 2007) Log Message: ----------- INITIAL REV: two utility classes for partitioning the SearchResult objects in a SearchResults object by URL, accumulating metadata about the captures for each URL. Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java Added: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java 2007-04-17 21:56:37 UTC (rev 1726) @@ -0,0 +1,152 @@ +/* PathQuerySearchResultPartition + * + * $Id$ + * + * Created on 4:10:12 PM Apr 16, 2007. + * + * Copyright (C) 2007 Internet Archive. + * + * This file is part of wayback-core. + * + * wayback-core is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * wayback-core is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with wayback-core; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package org.archive.wayback.query; + +import java.util.Date; +import java.util.HashMap; + +import org.archive.wayback.ResultURIConverter; +import org.archive.wayback.WaybackConstants; +import org.archive.wayback.core.SearchResult; +import org.archive.wayback.core.Timestamp; + +/** + * UI Utility object for storing information about multiple captures of an URL. + * This object tracks the url in question, total number of captures of that URL, + * the first Date captured, the last Date captured, and the unique Digests for + * all captures. + * + * @author brad + * @version $Date$, $Revision$ + */ +public class PathQuerySearchResultPartition { + private SearchResult firstResult = null; + private int numResults; + private Date firstDate; + private Date lastDate; + private String url; + private HashMap<String,Object> digests; + private ResultURIConverter uriConverter = null; + /** + * Constructor + * @param result + * @param uriConverter + */ + public PathQuerySearchResultPartition(SearchResult result, + ResultURIConverter uriConverter) { + firstResult = result; + digests = new HashMap<String,Object>(); + digests.put(searchResultToDigest(result),null); + url = searchResultToCanonicalUrl(result); + numResults = 1; + firstDate = searchResultToDate(result); + lastDate = searchResultToDate(result); + this.uriConverter = uriConverter; + } + + /** + * @return String Url that will result in a query for the URL + * stored in this object + */ + public String queryUrl() { + return uriConverter.makeQueryURI(firstResult); + } + /** + * @return String Url that will replay the first captured stored in this + * object + */ + public String replayUrl() { + return uriConverter.makeReplayURI(firstResult); + } + + /** + * incorporate data from the argument SearchResult into the aggregate + * statistics held in this object + * @param result + */ + public void addSearchResult(SearchResult result) { + numResults++; + Date d = searchResultToDate(result); + String digest = result.get(WaybackConstants.RESULT_MD5_DIGEST); + if(d.getTime() < firstDate.getTime()) { + firstDate = d; + } + if(d.getTime() > lastDate.getTime()) { + lastDate = d; + } + digests.put(digest, null); + } + /** + * @param result + * @return true if the argument SearchResult is for the same url as this + * ResultPartition is storing + */ + public boolean sameUrl(SearchResult result) { + return url.equals(searchResultToCanonicalUrl(result)); + } + + /** + * @return the firstDate + */ + public Date getFirstDate() { + return firstDate; + } + /** + * @return the lastDate + */ + public Date getLastDate() { + return lastDate; + } + /** + * @return the numResults + */ + public int getNumResults() { + return numResults; + } + /** + * @return the url + */ + public String getUrl() { + return url; + } + /** + * @return the number of unique digests for this url + */ + public int getNumVersions() { + return digests.size(); + } + + private static String searchResultToCanonicalUrl(SearchResult result) { + return result.get(WaybackConstants.RESULT_URL_KEY); + } + private static String searchResultToDigest(SearchResult result) { + return result.get(WaybackConstants.RESULT_MD5_DIGEST); + } + private static Date searchResultToDate(SearchResult result) { + Timestamp t = new Timestamp(result.get( + WaybackConstants.RESULT_CAPTURE_DATE)); + return t.getDate(); + } +} Added: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java 2007-04-17 21:56:37 UTC (rev 1726) @@ -0,0 +1,95 @@ +/* PathQuerySearchResultPartitioner + * + * $Id$ + * + * Created on 4:09:51 PM Apr 16, 2007. + * + * Copyright (C) 2007 Internet Archive. + * + * This file is part of wayback-core. + * + * wayback-core is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * wayback-core is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with wayback-core; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package org.archive.wayback.query; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.archive.wayback.ResultURIConverter; +import org.archive.wayback.core.SearchResult; +import org.archive.wayback.core.SearchResults; + +/** + * UI Utility object that transforms a SearchResults into a series of + * PathQuerySearchResultPartition objects, one object per URL in the + * SearchResults. This makes rendering of summary pages for a series of urls, + * with potentially multiple captures of each URL simpler. + * + * @author brad + * @version $Date$, $Revision$ + */ +public class PathQuerySearchResultPartitioner { + private ArrayList<PathQuerySearchResultPartition> partitions = null; + private int totalResultCount = 0; + /** + * Constructor + * @param results + * @param uriConverter + */ + public PathQuerySearchResultPartitioner(SearchResults results, + ResultURIConverter uriConverter) { + partitions = new ArrayList<PathQuerySearchResultPartition>(); + Iterator<SearchResult> itr = results.iterator(); + PathQuerySearchResultPartition current = null; + totalResultCount = 0; + while(itr.hasNext()) { + totalResultCount++; + SearchResult result = itr.next(); + if((current == null) || !current.sameUrl(result)) { + if(current != null) { + partitions.add(current); + } + current = new PathQuerySearchResultPartition(result, + uriConverter); + } else { + current.addSearchResult(result); + } + } + if(current != null) { + partitions.add(current); + } + } + + /** + * @return the total number of unique urls found in the SearchResults + */ + public int numUrls() { + return partitions.size(); + } + + /** + * @return the total number of captures for all urls in the SearchResults + */ + public int numResultsTotal() { + return totalResultCount; + } + + /** + * @return an Iterator of PathQuerySearchResultPartition objects + */ + public Iterator<PathQuerySearchResultPartition> iterator() { + return partitions.iterator(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2007-07-19 23:33:08
|
Revision: 1843 http://archive-access.svn.sourceforge.net/archive-access/?rev=1843&view=rev Author: bradtofel Date: 2007-07-19 16:33:09 -0700 (Thu, 19 Jul 2007) Log Message: ----------- REMOVE: quite old and never was used in codebase Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java 2007-07-19 23:30:47 UTC (rev 1842) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java 2007-07-19 23:33:09 UTC (rev 1843) @@ -1,152 +0,0 @@ -/* PathQuerySearchResultPartition - * - * $Id$ - * - * Created on 4:10:12 PM Apr 16, 2007. - * - * Copyright (C) 2007 Internet Archive. - * - * This file is part of wayback-core. - * - * wayback-core is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback-core is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback-core; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.query; - -import java.util.Date; -import java.util.HashMap; - -import org.archive.wayback.ResultURIConverter; -import org.archive.wayback.WaybackConstants; -import org.archive.wayback.core.SearchResult; -import org.archive.wayback.core.Timestamp; - -/** - * UI Utility object for storing information about multiple captures of an URL. - * This object tracks the url in question, total number of captures of that URL, - * the first Date captured, the last Date captured, and the unique Digests for - * all captures. - * - * @author brad - * @version $Date$, $Revision$ - */ -public class PathQuerySearchResultPartition { - private SearchResult firstResult = null; - private int numResults; - private Date firstDate; - private Date lastDate; - private String url; - private HashMap<String,Object> digests; - private ResultURIConverter uriConverter = null; - /** - * Constructor - * @param result - * @param uriConverter - */ - public PathQuerySearchResultPartition(SearchResult result, - ResultURIConverter uriConverter) { - firstResult = result; - digests = new HashMap<String,Object>(); - digests.put(searchResultToDigest(result),null); - url = searchResultToCanonicalUrl(result); - numResults = 1; - firstDate = searchResultToDate(result); - lastDate = searchResultToDate(result); - this.uriConverter = uriConverter; - } - - /** - * @return String Url that will result in a query for the URL - * stored in this object - */ - public String queryUrl() { - return uriConverter.makeQueryURI(firstResult); - } - /** - * @return String Url that will replay the first captured stored in this - * object - */ - public String replayUrl() { - return uriConverter.makeReplayURI(firstResult); - } - - /** - * incorporate data from the argument SearchResult into the aggregate - * statistics held in this object - * @param result - */ - public void addSearchResult(SearchResult result) { - numResults++; - Date d = searchResultToDate(result); - String digest = result.get(WaybackConstants.RESULT_MD5_DIGEST); - if(d.getTime() < firstDate.getTime()) { - firstDate = d; - } - if(d.getTime() > lastDate.getTime()) { - lastDate = d; - } - digests.put(digest, null); - } - /** - * @param result - * @return true if the argument SearchResult is for the same url as this - * ResultPartition is storing - */ - public boolean sameUrl(SearchResult result) { - return url.equals(searchResultToCanonicalUrl(result)); - } - - /** - * @return the firstDate - */ - public Date getFirstDate() { - return firstDate; - } - /** - * @return the lastDate - */ - public Date getLastDate() { - return lastDate; - } - /** - * @return the numResults - */ - public int getNumResults() { - return numResults; - } - /** - * @return the url - */ - public String getUrl() { - return url; - } - /** - * @return the number of unique digests for this url - */ - public int getNumVersions() { - return digests.size(); - } - - private static String searchResultToCanonicalUrl(SearchResult result) { - return result.get(WaybackConstants.RESULT_URL_KEY); - } - private static String searchResultToDigest(SearchResult result) { - return result.get(WaybackConstants.RESULT_MD5_DIGEST); - } - private static Date searchResultToDate(SearchResult result) { - Timestamp t = new Timestamp(result.get( - WaybackConstants.RESULT_CAPTURE_DATE)); - return t.getDate(); - } -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java 2007-07-19 23:30:47 UTC (rev 1842) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java 2007-07-19 23:33:09 UTC (rev 1843) @@ -1,95 +0,0 @@ -/* PathQuerySearchResultPartitioner - * - * $Id$ - * - * Created on 4:09:51 PM Apr 16, 2007. - * - * Copyright (C) 2007 Internet Archive. - * - * This file is part of wayback-core. - * - * wayback-core is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback-core is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback-core; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.query; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.archive.wayback.ResultURIConverter; -import org.archive.wayback.core.SearchResult; -import org.archive.wayback.core.SearchResults; - -/** - * UI Utility object that transforms a SearchResults into a series of - * PathQuerySearchResultPartition objects, one object per URL in the - * SearchResults. This makes rendering of summary pages for a series of urls, - * with potentially multiple captures of each URL simpler. - * - * @author brad - * @version $Date$, $Revision$ - */ -public class PathQuerySearchResultPartitioner { - private ArrayList<PathQuerySearchResultPartition> partitions = null; - private int totalResultCount = 0; - /** - * Constructor - * @param results - * @param uriConverter - */ - public PathQuerySearchResultPartitioner(SearchResults results, - ResultURIConverter uriConverter) { - partitions = new ArrayList<PathQuerySearchResultPartition>(); - Iterator<SearchResult> itr = results.iterator(); - PathQuerySearchResultPartition current = null; - totalResultCount = 0; - while(itr.hasNext()) { - totalResultCount++; - SearchResult result = itr.next(); - if((current == null) || !current.sameUrl(result)) { - if(current != null) { - partitions.add(current); - } - current = new PathQuerySearchResultPartition(result, - uriConverter); - } else { - current.addSearchResult(result); - } - } - if(current != null) { - partitions.add(current); - } - } - - /** - * @return the total number of unique urls found in the SearchResults - */ - public int numUrls() { - return partitions.size(); - } - - /** - * @return the total number of captures for all urls in the SearchResults - */ - public int numResultsTotal() { - return totalResultCount; - } - - /** - * @return an Iterator of PathQuerySearchResultPartition objects - */ - public Iterator<PathQuerySearchResultPartition> iterator() { - return partitions.iterator(); - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bra...@us...> - 2008-07-15 01:40:11
|
Revision: 2449 http://archive-access.svn.sourceforge.net/archive-access/?rev=2449&view=rev Author: bradtofel Date: 2008-07-14 18:40:21 -0700 (Mon, 14 Jul 2008) Log Message: ----------- REFACTOR: moved all the various UIResults subclasses functionality into the base class. These are no longer needed. Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UICaptureQueryResults.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIUrlQueryResults.java Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UICaptureQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UICaptureQueryResults.java 2008-07-15 01:37:42 UTC (rev 2448) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UICaptureQueryResults.java 2008-07-15 01:40:21 UTC (rev 2449) @@ -1,99 +0,0 @@ -/* UICaptureQueryResults - * - * $Id$ - * - * Created on 6:14:06 PM Jun 27, 2008. - * - * Copyright (C) 2008 Internet Archive. - * - * This file is part of wayback. - * - * wayback is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.query; - -import java.util.Iterator; - -import javax.servlet.http.HttpServletRequest; - -import org.archive.wayback.ResultURIConverter; -import org.archive.wayback.core.CaptureSearchResult; -import org.archive.wayback.core.CaptureSearchResults; -import org.archive.wayback.core.Timestamp; -import org.archive.wayback.core.WaybackRequest; - -/** - * - * - * @author brad - * @version $Date$, $Revision$ - */ -public class UICaptureQueryResults extends UIQueryResults { - - private CaptureSearchResults results; - private Timestamp firstResultTimestamp; - - private Timestamp lastResultTimestamp; - - /** - * Constructor -- chew search result summaries into format easier for JSPs - * to digest. - * - * @param httpRequest - * @param wbRequest - * @param results - * @param uriConverter - */ - public UICaptureQueryResults(HttpServletRequest httpRequest, - WaybackRequest wbRequest, CaptureSearchResults results, - ResultURIConverter uriConverter) { - super(httpRequest, wbRequest, results, uriConverter); - - this.firstResultTimestamp = Timestamp.parseBefore(results - .getFirstResultTimestamp()); - this.lastResultTimestamp = Timestamp.parseBefore(results - .getLastResultTimestamp()); - - this.results = results; - } - - /** - * @return first Timestamp in returned ResourceResults - */ - public Timestamp getFirstResultTimestamp() { - return firstResultTimestamp; - } - - /** - * @return last Timestamp in returned ResourceResults - */ - public Timestamp getLastResultTimestamp() { - return lastResultTimestamp; - } - - /** - * @return Iterator of CaptureSearchResult - */ - public Iterator<CaptureSearchResult> resultsIterator() { - return results.iterator(); - } - - /** - * @return Returns the results. - */ - public CaptureSearchResults getResults() { - return results; - } -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2008-07-15 01:37:42 UTC (rev 2448) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIQueryResults.java 2008-07-15 01:40:21 UTC (rev 2449) @@ -1,212 +0,0 @@ -/* UIQueryResults - * - * $Id$ - * - * Created on 12:03:14 PM Nov 8, 2005. - * - * Copyright (C) 2005 Internet Archive. - * - * This file is part of wayback. - * - * wayback is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.query; - -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; - -import org.archive.wayback.ResultURIConverter; -import org.archive.wayback.core.CaptureSearchResult; -import org.archive.wayback.core.SearchResults; -import org.archive.wayback.core.Timestamp; -import org.archive.wayback.core.UIResults; -import org.archive.wayback.core.WaybackRequest; - -/** - * Abstraction class to provide a single, (hopefully) simpler interface to - * query results for UI JSPs. Handles slight massaging of SearchResults (to - * fix zero-based/one-based numbers) URI fixup and creation for result pages, - * and later may provide more functionality for dividing results into columns, - * again to simplify UI JSPs. - * - * @author brad - * @version $Date$, $Revision$ - */ -public class UIQueryResults extends UIResults { - - private String searchUrl; - - private Timestamp startTimestamp; - - private Timestamp endTimestamp; - - private Timestamp exactRequestedTimestamp; - - private long resultsReturned; - private long resultsMatching; - private long resultsPerPage; - private long firstResult; - private long lastResult; - - private int numPages; - private int curPage; - - private CaptureSearchResult result; - - /** - * Constructor -- chew search result summaries into format easier for JSPs - * to digest. - * - * @param httpRequest - * @param wbRequest - * @param results - * @param uriConverter - */ - public UIQueryResults(HttpServletRequest httpRequest, - WaybackRequest wbRequest, SearchResults results, - ResultURIConverter uriConverter) { - super(wbRequest,uriConverter); - this.searchUrl = wbRequest.getRequestUrl(); - this.startTimestamp = Timestamp.parseBefore(results. - getFilter(WaybackRequest.REQUEST_START_DATE)); - this.endTimestamp = Timestamp.parseAfter(results.getFilter( - WaybackRequest.REQUEST_END_DATE)); - - this.resultsReturned = results.getReturnedCount(); - this.resultsMatching = results.getMatchingCount(); - this.resultsPerPage = results.getNumRequested(); - this.firstResult = results.getFirstReturned() + 1; - this.lastResult = ((firstResult - 1) + resultsReturned); - this.exactRequestedTimestamp = Timestamp.parseAfter( - wbRequest.getReplayTimestamp()); - // calculate total pages: - numPages = (int) Math.ceil((double)resultsMatching/(double)resultsPerPage); - curPage = (int) Math.floor(((double)(firstResult-1))/(double)resultsPerPage) + 1; - - } - - /** - * @return Timestamp end cutoff requested by user - */ - public Timestamp getEndTimestamp() { - return endTimestamp; - } - - /** - * @return URL or URL prefix requested by user - */ - public String getSearchUrl() { - return searchUrl; - } - - /** - * @return Timestamp start cutoff requested by user - */ - public Timestamp getStartTimestamp() { - return startTimestamp; - } - - /** - * @param timestamp - * @return Date for the timestamp string - */ - public Date timestampToDate(String timestamp) { - return new Timestamp(timestamp).getDate(); - } - - /** - * @param result - * @return Date representing captureDate of SearchResult result - */ - public Date resultToDate(CaptureSearchResult result) { - return result.getCaptureDate(); - } - - /** - * @return Returns the firstResult. - */ - public long getFirstResult() { - return firstResult; - } - - /** - * @return Returns the resultsMatching. - */ - public long getResultsMatching() { - return resultsMatching; - } - - /** - * @return Returns the resultsPerPage. - */ - public long getResultsPerPage() { - return resultsPerPage; - } - - /** - * @return Returns the resultsReturned. - */ - public long getResultsReturned() { - return resultsReturned; - } - - /** - * @return Returns the curPage. - */ - public int getCurPage() { - return curPage; - } - - /** - * @return Returns the numPages. - */ - public int getNumPages() { - return numPages; - } - - /** - * @param pageNum - * @return String URL which will drive browser to search results for a - * different page of results for the same query - */ - public String urlForPage(int pageNum) { - WaybackRequest wbRequest = getWbRequest(); - return wbRequest.getContextPrefix() + "query?" + - wbRequest.getQueryArguments(pageNum); - } - - /** - * @return Returns the lastResult. - */ - public long getLastResult() { - return lastResult; - } - - /** - * @return Returns the exactRequestedTimestamp. - */ - public Timestamp getExactRequestedTimestamp() { - return exactRequestedTimestamp; - } - - public CaptureSearchResult getResult() { - return result; - } - - public void setResult(CaptureSearchResult result) { - this.result = result; - } -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIUrlQueryResults.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIUrlQueryResults.java 2008-07-15 01:37:42 UTC (rev 2448) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/UIUrlQueryResults.java 2008-07-15 01:40:21 UTC (rev 2449) @@ -1,76 +0,0 @@ -/* UIUrlQueryResults - * - * $Id$ - * - * Created on 6:01:39 PM Jun 27, 2008. - * - * Copyright (C) 2008 Internet Archive. - * - * This file is part of wayback. - * - * wayback is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.query; - -import java.util.Iterator; - -import javax.servlet.http.HttpServletRequest; - -import org.archive.wayback.ResultURIConverter; -import org.archive.wayback.core.UrlSearchResult; -import org.archive.wayback.core.UrlSearchResults; -import org.archive.wayback.core.WaybackRequest; - -/** - * - * - * @author brad - * @version $Date$, $Revision$ - */ -public class UIUrlQueryResults extends UIQueryResults { - - private UrlSearchResults results; - - /** - * Constructor -- chew search result summaries into format easier for JSPs - * to digest. - * - * @param httpRequest - * @param wbRequest - * @param results - * @param uriConverter - */ - public UIUrlQueryResults(HttpServletRequest httpRequest, - WaybackRequest wbRequest, UrlSearchResults results, - ResultURIConverter uriConverter) { - super(httpRequest, wbRequest, results, uriConverter); - - this.results = results; - } - - /** - * @return Iterator of ResourceResults - */ - public Iterator<UrlSearchResult> resultsIterator() { - return results.iterator(); - } - - /** - * @return Returns the results. - */ - public UrlSearchResults getResults() { - return results; - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |