diff options
3 files changed, 8 insertions, 6 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java index ef7b16117..5d518009a 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java @@ -21,6 +21,7 @@ package org.apache.archiva.rest.api.services; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.maven2.model.Artifact; import org.apache.archiva.maven2.model.TreeEntry; +import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.redback.authorization.RedbackAuthorization; import org.apache.archiva.rest.api.model.ArtifactContent; @@ -192,18 +193,18 @@ public interface BrowseService @PathParam ("v") String version, @QueryParam ("repositoryId") String repositoryId ) throws ArchivaRestServiceException; - @Path ("artifactsNumber/{r}") + @Path ("artifacts/{r}") @GET @Produces ({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) @RedbackAuthorization (noPermission = true, noRestriction = true) /** * - * return artifacts number in a repository + * return List of all artifacts from this repository * @param repositoryId * @return * @throws ArchivaRestServiceException * @since 1.4-M3 */ - Integer getArtifactsNumber( @PathParam ( "r" ) String repositoryId ) + List<Artifact> getArtifacts( @PathParam ( "r" ) String repositoryId ) throws ArchivaRestServiceException; } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java index fa8d21217..57b238b62 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java @@ -830,13 +830,14 @@ public class DefaultBrowseService return false; } - public Integer getArtifactsNumber( String repositoryId ) + public List<Artifact> getArtifacts( String repositoryId ) throws ArchivaRestServiceException { RepositorySession repositorySession = repositorySessionFactory.createSession(); try { - return repositorySession.getRepository().getArtifacts( repositoryId ).size(); + List<ArtifactMetadata> artifactMetadatas = repositorySession.getRepository().getArtifacts( repositoryId ); + return buildArtifacts( artifactMetadatas, repositoryId ); } catch ( MetadataRepositoryException e ) { diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java index 544487354..05796a7d6 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java @@ -447,7 +447,7 @@ public class BrowseServiceTest try { - int number = browseService.getArtifactsNumber( testRepoId ); + int number = browseService.getArtifacts( testRepoId ).size(); log.info( "getArtifactsNumber: {}", number ); |