From 994e72b0185eb78a85051b6441453566b2537b83 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 28 May 2012 22:52:58 +0000 Subject: [PATCH] artifact content view: display snapshot versions git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1343416 13f79535-47bb-0310-9956-ffa450edef68 --- .../services/api/DefaultFileUploadService.java | 2 +- .../src/main/webapp/js/archiva/search.js | 16 ++++++++++------ .../main/webapp/js/templates/archiva/search.html | 4 ++-- .../apache/archiva/web/action/MergeAction.java | 5 +++-- .../apache/archiva/web/action/UploadAction.java | 4 ++-- .../storage/maven2/RepositoryModelResolver.java | 2 +- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultFileUploadService.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultFileUploadService.java index fb590de9e..4954ee336 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultFileUploadService.java +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/api/DefaultFileUploadService.java @@ -372,7 +372,7 @@ public class DefaultFileUploadService String filename = artifactPath.substring( lastIndex + 1 ); if ( VersionUtil.isSnapshot( version ) ) { - filename = filename.replaceAll( "SNAPSHOT", timestamp + "-" + newBuildNumber ); + filename = filename.replaceAll( VersionUtil.SNAPSHOT, timestamp + "-" + newBuildNumber ); } boolean fixChecksums = diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index c38ce483f..b2ca397ca 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -281,13 +281,17 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock mainContent.find("#artifact_content_tree").html(""); mainContent.find("#artifact-content-text" ).html(""); var idValue = $(this ).attr("id"); - var classifier=idValue.substringBeforeLast(":"); - var type = idValue.substringAfterLast(":"); - $.log("click:" + idValue + " -> " + classifier + ":" + type ); + var splitted = idValue.split(":"); + + var classifier=splitted[0];//idValue.substringBeforeLast(":"); + var version=splitted[1]; + var type = splitted[2]; + + $.log("click:" + idValue + " -> " + classifier + ":" + type + ":" + version); if (type=="pom"){ $.log("show pom"); var pomContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId); - pomContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version); + pomContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version); pomContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository()); pomContentUrl+="&t=pom"; mainContent.find("#artifact-content-text" ).html(smallSpinnerImg()); @@ -304,7 +308,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock return; } var entriesUrl = "restServices/archivaServices/browseService/artifactContentEntries/"+encodeURIComponent(self.groupId); - entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version); + entriesUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version); entriesUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository()); if(classifier){ entriesUrl+="&c="+encodeURIComponent(classifier); @@ -315,7 +319,7 @@ define("search",["jquery","i18n","jquery.tmpl","choosen","order!knockout","knock },function(file) { $.log("file:"+file.substringBeforeLast("/")+',classifier:'+classifier); var fileContentUrl = "restServices/archivaServices/browseService/artifactContentText/"+encodeURIComponent(self.groupId); - fileContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(self.version); + fileContentUrl+="/"+encodeURIComponent(self.artifactId)+"/"+encodeURIComponent(version); fileContentUrl+="?repositoryId="+encodeURIComponent(getSelectedBrowsingRepository()); if(type){ fileContentUrl+="&t="+encodeURIComponent(type); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html index 8af92748d..41e6fff19 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html @@ -811,8 +811,8 @@
diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java index 6f43b8a70..201c1cbbe 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/MergeAction.java @@ -26,15 +26,16 @@ import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.audit.AuditEvent; import org.apache.archiva.audit.Auditable; +import org.apache.archiva.common.utils.VersionUtil; import org.apache.archiva.metadata.model.ArtifactMetadata; import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.filter.Filter; import org.apache.archiva.metadata.repository.filter.IncludesFilter; +import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; import org.apache.archiva.scheduler.repository.RepositoryTask; import org.apache.archiva.stagerepository.merge.Maven2RepositoryMerger; -import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; @@ -296,7 +297,7 @@ public class MergeAction for ( ArtifactMetadata metadata : sourceArtifacts ) { - if ( metadata.getProjectVersion().contains( "SNAPSHOT" ) ) + if ( metadata.getProjectVersion().contains( VersionUtil.SNAPSHOT ) ) { artifactsWithOutSnapshots.add( metadata ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java index 3e83626f9..421f8ba1a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/action/UploadAction.java @@ -35,6 +35,7 @@ import org.apache.archiva.maven2.metadata.MavenMetadataReader; import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.model.SnapshotVersion; +import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.repository.RepositoryContentFactory; import org.apache.archiva.repository.RepositoryException; @@ -54,7 +55,6 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Writer; -import org.apache.archiva.redback.components.taskqueue.TaskQueueException; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; @@ -343,7 +343,7 @@ public class UploadAction String filename = artifactPath.substring( lastIndex + 1 ); if ( VersionUtil.isSnapshot( version ) ) { - filename = filename.replaceAll( "SNAPSHOT", timestamp + "-" + newBuildNumber ); + filename = filename.replaceAll( VersionUtil.SNAPSHOT, timestamp + "-" + newBuildNumber ); } boolean fixChecksums = diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index b71cd7419..92fe5a097 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -111,7 +111,7 @@ public class RepositoryModelResolver { // is a SNAPSHOT ? so we can try to find locally before asking remote repositories. - if ( StringUtils.contains( version, "SNAPSHOT" ) ) + if ( StringUtils.contains( version, VersionUtil.SNAPSHOT ) ) { File localSnapshotModel = findTimeStampedSnapshotPom( groupId, artifactId, version, model.getParent() ); if ( localSnapshotModel != null ) -- 2.39.5