maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r428280 - in /maven/repository-manager/trunk/maven-repository-webapp/src/main: java/org/apache/maven/repository/manager/web/action/SearchAction.java resources/xwork.xml
Date Thu, 03 Aug 2006 08:30:24 GMT
Author: brett
Date: Thu Aug  3 01:30:23 2006
New Revision: 428280

URL: http://svn.apache.org/viewvc?rev=428280&view=rev
Log:
[MRM-130] send single result for find artifact straight to the artifact page

Modified:
    maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SearchAction.java
    maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml

Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SearchAction.java
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SearchAction.java?rev=428280&r1=428279&r2=428280&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SearchAction.java
(original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SearchAction.java
Thu Aug  3 01:30:23 2006
@@ -76,6 +76,12 @@
      */
     private ConfigurationStore configurationStore;
 
+    private static final String NO_RESULTS = "noResults";
+
+    private static final String RESULTS = "results";
+
+    private static final String ARTIFACT = "artifact";
+
     public String quickSearch()
         throws MalformedURLException, RepositoryIndexException, RepositoryIndexSearchException,
         ConfigurationStoreException, ParseException
@@ -104,7 +110,7 @@
     }
 
     public String findArtifact()
-        throws ConfigurationStoreException, RepositoryIndexException, RepositoryIndexSearchException
+        throws Exception
     {
         // TODO: give action message if indexing is in progress
 
@@ -121,7 +127,18 @@
         searchResults = index.search(
             new LuceneQuery( new TermQuery( new Term( StandardIndexRecordFields.MD5, md5.toLowerCase()
) ) ) );
 
-        return SUCCESS;
+        if ( searchResults.isEmpty() )
+        {
+            return NO_RESULTS;
+        }
+        if ( searchResults.size() == 1 )
+        {
+            return ARTIFACT;
+        }
+        else
+        {
+            return RESULTS;
+        }
     }
 
     private RepositoryArtifactIndex getIndex()
@@ -164,5 +181,4 @@
     {
         return searchResults;
     }
-
 }

Modified: maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml?rev=428280&r1=428279&r2=428280&view=diff
==============================================================================
--- maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml (original)
+++ maven/repository-manager/trunk/maven-repository-webapp/src/main/resources/xwork.xml Thu
Aug  3 01:30:23 2006
@@ -50,6 +50,8 @@
       <result name="input">/WEB-INF/jsp/quickSearch.jsp</result>
       <result>/WEB-INF/jsp/results.jsp</result>
       <result name="error">/WEB-INF/jsp/quickSearch.jsp</result>
+      <result name="noResults">/WEB-INF/jsp/noResults.jsp</result>
+      <!-- TODO! -->
     </action>
 
     <action name="findArtifact" class="searchAction" method="input">
@@ -58,8 +60,14 @@
 
     <action name="checksumSearch" class="searchAction" method="findArtifact">
       <result name="input">/WEB-INF/jsp/findArtifact.jsp</result>
-      <result>/WEB-INF/jsp/results.jsp</result>
+      <result name="results">/WEB-INF/jsp/results.jsp</result>
       <result name="error">/WEB-INF/jsp/findArtifact.jsp</result>
+      <result name="noResults">/WEB-INF/jsp/noResults.jsp</result>
+      <!-- TODO! -->
+      <!-- TODO! use redirect-action instead -->
+      <result name="artifact" type="redirect">
+        /browse/${searchResults[0].groupId}/${searchResults[0].artifactId}/${searchResults[0].version}
+      </result>
     </action>
 
     <action name="browse" class="browseAction" method="browse">



Mime
View raw message