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 )
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 )
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()
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 )
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";
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()
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 )
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 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 );
}
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" ) ) );