]> source.dussan.org Git - archiva.git/commitdiff
change method to be able to retrieve artifacts
authorOlivier Lamy <olamy@apache.org>
Thu, 20 Sep 2012 19:42:46 +0000 (19:42 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 20 Sep 2012 19:42:46 +0000 (19:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1388175 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/services/BrowseService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/BrowseServiceTest.java

index ef7b1611749b64b0fde78579aede1d48897d5fdd..5d518009a357d92fe6c2fec1d0376af252ea2782 100644 (file)
@@ -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;
 }
index fa8d21217560ece7523b77f4e0ebda2439cc887b..57b238b62f2d1c28e908bf60c59b2a2a39d952d9 100644 (file)
@@ -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 )
         {
index 544487354a8a74dc42aa3184efc76eca0fbdad62..05796a7d6e72f7b65079f3e4e0a16cb98f09d8d2 100644 (file)
@@ -447,7 +447,7 @@ public class BrowseServiceTest
 
         try
         {
-            int number = browseService.getArtifactsNumber( testRepoId );
+            int number = browseService.getArtifacts( testRepoId ).size();
 
             log.info( "getArtifactsNumber: {}", number );