diff options
author | Olivier Lamy <olamy@apache.org> | 2012-05-23 16:26:02 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-05-23 16:26:02 +0000 |
commit | 1130d556c279f35460472d0a7f31217f4a090b36 (patch) | |
tree | 6676d4dd04cc813a82bbc659806f44c0490493a7 /archiva-modules/archiva-web/archiva-rest/archiva-rest-api | |
parent | 52790f9eeaa23ff0100d1a043a83ae4c7e3c1b7d (diff) | |
download | archiva-1130d556c279f35460472d0a7f31217f4a090b36.tar.gz archiva-1130d556c279f35460472d0a7f31217f4a090b36.zip |
use bean rather than passing string. return back repositoryId used.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1341937 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web/archiva-rest/archiva-rest-api')
2 files changed, 33 insertions, 9 deletions
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArtifactContentEntry.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArtifactContentEntry.java index b74a143b9..7c2fac56e 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArtifactContentEntry.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/ArtifactContentEntry.java @@ -35,16 +35,21 @@ public class ArtifactContentEntry private int depth; + private String repositoryId; + public ArtifactContentEntry() { // no op } - public ArtifactContentEntry( String path, boolean file, int depth ) + + public ArtifactContentEntry( String path, boolean file, int depth, String repositoryId ) { + this.path = path; this.file = file; this.depth = depth; + this.repositoryId = repositoryId; } public String getPath() @@ -77,6 +82,17 @@ public class ArtifactContentEntry this.depth = depth; } + public String getRepositoryId() + { + return repositoryId; + } + + public void setRepositoryId( String repositoryId ) + { + this.repositoryId = repositoryId; + } + + @Override public boolean equals( Object o ) { @@ -99,7 +115,11 @@ public class ArtifactContentEntry { return false; } - if ( path != null ? !path.equals( that.path ) : that.path != null ) + if ( !path.equals( that.path ) ) + { + return false; + } + if ( !repositoryId.equals( that.repositoryId ) ) { return false; } @@ -110,20 +130,23 @@ public class ArtifactContentEntry @Override public int hashCode() { - int result = path != null ? path.hashCode() : 0; + int result = path.hashCode(); result = 31 * result + ( file ? 1 : 0 ); result = 31 * result + depth; + result = 31 * result + repositoryId.hashCode(); return result; } + @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append( "ArtifactContentEntry" ); - sb.append( "{text='" ).append( path ).append( '\'' ); + sb.append( "{path='" ).append( path ).append( '\'' ); sb.append( ", file=" ).append( file ); sb.append( ", depth=" ).append( depth ); + sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' ); sb.append( '}' ); return sb.toString(); } 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 6cd280bd5..22028c4ab 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 @@ -22,6 +22,7 @@ import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.metadata.model.ProjectVersionMetadata; import org.apache.archiva.redback.authorization.RedbackAuthorization; import org.apache.archiva.rest.api.model.Artifact; +import org.apache.archiva.rest.api.model.ArtifactContent; import org.apache.archiva.rest.api.model.ArtifactContentEntry; import org.apache.archiva.rest.api.model.ArtifactDownloadInfo; import org.apache.archiva.rest.api.model.BrowseResult; @@ -172,14 +173,14 @@ public interface BrowseService @Path( "artifactContentText/{g}/{a}/{v}" ) @GET - @Produces( MediaType.TEXT_PLAIN ) + @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } ) @RedbackAuthorization( noPermission = true, noRestriction = true ) /** * if path is empty content of the file is returned (for pom view) */ - String getArtifactContentText( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId, - @PathParam( "v" ) String version, @QueryParam( "c" ) String classifier, - @QueryParam( "t" ) String type, @QueryParam( "p" ) String path, - @QueryParam( "repositoryId" ) String repositoryId ) + ArtifactContent getArtifactContentText( @PathParam( "g" ) String groupId, @PathParam( "a" ) String artifactId, + @PathParam( "v" ) String version, @QueryParam( "c" ) String classifier, + @QueryParam( "t" ) String type, @QueryParam( "p" ) String path, + @QueryParam( "repositoryId" ) String repositoryId ) throws ArchivaRestServiceException; } |