]> source.dussan.org Git - archiva.git/commitdiff
restore backward comp for the struts webapp
authorOlivier Lamy <olamy@apache.org>
Fri, 15 Jun 2012 20:10:08 +0000 (20:10 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 15 Jun 2012 20:10:08 +0000 (20:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1350773 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/model/Artifact.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/ArtifactDownloadInfoBuilder.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/action/ShowArtifactActionTest.java

index 9f975e46afc5f44837750beb547297a261695ada..3baa0ce0a480cfc6ea93378041df517bbfb669dd 100644 (file)
@@ -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();
     }
index 4a4065462a207babfd5e51b978ce183b4ee4497c..b569ac8e015603207f9b8cfbd482a7f0c6ef4963 100644 (file)
@@ -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;
 
     }
index 00814525d3705d98a39093b5f9468f0dc6cdbb9c..2b2f184283649a77546998aa7a927909efdcdf3a 100644 (file)
@@ -566,7 +566,7 @@ public class ShowArtifactActionTest
             List<Artifact> 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() );