[MRM-449, 450] improvements to the group search reporting

Submitted by: Teodoro Cue Jr.


git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@568011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2007-08-21 08:16:36 +00:00
parent 3e28430e1c
commit 8ffe658623
6 changed files with 19 additions and 7 deletions

View File

@ -32,9 +32,9 @@ public class RepositoryProblemByGroupIdConstraint
private void createWhereClause( String desiredGroupId ) private void createWhereClause( String desiredGroupId )
{ {
whereClause = "groupId == desiredGroupId"; whereClause = "groupId.like(desiredGroupId)";
declParams = new String[]{"String desiredGroupId"}; declParams = new String[]{"String desiredGroupId"};
params = new Object[]{desiredGroupId}; params = new Object[]{desiredGroupId + "%"};
} }
public RepositoryProblemByGroupIdConstraint( String desiredGroupId ) public RepositoryProblemByGroupIdConstraint( String desiredGroupId )

View File

@ -32,9 +32,9 @@ public class RepositoryProblemConstraint
private void createWhereClause( String desiredGroupId, String desiredRepositoryId ) 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"}; declParams = new String[]{"String desiredGroupId", "String desiredRepositoryId"};
params = new Object[]{desiredGroupId, desiredRepositoryId}; params = new Object[]{desiredGroupId + "%", desiredRepositoryId};
} }
public RepositoryProblemConstraint( String desiredGroupId, String desiredRepositoryId ) public RepositoryProblemConstraint( String desiredGroupId, String desiredRepositoryId )

View 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_3 = "org.apache.maven.archiva.test.3";
private static final String GROUP_ID_PARTIAL = "org.apache.maven.archiva";
private RepositoryProblemDAO repoProblemDao; private RepositoryProblemDAO repoProblemDao;
protected void setUp() protected void setUp()
@ -81,6 +83,7 @@ public class RepositoryProblemByGroupIdConstraintTest
assertConstraint( 1, new RepositoryProblemByGroupIdConstraint( GROUP_ID_1 ) ); assertConstraint( 1, new RepositoryProblemByGroupIdConstraint( GROUP_ID_1 ) );
assertConstraint( 2, new RepositoryProblemByGroupIdConstraint( GROUP_ID_2 ) ); assertConstraint( 2, new RepositoryProblemByGroupIdConstraint( GROUP_ID_2 ) );
assertConstraint( 3, new RepositoryProblemByGroupIdConstraint( GROUP_ID_3 ) ); assertConstraint( 3, new RepositoryProblemByGroupIdConstraint( GROUP_ID_3 ) );
assertConstraint( 6, new RepositoryProblemByGroupIdConstraint( GROUP_ID_PARTIAL ) );
} }
private void assertConstraint( int expectedHits, Constraint constraint ) private void assertConstraint( int expectedHits, Constraint constraint )

View 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_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_1 = "test-repo-1";
private static final String REPO_ID_2 = "test-repo-2"; 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( 2, new RepositoryProblemConstraint( GROUP_ID_2, REPO_ID_1 ) );
assertConstraint( 3, new RepositoryProblemConstraint( GROUP_ID_3, REPO_ID_1 ) ); assertConstraint( 3, new RepositoryProblemConstraint( GROUP_ID_3, REPO_ID_1 ) );
assertConstraint( 0, new RepositoryProblemConstraint( GROUP_ID_4, 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() public void testRepoIdConstraint()
@ -110,6 +113,10 @@ public class RepositoryProblemConstraintTest
assertConstraint( 2, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_2 ) ); assertConstraint( 2, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_2 ) );
assertConstraint( 3, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_3 ) ); assertConstraint( 3, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_3 ) );
assertConstraint( 0, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_4 ) ); 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 ) private void assertConstraint( int expectedHits, Constraint constraint )

View File

@ -154,7 +154,7 @@ public class GenerateReportAction
if ( groupId != null && ( !groupId.equals( "" ) ) ) 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 ); constraint = new RepositoryProblemConstraint( range, groupId, repositoryId );
} }
@ -163,7 +163,7 @@ public class GenerateReportAction
constraint = new RepositoryProblemByGroupIdConstraint( range, groupId ); 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 ); constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId );
} }

View File

@ -42,10 +42,12 @@ public class ShowReportsAction
private Collection repositoryIds = new ArrayList(); private Collection repositoryIds = new ArrayList();
public static final String ALL_REPOSITORIES = "All Repositories";
public String execute() public String execute()
throws Exception throws Exception
{ {
repositoryIds.add( "" ); repositoryIds.add( ALL_REPOSITORIES );
repositoryIds.addAll( repositoryIds.addAll(
dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) ); dao.query( new UniqueFieldConstraint( RepositoryProblem.class.getName(), "repositoryId" ) ) );