[MRM-329] revised reporting actions

Submitted by: Teodoro Cue

git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@562511 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2007-08-03 16:02:00 +00:00
parent 83dfd74838
commit 0dc2c29c92
22 changed files with 734 additions and 659 deletions

View File

@ -25,7 +25,8 @@ package org.apache.maven.archiva.model;
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$ * @version $Id$
*/ */
public class RepositoryProblemReport extends RepositoryProblem public class RepositoryProblemReport
extends RepositoryProblem
{ {
private static final long serialVersionUID = 4990893576717148324L; private static final long serialVersionUID = 4990893576717148324L;

View File

@ -25,11 +25,12 @@ package org.apache.maven.archiva.database;
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* @version $Id$ * @version $Id$
*/ */
public interface DeclarativeConstraint extends Constraint public interface DeclarativeConstraint
extends Constraint
{ {
/** /**
* Get the declared imports used for this query. (optional) * Get the declared imports used for this query. (optional)
* * <p/>
* NOTE: This is DAO implementation specific. * NOTE: This is DAO implementation specific.
* *
* @return the imports. (can be null) * @return the imports. (can be null)
@ -38,7 +39,7 @@ public interface DeclarativeConstraint extends Constraint
/** /**
* Get the declared parameters used for this query. (optional) * Get the declared parameters used for this query. (optional)
* * <p/>
* NOTE: This is DAO implementation specific. * NOTE: This is DAO implementation specific.
* *
* @return the parameters. (can be null) * @return the parameters. (can be null)
@ -47,7 +48,7 @@ public interface DeclarativeConstraint extends Constraint
/** /**
* The JDOQL filter to apply to the query. (optional) * The JDOQL filter to apply to the query. (optional)
* * <p/>
* NOTE: This is DAO implementation specific. * NOTE: This is DAO implementation specific.
* *
* @return the filter to apply. (can be null) * @return the filter to apply. (can be null)
@ -56,7 +57,7 @@ public interface DeclarativeConstraint extends Constraint
/** /**
* Get the parameters used for this query. (required if using {@link #getDeclaredParameters()} ) * Get the parameters used for this query. (required if using {@link #getDeclaredParameters()} )
* * <p/>
* NOTE: This is DAO implementation specific. * NOTE: This is DAO implementation specific.
* *
* @return the parameters. (can be null) * @return the parameters. (can be null)
@ -79,7 +80,7 @@ public interface DeclarativeConstraint extends Constraint
/** /**
* Get the variables used within the query. * Get the variables used within the query.
* * <p/>
* NOTE: This is DAO implementation specific. * NOTE: This is DAO implementation specific.
* *
* @return the variables used within the query. * @return the variables used within the query.
@ -95,7 +96,7 @@ public interface DeclarativeConstraint extends Constraint
/** /**
* Get the declared range used for this query. (optional) * Get the declared range used for this query. (optional)
* * <p/>
* NOTE: This is DAO implementation specific. * NOTE: This is DAO implementation specific.
* *
* @return the range. (can be null) * @return the range. (can be null)

View File

@ -28,6 +28,11 @@ public class RangeConstraint
extends AbstractDeclarativeConstraint extends AbstractDeclarativeConstraint
implements Constraint implements Constraint
{ {
public RangeConstraint()
{
this.range = null;
}
public RangeConstraint( int[] range ) public RangeConstraint( int[] range )
{ {
this.range = range; this.range = range;

View File

@ -24,16 +24,29 @@ import org.apache.maven.archiva.database.Constraint;
/** /**
* RepositoryProblemByGroupIdConstraint * RepositoryProblemByGroupIdConstraint
*/ */
public class RepositoryProblemByGroupIdConstraint extends RangeConstraint implements Constraint public class RepositoryProblemByGroupIdConstraint
extends RangeConstraint
implements Constraint
{ {
private String whereClause; private String whereClause;
private void createWhereClause( String desiredGroupId )
{
whereClause = "groupId == desiredGroupId";
declParams = new String[]{"String desiredGroupId"};
params = new Object[]{desiredGroupId};
}
public RepositoryProblemByGroupIdConstraint( String desiredGroupId )
{
super();
createWhereClause( desiredGroupId );
}
public RepositoryProblemByGroupIdConstraint( int[] range, String desiredGroupId ) public RepositoryProblemByGroupIdConstraint( int[] range, String desiredGroupId )
{ {
super( range ); super( range );
whereClause = "groupId == desiredGroupId"; createWhereClause( desiredGroupId );
declParams = new String[] { "String desiredGroupId" };
params = new Object[] { desiredGroupId };
} }
public String getSortColumn() public String getSortColumn()

View File

@ -24,16 +24,29 @@ import org.apache.maven.archiva.database.Constraint;
/** /**
* RepositoryProblemByRepositoryIdConstraint * RepositoryProblemByRepositoryIdConstraint
*/ */
public class RepositoryProblemByRepositoryIdConstraint extends RangeConstraint implements Constraint public class RepositoryProblemByRepositoryIdConstraint
extends RangeConstraint
implements Constraint
{ {
private String whereClause; private String whereClause;
private void createWhereClause( String desiredRepositoryId )
{
whereClause = "repositoryId == desiredRepositoryId";
declParams = new String[]{"String desiredRepositoryId"};
params = new Object[]{desiredRepositoryId};
}
public RepositoryProblemByRepositoryIdConstraint( String desiredRepositoryId )
{
super();
createWhereClause( desiredRepositoryId );
}
public RepositoryProblemByRepositoryIdConstraint( int[] range, String desiredRepositoryId ) public RepositoryProblemByRepositoryIdConstraint( int[] range, String desiredRepositoryId )
{ {
super( range ); super( range );
whereClause = "repositoryId == desiredRepositoryId"; createWhereClause( desiredRepositoryId );
declParams = new String[] { "String desiredRepositoryId" };
params = new Object[] { desiredRepositoryId };
} }
public String getSortColumn() public String getSortColumn()

View File

@ -22,23 +22,36 @@ package org.apache.maven.archiva.database.constraints;
import org.apache.maven.archiva.database.Constraint; import org.apache.maven.archiva.database.Constraint;
/** /**
* RepositoryProblemByArtifactIdConstraint * RepositoryProblemConstraint
*/ */
public class RepositoryProblemByArtifactIdConstraint extends RangeConstraint implements Constraint public class RepositoryProblemConstraint
extends RangeConstraint
implements Constraint
{ {
private String whereClause; private String whereClause;
public RepositoryProblemByArtifactIdConstraint( int[] range, String desiredArtifactId ) private void createWhereClause( String desiredGroupId, String desiredRepositoryId )
{
whereClause = "groupId == desiredGroupId && repositoryId == desiredRepositoryId";
declParams = new String[]{"String desiredGroupId", "String desiredRepositoryId"};
params = new Object[]{desiredGroupId, desiredRepositoryId};
}
public RepositoryProblemConstraint( String desiredGroupId, String desiredRepositoryId )
{
super();
createWhereClause( desiredGroupId, desiredRepositoryId );
}
public RepositoryProblemConstraint( int[] range, String desiredGroupId, String desiredRepositoryId )
{ {
super( range ); super( range );
whereClause = "artifactId == desiredArtifactId"; createWhereClause( desiredGroupId, desiredRepositoryId );
declParams = new String[] { "String desiredArtifactId" };
params = new Object[] { desiredArtifactId };
} }
public String getSortColumn() public String getSortColumn()
{ {
return "groupId"; return "artifactId";
} }
public String getWhereCondition() public String getWhereCondition()

View File

@ -0,0 +1,57 @@
package org.apache.maven.archiva.database.constraints;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.archiva.database.Constraint;
/**
* UniqueFieldConstraint
*/
public class UniqueFieldConstraint
extends AbstractSimpleConstraint
implements Constraint
{
private String sql;
public UniqueFieldConstraint( String className, String fieldName )
{
sql = "SELECT " + fieldName + " FROM " + className + " GROUP BY " + fieldName + " ORDER BY " + fieldName +
" ASCENDING";
}
public UniqueFieldConstraint( String className, String fieldName, String fieldNamePrefix )
{
sql = "SELECT " + fieldName + " FROM " + className + " WHERE " + fieldName +
".startsWith( fieldPrefix ) PARAMETERS String fieldPrefix GROUP BY " + fieldName + " ORDER BY " +
fieldName + " ASCENDING";
super.params = new Object[]{fieldNamePrefix};
}
public Class getResultClass()
{
return String.class;
}
public String getSelectSql()
{
return sql;
}
}

View File

@ -0,0 +1,88 @@
package org.apache.maven.archiva.database.constraints;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.model.RepositoryProblem;
import java.util.List;
/**
* RangeConstraintTest
*/
public class RangeConstraintTest
extends AbstractArchivaDatabaseTestCase
{
private RepositoryProblemDAO repoProblemDao;
protected void setUp()
throws Exception
{
super.setUp();
ArchivaDAO dao = (ArchivaDAO) lookup( ArchivaDAO.ROLE, "jdo" );
repoProblemDao = dao.getRepositoryProblemDAO();
}
public RepositoryProblem createRepoProblem()
{
RepositoryProblem repoProblem = new RepositoryProblem();
repoProblem.setGroupId( "groupId" );
repoProblem.setArtifactId( "artifactId" );
repoProblem.setMessage( "message" );
repoProblem.setOrigin( "origin" );
repoProblem.setPath( "path" );
repoProblem.setRepositoryId( "repositoryId" );
repoProblem.setType( "type" );
repoProblem.setVersion( "version" );
return repoProblem;
}
public void testConstraint()
throws Exception
{
repoProblemDao.saveRepositoryProblem( createRepoProblem() );
repoProblemDao.saveRepositoryProblem( createRepoProblem() );
repoProblemDao.saveRepositoryProblem( createRepoProblem() );
repoProblemDao.saveRepositoryProblem( createRepoProblem() );
repoProblemDao.saveRepositoryProblem( createRepoProblem() );
assertConstraint( 0, new RangeConstraint( new int[]{5, 10} ) );
assertConstraint( 1, new RangeConstraint( new int[]{0, 1} ) );
assertConstraint( 2, new RangeConstraint( new int[]{0, 2} ) );
assertConstraint( 3, new RangeConstraint( new int[]{0, 3} ) );
assertConstraint( 4, new RangeConstraint( new int[]{0, 4} ) );
assertConstraint( 5, new RangeConstraint( new int[]{0, 5} ) );
assertConstraint( 5, new RangeConstraint() );
}
private void assertConstraint( int expectedHits, Constraint constraint )
throws Exception
{
List results = repoProblemDao.queryRepositoryProblems( constraint );
assertNotNull( "Range Constraint: Not Null", results );
assertEquals( "Range Constraint: Results.size", expectedHits, results.size() );
}
}

View File

@ -0,0 +1,93 @@
package org.apache.maven.archiva.database.constraints;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.model.RepositoryProblem;
import java.util.List;
/**
* RepositoryProblemByGroupIdConstraintTest
*/
public class RepositoryProblemByGroupIdConstraintTest
extends AbstractArchivaDatabaseTestCase
{
private static final String GROUP_ID_1 = "org.apache.maven.archiva.test.1";
private static final String GROUP_ID_2 = "org.apache.maven.archiva.test.2";
private static final String GROUP_ID_3 = "org.apache.maven.archiva.test.3";
private RepositoryProblemDAO repoProblemDao;
protected void setUp()
throws Exception
{
super.setUp();
ArchivaDAO dao = (ArchivaDAO) lookup( ArchivaDAO.ROLE, "jdo" );
repoProblemDao = dao.getRepositoryProblemDAO();
}
public RepositoryProblem createRepoProblem( String groupId )
{
RepositoryProblem repoProblem = new RepositoryProblem();
repoProblem.setGroupId( groupId );
repoProblem.setArtifactId( "artifactId" );
repoProblem.setMessage( "message" );
repoProblem.setOrigin( "origin" );
repoProblem.setPath( "path" );
repoProblem.setRepositoryId( "repositoryId" );
repoProblem.setType( "type" );
repoProblem.setVersion( "version" );
return repoProblem;
}
public void testConstraint()
throws Exception
{
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_2 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_2 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_3 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_3 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_3 ) );
assertConstraint( 1, new RepositoryProblemByGroupIdConstraint( GROUP_ID_1 ) );
assertConstraint( 2, new RepositoryProblemByGroupIdConstraint( GROUP_ID_2 ) );
assertConstraint( 3, new RepositoryProblemByGroupIdConstraint( GROUP_ID_3 ) );
}
private void assertConstraint( int expectedHits, Constraint constraint )
throws Exception
{
List results = repoProblemDao.queryRepositoryProblems( constraint );
assertNotNull( "Repository Problems by Group Id: Not Null", results );
assertEquals( "Repository Problems by Group Id: Results.size", expectedHits, results.size() );
}
}

View File

@ -0,0 +1,93 @@
package org.apache.maven.archiva.database.constraints;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.model.RepositoryProblem;
import java.util.List;
/**
* RepositoryProblemByRepositoryIdConstraintTest
*/
public class RepositoryProblemByRepositoryIdConstraintTest
extends AbstractArchivaDatabaseTestCase
{
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_3 = "test-repo-3";
private RepositoryProblemDAO repoProblemDao;
protected void setUp()
throws Exception
{
super.setUp();
ArchivaDAO dao = (ArchivaDAO) lookup( ArchivaDAO.ROLE, "jdo" );
repoProblemDao = dao.getRepositoryProblemDAO();
}
public RepositoryProblem createRepoProblem( String repoId )
{
RepositoryProblem repoProblem = new RepositoryProblem();
repoProblem.setGroupId( "groupId" );
repoProblem.setArtifactId( "artifactId" );
repoProblem.setMessage( "message" );
repoProblem.setOrigin( "origin" );
repoProblem.setPath( "path" );
repoProblem.setRepositoryId( repoId );
repoProblem.setType( "type" );
repoProblem.setVersion( "version" );
return repoProblem;
}
public void testConstraint()
throws Exception
{
repoProblemDao.saveRepositoryProblem( createRepoProblem( REPO_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( REPO_ID_2 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( REPO_ID_2 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( REPO_ID_3 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( REPO_ID_3 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( REPO_ID_3 ) );
assertConstraint( 1, new RepositoryProblemByRepositoryIdConstraint( REPO_ID_1 ) );
assertConstraint( 2, new RepositoryProblemByRepositoryIdConstraint( REPO_ID_2 ) );
assertConstraint( 3, new RepositoryProblemByRepositoryIdConstraint( REPO_ID_3 ) );
}
private void assertConstraint( int expectedHits, Constraint constraint )
throws Exception
{
List results = repoProblemDao.queryRepositoryProblems( constraint );
assertNotNull( "Repository Problems by Repository Id: Not Null", results );
assertEquals( "Repository Problems by Repository Id: Results.size", expectedHits, results.size() );
}
}

View File

@ -0,0 +1,122 @@
package org.apache.maven.archiva.database.constraints;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.model.RepositoryProblem;
import java.util.List;
/**
* RepositoryProblemConstraintTest
*/
public class RepositoryProblemConstraintTest
extends AbstractArchivaDatabaseTestCase
{
private static final String GROUP_ID_1 = "org.apache.maven.archiva.test.1";
private static final String GROUP_ID_2 = "org.apache.maven.archiva.test.2";
private static final String GROUP_ID_3 = "org.apache.maven.archiva.test.3";
private static final String GROUP_ID_4 = "org.apache.maven.archiva.test.4";
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_3 = "test-repo-3";
private static final String REPO_ID_4 = "test-repo-4";
private RepositoryProblemDAO repoProblemDao;
protected void setUp()
throws Exception
{
super.setUp();
ArchivaDAO dao = (ArchivaDAO) lookup( ArchivaDAO.ROLE, "jdo" );
repoProblemDao = dao.getRepositoryProblemDAO();
}
public RepositoryProblem createRepoProblem( String groupId, String repoId )
{
RepositoryProblem repoProblem = new RepositoryProblem();
repoProblem.setGroupId( groupId );
repoProblem.setArtifactId( "artifactId" );
repoProblem.setMessage( "message" );
repoProblem.setOrigin( "origin" );
repoProblem.setPath( "path" );
repoProblem.setRepositoryId( repoId );
repoProblem.setType( "type" );
repoProblem.setVersion( "version" );
return repoProblem;
}
public void testGroupIdConstraint()
throws Exception
{
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1, REPO_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_2, REPO_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_2, REPO_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_3, REPO_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_3, REPO_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_3, REPO_ID_1 ) );
assertConstraint( 1, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_1 ) );
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 ) );
}
public void testRepoIdConstraint()
throws Exception
{
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1, REPO_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1, REPO_ID_2 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1, REPO_ID_2 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1, REPO_ID_3 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1, REPO_ID_3 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1, REPO_ID_3 ) );
assertConstraint( 1, new RepositoryProblemConstraint( GROUP_ID_1, REPO_ID_1 ) );
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 ) );
}
private void assertConstraint( int expectedHits, Constraint constraint )
throws Exception
{
List results = repoProblemDao.queryRepositoryProblems( constraint );
assertNotNull( "Repository Problems: Not Null", results );
assertEquals( "Repository Problems: Results.size", expectedHits, results.size() );
}
}

View File

@ -0,0 +1,117 @@
package org.apache.maven.archiva.database.constraints;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArtifactDAO;
import org.apache.maven.archiva.database.RepositoryProblemDAO;
import org.apache.maven.archiva.database.SimpleConstraint;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaArtifactModel;
import org.apache.maven.archiva.model.RepositoryProblem;
import java.util.Date;
import java.util.List;
/**
* UniqueFieldConstraintTest
*/
public class UniqueFieldConstraintTest
extends AbstractArchivaDatabaseTestCase
{
private static final String GROUP_ID_1 = "org.apache.maven.archiva.test.1";
private static final String GROUP_ID_2 = "org.apache.maven.archiva.test.2";
private static final String GROUP_ID_3 = "org.apache.maven.archiva.test.3";
private ArchivaDAO archivaDao;
private ArtifactDAO artifactDao;
private RepositoryProblemDAO repoProblemDao;
protected void setUp()
throws Exception
{
super.setUp();
archivaDao = (ArchivaDAO) lookup( ArchivaDAO.ROLE, "jdo" );
artifactDao = archivaDao.getArtifactDAO();
repoProblemDao = archivaDao.getRepositoryProblemDAO();
}
public ArchivaArtifact createArtifact( String groupId )
{
ArchivaArtifact artifact = artifactDao.createArtifact( groupId, "artifactId", "version", "classifier", "jar" );
artifact.getModel().setLastModified( new Date() );
artifact.getModel().setRepositoryId( "repoId" );
return artifact;
}
public RepositoryProblem createRepoProblem( String groupId )
{
RepositoryProblem repoProblem = new RepositoryProblem();
repoProblem.setGroupId( groupId );
repoProblem.setArtifactId( "artifactId" );
repoProblem.setMessage( "message" );
repoProblem.setOrigin( "origin" );
repoProblem.setPath( "path" );
repoProblem.setRepositoryId( "repoId" );
repoProblem.setType( "type" );
repoProblem.setVersion( "version" );
return repoProblem;
}
public void testArtifact()
throws Exception
{
artifactDao.saveArtifact( createArtifact( GROUP_ID_1 ) );
artifactDao.saveArtifact( createArtifact( GROUP_ID_2 ) );
artifactDao.saveArtifact( createArtifact( GROUP_ID_3 ) );
assertConstraint( 1, new UniqueFieldConstraint( ArchivaArtifactModel.class.getName(), "artifactId" ) );
assertConstraint( 3, new UniqueFieldConstraint( ArchivaArtifactModel.class.getName(), "groupId" ) );
}
public void testRepoProblem()
throws Exception
{
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_1 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_2 ) );
repoProblemDao.saveRepositoryProblem( createRepoProblem( GROUP_ID_3 ) );
assertConstraint( 1, new UniqueFieldConstraint( RepositoryProblem.class.getName(), "artifactId" ) );
assertConstraint( 3, new UniqueFieldConstraint( RepositoryProblem.class.getName(), "groupId" ) );
}
private void assertConstraint( int expectedHits, SimpleConstraint constraint )
throws Exception
{
List results = archivaDao.query( constraint );
assertNotNull( "Repository Problems: Not Null", results );
assertEquals( "Repository Problems: Results.size", expectedHits, results.size() );
}
}

View File

@ -1,238 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="ArchivaReport"
pageWidth="1800">
<field name="groupId" class="java.lang.String"/>
<field name="artifactId" class="java.lang.String"/>
<field name="version" class="java.lang.String"/>
<field name="message" class="java.lang.String"/>
<field name="origin" class="java.lang.String"/>
<field name="path" class="java.lang.String"/>
<field name="type" class="java.lang.String"/>
<field name="groupURL" class="java.lang.String"/>
<field name="artifactURL" class="java.lang.String"/>
<field name="versionURL" class="java.lang.String"/>
<field name="prev" class="java.lang.String"/>
<field name="next" class="java.lang.String"/>
<field name="page" class="java.lang.Integer"/>
<field name="isLastPage" class="java.lang.Boolean"/>
<title>
<band height="50">
<staticText>
<reportElement x="0" y="0" width="2240" height="50"/>
<textElement textAlignment="Center">
<font size="14" isBold="true"/>
</textElement>
<text><![CDATA[All Problematic Artifacts]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band></band>
</pageHeader>
<columnHeader>
<band height="20">
<staticText>
<reportElement x="0" y="0" width="300" height="20"/>
<box leftBorder="Thin"
leftPadding="10"
rightBorder="Thin"
rightPadding="10"
topBorder="Thin"
bottomBorder="Thin"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Group Id]]></text>
</staticText>
<staticText>
<reportElement x="300" y="0" width="300" height="20"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
topBorder="Thin"
bottomBorder="Thin"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Artifact Id]]></text>
</staticText>
<staticText>
<reportElement x="600" y="0" width="300" height="20"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
topBorder="Thin"
bottomBorder="Thin"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Version]]></text>
</staticText>
<staticText>
<reportElement x="900" y="0" width="300" height="20"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
topBorder="Thin"
bottomBorder="Thin"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Message]]></text>
</staticText>
<staticText>
<reportElement x="1200" y="0" width="300" height="20"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
topBorder="Thin"
bottomBorder="Thin"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Origin]]></text>
</staticText>
<staticText>
<reportElement x="1500" y="0" width="300" height="20"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
topBorder="Thin"
bottomBorder="Thin"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Repository Path]]></text>
</staticText>
<staticText>
<reportElement x="1800" y="0" width="300" height="20"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
topBorder="Thin"
bottomBorder="Thin"/>
<textElement textAlignment="Center">
<font size="12"/>
</textElement>
<text><![CDATA[Type]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20">
<textField isBlankWhenNull="true" hyperlinkType="Reference" hyperlinkTarget="Self">
<reportElement x="0" y="0" width="300" height="15"/>
<box leftBorder="Thin"
leftPadding="10"
rightBorder="Thin"
rightPadding="10"
bottomBorder="Thin"/>
<textFieldExpression>
<![CDATA[$F{groupId}]]>
</textFieldExpression>
<hyperlinkReferenceExpression><![CDATA[$F{groupURL}]]></hyperlinkReferenceExpression>
</textField>
<textField isBlankWhenNull="true" hyperlinkType="Reference" hyperlinkTarget="Self">
<reportElement x="300" y="0" width="300" height="15"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
bottomBorder="Thin"/>
<textFieldExpression>
<![CDATA[$F{artifactId}]]>
</textFieldExpression>
<hyperlinkReferenceExpression><![CDATA[$F{artifactURL}]]></hyperlinkReferenceExpression>
</textField>
<textField isBlankWhenNull="true" hyperlinkType="Reference" hyperlinkTarget="Self">
<reportElement x="600" y="0" width="300" height="15"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
bottomBorder="Thin"/>
<textFieldExpression>
<![CDATA[$F{version}]]>
</textFieldExpression>
<hyperlinkReferenceExpression><![CDATA[$F{versionURL}]]></hyperlinkReferenceExpression>
</textField>
<textField isBlankWhenNull="true" isStretchWithOverflow="true">
<reportElement x="900" y="0" width="300" height="15"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
bottomBorder="Thin"/>
<textFieldExpression>
<![CDATA[$F{message}]]>
</textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="1200" y="0" width="300" height="15"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
bottomBorder="Thin"/>
<textFieldExpression>
<![CDATA[$F{origin}]]>
</textFieldExpression>
</textField>
<textField isBlankWhenNull="true" isStretchWithOverflow="true">
<reportElement x="1500" y="0" width="300" height="15"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
bottomBorder="Thin"/>
<textFieldExpression>
<![CDATA[$F{path}]]>
</textFieldExpression>
</textField>
<textField isBlankWhenNull="true">
<reportElement x="1800" y="0" width="300" height="15"/>
<box leftPadding="10"
rightBorder="Thin"
rightPadding="10"
bottomBorder="Thin"/>
<textFieldExpression>
<![CDATA[$F{type}]]>
</textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band></band>
</columnFooter>
<pageFooter>
<band height="15">
<textField>
<reportElement x="0" y="0" width="50" height="15"/>
<textFieldExpression>
<![CDATA["Page: " + $F{page}]]>
</textFieldExpression>
</textField>
<textField hyperlinkType="Reference" hyperlinkTarget="Self">
<reportElement x="50" y="0" width="50" height="15">
<printWhenExpression>
<![CDATA[$F{page}.intValue() != 1]]>
</printWhenExpression>
</reportElement>
<textFieldExpression>
<![CDATA["prev"]]>
</textFieldExpression>
<hyperlinkReferenceExpression><![CDATA[$F{prev}]]></hyperlinkReferenceExpression>
</textField>
<textField hyperlinkType="Reference" hyperlinkTarget="Self">
<reportElement x="100" y="0" width="50" height="15">
<printWhenExpression>
<![CDATA[$F{isLastPage} != true]]>
</printWhenExpression>
</reportElement>
<textFieldExpression>
<![CDATA["next"]]>
</textFieldExpression>
<hyperlinkReferenceExpression><![CDATA[$F{next}]]></hyperlinkReferenceExpression>
</textField>
</band>
</pageFooter>
<summary>
<band></band>
</summary>
</jasperReport>

View File

@ -1,35 +0,0 @@
package org.apache.maven.archiva.web.action.reports;
import org.apache.maven.archiva.database.constraints.RangeConstraint;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* All problematic artifacts reporting.
*
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="allProblematicArtifactsAction"
*/
public class AllProblematicArtifactsAction extends AbstractReportAction
{
protected void configureConstraint()
{
this.constraint = new RangeConstraint( range );
}
}

View File

@ -19,13 +19,13 @@ package org.apache.maven.archiva.web.action.reports;
* under the License. * under the License.
*/ */
import java.util.ArrayList; import com.opensymphony.webwork.interceptor.ServletRequestAware;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.maven.archiva.database.ArchivaDAO; import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.Constraint; import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.constraints.RangeConstraint;
import org.apache.maven.archiva.database.constraints.RepositoryProblemByGroupIdConstraint;
import org.apache.maven.archiva.database.constraints.RepositoryProblemByRepositoryIdConstraint;
import org.apache.maven.archiva.database.constraints.RepositoryProblemConstraint;
import org.apache.maven.archiva.model.RepositoryProblem; import org.apache.maven.archiva.model.RepositoryProblem;
import org.apache.maven.archiva.model.RepositoryProblemReport; import org.apache.maven.archiva.model.RepositoryProblemReport;
import org.apache.maven.archiva.security.ArchivaRoleConstants; import org.apache.maven.archiva.security.ArchivaRoleConstants;
@ -35,12 +35,16 @@ import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle;
import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException; import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException;
import org.codehaus.plexus.xwork.action.PlexusActionSupport; import org.codehaus.plexus.xwork.action.PlexusActionSupport;
import com.opensymphony.webwork.interceptor.ServletRequestAware; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/** /**
* Abstract reporting. * @plexus.component role="com.opensymphony.xwork.Action" role-hint="generateReportAction"
*/ */
public abstract class AbstractReportAction extends PlexusActionSupport implements SecureAction, ServletRequestAware public class GenerateReportAction
extends PlexusActionSupport
implements SecureAction, ServletRequestAware
{ {
/** /**
* @plexus.requirement role-hint="jdo" * @plexus.requirement role-hint="jdo"
@ -53,6 +57,10 @@ public abstract class AbstractReportAction extends PlexusActionSupport implement
protected List reports = new ArrayList(); protected List reports = new ArrayList();
protected String groupId;
protected String repositoryId;
protected String prev; protected String prev;
protected String next; protected String next;
@ -67,13 +75,10 @@ public abstract class AbstractReportAction extends PlexusActionSupport implement
public static final String BLANK = "blank"; public static final String BLANK = "blank";
public String execute() throws Exception public String execute()
throws Exception
{ {
range[0] = ( page - 1 ) * rowCount; List problemArtifacts = dao.getRepositoryProblemDAO().queryRepositoryProblems( configureConstraint() );
range[1] = ( page * rowCount ) + 1; // Add 1 to check if it's the last page or not.
configureConstraint();
List problemArtifacts = dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint );
String contextPath = String contextPath =
request.getRequestURL().substring( 0, request.getRequestURL().indexOf( request.getRequestURI() ) ); request.getRequestURL().substring( 0, request.getRequestURL().indexOf( request.getRequestURI() ) );
@ -85,10 +90,8 @@ public abstract class AbstractReportAction extends PlexusActionSupport implement
problemArtifactReport = new RepositoryProblemReport( problemArtifact ); problemArtifactReport = new RepositoryProblemReport( problemArtifact );
problemArtifactReport.setGroupURL( contextPath + "/browse/" + problemArtifact.getGroupId() ); problemArtifactReport.setGroupURL( contextPath + "/browse/" + problemArtifact.getGroupId() );
problemArtifactReport.setArtifactURL( contextPath + "/browse/" + problemArtifact.getGroupId() + "/" problemArtifactReport.setArtifactURL(
+ problemArtifact.getArtifactId() ); contextPath + "/browse/" + problemArtifact.getGroupId() + "/" + problemArtifact.getArtifactId() );
problemArtifactReport.setVersionURL( contextPath + "/browse/" + problemArtifact.getGroupId() + "/"
+ problemArtifact.getArtifactId() + "/" + problemArtifact.getVersion() );
reports.add( problemArtifactReport ); reports.add( problemArtifactReport );
} }
@ -102,8 +105,10 @@ public abstract class AbstractReportAction extends PlexusActionSupport implement
reports.remove( rowCount ); reports.remove( rowCount );
} }
prev = request.getRequestURL() + "?page=" + ( page - 1 ) + "&rowCount=" + rowCount; prev = request.getRequestURL() + "?page=" + ( page - 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId +
next = request.getRequestURL() + "?page=" + ( page + 1 ) + "&rowCount=" + rowCount; "&repositoryId=" + repositoryId;
next = request.getRequestURL() + "?page=" + ( page + 1 ) + "&rowCount=" + rowCount + "&groupId=" + groupId +
"&repositoryId=" + repositoryId;
if ( reports.size() == 0 && page == 1 ) if ( reports.size() == 0 && page == 1 )
{ {
@ -115,10 +120,35 @@ public abstract class AbstractReportAction extends PlexusActionSupport implement
} }
} }
/** private Constraint configureConstraint()
* To be implemented by sub-reports to configure specific constraints. {
*/ Constraint constraint;
abstract protected void configureConstraint();
range[0] = ( page - 1 ) * rowCount;
range[1] = ( page * rowCount ) + 1; // Add 1 to check if it's the last page or not.
if ( groupId != null && ( !groupId.equals( "" ) ) )
{
if ( repositoryId != null && ( !repositoryId.equals( "" ) ) )
{
constraint = new RepositoryProblemConstraint( range, groupId, repositoryId );
}
else
{
constraint = new RepositoryProblemByGroupIdConstraint( range, groupId );
}
}
else if ( repositoryId != null && ( !repositoryId.equals( "" ) ) )
{
constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId );
}
else
{
constraint = new RangeConstraint( range );
}
return constraint;
}
public void setServletRequest( HttpServletRequest request ) public void setServletRequest( HttpServletRequest request )
{ {
@ -130,6 +160,26 @@ public abstract class AbstractReportAction extends PlexusActionSupport implement
return reports; return reports;
} }
public String getGroupId()
{
return groupId;
}
public void setGroupId( String groupId )
{
this.groupId = groupId;
}
public String getRepositoryId()
{
return repositoryId;
}
public void setRepositoryId( String repositoryId )
{
this.repositoryId = repositoryId;
}
public String getPrev() public String getPrev()
{ {
return prev; return prev;
@ -165,7 +215,8 @@ public abstract class AbstractReportAction extends PlexusActionSupport implement
return isLastPage; return isLastPage;
} }
public SecureActionBundle getSecureActionBundle() throws SecureActionException public SecureActionBundle getSecureActionBundle()
throws SecureActionException
{ {
SecureActionBundle bundle = new SecureActionBundle(); SecureActionBundle bundle = new SecureActionBundle();

View File

@ -1,42 +0,0 @@
package org.apache.maven.archiva.web.action.reports;
import org.apache.maven.archiva.database.constraints.RepositoryProblemByArtifactIdConstraint;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* By artifact id reporting.
*
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="reportsByArtifactIdAction"
*/
public class ReportsByArtifactIdAction extends AbstractReportAction
{
private String artifactId;
protected void configureConstraint()
{
this.constraint = new RepositoryProblemByArtifactIdConstraint( range, artifactId );
}
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
}
}

View File

@ -1,43 +0,0 @@
package org.apache.maven.archiva.web.action.reports;
import org.apache.maven.archiva.database.constraints.RangeConstraint;
import org.apache.maven.archiva.database.constraints.RepositoryProblemByGroupIdConstraint;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* By group id reporting.
*
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="reportsByGroupIdAction"
*/
public class ReportsByGroupIdAction extends AbstractReportAction
{
private String groupId;
protected void configureConstraint()
{
this.constraint = new RepositoryProblemByGroupIdConstraint( range, groupId );
}
public void setGroupId( String groupId )
{
this.groupId = groupId;
}
}

View File

@ -1,42 +0,0 @@
package org.apache.maven.archiva.web.action.reports;
import org.apache.maven.archiva.database.constraints.RepositoryProblemByRepositoryIdConstraint;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* By repository id reporting.
*
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="reportsByRepositoryIdAction"
*/
public class ReportsByRepositoryIdAction extends AbstractReportAction
{
private String repositoryId;
protected void configureConstraint()
{
this.constraint = new RepositoryProblemByRepositoryIdConstraint( range, repositoryId );
}
public void setRepositoryId( String repositoryId )
{
this.repositoryId = repositoryId;
}
}

View File

@ -1,49 +0,0 @@
package org.apache.maven.archiva.web.action.reports;
import java.util.Collection;
import org.apache.maven.archiva.database.ArchivaDAO;
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
/**
* Show reports.
*
* @plexus.component role="com.opensymphony.xwork.Action" role-hint="showReportsAction"
*/
public class ShowReportsAction extends PlexusActionSupport
{
/**
* @plexus.requirement role-hint="jdo"
*/
protected ArchivaDAO dao;
private Collection groupIds;
private Collection artifactIds;
private Collection repositoryIds;
public String execute() throws Exception
{
/*
* TODO Use combo box for groupIds, artifactIds and repositoryIds instead of a text field.
*/
return SUCCESS;
}
public Collection getGroupIds()
{
return groupIds;
}
public Collection getArtifactIds()
{
return artifactIds;
}
public Collection getRepositoryIds()
{
return repositoryIds;
}
}

View File

@ -395,34 +395,7 @@
<result>/WEB-INF/jsp/reports/showReports.jsp</result> <result>/WEB-INF/jsp/reports/showReports.jsp</result>
</action> </action>
<action name="allProblematicArtifacts" class="allProblematicArtifactsAction"> <action name="generateReportAction" class="generateReportAction">
<result name="success" type="jasper">
<param name="location">/WEB-INF/jasperreports/report.jasper</param>
<param name="dataSource">reports</param>
<param name="format">HTML</param>
</result>
<result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
</action>
<action name="byGroupId" class="reportsByGroupIdAction">
<result name="success" type="jasper">
<param name="location">/WEB-INF/jasperreports/report.jasper</param>
<param name="dataSource">reports</param>
<param name="format">HTML</param>
</result>
<result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
</action>
<action name="byArtifactId" class="reportsByArtifactIdAction">
<result name="success" type="jasper">
<param name="location">/WEB-INF/jasperreports/report.jasper</param>
<param name="dataSource">reports</param>
<param name="format">HTML</param>
</result>
<result name="blank">/WEB-INF/jsp/reports/blankReport.jsp</result>
</action>
<action name="byRepositoryId" class="reportsByRepositoryIdAction">
<result name="success" type="jasper"> <result name="success" type="jasper">
<param name="location">/WEB-INF/jasperreports/report.jasper</param> <param name="location">/WEB-INF/jasperreports/report.jasper</param>
<param name="dataSource">reports</param> <param name="dataSource">reports</param>

View File

@ -1,36 +0,0 @@
<%--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
--%>
<%@ taglib prefix="ww" uri="/webwork" %>
<html>
<head>
<title>Reports</title>
<ww:head/>
</head>
<body>
<h1>Reports</h1>
<div id="contentArea">
<ww:text name="The operation generated an empty report."/>
</div>
</body>
</html>

View File

@ -1,80 +0,0 @@
<%--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
--%>
<%@ taglib prefix="ww" uri="/webwork" %>
<html>
<head>
<title>Reports</title>
<ww:head/>
</head>
<body>
<script>
function getRowCount()
{
document.getElementById("rowCount1_id").value = document.getElementById("rowCountSource_id").value;
document.getElementById("rowCount2_id").value = document.getElementById("rowCountSource_id").value;
document.getElementById("rowCount3_id").value = document.getElementById("rowCountSource_id").value;
document.getElementById("rowCount4_id").value = document.getElementById("rowCountSource_id").value;
}
</script>
<h1>Reports</h1>
<div id="contentArea">
<h2>Global Settings</h2>
<ww:textfield id="rowCountSource_id" label="Row Count" value="100"/>
<br><br>
<h2>All Problematic Artifacts</h2>
<ww:form onsubmit="getRowCount();" action="allProblematicArtifacts" namespace="/report">
<ww:hidden id="rowCount1_id" name="rowCount"/>
<ww:submit value="Show All Problematic Artifacts"/>
</ww:form>
<br>
<h2>Problematic Artifacts by Group Id</h2>
<ww:form action="byGroupId" namespace="/report">
<ww:hidden id="rowCount2_id" name="rowCount"/>
<ww:textfield name="groupId"/>
<ww:submit value="Problematic Artifacts by Group Id"/>
</ww:form>
<br>
<h2>Problematic Artifacts by Artifact Id</h2>
<ww:form action="byArtifactId" namespace="/report">
<ww:hidden id="rowCount3_id" name="rowCount"/>
<ww:textfield name="artifactId"/>
<ww:submit value="Problematic Artifacts by Artifact Id"/>
</ww:form>
<br>
<h2>Problematic Artifacts by Repository Id</h2>
<ww:form action="byRepositoryId" namespace="/report">
<ww:hidden id="rowCount4_id" name="rowCount"/>
<ww:textfield name="repositoryId"/>
<ww:submit value="Problematic Artifacts by Repository Id"/>
</ww:form>
</div>
</body>
</html>