]> source.dussan.org Git - archiva.git/commitdiff
[MRM-449, 450] improvements to the group search reporting
authorBrett Porter <brett@apache.org>
Tue, 21 Aug 2007 08:16:36 +0000 (08:16 +0000)
committerBrett Porter <brett@apache.org>
Tue, 21 Aug 2007 08:16:36 +0000 (08:16 +0000)
Submitted by: Teodoro Cue Jr.

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@568011 13f79535-47bb-0310-9956-ffa450edef68

archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraint.java
archiva-database/src/main/java/org/apache/maven/archiva/database/constraints/RepositoryProblemConstraint.java
archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemByGroupIdConstraintTest.java
archiva-database/src/test/java/org/apache/maven/archiva/database/constraints/RepositoryProblemConstraintTest.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ShowReportsAction.java

index 1a0971acbe2b5be742cfd798141f40db107ef007..6186b0e3c39adf92e9afbe56e2b8b672727a6df3 100644 (file)
@@ -32,9 +32,9 @@ public class RepositoryProblemByGroupIdConstraint
 
     private void createWhereClause( String desiredGroupId )
     {
-        whereClause = "groupId == desiredGroupId";
+        whereClause = "groupId.like(desiredGroupId)";
         declParams = new String[]{"String desiredGroupId"};
-        params = new Object[]{desiredGroupId};
+        params = new Object[]{desiredGroupId + "%"};
     }
 
     public RepositoryProblemByGroupIdConstraint( String desiredGroupId )
index 3c2c997ac663857d85460dd54b18ccc9f4192862..eaff8338bee9068d9750026620e60dd41c71ae10 100644 (file)
@@ -32,9 +32,9 @@ public class RepositoryProblemConstraint
 
     private void createWhereClause( String desiredGroupId, String desiredRepositoryId )
     {
-        whereClause = "groupId == desiredGroupId && repositoryId == desiredRepositoryId";
+        whereClause = "groupId.like(desiredGroupId) && repositoryId == desiredRepositoryId";
         declParams = new String[]{"String desiredGroupId", "String desiredRepositoryId"};
-        params = new Object[]{desiredGroupId, desiredRepositoryId};
+        params = new Object[]{desiredGroupId + "%", desiredRepositoryId};
     }
 
     public RepositoryProblemConstraint( String desiredGroupId, String desiredRepositoryId )
index 49d4713e0f459f2d7289bb09967768f1f22008a3..cc8b3f42b3067c86617bbf49f72dd90d9d664d22 100644 (file)
@@ -39,6 +39,8 @@ public class RepositoryProblemByGroupIdConstraintTest
 
     private static final String GROUP_ID_3 = "org.apache.maven.archiva.test.3";
 
+    private static final String GROUP_ID_PARTIAL = "org.apache.maven.archiva";
+
     private RepositoryProblemDAO repoProblemDao;
 
     protected void setUp()
@@ -81,6 +83,7 @@ public class RepositoryProblemByGroupIdConstraintTest
         assertConstraint( 1, new RepositoryProblemByGroupIdConstraint( GROUP_ID_1 ) );
         assertConstraint( 2, new RepositoryProblemByGroupIdConstraint( GROUP_ID_2 ) );
         assertConstraint( 3, new RepositoryProblemByGroupIdConstraint( GROUP_ID_3 ) );
+        assertConstraint( 6, new RepositoryProblemByGroupIdConstraint( GROUP_ID_PARTIAL ) );
     }
 
     private void assertConstraint( int expectedHits, Constraint constraint )
index e0d77b31a65cb8e241a7acf244235405904fba21..a593281ac384b6fd3ede6beebdf4d2c1debbd5cc 100644 (file)
@@ -41,6 +41,8 @@ public class RepositoryProblemConstraintTest
 
     private static final String GROUP_ID_4 = "org.apache.maven.archiva.test.4";
 
+    private static final String GROUP_ID_PARTIAL = "org.apache.maven.archiva";
+
     private static final String REPO_ID_1 = "test-repo-1";
 
     private static final String REPO_ID_2 = "test-repo-2";
@@ -92,6 +94,7 @@ public class RepositoryProblemConstraintTest
         assertConstraint( 2, new RepositoryProblemConstraint( GROUP_ID_2, REPO_ID_1 ) );
         assertConstraint( 3, new RepositoryProblemConstraint( GROUP_ID_3, REPO_ID_1 ) );
         assertConstraint( 0, new RepositoryProblemConstraint( GROUP_ID_4, REPO_ID_1 ) );
+        assertConstraint( 6, new RepositoryProblemConstraint( GROUP_ID_PARTIAL, REPO_ID_1 ) );
     }
 
     public void testRepoIdConstraint()
@@ -110,6 +113,10 @@ public class RepositoryProblemConstraintTest
         assertConstraint( 2, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_2 ) );
         assertConstraint( 3, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_3 ) );
         assertConstraint( 0, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_4 ) );
+        assertConstraint( 1, new RepositoryProblemConstraint( GROUP_ID_PARTIAL, REPO_ID_1 ) );
+        assertConstraint( 2, new RepositoryProblemConstraint( GROUP_ID_PARTIAL, REPO_ID_2 ) );
+        assertConstraint( 3, new RepositoryProblemConstraint( GROUP_ID_PARTIAL, REPO_ID_3 ) );
+        assertConstraint( 0, new RepositoryProblemConstraint( GROUP_ID_PARTIAL, REPO_ID_4 ) );
     }
 
     private void assertConstraint( int expectedHits, Constraint constraint )
index 17c84ada688db8682f1cdeedc843db0041b86fb5..b836ddc91fc5b6d68804f362a84b346aab510afa 100644 (file)
@@ -154,7 +154,7 @@ public class GenerateReportAction
 
         if ( groupId != null && ( !groupId.equals( "" ) ) )
         {
-            if ( repositoryId != null && ( !repositoryId.equals( "" ) ) )
+            if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( ShowReportsAction.ALL_REPOSITORIES ) ) )
             {
                 constraint = new RepositoryProblemConstraint( range, groupId, repositoryId );
             }
@@ -163,7 +163,7 @@ public class GenerateReportAction
                 constraint = new RepositoryProblemByGroupIdConstraint( range, groupId );
             }
         }
-        else if ( repositoryId != null && ( !repositoryId.equals( "" ) ) )
+        else if ( repositoryId != null && ( !repositoryId.equals( "" ) && !repositoryId.equals( ShowReportsAction.ALL_REPOSITORIES ) ) )
         {
             constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId );
         }
index 004b4b15939e215fe99c64e8d09ffdacb6818779..2414d2f40bdf391baf5429df6878b0c4fec32c27 100644 (file)
@@ -42,10 +42,12 @@ public class ShowReportsAction
 
     private Collection repositoryIds = new ArrayList();
 
+    public static final String ALL_REPOSITORIES = "All Repositories";
+
     public String execute()
         throws Exception
     {
-        repositoryIds.add( "" );
+        repositoryIds.add( ALL_REPOSITORIES );
         repositoryIds.addAll(
             dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) );