From a5721cffbaee73b6162744834b5ac103075d28fd Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Thu, 29 Mar 2012 22:53:13 +0000 Subject: [PATCH] transfer more informations for file uploading: maven coordinate git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1307154 13f79535-47bb-0310-9956-ffa450edef68 --- .../api/DefaultFileUploadService.java | 15 +++ .../ui/services/model/FileMetadata.java | 106 ++++++++++++++++++ .../archiva/artifacts-management.html | 3 +- 3 files changed, 123 insertions(+), 1 deletion(-) 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 37c6dafeb..4d5ff797f 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 @@ -88,19 +88,34 @@ public class DefaultFileUploadService String packaging = IOUtils.toString( multipartBody.getAttachment( "packaging" ).getDataHandler().getInputStream() ); + String repositoryId = + IOUtils.toString( multipartBody.getAttachment( "repositoryId" ).getDataHandler().getInputStream() ); + boolean generatePom = BooleanUtils.toBoolean( IOUtils.toString( multipartBody.getAttachment( "generatePom" ).getDataHandler().getInputStream() ) ); String classifier = IOUtils.toString( multipartBody.getAttachment( "classifier" ).getDataHandler().getInputStream() ); + boolean pomFile = BooleanUtils.toBoolean( + IOUtils.toString( multipartBody.getAttachment( "pomFile" ).getDataHandler().getInputStream() ) ); + log.info( "uploading file:" + groupId + ":" + artifactId + ":" + version ); Attachment file = multipartBody.getAttachment( "files[]" ); File tmpFile = File.createTempFile( "upload-artifact", "tmp" ); tmpFile.deleteOnExit(); IOUtils.copy( file.getDataHandler().getInputStream(), new FileOutputStream( tmpFile ) ); FileMetadata fileMetadata = new FileMetadata( "thefile", tmpFile.length(), "theurl" ); + fileMetadata.setGroupId( groupId ); + fileMetadata.setArtifactId( artifactId ); + fileMetadata.setVersion( version ); + fileMetadata.setVersion( version ); + fileMetadata.setPackaging( packaging ); + fileMetadata.setGeneratePom( generatePom ); + fileMetadata.setClassifier( classifier ); fileMetadata.setDeleteUrl( tmpFile.getName() ); + fileMetadata.setRepositoryId( repositoryId ); + fileMetadata.setPomFile( pomFile ); return fileMetadata; } catch ( IOException e ) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/FileMetadata.java b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/FileMetadata.java index 5dbeb2515..864d9b7e4 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/FileMetadata.java +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/java/org/apache/archiva/webapp/ui/services/model/FileMetadata.java @@ -41,6 +41,22 @@ public class FileMetadata private String errorKey; + private String groupId; + + private String artifactId; + + private String version; + + private String packaging; + + private boolean generatePom; + + private String classifier; + + private String repositoryId; + + private boolean pomFile; + public FileMetadata() { // no op @@ -105,4 +121,94 @@ public class FileMetadata { this.deleteType = deleteType; } + + public String getErrorKey() + { + return errorKey; + } + + public void setErrorKey( String errorKey ) + { + this.errorKey = errorKey; + } + + public String getGroupId() + { + return groupId; + } + + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } + + public String getArtifactId() + { + return artifactId; + } + + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } + + public String getVersion() + { + return version; + } + + public void setVersion( String version ) + { + this.version = version; + } + + public String getPackaging() + { + return packaging; + } + + public void setPackaging( String packaging ) + { + this.packaging = packaging; + } + + public boolean isGeneratePom() + { + return generatePom; + } + + public void setGeneratePom( boolean generatePom ) + { + this.generatePom = generatePom; + } + + public String getClassifier() + { + return classifier; + } + + public void setClassifier( String classifier ) + { + this.classifier = classifier; + } + + public String getRepositoryId() + { + return repositoryId; + } + + public void setRepositoryId( String repositoryId ) + { + this.repositoryId = repositoryId; + } + + public boolean isPomFile() + { + return pomFile; + } + + public void setPomFile( boolean pomFile ) + { + this.pomFile = pomFile; + } } diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/artifacts-management.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/artifacts-management.html index 719965d76..8140438f8 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/artifacts-management.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/artifacts-management.html @@ -94,7 +94,8 @@ {% for (var i=0, file; file=o.files[i]; i++) { %} {%=file.name%} - + + pomFile: {%=o.formatFileSize(file.size)%} {% if (file.error) { %} -- 2.39.5