Compare commits
36 Commits
task_21388
...
master
32
.classpath
32
.classpath
|
@ -6,6 +6,17 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
|
@ -13,9 +24,15 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<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">
|
||||||
|
@ -29,16 +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="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -2,4 +2,5 @@ eclipse.preferences.version=1
|
||||||
encoding//src/main/java=UTF-8
|
encoding//src/main/java=UTF-8
|
||||||
encoding//src/main/resources=UTF-8
|
encoding//src/main/resources=UTF-8
|
||||||
encoding//src/test/java=UTF-8
|
encoding//src/test/java=UTF-8
|
||||||
|
encoding//src/test/resources=UTF-8
|
||||||
encoding/<project>=UTF-8
|
encoding/<project>=UTF-8
|
||||||
|
|
|
@ -1,18 +1,72 @@
|
||||||
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="workspace-tree-widget">
|
<wb-module deploy-name="workspace-tree-widget">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project-modules>
|
</project-modules>
|
||||||
|
|
64
CHANGELOG.md
64
CHANGELOG.md
|
@ -4,8 +4,62 @@
|
||||||
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.4] - 2024-07-17
|
||||||
|
|
||||||
## [v6.33.0-SNAPSHOT] - 2021-05-11
|
- Updated `ws-task-executor-widget` dependency lower range [#27747#note-20]
|
||||||
|
|
||||||
|
## [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
|
||||||
|
|
||||||
|
- [#23225] Updated the method to read the members of (VRE or Simple) shared folders
|
||||||
|
|
||||||
|
## [v6.34.3] - 2022-03-24
|
||||||
|
|
||||||
|
#### Enhancements
|
||||||
|
|
||||||
|
- [#23020] Reinforce the (ApplicationProfile-)Workspace-Explorer-App discovery
|
||||||
|
- [#22923] Migrate to maven-portal-bom 3.7.0[-SNAPSHOT]
|
||||||
|
|
||||||
|
## [v6.34.1] - 2021-12-20
|
||||||
|
|
||||||
|
#### Fixes
|
||||||
|
|
||||||
|
- [#22578] GetInfo facility invoked by Tree View does not display properly the Owner field
|
||||||
|
|
||||||
|
## [v6.34.0] - 2021-11-05
|
||||||
|
|
||||||
|
#### Enhancements
|
||||||
|
|
||||||
|
- [#22251] Make workspace file size field smart
|
||||||
|
|
||||||
|
## [v6.33.1] - 2021-06-11
|
||||||
|
|
||||||
|
#### Fixes
|
||||||
|
|
||||||
|
[#21575] Fixed icon associated with simple folders in the grid view
|
||||||
|
Moved to maven-portal-bom 3.6.3
|
||||||
|
|
||||||
|
## [v6.33.0] - 2021-05-11
|
||||||
|
|
||||||
#### Enhancements
|
#### Enhancements
|
||||||
|
|
||||||
|
@ -37,7 +91,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
|
||||||
|
|
||||||
|
@ -51,14 +105,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
|
||||||
|
|
||||||
|
@ -71,7 +125,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
|
||||||
|
|
||||||
|
|
86
pom.xml
86
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.33.0-SNAPSHOT</version>
|
<version>6.35.4</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.2-SNAPSHOT</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,10 +188,24 @@
|
||||||
<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>
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
<version>(1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -185,11 +227,11 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<!-- <dependency> -->
|
||||||
<groupId>com.thoughtworks.xstream</groupId>
|
<!-- <groupId>com.thoughtworks.xstream</groupId> -->
|
||||||
<artifactId>xstream</artifactId>
|
<!-- <artifactId>xstream</artifactId> -->
|
||||||
<!-- <version>1.4.5</version> -->
|
<!-- <version>1.4.5</version> -->
|
||||||
</dependency>
|
<!-- </dependency> -->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.widgets</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
|
@ -224,6 +266,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -233,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>
|
||||||
|
@ -248,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 -->
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.i18n.client.NumberFormat;
|
|
||||||
|
|
||||||
//import com.google.gwt.dom.client.Element;
|
//import com.google.gwt.dom.client.Element;
|
||||||
//import com.google.gwt.user.client.Element;
|
//import com.google.gwt.user.client.Element;
|
||||||
|
@ -217,7 +216,7 @@ public static enum WS_UPLOAD_TYPE {File, Archive};
|
||||||
public static final String ACCOUNTING_HISTORY_OF = "Accounting history of: ";
|
public static final String ACCOUNTING_HISTORY_OF = "Accounting history of: ";
|
||||||
public static final String ACCOUNTING_READERS_OF = "Accounting readers of: ";
|
public static final String ACCOUNTING_READERS_OF = "Accounting readers of: ";
|
||||||
|
|
||||||
public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
|
//public static final NumberFormat numberFormatterKB = NumberFormat.getFormat("#,##0 KB;(#,##0 KB)");
|
||||||
|
|
||||||
//USED IN HTTP GET AS PARAMETER.. THIS PARAMS ARE REPLICATED IN THE CONSTANTS OF TREE WIDGET
|
//USED IN HTTP GET AS PARAMETER.. THIS PARAMS ARE REPLICATED IN THE CONSTANTS OF TREE WIDGET
|
||||||
public static final String GET_SEARCH_PARAMETER ="search";
|
public static final String GET_SEARCH_PARAMETER ="search";
|
||||||
|
|
|
@ -330,18 +330,18 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// SPECIAL FOLDER?
|
// SPECIAL FOLDER?
|
||||||
if (this.isSpecialFolder())
|
if (this.isSpecialFolder()) {
|
||||||
absImgPr = Resources.getIconSpecialFolder();
|
absImgPr = Resources.getIconSpecialFolder();
|
||||||
else { // SIMPLE FOLDER
|
} else { // SIMPLE FOLDER
|
||||||
if (this.isPublic()) // IS PLUBIC
|
if (this.isPublic()) { // IS PLUBIC
|
||||||
absImgPr = Resources.getIconFolderPublic();
|
absImgPr = Resources.getIconFolderPublic();
|
||||||
else {
|
} else {
|
||||||
if (this.getSynchedWithWsThredds() != null) {
|
Boolean isSynched = this.getSynchedWithWsThredds();
|
||||||
if(this.getSynchedWithWsThredds()) {
|
if (isSynched != null && isSynched) {
|
||||||
absImgPr = Resources.getIconSynchedFolder();
|
absImgPr = Resources.getIconSynchedFolder();
|
||||||
}
|
} else {
|
||||||
} else
|
|
||||||
absImgPr = Resources.getIconFolder();
|
absImgPr = Resources.getIconFolder();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.user.workspace.client.util;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.i18n.client.NumberFormat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class SizeUtil.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Nov 5, 2021
|
||||||
|
*/
|
||||||
|
public class SizeUtil {
|
||||||
|
|
||||||
|
public static final NumberFormat numberFormat = NumberFormat.getFormat("#,##0.#");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Readable file size.
|
||||||
|
*
|
||||||
|
* @param size the size
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
public static String readableFileSize(long size) {
|
||||||
|
GWT.log("Converting size: "+size);
|
||||||
|
// -1 should be the size of a folder
|
||||||
|
if (size == -1)
|
||||||
|
return "";
|
||||||
|
// in some cases the size returned by SHUB is negative,
|
||||||
|
// so reporting as 1B to user
|
||||||
|
if (size < 0)
|
||||||
|
return "1 byte";
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return "0 byte";
|
||||||
|
|
||||||
|
final String[] units = new String[] { "bytes", "kB", "MB", "GB", "TB" };
|
||||||
|
int digitGroups = (int) (Math.log10(size) / Math.log10(1024));
|
||||||
|
|
||||||
|
return numberFormat.format(size / Math.pow(1024, digitGroups)) +" " +units[digitGroups];
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,10 +4,10 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
|
import org.gcube.portlets.user.workspace.client.util.SizeUtil;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
|
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.i18n.client.NumberFormat;
|
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
|
@ -60,7 +59,7 @@ public class DialogGetInfo extends Dialog {
|
||||||
// private TextArea textAreaSharedWith = new TextArea();
|
// private TextArea textAreaSharedWith = new TextArea();
|
||||||
private Html htmlUsersWidget = new Html();
|
private Html htmlUsersWidget = new Html();
|
||||||
private Html htmlPropertiesWidget = new Html();
|
private Html htmlPropertiesWidget = new Html();
|
||||||
private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
//private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
||||||
// private TextField<String> txtGcubeItemProperties;
|
// private TextField<String> txtGcubeItemProperties;
|
||||||
private HorizontalPanel hpGcubeProperties;
|
private HorizontalPanel hpGcubeProperties;
|
||||||
private DialogEditProperties editProperties = null;
|
private DialogEditProperties editProperties = null;
|
||||||
|
@ -448,10 +447,7 @@ public class DialogGetInfo extends Dialog {
|
||||||
private String getFormattedSize(long value) {
|
private String getFormattedSize(long value) {
|
||||||
|
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
double kb = value / 1024;
|
return SizeUtil.readableFileSize(value);
|
||||||
if (kb < 1)
|
|
||||||
kb = 1;
|
|
||||||
return number.format(kb);
|
|
||||||
} else if (value == 0) {
|
} else if (value == 0) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
|
||||||
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
|
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
|
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
|
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
|
||||||
|
@ -13,6 +12,7 @@ import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
|
import org.gcube.portlets.user.workspace.client.util.SizeUtil;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
|
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
|
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
|
||||||
|
@ -37,7 +37,6 @@ import com.google.gwt.event.dom.client.LoadEvent;
|
||||||
import com.google.gwt.event.dom.client.LoadHandler;
|
import com.google.gwt.event.dom.client.LoadHandler;
|
||||||
import com.google.gwt.http.client.URL;
|
import com.google.gwt.http.client.URL;
|
||||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
import com.google.gwt.i18n.client.NumberFormat;
|
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
|
@ -79,7 +78,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
|
|
||||||
public static final String EMPTY = "empty";
|
public static final String EMPTY = "empty";
|
||||||
|
|
||||||
private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
//private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new dialog get info bootstrap.
|
* Instantiates a new dialog get info bootstrap.
|
||||||
|
@ -468,6 +467,9 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
addHandlers();
|
addHandlers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On detach.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onDetach() {
|
protected void onDetach() {
|
||||||
super.onDetach();
|
super.onDetach();
|
||||||
|
@ -482,6 +484,13 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance frame.
|
||||||
|
*
|
||||||
|
* @param fileURL the file URL
|
||||||
|
* @param thePreviewPlaceholder the the preview placeholder
|
||||||
|
* @return the frame
|
||||||
|
*/
|
||||||
public Frame instanceFrame(String fileURL, final HTML thePreviewPlaceholder) {
|
public Frame instanceFrame(String fileURL, final HTML thePreviewPlaceholder) {
|
||||||
//addLoading();
|
//addLoading();
|
||||||
String urlEncoded = URL.encode(fileURL);
|
String urlEncoded = URL.encode(fileURL);
|
||||||
|
@ -618,10 +627,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
private String getFormattedSize(long value) {
|
private String getFormattedSize(long value) {
|
||||||
|
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
double kb = value / 1024;
|
return SizeUtil.readableFileSize(value);
|
||||||
if (kb < 1)
|
|
||||||
kb = 1;
|
|
||||||
return number.format(kb);
|
|
||||||
} else if (value == 0) {
|
} else if (value == 0) {
|
||||||
return EMPTY;
|
return EMPTY;
|
||||||
} else
|
} else
|
||||||
|
@ -894,6 +900,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
* Sets the placeholder.
|
* Sets the placeholder.
|
||||||
*
|
*
|
||||||
* @param html the html
|
* @param html the html
|
||||||
|
* @param spinner the spinner
|
||||||
* @param placeholder the placeholder
|
* @param placeholder the placeholder
|
||||||
*/
|
*/
|
||||||
private void setPlaceholder(HTML html, boolean spinner, String placeholder) {
|
private void setPlaceholder(HTML html, boolean spinner, String placeholder) {
|
||||||
|
@ -916,6 +923,13 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show PDF preview.
|
||||||
|
*
|
||||||
|
* @param pdfURL the pdf URL
|
||||||
|
* @param divId the div id
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
public static native String showPDFPreview(String pdfURL, String divId)/*-{
|
public static native String showPDFPreview(String pdfURL, String divId)/*-{
|
||||||
var theDivContainer = "#"+divId;
|
var theDivContainer = "#"+divId;
|
||||||
$wnd.PDFObject.embed(pdfURL, theDivContainer);
|
$wnd.PDFObject.embed(pdfURL, theDivContainer);
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.List;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.gcube.common.storagehub.model.types.WorkspaceItemType;
|
import org.gcube.common.storagehub.model.types.WorkspaceItemType;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.Member;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
||||||
|
@ -160,18 +161,13 @@ public class NotificationStorageHubUtil {
|
||||||
|
|
||||||
if(isFolderAndShared(rootSharedFolder)){ //JUST TO BE SURE
|
if(isFolderAndShared(rootSharedFolder)){ //JUST TO BE SURE
|
||||||
|
|
||||||
List<String> listPortalLogin = workspace.getSharedFolderMembers(rootSharedFolder.getId());
|
List<Member> listMembers = workspace.getSharedFolderMembers(rootSharedFolder.getId());
|
||||||
logger.debug("StorageHub returned "+ listPortalLogin.size() + " user/s");
|
logger.debug("StorageHub returned "+ listMembers.size() + " user/s");
|
||||||
|
|
||||||
if(!WsUtil.isWithinPortal())
|
if(!WsUtil.isWithinPortal())
|
||||||
return StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLoginTestMode(listPortalLogin);
|
return StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLoginTestMode(listMembers);
|
||||||
|
|
||||||
List<InfoContactModel> listContacts = new ArrayList<InfoContactModel>(listPortalLogin.size());
|
return StorageHubToWorkpaceConverter.listMembersToListContact(listMembers);
|
||||||
for (String login : listPortalLogin) {
|
|
||||||
listContacts.add(StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLogin(login));
|
|
||||||
}
|
|
||||||
|
|
||||||
return listContacts;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
logger.debug("the item with id: "+rootSharedFolder.getId()+ " is not "+WorkspaceItemType.SHARED_FOLDER);
|
logger.debug("the item with id: "+rootSharedFolder.getId()+ " is not "+WorkspaceItemType.SHARED_FOLDER);
|
||||||
|
|
|
@ -10,7 +10,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
|
||||||
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
import org.gcube.common.resources.gcore.utils.XPathHelper;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
|
import org.gcube.common.scope.impl.ScopeBean.Type;
|
||||||
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
||||||
import org.gcube.resources.discovery.client.queries.api.Query;
|
import org.gcube.resources.discovery.client.queries.api.Query;
|
||||||
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
|
||||||
|
@ -19,12 +20,11 @@ import org.slf4j.LoggerFactory;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ApplicationProfileReader.
|
* The Class ApplicationProfileReader.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
|
||||||
* Sep 14, 2016
|
* Sep 14, 2016
|
||||||
*/
|
*/
|
||||||
public class ApplicationProfileReader {
|
public class ApplicationProfileReader {
|
||||||
|
|
||||||
|
@ -48,12 +48,26 @@ public class ApplicationProfileReader {
|
||||||
private String resourceName;
|
private String resourceName;
|
||||||
private String appID;
|
private String appID;
|
||||||
|
|
||||||
|
public enum APPLICATION_PROFILE_ITEM {
|
||||||
|
|
||||||
|
SCOPE("/Scope/text()"), URL("/URL/text()");
|
||||||
|
|
||||||
|
private String xPath;
|
||||||
|
|
||||||
|
APPLICATION_PROFILE_ITEM(String xpath) {
|
||||||
|
this.xPath = xpath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXPath() {
|
||||||
|
return xPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new application profile reader.
|
* Instantiates a new application profile reader.
|
||||||
*
|
*
|
||||||
* @param resourceName the resource name
|
* @param resourceName the resource name
|
||||||
* @param appID the app id
|
* @param appID the app id
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public ApplicationProfileReader(String resourceName, String appID) throws Exception {
|
public ApplicationProfileReader(String resourceName, String appID) throws Exception {
|
||||||
|
@ -64,150 +78,167 @@ public class ApplicationProfileReader {
|
||||||
this.scope = ScopeProvider.instance.get();
|
this.scope = ScopeProvider.instance.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this method looks up the generic resource among the ones available in the infrastructure using scope provider {@link ScopeProvider.instance.get()}
|
* this method looks up the generic resource among the ones available in the
|
||||||
* resource name {@value #WORKSPACE_EXPLORER_APP_NAME} and secondaryType {@value #SECONDARY_TYPE}
|
* infrastructure using scope provider {@link ScopeProvider.instance.get()}
|
||||||
|
* resource name {@value #WORKSPACE_EXPLORER_APP_NAME} and secondaryType
|
||||||
|
* {@value #SECONDARY_TYPE}
|
||||||
*
|
*
|
||||||
* @return the applicationProfile profile
|
* @return the applicationProfile profile
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* this method looks up the applicationProfile profile among the ones available in the infrastructure.
|
* this method looks up the applicationProfile profile among the ones available
|
||||||
|
* in the infrastructure.
|
||||||
*
|
*
|
||||||
* @return the applicationProfile profile
|
* @return the applicationProfile profile
|
||||||
*/
|
*/
|
||||||
public ApplicationProfile readProfileFromInfrastrucure() {
|
public ApplicationProfile readProfileFromInfrastrucure() {
|
||||||
|
|
||||||
ApplicationProfile appProf = new ApplicationProfile();
|
ApplicationProfile appProf = new ApplicationProfile();
|
||||||
String queryString = getGcubeGenericQueryString(secondaryType, appID);
|
String queryString = getGcubeGenericQueryString(secondaryType, appID);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if(scope==null)
|
if (scope == null)
|
||||||
throw new Exception("Scope is null, set scope into ScopeProvider");
|
throw new Exception("Scope is null, set scope into ScopeProvider");
|
||||||
|
|
||||||
logger.info("Trying to fetch ApplicationProfile in the scope: "+scope+", SecondaryType: " + secondaryType + ", AppId: " + appID);
|
logger.info("Trying to fetch " + SECONDARY_TYPE + " in the scope: " + scope + ", SecondaryType: "
|
||||||
Query q = new QueryBox(queryString);
|
+ secondaryType + ", AppId: " + appID);
|
||||||
DiscoveryClient<String> client = client();
|
Query q = new QueryBox(queryString);
|
||||||
List<String> appProfile = client.submit(q);
|
DiscoveryClient<String> client = client();
|
||||||
|
List<String> appProfile = client.submit(q);
|
||||||
|
|
||||||
if (appProfile == null || appProfile.size() == 0)
|
if (appProfile == null || appProfile.size() == 0)
|
||||||
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType + ", AppId: " + appID +" is not registered in the scope: "+scope);
|
throw new ApplicationProfileNotFoundException("Generic Resource with SecondaryType: " + secondaryType
|
||||||
else {
|
+ ", AppId: " + appID + " is not registered in the scope: " + scope);
|
||||||
String elem = appProfile.get(0);
|
else {
|
||||||
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
String elem = appProfile.get(0);
|
||||||
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
|
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
XPathHelper helper = new XPathHelper(node);
|
Node node = docBuilder.parse(new InputSource(new StringReader(elem))).getDocumentElement();
|
||||||
|
XPathHelper helper = new XPathHelper(node);
|
||||||
|
|
||||||
List<String> currValue = null;
|
List<String> currValue = null;
|
||||||
currValue = helper.evaluate(RESOURCE_PROFILE_NAME_TEXT);
|
currValue = helper.evaluate(RESOURCE_PROFILE_NAME_TEXT);
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
appProf.setName(currValue.get(0));
|
appProf.setName(currValue.get(0));
|
||||||
}
|
} else
|
||||||
else throw new ApplicationProfileNotFoundException("Your applicationProfile NAME was not found in the profile");
|
throw new ApplicationProfileNotFoundException(
|
||||||
|
"Your " + SECONDARY_TYPE + " NAME was not found in the generic resource");
|
||||||
|
|
||||||
currValue = helper.evaluate(RESOURCE_PROFILE_DESCRIPTION_TEXT);
|
currValue = helper.evaluate(RESOURCE_PROFILE_DESCRIPTION_TEXT);
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
appProf.setDescription(currValue.get(0));
|
appProf.setDescription(currValue.get(0));
|
||||||
}
|
} else
|
||||||
else logger.warn("No Description exists for " + appProf.getName());
|
logger.warn("No Description exists for " + appProf.getName());
|
||||||
|
|
||||||
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_APP_ID_TEXT);
|
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_APP_ID_TEXT);
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
appProf.setKey(currValue.get(0));
|
appProf.setKey(currValue.get(0));
|
||||||
}
|
} else
|
||||||
else throw new ApplicationProfileNotFoundException("Your applicationProfile ID n was not found in the profile, consider adding <AppId> element in <Body>");
|
throw new ApplicationProfileNotFoundException("Your " + SECONDARY_TYPE
|
||||||
|
+ " ID was not found in the generic resource, consider adding <AppId> element in <Body>");
|
||||||
|
|
||||||
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_THUMBNAIL_URL_TEXT);
|
currValue = helper.evaluate(RESOURCE_PROFILE_BODY_THUMBNAIL_URL_TEXT);
|
||||||
if (currValue != null && currValue.size() > 0) {
|
if (currValue != null && currValue.size() > 0) {
|
||||||
appProf.setImageUrl(currValue.get(0));
|
appProf.setImageUrl(currValue.get(0));
|
||||||
}
|
} else {
|
||||||
else{
|
logger.warn("Null or empty <ThumbnailURL> element in <Body> of " + appProf.getName());
|
||||||
logger.warn("Null or empty <ThumbnailURL> element in <Body>" + appProf.getName());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
currValue = helper.evaluate("/Resource/Profile/Body/EndPoint[Scope='"+scope.toString()+"']/Scope/text()");
|
currValue = helper
|
||||||
|
.evaluate("/Resource/Profile/Body/EndPoint[Scope='" + scope.toString() + "']/Scope/text()");
|
||||||
|
|
||||||
if (currValue != null && currValue.size() > 0) {
|
appProf = readEndPointForScopeWithRetry(helper, scope, APPLICATION_PROFILE_ITEM.SCOPE, appProf);
|
||||||
List<String> scopes = currValue;
|
|
||||||
String currentScope = scopes.get(0);
|
|
||||||
|
|
||||||
//int slashCount = StringUtils.countMatches(currentScope, "/");
|
appProf = readEndPointForScopeWithRetry(helper, scope, APPLICATION_PROFILE_ITEM.URL, appProf);
|
||||||
|
|
||||||
boolean isVRE = WsUtil.isVRE(currentScope);
|
logger.debug("returning: " + appProf);
|
||||||
|
|
||||||
//if(slashCount < 3){//CASE not VRE - set session scope
|
|
||||||
if(!isVRE){//CASE not VRE - set session scope
|
|
||||||
logger.info("Scope "+ scope.toString() + " is not a VRE");
|
|
||||||
|
|
||||||
List<String> listSessionScope = helper.evaluate("/Resource/Profile/Body/EndPoint[Scope='"+scope.toString()+"']/Sessionscope/text()"); //get session scope of i+1-mo scope
|
|
||||||
logger.debug("ListSessionScope is: "+ listSessionScope.toString());
|
|
||||||
|
|
||||||
if(listSessionScope!=null && listSessionScope.size()>0){ //If sessions scope exists
|
|
||||||
|
|
||||||
logger.debug("setting session scope "+ listSessionScope.get(0));
|
|
||||||
appProf.setScope(listSessionScope.get(0));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
logger.trace("session scope not exists setting scope "+ scope.toString());
|
|
||||||
appProf.setScope(scope.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{ //CASE IS A VRE
|
|
||||||
logger.info("Scope "+ scope.toString() + " is a VRE");
|
|
||||||
appProf.setScope(scope.toString());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//RETRIEVE URL
|
|
||||||
currValue = helper.evaluate("/Resource/Profile/Body/EndPoint[Scope='"+scope.toString()+"']/URL/text()");
|
|
||||||
|
|
||||||
if (currValue != null && currValue.size() > 0) {
|
|
||||||
String url = currValue.get(0);
|
|
||||||
// System.out.println("URL "+url);
|
|
||||||
if(url!=null)
|
|
||||||
appProf.setUrl(url);
|
|
||||||
else
|
|
||||||
throw new ApplicationProfileNotFoundException("Your applicationProfile URL was not found in the profile for Scope: " + scope.toString());
|
|
||||||
}
|
|
||||||
else throw new ApplicationProfileNotFoundException("Your applicationProfile URL was not found in the profile for Scope: " + scope.toString());
|
|
||||||
|
|
||||||
}
|
|
||||||
else throw new ApplicationProfileNotFoundException("Your applicationProfile with scope "+scope.toString()+" was not found in the profile, consider adding <EndPoint><Scope> element in <Body>");
|
|
||||||
|
|
||||||
logger.debug("returning: "+appProf);
|
|
||||||
return appProf;
|
return appProf;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error while trying to fetch applicationProfile profile from the infrastructure", e);
|
logger.error("Error while trying to fetch applicationProfile profile from the infrastructure", e);
|
||||||
return null;
|
return null;
|
||||||
}finally{
|
} finally {
|
||||||
/*
|
/*
|
||||||
if(originalScope!=null && !originalScope.isEmpty()){
|
* if(originalScope!=null && !originalScope.isEmpty()){
|
||||||
ScopeProvider.instance.set(originalScope);
|
* ScopeProvider.instance.set(originalScope);
|
||||||
logger.info("scope provider setted to orginal scope: "+originalScope);
|
* logger.info("scope provider setted to orginal scope: "+originalScope); }else{
|
||||||
}else{
|
* ScopeProvider.instance.reset(); logger.info("scope provider reset"); }
|
||||||
ScopeProvider.instance.reset();
|
*/
|
||||||
logger.info("scope provider reset");
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ApplicationProfile readEndPointForScopeWithRetry(XPathHelper helper, String scope,
|
||||||
|
APPLICATION_PROFILE_ITEM searchItem, ApplicationProfile appProf)
|
||||||
|
throws ApplicationProfileNotFoundException {
|
||||||
|
|
||||||
|
String xPathToQuery = "/Resource/Profile/Body/EndPoint[Scope='" + scope + "']" + searchItem.getXPath();
|
||||||
|
logger.debug("Identifying path with current scope: " + xPathToQuery);
|
||||||
|
List<String> currValue = helper.evaluate(xPathToQuery);
|
||||||
|
|
||||||
|
String queryResult = null;
|
||||||
|
|
||||||
|
if (currValue == null || currValue.isEmpty()) {
|
||||||
|
logger.warn("In the " + SECONDARY_TYPE + " with name " + appProf.getName() + " the xPath " + xPathToQuery
|
||||||
|
+ " returned with no results");
|
||||||
|
|
||||||
|
ScopeBean scopeBean = new ScopeBean(scope);
|
||||||
|
if (scopeBean.is(Type.VRE) || scopeBean.is(Type.VO)) {
|
||||||
|
String pathSeparator = "/";
|
||||||
|
String[] components = scope.split(pathSeparator);
|
||||||
|
scope = pathSeparator + components[1];
|
||||||
|
logger.info("The scope "+scopeBean.toString()+" is of kind " + Type.VRE + " or " + Type.VO
|
||||||
|
+ ". Retry in action - going to search the default <EndPoint> with the root scope: " + scope);
|
||||||
|
|
||||||
|
xPathToQuery = "/Resource/Profile/Body/EndPoint[Scope='" + scope + "']" + searchItem.getXPath();
|
||||||
|
logger.debug("Identifying path with root scope: " + xPathToQuery);
|
||||||
|
currValue = helper.evaluate(xPathToQuery);
|
||||||
|
|
||||||
|
if (currValue == null || currValue.isEmpty()) {
|
||||||
|
logger.warn("In the " + SECONDARY_TYPE + " with name " + appProf.getName() + " the xPath " + xPathToQuery
|
||||||
|
+ " returned with no results");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currValue == null || currValue.isEmpty()) {
|
||||||
|
throw new ApplicationProfileNotFoundException("Your ApplicationProfile in the scope " + scope
|
||||||
|
+ " have not an <EndPoint> accessible, consider adding <EndPoint><Scope></Scope> element in <Body>");
|
||||||
|
}
|
||||||
|
|
||||||
|
queryResult = currValue.get(0);
|
||||||
|
logger.info("The xPath: " + xPathToQuery + " returned with the result: " + queryResult);
|
||||||
|
|
||||||
|
switch (searchItem) {
|
||||||
|
case SCOPE:
|
||||||
|
appProf.setScope(currValue.get(0));
|
||||||
|
break;
|
||||||
|
case URL:
|
||||||
|
appProf.setUrl(currValue.get(0));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return appProf;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the gcube generic query string.
|
* Gets the gcube generic xPath string.
|
||||||
*
|
*
|
||||||
* @param secondaryType the secondary type
|
* @param secondaryType the secondary type
|
||||||
* @param appId the app id
|
* @param appId the app id
|
||||||
* @return the gcube generic query string
|
* @return the gcube generic xPath string
|
||||||
*/
|
*/
|
||||||
public static String getGcubeGenericQueryString(String secondaryType, String appId){
|
public static String getGcubeGenericQueryString(String secondaryType, String appId) {
|
||||||
|
|
||||||
return "for $profile in collection('/db/Profiles/GenericResource')//Resource " +
|
return "for $profile in collection('/db/Profiles/GenericResource')//Resource "
|
||||||
"where $profile/Profile/SecondaryType/string() eq '"+secondaryType+"' and $profile/Profile/Body/AppId/string() " +
|
+ "where $profile/Profile/SecondaryType/string() eq '" + secondaryType
|
||||||
" eq '" + appId + "'" +
|
+ "' and $profile/Profile/Body/AppId/string() " + " eq '" + appId + "'" + "return $profile";
|
||||||
"return $profile";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,7 +250,6 @@ public class ApplicationProfileReader {
|
||||||
return secondaryType;
|
return secondaryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the scope.
|
* Gets the scope.
|
||||||
*
|
*
|
||||||
|
@ -238,8 +268,9 @@ public class ApplicationProfileReader {
|
||||||
return resourceName;
|
return resourceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see java.lang.Object#toString()
|
* @see java.lang.Object#toString()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -258,20 +289,4 @@ public class ApplicationProfileReader {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// ScopeProvider.instance.set("/gcube");
|
|
||||||
// ApplicationProfileReader ap = new ApplicationProfileReader("Workspace-Explorer-App", "org.gcube.portlets.user.workspaceexplorerapp.server.WorkspaceExplorerAppServiceImpl");
|
|
||||||
// System.out.println(ap.readProfileFromInfrastrucure());
|
|
||||||
// }
|
|
||||||
// catch (Exception e) {
|
|
||||||
// // TODO Auto-generated catch block
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class ObjectStorageHubToWorkpaceMapper {
|
||||||
* @return the file model
|
* @return the file model
|
||||||
* @throws InternalErrorException the internal error exception
|
* @throws InternalErrorException the internal error exception
|
||||||
*/
|
*/
|
||||||
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared) throws InternalErrorException{
|
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared, GCubeUser loggedUser) throws InternalErrorException{
|
||||||
|
|
||||||
FileModel fileModel = null;
|
FileModel fileModel = null;
|
||||||
//boolean isPublic = false;
|
//boolean isPublic = false;
|
||||||
|
@ -145,6 +145,8 @@ public class ObjectStorageHubToWorkpaceMapper {
|
||||||
fileModel.setShareable(false);
|
fileModel.setShareable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setFullNameOwner(wrappedItem, fileModel, loggedUser);
|
||||||
|
|
||||||
//setSynchedThreddsStateFor(fileModel);
|
//setSynchedThreddsStateFor(fileModel);
|
||||||
fileModel.setIsRoot(wrappedItem.isRoot());
|
fileModel.setIsRoot(wrappedItem.isRoot());
|
||||||
logger.trace("Returning converted tree item: "+fileModel);
|
logger.trace("Returning converted tree item: "+fileModel);
|
||||||
|
@ -247,27 +249,32 @@ public class ObjectStorageHubToWorkpaceMapper {
|
||||||
fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
|
fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setFullNameOwner(wrappedItem, fileGridModel, loggedUser);
|
||||||
|
|
||||||
|
logger.trace("Returning converted grid item: "+fileGridModel);
|
||||||
|
return fileGridModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void setFullNameOwner(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel fileModel, GCubeUser loggedUser) {
|
||||||
//OWNER
|
//OWNER
|
||||||
if(wrappedItem.isShared()){ //IT IS READ FROM SHUB ONLY IF THE ITEM IS SHARED
|
if(wrappedItem.isShared()){ //IT IS READ FROM SHUB ONLY IF THE ITEM IS SHARED
|
||||||
fileGridModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
|
fileModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
|
||||||
String ownerUsername = wrappedItem.getOwner();
|
String ownerUsername = wrappedItem.getOwner();
|
||||||
if(ownerUsername!=null){
|
if(ownerUsername!=null){
|
||||||
// System.out.println("++++reading owner");
|
// System.out.println("++++reading owner");
|
||||||
//String portalLogin = owner.getPortalLogin();
|
//String portalLogin = owner.getPortalLogin();
|
||||||
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
|
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
String ownerUsername = wrappedItem.getOwner();
|
String ownerUsername = wrappedItem.getOwner();
|
||||||
//Task #12911 I'm calling getUserFullName for any user other than logged user
|
//Task #12911 I'm calling getUserFullName for any user other than logged user
|
||||||
if(ownerUsername!=null && ownerUsername.compareToIgnoreCase(loggedUser.getUsername())!=0){
|
if(ownerUsername!=null && ownerUsername.compareToIgnoreCase(loggedUser.getUsername())!=0){
|
||||||
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
|
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
|
||||||
}else
|
}else
|
||||||
fileGridModel.setOwnerFullName(loggedUser.getFullname());
|
fileModel.setOwnerFullName(loggedUser.getFullname());
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace("Returning converted grid item: "+fileGridModel);
|
|
||||||
return fileGridModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.gcube.common.storagehub.model.items.nodes.accounting.AccountFolderEnt
|
||||||
import org.gcube.common.storagehub.model.items.nodes.accounting.AccountFolderEntryRemoval;
|
import org.gcube.common.storagehub.model.items.nodes.accounting.AccountFolderEntryRemoval;
|
||||||
import org.gcube.common.storagehub.model.items.nodes.accounting.AccountFolderEntryRenaming;
|
import org.gcube.common.storagehub.model.items.nodes.accounting.AccountFolderEntryRenaming;
|
||||||
import org.gcube.common.storagehub.model.items.nodes.accounting.AccountingEntryType;
|
import org.gcube.common.storagehub.model.items.nodes.accounting.AccountingEntryType;
|
||||||
|
import org.gcube.common.storagehubwrapper.shared.Member;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItemType;
|
||||||
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
import org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceSharedFolder;
|
||||||
|
@ -44,6 +45,11 @@ import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryTyp
|
||||||
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
|
||||||
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
|
||||||
import org.gcube.usecases.ws.thredds.model.ContainerType;
|
import org.gcube.usecases.ws.thredds.model.ContainerType;
|
||||||
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
||||||
|
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
||||||
|
import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -134,7 +140,8 @@ public class StorageHubToWorkpaceConverter implements Serializable {
|
||||||
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
||||||
FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException {
|
FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException {
|
||||||
|
|
||||||
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
|
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel,
|
||||||
|
isParentShared, loggedUser);
|
||||||
return setSynchedWithWsThredds(fileModel, wrappedItem);
|
return setSynchedWithWsThredds(fileModel, wrappedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,11 +156,11 @@ public class StorageHubToWorkpaceConverter implements Serializable {
|
||||||
public FileGridModel toGridFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
public FileGridModel toGridFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
|
||||||
FileModel parentFolderModel) throws InternalErrorException {
|
FileModel parentFolderModel) throws InternalErrorException {
|
||||||
|
|
||||||
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem, parentFolderModel, loggedUser);
|
FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem,
|
||||||
|
parentFolderModel, loggedUser);
|
||||||
return (FileGridModel) setSynchedWithWsThredds(fileGridModel, wrappedItem);
|
return (FileGridModel) setSynchedWithWsThredds(fileGridModel, wrappedItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected FileModel setSynchedWithWsThredds(FileModel fileModel, WorkspaceItem wrappedItem) {
|
protected FileModel setSynchedWithWsThredds(FileModel fileModel, WorkspaceItem wrappedItem) {
|
||||||
logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
|
logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
|
||||||
|
|
||||||
|
@ -297,6 +304,47 @@ public class StorageHubToWorkpaceConverter implements Serializable {
|
||||||
return new InfoContactModel(portalLogin, portalLogin, fullName, emailDomain, false);
|
return new InfoContactModel(portalLogin, portalLogin, fullName, emailDomain, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<InfoContactModel> listMembersToListContact(List<Member> members) {
|
||||||
|
logger.info("listMembersToListContact called for " + members.size() + " member/s");
|
||||||
|
|
||||||
|
List<InfoContactModel> listContacts = new ArrayList<InfoContactModel>();
|
||||||
|
UserManager userManager = new LiferayUserManager();
|
||||||
|
|
||||||
|
for (Member member : members) {
|
||||||
|
logger.debug("Resolving member: " + member);
|
||||||
|
boolean isGroup = member.getMemberType().equals(Member.TYPE.GROUP) ? true : false;
|
||||||
|
|
||||||
|
if (!isGroup) {
|
||||||
|
InfoContactModel icm = buildGxtInfoContactFromPortalLogin(member.getIdentity());
|
||||||
|
// HE/SHE IS A USER
|
||||||
|
listContacts.add(icm);
|
||||||
|
} else {
|
||||||
|
// HE/SHE IS A GROUP
|
||||||
|
logger.debug("The member: " + member + " is a group, resolving list of Users from "
|
||||||
|
+ LiferayUserManager.class.getSimpleName() + " for the group name: " + member.getName());
|
||||||
|
try {
|
||||||
|
List<GCubeUser> listUsers = userManager.listUsersByGroupName(member.getName());
|
||||||
|
|
||||||
|
if (listUsers != null) {
|
||||||
|
logger.debug("List of user for groupName are: " + listUsers.size());
|
||||||
|
for (GCubeUser user : listUsers) {
|
||||||
|
InfoContactModel icm = buildGxtInfoContactFromPortalLogin(user.getUsername());
|
||||||
|
listContacts.add(icm);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.warn("List of user for groupName: " + member.getName() + " is null");
|
||||||
|
}
|
||||||
|
} catch (UserManagementSystemException | GroupRetrievalFault | UserRetrievalFault e) {
|
||||||
|
logger.warn("Error occurrend on resolving the member: " + member.getName(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("Returning " + listContacts.size() + " from members");
|
||||||
|
return listContacts;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO ********TEMPORARY SOLUTION HL MUST MANAGE SPECIAL FOLDER AS
|
* TODO ********TEMPORARY SOLUTION HL MUST MANAGE SPECIAL FOLDER AS
|
||||||
* WORKSPACESPECIALFOLDER**** REMOVE THIS METHOD AND ADDING INSTANCE OF AT
|
* WORKSPACESPECIALFOLDER**** REMOVE THIS METHOD AND ADDING INSTANCE OF AT
|
||||||
|
@ -346,7 +394,8 @@ public class StorageHubToWorkpaceConverter implements Serializable {
|
||||||
.isPublicFolder(); // TODO
|
.isPublicFolder(); // TODO
|
||||||
FileModel parentModel = null;
|
FileModel parentModel = null;
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared());
|
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared(),
|
||||||
|
loggedUser);
|
||||||
|
|
||||||
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false,
|
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false,
|
||||||
isPublicDir);
|
isPublicDir);
|
||||||
|
@ -881,12 +930,12 @@ public class StorageHubToWorkpaceConverter implements Serializable {
|
||||||
return hashTestUser;
|
return hashTestUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<String> listPortalLogin) {
|
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<Member> listMemebers) {
|
||||||
|
|
||||||
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
|
||||||
|
|
||||||
for (String portalLogin : listPortalLogin)
|
for (Member member : listMemebers)
|
||||||
listContact.add(getHashTestUsers().get(portalLogin));
|
listContact.add(getHashTestUsers().get(member.getIdentity()));
|
||||||
|
|
||||||
return listContact;
|
return listContact;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
||||||
|
@ -121,7 +120,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;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,10 +291,9 @@ public class MimeTypeUtility {
|
||||||
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
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
/resources/
|
|
@ -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();
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.workspace;
|
package org.gcube.portlets.user.workspace;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.gcube.common.encryption.StringEncrypter;
|
import org.gcube.common.encryption.StringEncrypter;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
import org.gcube.portlets.user.workspace.server.util.StringUtil;
|
import org.gcube.portlets.user.workspace.server.util.StringUtil;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,29 +1,25 @@
|
||||||
package org.gcube.portlets.user.workspace;
|
package org.gcube.portlets.user.workspace;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl;
|
|
||||||
|
|
||||||
public class TestProperties {
|
public class TestProperties {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
// public static void main(String[] args) {
|
||||||
|
//
|
||||||
|
// Properties prop = new Properties();
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // load a properties file from class path, inside static method
|
||||||
|
// prop.load(GWTWorkspaceServiceImpl.class.getClassLoader().getResourceAsStream("portletClassName.properties"));
|
||||||
|
//
|
||||||
|
// // get the property value and print it out
|
||||||
|
// System.out.println(prop.getProperty("idreport"));
|
||||||
|
// System.out.println(prop.getProperty("idtemplate"));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// } catch (IOException ex) {
|
||||||
|
// ex.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
Properties prop = new Properties();
|
|
||||||
|
|
||||||
try {
|
|
||||||
// load a properties file from class path, inside static method
|
|
||||||
prop.load(GWTWorkspaceServiceImpl.class.getClassLoader().getResourceAsStream("portletClassName.properties"));
|
|
||||||
|
|
||||||
// get the property value and print it out
|
|
||||||
System.out.println(prop.getProperty("idreport"));
|
|
||||||
System.out.println(prop.getProperty("idtemplate"));
|
|
||||||
|
|
||||||
|
|
||||||
} catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.gcube.portlets.user.workspace.junit;
|
||||||
|
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.workspace.server.reader.ApplicationProfileReader;
|
||||||
|
|
||||||
|
public class WEA_AP_Reader {
|
||||||
|
|
||||||
|
public static String SCOPE = "/d4science.research-infrastructures.eu";
|
||||||
|
public static String resourceName = "Workspace-Explorer-App";
|
||||||
|
public static String appID = "org.gcube.portlets.user.workspaceexplorerapp.server.WorkspaceExplorerAppServiceImpl";
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void readAP() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// ScopeProvider.instance.set("/d4science.research-infrastructures.eu/D4Research/Limnodata");
|
||||||
|
ScopeProvider.instance.set(SCOPE);
|
||||||
|
ApplicationProfileReader ap = new ApplicationProfileReader(resourceName, appID);
|
||||||
|
System.out.println("ApplicationProfile found: " + ap.readProfileFromInfrastrucure());
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue