Compare commits

...

16 Commits

Author SHA1 Message Date
Francesco Mangiacrapa 00a747735a replaced social dependencies, see #27083#note-16 2024-04-22 16:39:55 +02:00
Francesco Mangiacrapa 39c91b5721 removed -SNAPSHOT to be released 2024-03-19 10:43:37 +01:00
Francesco Mangiacrapa 693a4fc281 Merge pull request 'edit_facility_26115' (!5) from edit_facility_26115 into master
Reviewed-on: #5
2024-03-19 10:42:37 +01:00
Francesco Mangiacrapa 4e409b16cd updated changelog 2024-03-19 10:42:08 +01:00
Francesco Mangiacrapa 0e88bbbab5 commented profile 2024-02-23 17:34:21 +01:00
Francesco Mangiacrapa 31130db6c9 updated pom 2024-02-23 17:09:25 +01:00
Francesco Mangiacrapa 18c0300dc7 removed data-miner-manager-cl (indirect) dependency 2024-02-20 17:25:02 +01:00
Francesco Mangiacrapa b678fdeedc reverted to GWT 2.7.0 2024-02-20 14:57:41 +01:00
Francesco Mangiacrapa 6a19713ea4 - Moved to maven parent 1.2.0
- Added lombok 1.18.4 (provided) to avoid
`java.lang.ClassNotFoundException: com.sun.tools.javac.code.TypeTags`
- Moved to GWT 2.8.2
2024-02-20 11:49:03 +01:00
Francesco Mangiacrapa a7bed05f4c fixing the incident #23862 2022-09-14 14:58:01 +02:00
Francesco Mangiacrapa 9ca232196e Removed -SNAPSHOT to be released. Passed to maven-portal-bom.3.6.4 2022-09-05 14:52:08 +02:00
Francesco Mangiacrapa 040b2c3817 Bug fixing issues #23676, #23789 2022-09-05 14:09:33 +02:00
Francesco Mangiacrapa 506d129cbc removed -SNAPSHOT to be released 2022-06-27 15:02:25 +02:00
Francesco Mangiacrapa fead3eaee0 #23523 Updated to maven-portal-bom 3.6.4 2022-06-27 14:51:32 +02:00
Francesco Mangiacrapa c9e3430b83 Removed -SNAPSHOT to be released 2022-05-03 16:02:12 +02:00
Francesco Mangiacrapa 074f7866ea Merge pull request 'task_23225' (!4) from task_23225 into master
Reviewed-on: #4
2022-05-03 15:58:54 +02:00
12 changed files with 230 additions and 105 deletions

View File

@ -13,8 +13,26 @@
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" 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>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
@ -28,23 +46,5 @@
<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="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"/>
</classpath>

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -11,7 +13,9 @@
<wb-module deploy-name="workspace-tree-widget">
@ -23,7 +27,9 @@
<wb-resource deploy-path="/" source-path="/src/main/java"/>
@ -35,18 +41,10 @@
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/generated-sources/annotations"/>
@ -58,7 +56,9 @@
</wb-module>

View File

@ -4,7 +4,26 @@
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).
## [v6.35.0-SNAPSHOT] - 2022-05-02
## [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
- [#23523] Updated to maven-portal-bom 3.6.4
## [v6.35.0] - 2022-05-03
#### Enhancements
@ -68,7 +87,7 @@ Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
[#19952] Fixed incident
## [v6.31.0] [r4.25.0] - 2020-09-29
## [v6.31.0] - 2020-09-29
#### Enhancements
@ -82,14 +101,14 @@ Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
[#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
[#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
@ -102,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
## [v6.29.0] [r4.21.0] - 2020-03-27
## [v6.29.0] - 2020-03-27
#### New Features

73
pom.xml
View File

@ -5,13 +5,13 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.1.0</version>
<version>1.2.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>6.35.0-SNAPSHOT</version>
<version>6.35.3</version>
<name>gCube Workspace Tree Widget</name>
<description>
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>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<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>
<dependencyManagement>
@ -46,13 +49,38 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.3</version>
<version>${gcube-portal-bom-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</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>
<!-- Google Web Toolkit (GWT) -->
@ -70,7 +98,7 @@
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt2.2.5-gwt2.X</artifactId>
<version>${gwtVersion}</version>
<version>${gxt2.2.5-gwt2.X-version}</version>
<scope>compile</scope>
</dependency>
@ -138,7 +166,7 @@
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>image-previewer-widget</artifactId>
<version>[1.0.0,)</version>
<version>[1.0.0, 1.3.0-SNAPSHOT)</version>
<exclusions>
<exclusion>
<groupId>com.google.gwt</groupId>
@ -160,6 +188,20 @@
<scope>compile</scope>
</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>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ws-task-executor-widget</artifactId>
@ -234,9 +276,22 @@
</dependency>
<dependency>
<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>
</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>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslsocial</artifactId>
@ -249,6 +304,12 @@
<artifactId>ckan-metadata-publisher-widget</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JSON PARSER -->

View File

@ -153,7 +153,7 @@ public class DownloadServlet extends HttpServlet{
ByteArrayInputStream is = new ByteArrayInputStream(fileContent.getBytes());
String contentDisposition = viewContent?"inline":"attachment";
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.setContentType(urlMimeType);
@ -190,7 +190,7 @@ public class DownloadServlet extends HttpServlet{
logger.info("Downloading the folder: "+workspaceFolder);
String contentDisposition = viewContent?"inline":"attachment";
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.setContentType(mimeType);
@ -233,7 +233,7 @@ public class DownloadServlet extends HttpServlet{
String mimeType = pdfFile.getMimeType();
logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+pdfFile.getId());
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.setContentType(mimeType);
@ -267,7 +267,7 @@ public class DownloadServlet extends HttpServlet{
ImageFileItem imageFile = (ImageFileItem) workspaceFileItem;
logger.info("Downloading: "+imageFile);
String mimeType = imageFile.getMimeType();
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType);
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType,false);
String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(mimeType);
@ -298,7 +298,7 @@ public class DownloadServlet extends HttpServlet{
URLFileItem externalUrl = (URLFileItem) workspaceFileItem;
logger.info("Downloading: "+externalUrl);
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";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(urlMimeType);
@ -347,7 +347,7 @@ public class DownloadServlet extends HttpServlet{
try{
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType());
String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType(),false);
logger.info("Downloading default item: "+workspaceFileItem);
//String contentDisposition = viewContent?"inline":"attachment";

View File

@ -22,7 +22,6 @@ import org.apache.tika.mime.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// TODO: Auto-generated Javadoc
/**
* The Class MimeTypeUtil.
@ -120,7 +119,6 @@ public class MimeTypeUtility {
}
br.close();
}
/**
* Load preview mime types.
@ -165,12 +163,12 @@ public class MimeTypeUtility {
*
* @param name the file name.
* @param mimeType the mime type.
* @param isFolder the is folder
* @return the right name.
* @throws IOException Signals that an I/O exception has occurred.
*/
public static String getNameWithExtension(String name, String mimeType) throws IOException {
logger.debug("Deriving the file extension for file name: " + name + ", with mimeType: " + mimeType);
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);
if (mimeType == null || mimeType.isEmpty()) {
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);
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;
}
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);
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 = "";
if (extensions != null) {
toMimeTypeExtension = extensions.get(extensions.size() - 1); // 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);
String fullName = name;
if (extensions != null && extensions.size() > 0) {
// I'm reading the last extension in the map (myme type - list of extensions)
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
if (!declaredExtension.isEmpty() && !toMimeTypeExtension.isEmpty()) {
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;
logger.info("returning full name:" + fullName);
return fullName;
}
@ -314,11 +290,10 @@ public class MimeTypeUtility {
public static Map<String, String> getExtensionToMimeTypeMap() {
return extension_mimetype_map;
}
/**
* Gets the preview mimetype extension map with the
* mime types allowed for preview displaying
* Gets the preview mimetype extension map with the mime types allowed for
* preview displaying
*
* @return the preview mimetype extension map
*/

View File

@ -181,6 +181,7 @@ text/iuls=uls
text/plain=bas
text/plain=c
text/plain=h
text/plain=asc
text/plain=txt
text/richtext=rtx
text/scriptlet=sct

View File

@ -149,6 +149,7 @@ text/iuls=uls
text/plain=bas
text/plain=c
text/plain=h
text/plain=asc
text/plain=txt
text/richtext=rtx
text/scriptlet=sct

View File

@ -175,5 +175,5 @@ public class HttpCallerUtil {
public void setPassword(String password) {
this.password = password;
}
}

View File

@ -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;
}
}

View File

@ -38,7 +38,7 @@ public class MimeTypeUtilityTest {
for (String keyFileName : fileNamesToMimeTypes.keySet()) {
try {
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);
} catch (IOException e) {
e.printStackTrace();

View File

@ -3,10 +3,7 @@
*/
package org.gcube.portlets.user.workspace;
import java.util.Iterator;
import org.gcube.common.encryption.StringEncrypter;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.workspace.server.util.StringUtil;