Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
Francesco Mangiacrapa | 00a747735a | |
Francesco Mangiacrapa | 39c91b5721 | |
Francesco Mangiacrapa | 693a4fc281 | |
Francesco Mangiacrapa | 4e409b16cd | |
Francesco Mangiacrapa | 0e88bbbab5 | |
Francesco Mangiacrapa | 31130db6c9 | |
Francesco Mangiacrapa | 18c0300dc7 | |
Francesco Mangiacrapa | b678fdeedc | |
Francesco Mangiacrapa | 6a19713ea4 | |
Francesco Mangiacrapa | a7bed05f4c | |
Francesco Mangiacrapa | 9ca232196e | |
Francesco Mangiacrapa | 040b2c3817 |
38
.classpath
38
.classpath
|
@ -13,8 +13,26 @@
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="optional" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
|
@ -28,23 +46,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +13,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="workspace-tree-widget">
|
<wb-module deploy-name="workspace-tree-widget">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +27,8 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,19 +41,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/generated-sources/annotations"/>
|
<wb-resource deploy-path="/" source-path="/target/generated-sources/annotations"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +56,8 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
23
CHANGELOG.md
23
CHANGELOG.md
|
@ -4,6 +4,21 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v6.35.3] - 2024-03-19
|
||||||
|
|
||||||
|
- Moved to maven parent 1.2.0
|
||||||
|
- Added lombok 1.18.4 (provided) to avoid `java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags`
|
||||||
|
- Equipped with the new Catalogue Publishing Widget [#26825]
|
||||||
|
- image-previewer-widget range at [1.0.0, 1.3.0-SNAPSHOT)
|
||||||
|
|
||||||
|
## [v6.35.2] - 2022-09-14
|
||||||
|
|
||||||
|
#### Bug fixed
|
||||||
|
|
||||||
|
- [#23676] Fixed - Added extension .txt to ASC files when dowloaded
|
||||||
|
- [#23789] Fixed - Notebook files (.ipynb) are downloaded with .txt attached.
|
||||||
|
- [#23862] Fixed - Downloading folders containing a "." in the name, the .zip is appended to file name
|
||||||
|
|
||||||
## [v6.35.1] - 2022-06-27
|
## [v6.35.1] - 2022-06-27
|
||||||
|
|
||||||
- [#23523] Updated to maven-portal-bom 3.6.4
|
- [#23523] Updated to maven-portal-bom 3.6.4
|
||||||
|
@ -72,7 +87,7 @@ Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
|
||||||
|
|
||||||
[#19952] Fixed incident
|
[#19952] Fixed incident
|
||||||
|
|
||||||
## [v6.31.0] [r4.25.0] - 2020-09-29
|
## [v6.31.0] - 2020-09-29
|
||||||
|
|
||||||
#### Enhancements
|
#### Enhancements
|
||||||
|
|
||||||
|
@ -86,14 +101,14 @@ Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
|
||||||
|
|
||||||
[#19759#note-12] Fixed updating the description of a folder
|
[#19759#note-12] Fixed updating the description of a folder
|
||||||
|
|
||||||
## [v6.30.1] [r4.24.0] - 2020-06-25
|
## [v6.30.1] - 2020-06-25
|
||||||
|
|
||||||
#### Fixes
|
#### Fixes
|
||||||
|
|
||||||
[#19544] update the unsharing messages in the accounting history
|
[#19544] update the unsharing messages in the accounting history
|
||||||
|
|
||||||
|
|
||||||
## [v6.30.0] [r4.23.0] - 2020-05-18
|
## [v6.30.0] - 2020-05-18
|
||||||
|
|
||||||
#### New Features
|
#### New Features
|
||||||
|
|
||||||
|
@ -106,7 +121,7 @@ Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
|
||||||
[#19243] Fixed upload archive facility does not work properly with Windows OS
|
[#19243] Fixed upload archive facility does not work properly with Windows OS
|
||||||
|
|
||||||
|
|
||||||
## [v6.29.0] [r4.21.0] - 2020-03-27
|
## [v6.29.0] - 2020-03-27
|
||||||
|
|
||||||
#### New Features
|
#### New Features
|
||||||
|
|
||||||
|
|
73
pom.xml
73
pom.xml
|
@ -5,13 +5,13 @@
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>maven-parent</artifactId>
|
<artifactId>maven-parent</artifactId>
|
||||||
<groupId>org.gcube.tools</groupId>
|
<groupId>org.gcube.tools</groupId>
|
||||||
<version>1.1.0</version>
|
<version>1.2.0</version>
|
||||||
<relativePath />
|
<relativePath />
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>workspace-tree-widget</artifactId>
|
<artifactId>workspace-tree-widget</artifactId>
|
||||||
<version>6.35.1</version>
|
<version>6.35.3</version>
|
||||||
<name>gCube Workspace Tree Widget</name>
|
<name>gCube Workspace Tree Widget</name>
|
||||||
<description>
|
<description>
|
||||||
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
|
||||||
|
@ -39,6 +39,9 @@
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<gxt2.2.5-gwt2.X-version>2.7.0</gxt2.2.5-gwt2.X-version>
|
||||||
|
|
||||||
|
<gcube-portal-bom-version>3.7.0</gcube-portal-bom-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
@ -46,13 +49,38 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.distribution</groupId>
|
<groupId>org.gcube.distribution</groupId>
|
||||||
<artifactId>maven-portal-bom</artifactId>
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
<version>3.6.4</version>
|
<version>${gcube-portal-bom-version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<!-- <profiles> -->
|
||||||
|
<!-- <profile> -->
|
||||||
|
<!-- <id>workspace-tree-release-profile</id> -->
|
||||||
|
<!-- <activation> -->
|
||||||
|
<!-- <property> -->
|
||||||
|
<!-- <name>Release</name> -->
|
||||||
|
<!-- </property> -->
|
||||||
|
<!-- </activation> -->
|
||||||
|
<!-- <properties> -->
|
||||||
|
<!-- <gcube-portal-bom-version>3.7.0</gcube-portal-bom-version> -->
|
||||||
|
<!-- </properties> -->
|
||||||
|
<!-- </profile> -->
|
||||||
|
<!-- <profile> -->
|
||||||
|
<!-- <id>workspace-tree-snapshot-profile</id> -->
|
||||||
|
<!-- <activation> -->
|
||||||
|
<!-- <property> -->
|
||||||
|
<!-- <name>!Release</name> -->
|
||||||
|
<!-- </property> -->
|
||||||
|
<!-- </activation> -->
|
||||||
|
<!-- <properties> -->
|
||||||
|
<!-- <gcube-portal-bom-version>3.8.0-SNAPSHOT</gcube-portal-bom-version> -->
|
||||||
|
<!-- </properties> -->
|
||||||
|
<!-- </profile> -->
|
||||||
|
<!-- </profiles> -->
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- Google Web Toolkit (GWT) -->
|
<!-- Google Web Toolkit (GWT) -->
|
||||||
|
@ -70,7 +98,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sencha.gxt</groupId>
|
<groupId>com.sencha.gxt</groupId>
|
||||||
<artifactId>gxt2.2.5-gwt2.X</artifactId>
|
<artifactId>gxt2.2.5-gwt2.X</artifactId>
|
||||||
<version>${gwtVersion}</version>
|
<version>${gxt2.2.5-gwt2.X-version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -138,7 +166,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>image-previewer-widget</artifactId>
|
<artifactId>image-previewer-widget</artifactId>
|
||||||
<version>[1.0.0,)</version>
|
<version>[1.0.0, 1.3.0-SNAPSHOT)</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
|
@ -160,6 +188,20 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
<version>1.1.1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.4</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>ws-task-executor-widget</artifactId>
|
<artifactId>ws-task-executor-widget</artifactId>
|
||||||
|
@ -234,9 +276,22 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.portal</groupId>
|
||||||
<artifactId>social-networking-library</artifactId>
|
<artifactId>social-library-stubs</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.social-networking</groupId>
|
||||||
|
<artifactId>social-service-client</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>social-networking-library</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
<artifactId>aslsocial</artifactId>
|
<artifactId>aslsocial</artifactId>
|
||||||
|
@ -249,6 +304,12 @@
|
||||||
<artifactId>ckan-metadata-publisher-widget</artifactId>
|
<artifactId>ckan-metadata-publisher-widget</artifactId>
|
||||||
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||||
|
<artifactId>gwt-log</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- JSON PARSER -->
|
<!-- JSON PARSER -->
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class DownloadServlet extends HttpServlet{
|
||||||
ByteArrayInputStream is = new ByteArrayInputStream(fileContent.getBytes());
|
ByteArrayInputStream is = new ByteArrayInputStream(fileContent.getBytes());
|
||||||
String contentDisposition = viewContent?"inline":"attachment";
|
String contentDisposition = viewContent?"inline":"attachment";
|
||||||
String urlMimeType = "text/uri-list";
|
String urlMimeType = "text/uri-list";
|
||||||
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), urlMimeType);
|
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), urlMimeType, false);
|
||||||
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
||||||
resp.setContentType(urlMimeType);
|
resp.setContentType(urlMimeType);
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ public class DownloadServlet extends HttpServlet{
|
||||||
logger.info("Downloading the folder: "+workspaceFolder);
|
logger.info("Downloading the folder: "+workspaceFolder);
|
||||||
String contentDisposition = viewContent?"inline":"attachment";
|
String contentDisposition = viewContent?"inline":"attachment";
|
||||||
String mimeType = "application/zip";
|
String mimeType = "application/zip";
|
||||||
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), mimeType);
|
String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), mimeType,true);
|
||||||
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
||||||
resp.setContentType(mimeType);
|
resp.setContentType(mimeType);
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ public class DownloadServlet extends HttpServlet{
|
||||||
String mimeType = pdfFile.getMimeType();
|
String mimeType = pdfFile.getMimeType();
|
||||||
logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+pdfFile.getId());
|
logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+pdfFile.getId());
|
||||||
String contentDisposition = viewContent?"inline":"attachment";
|
String contentDisposition = viewContent?"inline":"attachment";
|
||||||
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType);
|
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType,false);
|
||||||
|
|
||||||
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
||||||
resp.setContentType(mimeType);
|
resp.setContentType(mimeType);
|
||||||
|
@ -267,7 +267,7 @@ public class DownloadServlet extends HttpServlet{
|
||||||
ImageFileItem imageFile = (ImageFileItem) workspaceFileItem;
|
ImageFileItem imageFile = (ImageFileItem) workspaceFileItem;
|
||||||
logger.info("Downloading: "+imageFile);
|
logger.info("Downloading: "+imageFile);
|
||||||
String mimeType = imageFile.getMimeType();
|
String mimeType = imageFile.getMimeType();
|
||||||
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType);
|
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType,false);
|
||||||
String contentDisposition = viewContent?"inline":"attachment";
|
String contentDisposition = viewContent?"inline":"attachment";
|
||||||
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
||||||
resp.setContentType(mimeType);
|
resp.setContentType(mimeType);
|
||||||
|
@ -298,7 +298,7 @@ public class DownloadServlet extends HttpServlet{
|
||||||
URLFileItem externalUrl = (URLFileItem) workspaceFileItem;
|
URLFileItem externalUrl = (URLFileItem) workspaceFileItem;
|
||||||
logger.info("Downloading: "+externalUrl);
|
logger.info("Downloading: "+externalUrl);
|
||||||
String urlMimeType = "text/uri-list";
|
String urlMimeType = "text/uri-list";
|
||||||
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), urlMimeType);
|
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), urlMimeType,false);
|
||||||
String contentDisposition = viewContent?"inline":"attachment";
|
String contentDisposition = viewContent?"inline":"attachment";
|
||||||
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
|
||||||
resp.setContentType(urlMimeType);
|
resp.setContentType(urlMimeType);
|
||||||
|
@ -347,7 +347,7 @@ public class DownloadServlet extends HttpServlet{
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType());
|
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType(),false);
|
||||||
logger.info("Downloading default item: "+workspaceFileItem);
|
logger.info("Downloading default item: "+workspaceFileItem);
|
||||||
|
|
||||||
//String contentDisposition = viewContent?"inline":"attachment";
|
//String contentDisposition = viewContent?"inline":"attachment";
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.tika.mime.MediaType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class MimeTypeUtil.
|
* The Class MimeTypeUtil.
|
||||||
|
@ -120,7 +119,6 @@ public class MimeTypeUtility {
|
||||||
}
|
}
|
||||||
br.close();
|
br.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load preview mime types.
|
* Load preview mime types.
|
||||||
|
@ -165,12 +163,12 @@ public class MimeTypeUtility {
|
||||||
*
|
*
|
||||||
* @param name the file name.
|
* @param name the file name.
|
||||||
* @param mimeType the mime type.
|
* @param mimeType the mime type.
|
||||||
|
* @param isFolder the is folder
|
||||||
* @return the right name.
|
* @return the right name.
|
||||||
* @throws IOException Signals that an I/O exception has occurred.
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
*/
|
*/
|
||||||
public static String getNameWithExtension(String name, String mimeType) throws IOException {
|
public static String getNameWithExtension(String name, String mimeType, boolean isFolder) throws IOException {
|
||||||
|
logger.debug("Deriving the file extension for file name: " + name + ", with mimeType: " + mimeType+", isFolder: "+isFolder);
|
||||||
logger.debug("Deriving the file extension for file name: " + name + ", with mimeType: " + mimeType);
|
|
||||||
|
|
||||||
if (mimeType == null || mimeType.isEmpty()) {
|
if (mimeType == null || mimeType.isEmpty()) {
|
||||||
logger.debug("Input mime type is null or empty returning passed name: " + name);
|
logger.debug("Input mime type is null or empty returning passed name: " + name);
|
||||||
|
@ -178,52 +176,30 @@ public class MimeTypeUtility {
|
||||||
}
|
}
|
||||||
|
|
||||||
String declaredExtension = FilenameUtils.getExtension(name);
|
String declaredExtension = FilenameUtils.getExtension(name);
|
||||||
logger.debug("The name " + name + " contains the extension: " + declaredExtension);
|
logger.info("The name " + name + " contains the extension: " + declaredExtension);
|
||||||
|
|
||||||
if (declaredExtension.equals("exe"))
|
//If the filename contains the extension returning the name like it is (skipping the folder)
|
||||||
|
if (declaredExtension != null && !declaredExtension.isEmpty() && !isFolder) {
|
||||||
|
logger.debug(
|
||||||
|
"The filename contains a not empty extension: " + declaredExtension + ", so returning the name like it is");
|
||||||
return name;
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.debug("Either the name does not contains the extension or it is a folder, deriving extension from mimeType");
|
||||||
List<String> extensions = MimeTypeUtility.getExtension(mimeType);
|
List<String> extensions = MimeTypeUtility.getExtension(mimeType);
|
||||||
logger.trace("Extension/s available for input mimetype: " + mimeType + " into map is/are: " + extensions);
|
logger.debug("Extension/s available for input mimetype: " + mimeType + " into map is/are: " + extensions);
|
||||||
|
|
||||||
String toMimeTypeExtension = "";
|
String toMimeTypeExtension = "";
|
||||||
if (extensions != null) {
|
String fullName = name;
|
||||||
toMimeTypeExtension = extensions.get(extensions.size() - 1); // I'm reading the last extension in the map
|
if (extensions != null && extensions.size() > 0) {
|
||||||
// (myme type - list of extensions)
|
// I'm reading the last extension in the map (myme type - list of extensions)
|
||||||
logger.debug("Using the last extension read into list of available extensions: " + toMimeTypeExtension);
|
toMimeTypeExtension = extensions.get(extensions.size() - 1);
|
||||||
|
logger.info("Using the last extension read into list of available extensions: " + toMimeTypeExtension);
|
||||||
|
fullName = String.format("%s%s%s", name, DOT_STRING, toMimeTypeExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MANAGING ALREADY DECLARED EXTENSION IN THE FILE NAME
|
logger.info("returning full name:" + fullName);
|
||||||
if (!declaredExtension.isEmpty() && !toMimeTypeExtension.isEmpty()) {
|
return fullName;
|
||||||
String dEextL = declaredExtension.toLowerCase();
|
|
||||||
String mtExtL = toMimeTypeExtension.toLowerCase();
|
|
||||||
|
|
||||||
// The extension writes in the file name is matching the mime type extension
|
|
||||||
// declared in the map
|
|
||||||
if (dEextL.equals(mtExtL)) {
|
|
||||||
logger.trace("The Extension declared in the name " + name
|
|
||||||
+ " is matching derived mime type extension so returning the input name: " + name);
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(!dEextL.trim().contains(" ")) {
|
|
||||||
// logger.trace("The Extension declared in the name "+name+" seems a valid suffix (without other spaces) so returning the input name: "+name);
|
|
||||||
// return name;
|
|
||||||
// }
|
|
||||||
|
|
||||||
logger.debug("No logic seems to match the extension declared in the name " + declaredExtension
|
|
||||||
+ " as a valid extension so I'm adding the extension derived from mime type map: "
|
|
||||||
+ toMimeTypeExtension);
|
|
||||||
}
|
|
||||||
|
|
||||||
// CHECKING THE FOLLOWING IN ORDER TO AVOID THE DOT AS LAST CHAR OF FILENAME
|
|
||||||
if (toMimeTypeExtension.isEmpty()) {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
String fullname = String.format("%s%s%s", name, DOT_STRING, toMimeTypeExtension);
|
|
||||||
logger.trace("returning full name:" + fullname);
|
|
||||||
return fullname;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,11 +290,10 @@ public class MimeTypeUtility {
|
||||||
public static Map<String, String> getExtensionToMimeTypeMap() {
|
public static Map<String, String> getExtensionToMimeTypeMap() {
|
||||||
return extension_mimetype_map;
|
return extension_mimetype_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the preview mimetype extension map with the
|
* Gets the preview mimetype extension map with the mime types allowed for
|
||||||
* mime types allowed for preview displaying
|
* preview displaying
|
||||||
*
|
*
|
||||||
* @return the preview mimetype extension map
|
* @return the preview mimetype extension map
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -181,6 +181,7 @@ text/iuls=uls
|
||||||
text/plain=bas
|
text/plain=bas
|
||||||
text/plain=c
|
text/plain=c
|
||||||
text/plain=h
|
text/plain=h
|
||||||
|
text/plain=asc
|
||||||
text/plain=txt
|
text/plain=txt
|
||||||
text/richtext=rtx
|
text/richtext=rtx
|
||||||
text/scriptlet=sct
|
text/scriptlet=sct
|
||||||
|
|
|
@ -149,6 +149,7 @@ text/iuls=uls
|
||||||
text/plain=bas
|
text/plain=bas
|
||||||
text/plain=c
|
text/plain=c
|
||||||
text/plain=h
|
text/plain=h
|
||||||
|
text/plain=asc
|
||||||
text/plain=txt
|
text/plain=txt
|
||||||
text/richtext=rtx
|
text/richtext=rtx
|
||||||
text/scriptlet=sct
|
text/scriptlet=sct
|
||||||
|
|
|
@ -175,5 +175,5 @@ public class HttpCallerUtil {
|
||||||
public void setPassword(String password) {
|
public void setPassword(String password) {
|
||||||
this.password = password;
|
this.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
package org.gcube.portlets.user.workspace;
|
||||||
|
|
||||||
|
import org.gcube.common.storagehubwrapper.server.StorageHubClientService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class MappingGroupNameToScopeName {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(MappingGroupNameToScopeName.class);
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// VRE
|
||||||
|
String context = "d4science.research-infrastructures.eu-D4OS-FAO-Tuna_Atlas";
|
||||||
|
String rootName = "/d4science.research-infrastructures.eu";
|
||||||
|
String vreName = "FAO-Tuna_Atlas";
|
||||||
|
//
|
||||||
|
// //VO
|
||||||
|
// String context = "d4science.research-infrastructures.eu-D4OS";
|
||||||
|
// String rootName = "/d4science.research-infrastructures.eu";
|
||||||
|
// String vreName = null;
|
||||||
|
|
||||||
|
// ROOT
|
||||||
|
// String context = "d4science.research-infrastructures.eu";
|
||||||
|
// String rootName = "/d4science.research-infrastructures.eu";
|
||||||
|
// String vreName = null;
|
||||||
|
|
||||||
|
System.out.println(getScopeFromVREGroupName(context, rootName, vreName));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the scope from VRE group name.
|
||||||
|
*
|
||||||
|
* @param context the context
|
||||||
|
* @return the scope from VRE group name. Eg. with the input
|
||||||
|
* 'gcube-devNext-NextNext' returns '/gcube/devNext/NextNext'
|
||||||
|
*/
|
||||||
|
public static String getScopeFromVREGroupName(String context, String infrastructurName, String vreName) {
|
||||||
|
// String entireScopeName = context.replaceAll("^/(.*)/?$", "$1").replaceAll("-", "/");
|
||||||
|
// return entireScopeName;
|
||||||
|
|
||||||
|
if (vreName == null)
|
||||||
|
vreName = "";
|
||||||
|
|
||||||
|
logger.debug("vreName: " + vreName);
|
||||||
|
|
||||||
|
if (infrastructurName.startsWith("/"))
|
||||||
|
infrastructurName = infrastructurName.substring(1, infrastructurName.length());
|
||||||
|
|
||||||
|
logger.debug("infrastructurName: " + infrastructurName);
|
||||||
|
|
||||||
|
String voGroup = context.replaceAll(infrastructurName, "");
|
||||||
|
if (vreName != null) {
|
||||||
|
voGroup = voGroup.replaceAll(vreName, "").replaceAll("-", "");
|
||||||
|
}
|
||||||
|
String voName = voGroup.replaceAll("-", "");
|
||||||
|
logger.debug("voName: " + voName);
|
||||||
|
|
||||||
|
StringBuilder theScopeBuilder = new StringBuilder();
|
||||||
|
theScopeBuilder.append("/" + infrastructurName);
|
||||||
|
if (voName != null && !voName.isEmpty()) {
|
||||||
|
theScopeBuilder.append("/" + voName);
|
||||||
|
}
|
||||||
|
if (vreName != null && !vreName.isEmpty()) {
|
||||||
|
theScopeBuilder.append("/" + vreName);
|
||||||
|
}
|
||||||
|
String theScope = theScopeBuilder.toString();
|
||||||
|
logger.info("Built scope: " + theScope);
|
||||||
|
return theScope;
|
||||||
|
}
|
||||||
|
}
|
|
@ -38,7 +38,7 @@ public class MimeTypeUtilityTest {
|
||||||
for (String keyFileName : fileNamesToMimeTypes.keySet()) {
|
for (String keyFileName : fileNamesToMimeTypes.keySet()) {
|
||||||
try {
|
try {
|
||||||
System.out.println("\nResolving file name with extension for name: "+keyFileName);
|
System.out.println("\nResolving file name with extension for name: "+keyFileName);
|
||||||
String toFileName = MimeTypeUtility.getNameWithExtension(keyFileName, fileNamesToMimeTypes.get(keyFileName));
|
String toFileName = MimeTypeUtility.getNameWithExtension(keyFileName, fileNamesToMimeTypes.get(keyFileName), false);
|
||||||
System.out.println("Assigned the file name: "+toFileName);
|
System.out.println("Assigned the file name: "+toFileName);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue