From: Olivier Lamy Date: Fri, 15 Jun 2012 20:10:08 +0000 (+0000) Subject: restore backward comp for the struts webapp X-Git-Tag: archiva-1.4-M3~612 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f2809251dc45f432779150caff01b77ac71bcbc8;p=archiva.git restore backward comp for the struts webapp git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1350773 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java index 9f975e46a..3baa0ce0a 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java @@ -151,6 +151,12 @@ public class Artifact */ private String path; + /** + * concat of artifactId+'-'+version+'.'+type + * @since 1.4-M3 + */ + private String id; + public Artifact() { @@ -405,6 +411,16 @@ public class Artifact this.path = path; } + public String getId() + { + return id; + } + + public void setId( String id ) + { + this.id = id; + } + @Override public String toString() { @@ -434,6 +450,7 @@ public class Artifact sb.append( ", size='" ).append( size ).append( '\'' ); sb.append( ", type='" ).append( type ).append( '\'' ); sb.append( ", path='" ).append( path ).append( '\'' ); + sb.append( ", id='" ).append( id ).append( '\'' ); sb.append( '}' ); return sb.toString(); } diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java index 4a4065462..b569ac8e0 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java @@ -111,6 +111,9 @@ public class ArtifactDownloadInfoBuilder artifact.setContext( managedRepositoryContent.getId() ); DecimalFormat df = new DecimalFormat( "#,###.##", new DecimalFormatSymbols( Locale.US ) ); artifact.setSize( df.format( s ) + " " + symbol ); + + artifact.setId( ref.getArtifactId() + "-" + ref.getVersion() + "." + ref.getType() ); + return artifact; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java index 00814525d..2b2f18428 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java @@ -566,7 +566,7 @@ public class ShowArtifactActionTest List list = artifactMap.get( artifact.getVersion() ); Artifact actual = list.get( 0 ); assertEquals( artifact.getNamespace(), actual.getGroupId() ); - assertEquals( artifact.getId(), actual.getArtifactId() ); + assertEquals( artifact.getId(),actual.getId() ); // olamy test has no more sense as we reuse an other object now //assertEquals( artifact.getProject(), actual.getGroupId() ); assertEquals( artifact.getRepositoryId(), actual.getRepositoryId() );