Compare commits

..

No commits in common. "master" and "v6.30.0" have entirely different histories.

54 changed files with 1993 additions and 4202 deletions

View File

@ -6,21 +6,26 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </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 excluding="**" kind="src" output="target/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes> <attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
@ -35,16 +40,5 @@
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -2,5 +2,4 @@ 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

View File

@ -1,72 +1,7 @@
<?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>

View File

@ -4,126 +4,22 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v6.35.3] - 2024-03-19 ## [v6-30-0] [r4-23-0] - 2020-05-18
- Moved to maven parent 1.2.0 **New Features**
- 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
[#21388] Integrated with new workflow to interact with ws-thredds 1.x
[#21444] Moved to maven-portal-bom >= 3.6.2-SNAPSHOT
## [v6.32.0] - 2021-04-12
#### Enhancements
[#21153] Upgrade the maven-portal-bom to 3.6.1 version
[#20762] Moved to ckan-metadata-publisher-widget 2.X
## [v6.31.3] - 2021-03-25
#### Bug Fixes
Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
## [v6.31.2] - 2021-01-18
#### Bug Fixes
[#20457] Just including patched library
## [v6.31.1] - 2020-10-19
#### Bug Fixes
[#19952] Fixed incident
## [v6.31.0] - 2020-09-29
#### Enhancements
[#19600] revisit the "Get Info" Dialog in a modern view
#### New Features
[#19695] Show the file preview via Google Docs Viewer
#### Bug Fixes
[#19759#note-12] Fixed updating the description of a folder
## [v6.30.1] - 2020-06-25
#### Fixes
[#19544] update the unsharing messages in the accounting history
## [v6.30.0] - 2020-05-18
#### New Features
[#19058] Restore operation: the user has to select the destination folder [#19058] Restore operation: the user has to select the destination folder
#### Fixes **Fixes**
[#19232] Fixed upload of file names that use special characters [#19232] Fixed upload of file names that use special characters
[#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] - 2020-03-27 ## [v6-29-0] [r4.21.0] - 2020-03-27
#### New Features **New Features**
[#18150] Get Shareable Link as Long URL also [#18150] Get Shareable Link as Long URL also
@ -131,26 +27,29 @@ Declared the workspace-uploader range [2.X, 3.X-SNAPSHOT)
[#18174] Workspace Search facility, business logic applied on workspace side [#18174] Workspace Search facility, business logic applied on workspace side
#### Fixes **Fixes**
[#18577] Fixing Shareable link informative text for public file [#18577] Fixing Shareable link informative text for public file
[#18926] Workspace portlet: previous version file download errors [#18926] Workspace portlet: previous version file download errors
## [v6.28.1] - n.a.
## [6-28-1] - 2020-02-03
Migrated to git Migrated to git
## [v6.28.0] - n.a.
## [6-28-0] - [${buildDate}]
Merged with branch version Merged with branch version
Changed shared folder check to send notification Changed shared folder check to send notification
## [v6.27.0] - 2019-09-25
## [6-27-0] - [${buildDate}]
[Task #17226] Workspace and Workspace Tree: migrate HL remaining methods to SHUB [Task #17226] Workspace and Workspace Tree: migrate HL remaining methods to SHUB
@ -159,19 +58,22 @@ Updated the list of classes shared with sharing widget component
[Task #17552] Workspace: reconsider the actions Private Link, Folder Link and Get Link [Task #17552] Workspace: reconsider the actions Private Link, Folder Link and Get Link
## [v6.26.0] - 2019-08-02
## [6-26-0] - [${buildDate}]
[Task #17135] Workspace: assign the file extension during the download [Task #17135] Workspace: assign the file extension during the download
[Feature #17091] Reconsider error message when deleting a shared folder [Feature #17091] Reconsider error message when deleting a shared folder
## [v6.25.1] - 2019-07-05
## [6-25-1] - [${buildDate}]
[Task #17018] Move some methods to SHUB due to backward compatibility broken between SHUB and HL [Task #17018] Move some methods to SHUB due to backward compatibility broken between SHUB and HL
## [v6.25.0] - 2019-04-04
## [6-25-0] - [${buildDate}]
Updated to StorageHub [ticket: #13226] Updated to StorageHub [ticket: #13226]
@ -180,7 +82,8 @@ Updated to StorageHub [ticket: #13226]
[Task #12910] Rename and delete operations on shared folder should be managed by dedicated message on WS-side [Task #12910] Rename and delete operations on shared folder should be managed by dedicated message on WS-side
## [v6.24.1] - 2019-01-08
## [6-24-1] - [${buildDate}]
Updated regular expression to validate Folder and File names Updated regular expression to validate Folder and File names
@ -189,7 +92,8 @@ Updated regular expression to validate Folder and File names
[Task #13106] Provide public links for versioned files [Task #13106] Provide public links for versioned files
## [v6.23.0] - 2018-11-13
## [6-23-0] - [${buildDate}]
[Task #12521] Migrate the tree view [Task #12521] Migrate the tree view
@ -216,70 +120,82 @@ Updated regular expression to validate Folder and File names
[Incident #12922] Workspace get link not working [Incident #12922] Workspace get link not working
## [v6.22.0] - 2018-09-14
## [6-22-0] - [2018-09-14]
[Task #12489] Migrate delete operation to StorageHub [Task #12489] Migrate delete operation to StorageHub
integrated CLARIN Switchboard with service endpoint query for Switchboard service discovery integrated CLARIN Switchboard with service endpoint query for Switchboard service discovery
## [v6.21.1] - 2018-07-02
## [6-21-1] - [2018-07-02]
[Task #12089] Migrate to workspace-uploader 2.0 [Task #12089] Migrate to workspace-uploader 2.0
[Release #12006] Removed Send to [Release #12006] Removed Send to
## [v6.21.0] - 2018-06-07
## [6-21-0] - [2018-06-07]
[Project Activity #11690] Integrated with Task Executor Widget [Project Activity #11690] Integrated with Task Executor Widget
## [v6.20.1] - 2018-04-19
## [6-20-1] - [2018-04-19]
Managed case of Exception in order to avoid failure on checkItemLocked Managed case of Exception in order to avoid failure on checkItemLocked
## [v6.20.0] - 2018-03-01
## [6-20-0] - [2018-03-01]
[Task #11127] Porting to new ws-thredds engine [Task #11127] Porting to new ws-thredds engine
[Feature #11325] Workspace: add New URL feature in the context menu of right pane [Feature #11325] Workspace: add New URL feature in the context menu of right pane
## [v6.19.0] - 2018-01-09
## [6-19-0] - [2018-01-09]
Issue #10831, Workspace download folder tomcat temp occupation issue Issue #10831, Workspace download folder tomcat temp occupation issue
## [v6.18.0] - 2017-09-29
## [6-18-0] - [2017-09-29]
Feature #9760: WS-Thredds synch folder integration Feature #9760: WS-Thredds synch folder integration
## [v6.17.2] - 2017-09-13
## [6-17-2] - [2017-09-13]
Incident #9676: fixed. Removed check on get sub-folder public link when operation is performed by an administrator Incident #9676: fixed. Removed check on get sub-folder public link when operation is performed by an administrator
## [v6.17.1] - 2017-07-10
## [6-17-1] - [2017-07-10]
Added regex in order to remove list of chars when renaming or creating new item. It is different for folder and item name Added regex in order to remove list of chars when renaming or creating new item. It is different for folder and item name
## [v6.17.0] - 2017-05-22
## [6-17-0] - [2017-05-22]
[Feature #5207] Integrate Image Preview Widget [Feature #5207] Integrate Image Preview Widget
## [v6.16.1] - 2017-04-11
## [6-16-1] - [2017-04-11]
Quick fix to set folder as public Quick fix to set folder as public
Updated messages to history including version of file if it is present Updated messages to history including version of file if it is present
## [v6.16.0] - 2017-03-03
## [6-16-0] - [2017-03-03]
Removed no longer used dependency: accesslogger Removed no longer used dependency: accesslogger
@ -292,26 +208,30 @@ Edit Administrator can be performed by other Administrator/s
'Edit Permissions' can be performed by Administrators 'Edit Permissions' can be performed by Administrators
## [v6.15.2] - 2016-01-20
## [6-15-2] - [2016-01-20]
Added a loader on share window when contacts are loading from server Added a loader on share window when contacts are loading from server
Removed currUserId parameter from client side required for external servlets Removed currUserId parameter from client side required for external servlets
## [v6.15.1] - 2016-01-05
## [6-15-1] - [2016-01-05]
Removed message box shown in case of failure on getAllContatcs Removed message box shown in case of failure on getAllContatcs
## [v6.15.0] - 2016-11-29
## [6-15-0] - [2016-11-29]
[Feature #5873] Remove ASL Session from the Workspace and its components [Feature #5873] Remove ASL Session from the Workspace and its components
Updated logic to get Folder Link (as Public folder). The access is granted for owner or admin Updated logic to get Folder Link (as Public folder). The access is granted for owner or admin
## [v6.14.0] - 2016-09-29
## [6-14-0] - [2016-09-29]
[Feature #2335] Added "Get Folder Link" facility [Feature #2335] Added "Get Folder Link" facility
@ -326,38 +246,44 @@ Added 'gcube-url-shortener' dependency, removed internal classes for shortener
[Bug #5218] Fixed return to the Workspace root Folder [Bug #5218] Fixed return to the Workspace root Folder
## [v6.13.0] - 2016-05-31
## [6-13-0] - [2016-05-31]
[Feature #4128] Migration to Liferay 6.2 [Feature #4128] Migration to Liferay 6.2
Data Catalogue publishing supported Data Catalogue publishing supported
## [v6.12.0] - 2016-05-16
## [6-12-0] - [2016-05-16]
Integrated with new workspace uploader Integrated with new workspace uploader
Bug fixed: Css for Dialog Cancel multiple files Bug fixed: Css for Dialog Cancel multiple files
## [v6.11.1] - 2016-02-24
## [6-11-1] - [2016-02-24]
Added icons for: .odt, .ods, .ott, .odg, .odp Added icons for: .odt, .ods, .ott, .odg, .odp
## [v6.11.0] - 2016-01-20
## [6-11-0] - [2016-01-20]
[Feature #1925] Added, new public link format: http://host/storageID [Feature #1925] Added, new public link format: http://host/storageID
[Feature #1298] Update public link generation [Feature #1298] Update public link generation
## [v6.10.1] - 2015-12-16
## [6-10-1] - [2015-12-16]
Bug Fixing - #1804; #1808; #1822; #1333 Bug Fixing - #1804; #1808; #1822; #1333
## [v6.10.0] - 2015-11-19
## [6-10-0] - [2015-11-19]
[Feature #124] Remove a user from shared folder [Feature #124] Remove a user from shared folder
@ -370,7 +296,8 @@ Bug Fixing - #1804; #1808; #1822; #1333
[Bug: #1459] Fixed: get link disabled [Bug: #1459] Fixed: get link disabled
## [v6.9.0] - 2015-10-30
## [6-9-0] - [2015-10-30]
[Bug #718] Fixed breadcrumb path [Bug #718] Fixed breadcrumb path
@ -383,82 +310,94 @@ Bug Fixing - #1804; #1808; #1822; #1333
[Bug #1270] Fixed. Workspace improvements: many rpc calls after an delete multiple [Bug #1270] Fixed. Workspace improvements: many rpc calls after an delete multiple
## [v6.8.0] - 2015-07-06
## [6-8-0] - [2015-07-06]
[Feature #129] Porting to HL 2.0 [Feature #129] Porting to HL 2.0
[Feature #331] Public Link updated to show short link and complete link [Feature #331] Public Link updated to show short link and complete link
## [v6.7.2] - 2015-04-15
## [6-7-2] - [2015-04-15]
Integrated with Contact Edit Permissions Integrated with Contact Edit Permissions
## [v6.7.1] - 2014-10-29
## [6-7-1] - [2014-10-29]
Added user storage usage Added user storage usage
Added notifications for: set folder Administrator, delete shared folder Added notifications for: set folder Administrator, delete shared folder
## [v6.6.7] - 2014-09-01
## [6-6-7] - [2014-09-01]
Support Ticket #813: Broken Breadcrumb for long path Support Ticket #813: Broken Breadcrumb for long path
Ticket #3053: Load current ACL stored to Shared Folder Ticket #3053: Load current ACL stored to Shared Folder
## [v6.6.6] - 2014-07-02
[#2798] Sharing Panel usability improved ## [6-6-6] - [2014-07-02]
#2798 Sharing Panel usability improved
Completed activity to https://support.social.isti.cnr.it/ticket/126 Completed activity to https://support.social.isti.cnr.it/ticket/126
## [v6.6.5] - 2014-06-04
## [6-6-5] - [2014-06-04]
Added Trash: https://issue.imarine.research-infrastructures.eu/ticket/2497 Added Trash: https://issue.imarine.research-infrastructures.eu/ticket/2497
Updated pom to support new portal configuration (gcube release 3.2) Updated pom to support new portal configuration (gcube release 3.2)
## [v6.6.4] - 2014-05-22
## [6-6-4] - [2014-05-22]
Fixed: https://support.d4science.research-infrastructures.eu/ticket/843 Fixed: https://support.d4science.research-infrastructures.eu/ticket/843
Added: item number in grid and trash. See: https://issue.imarine.research-infrastructures.eu/ticket/282 Added: item number in grid and trash. See: https://issue.imarine.research-infrastructures.eu/ticket/282
## [v6.6.2] - 2014-3-17
## [6-6-2] - [2014-3-17]
Management of My Special Folder Management of My Special Folder
Added change permissions to VRE shared folder Added change permissions to VRE shared folder
## [v6.6.0] - 2014-2-07
[#2634] Workspace: support for setting permissions over shared folders ## [6-6-0] - [2014-2-07]
[#2633] Workspace: support for VRE Shared Folders #2634 Workspace: support for setting permissions over shared folders
[#2290] Worskspace history operations: should support the session validation #2633 Workspace: support for VRE Shared Folders
#2290 Worskspace history operations: should support the session validation
## [v6.5.1] - 2013-12-12
## [6-5-1] - [2013-12-12]
Changed several labels into Logger Changed several labels into Logger
## [v6.5.0] - 2013-10-21
## [6-5-0] - [2013-10-21]
#Ticket 2223. This project was enhancements to gwt 2.5.1 #Ticket 2223. This project was enhancements to gwt 2.5.1
GCF dependency was removed GCF dependency was removed
## [v6.4.0] - 2013-09-16
## [6-4-0] - [2013-09-16]
Provide support for public link, Related ticket: #1993 Provide support for public link, Related ticket: #1993
@ -467,7 +406,8 @@ Link sharing and public link: generate a human-readable URL via URL shortening,
Fixed bug on shared links, Ticket #630 Fixed bug on shared links, Ticket #630
## [v6.3.0] - 2013-07-08
## [6-3-0] - [2013-07-08]
Provide support for share link, Related ticket: #1504 Provide support for share link, Related ticket: #1504
@ -476,87 +416,100 @@ Edit description on sharing, Related ticket: #1822
Bugs fixed, Related Tickets: #628, #633, #630 Bugs fixed, Related Tickets: #628, #633, #630
## [v6.2.0] - 2013-05-29
## [6-2-0] - [2013-05-29]
Provide support for accounting, related ticket: #1752 Provide support for accounting, related ticket: #1752
Enable notification for file upload in shared folder, related ticket: #1732 Enable notification for file upload in shared folder, related ticket: #1732
## [v6.1.0] - 2013-04-19
## [6-1-0] - [2013-04-19]
Workspace portlet was enhanced to meet the requests coming from the User Community Workspace portlet was enhanced to meet the requests coming from the User Community
Related tickets: #1500, #1498, #320, #1487, #1499, #1501, #1497, #1536 Related tickets: #1500, #1498, #320, #1487, #1499, #1501, #1497, #1536
## [v6.0.0] - 2013-03-05
[#1247] The workspace tree was mavenized ## [6-0-0] - [2013-03-05]
[#230], [#205] The Workspace environment now supports the sharing of folder between users #1247 The workspace tree was mavenized
#230, #205 The Workspace environment now supports the sharing of folder between users
## [v5.1.0] - 2012-09-21
## [5-1-0] - [2012-09-21]
Old Send Message removed, added support for new mail sender Old Send Message removed, added support for new mail sender
Bug fixed: upload file/archive Bug fixed: upload file/archive
## [v5.0.0] - 2012-05-04
[#216] New version of Workspace Tree is developed using the GXT framework ## [5-0-0] - [2012-05-04]
[#216] New tree is asynchronous #216 New version of Workspace Tree is developed using the GXT framework
[#216] Reviews tree GUI and adding new features #216 New tree is asynchronous
#216 Reviews tree GUI and adding new features
## [v4.3.0] - 2011-09-01
[#1740]: ICIS / Download csv / added extension .xlw ## [4-3-0] - [2011-09-01]
#1740: ICIS / Download csv / added extension .xlw
## [v4.2.0] - 2011-07-01
[#1555]: WorkflowTemplate and WorkflowReport required in Workspace Portlet ## [4-2-0] - [2011-07-01]
#1555: WorkflowTemplate and WorkflowReport required in Workspace Portlet
## [v4.1.0] - 2011-05-06
## [4-1-0] - [2011-05-06]
Synch with others changes in HomeLibrary Synch with others changes in HomeLibrary
GWT 2.2.0 GWT 2.2.0
## [v4.0.0] - 2011-02-07
## [4-0-0] - [2011-02-07]
Removed Workspace and Basket type, replaced with folder option Removed Workspace and Basket type, replaced with folder option
Synch with others changes in HomeLibrary Synch with others changes in HomeLibrary
## [v3.2.1] - 2010-11-09
## [3-2-1] - [2010-11-09]
Added more checks on GWT model construction Added more checks on GWT model construction
## [v3.2.0] - 2010-10-22
## [3-2-0] - [2010-10-22]
Enabled details panel for Report, ReportTemplate and AquaMapsItem workspace items Enabled details panel for Report, ReportTemplate and AquaMapsItem workspace items
## [v3.1.0] - 2010-09-03
[#36] ICIS / Workspace / Upload an archive ## [3-1-0] - [2010-09-03]
#36: ICIS / Workspace / Upload an archive
Merged ThumbnailServlet and ImageServlet Merged ThumbnailServlet and ImageServlet
[#774]: Workspace portlet tree - Open Report / Template redirect link not working #774: Workspace portlet tree - Open Report / Template redirect link not working
## [v3.0.0] - 2010-07-16
## [3-0-0] - [2010-07-16]
Ported to GWT 2.0 Ported to GWT 2.0
@ -565,9 +518,10 @@ Updated project structure to WebPortlet
Update to LifeRay portal Update to LifeRay portal
## [v2.6.0] - 2010-05-14
[#424]: Workspace code refactoring an enanchement ## [2-6-0] - [2010-05-14]
#424: Workspace code refactoring an enanchement
refactored code refactored code
@ -576,41 +530,50 @@ uniformed icons, no more specialized action icons
added more informations on items like AquaMapsItem, Report and Report Template added more informations on items like AquaMapsItem, Report and Report Template
## [v2.5.0] - 2010-01-29
## [2-5-0] - [2010-01-29]
gcube release 1.7.0 gcube release 1.7.0
## [v2.4.0] - 2009-11-30
## [2-4-0] - [2009-11-30]
gcube release 1.6.0 gcube release 1.6.0
## [v2.3.0] - 2009-11-16
## [2-3-0] - [2009-11-16]
gcube release 1.5.0 gcube release 1.5.0
## [v2.2.0] - 2009-10-16
## [2-2-0] - [2009-10-16]
gcube release gcube release
## [v2.1.1] - 2009-07-29
## [2-1-1] - [2009-07-29]
gcube release 1.2.2 gcube release 1.2.2
## [v2.1.0] - 2009-07-14
## [2-1-0] - [2009-07-14]
gcube release 1.2.0 gcube release 1.2.0
## [v2.0.0] - 2009-05-19
## [2-0-0] - [2009-05-19]
gcube release 1.2.0 rc1 gcube release 1.2.0 rc1
## [v1.1.2] - 2009-01-12
## [1-1-2] - [2009-01-12]
first release first release

View File

@ -15,7 +15,7 @@
<include>README.md</include> <include>README.md</include>
<include>LICENSE.md</include> <include>LICENSE.md</include>
<include>profile.xml</include> <include>profile.xml</include>
<include>CHANGELOG.md</include> <include>changelog.md</include>
</includes> </includes>
<fileMode>755</fileMode> <fileMode>755</fileMode>
<filtered>true</filtered> <filtered>true</filtered>

111
pom.xml
View File

@ -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.2.0</version> <version>1.1.0</version>
<relativePath /> <relativePath />
</parent> </parent>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId> <artifactId>workspace-tree-widget</artifactId>
<version>6.35.3</version> <version>6.30.0</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
@ -27,7 +27,7 @@
<repositories> <repositories>
<repository> <repository>
<id>eclipselink</id> <id>eclipselink</id>
<url>https://nexus.d4science.org/nexus/content/repositories/eclipselink/</url> <url>http://maven.research-infrastructures.eu:8081/nexus/content/repositories/eclipselink/</url>
</repository> </repository>
</repositories> </repositories>
@ -39,9 +39,6 @@
<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>
@ -49,40 +46,31 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
<version>${gcube-portal-bom-version}</version> <version>3.6.0</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>
<!-- UNCOMMENT THIS TO RUN IN DEVO MODE -->
<!-- <dependency> -->
<!-- <groupId>xerces</groupId> -->
<!-- <artifactId>xerces</artifactId> -->
<!-- <version>2.4.0</version> -->
<!-- </dependency> -->
<!-- This dependency is needed to use GWT UI BInder without old Xerces
version of gCore complaining -->
<!-- <dependency> -->
<!-- <groupId>xerces</groupId> -->
<!-- <artifactId>xercesImpl</artifactId> -->
<!-- <version>2.9.1</version> -->
<!-- <scope>provided</scope> -->
<!-- </dependency> -->
<!-- Google Web Toolkit (GWT) --> <!-- Google Web Toolkit (GWT) -->
<dependency> <dependency>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
@ -93,12 +81,13 @@
<dependency> <dependency>
<groupId>org.gcube.portal</groupId> <groupId>org.gcube.portal</groupId>
<artifactId>storagehub-icons-library</artifactId> <artifactId>storagehub-icons-library</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<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>${gxt2.2.5-gwt2.X-version}</version> <version>${gwtVersion}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -139,7 +128,7 @@
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId> <artifactId>common-scope-maps</artifactId>
<scope>provided</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- END FWS --> <!-- END FWS -->
@ -166,7 +155,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, 1.3.0-SNAPSHOT)</version> <version>[1.0.0,)</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>com.google.gwt</groupId> <groupId>com.google.gwt</groupId>
@ -188,24 +177,10 @@
<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>[0.0.1, 2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<dependency> <dependency>
@ -227,23 +202,23 @@
<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>
<artifactId>workspace-uploader</artifactId> <artifactId>workspace-uploader</artifactId>
<version>[2.0.0, 3.0.0-SNAPSHOT)</version> <version>[1.0.0, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>storagehub-client-wrapper</artifactId> <artifactId>storagehub-client-wrapper</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version> <version>[0.6.2, 1.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
@ -266,7 +241,6 @@
<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>
@ -275,22 +249,9 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.portal</groupId>
<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> <groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId> <artifactId>social-networking-library</artifactId>
</exclusion> <scope>provided</scope>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.applicationsupportlayer</groupId> <groupId>org.gcube.applicationsupportlayer</groupId>
@ -302,14 +263,8 @@
<dependency> <dependency>
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId> <artifactId>ckan-metadata-publisher-widget</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version> <version>[1.0.0,2.0.0-SNAPSHOT)</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 -->

View File

@ -118,6 +118,7 @@ import org.gcube.portlets.user.workspace.client.view.tree.AsyncTreePanel;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart; import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart.AddType; import org.gcube.portlets.user.workspace.client.view.windows.DialogAddFolderAndSmart.AddType;
import org.gcube.portlets.user.workspace.client.view.windows.DialogAddUrl; import org.gcube.portlets.user.workspace.client.view.windows.DialogAddUrl;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink; import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink;
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink.Link_Type; import org.gcube.portlets.user.workspace.client.view.windows.DialogGetLink.Link_Type;
import org.gcube.portlets.user.workspace.client.view.windows.DialogShareLink; import org.gcube.portlets.user.workspace.client.view.windows.DialogShareLink;
@ -174,7 +175,6 @@ import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.event.HideEvent; import com.github.gwtbootstrap.client.ui.event.HideEvent;
import com.github.gwtbootstrap.client.ui.event.HideHandler; import com.github.gwtbootstrap.client.ui.event.HideHandler;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.RequestBuilder;
@ -210,8 +210,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
public static final int delayTime = 3000; public static final int delayTime = 3000;
public static Map<String, List<String>> mapOfAllowedMimeTypesForPreview = null;
/** /**
* Instantiates a new app controller explorer. * Instantiates a new app controller explorer.
*/ */
@ -312,7 +310,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
modal.setTitle("Publish Item"); modal.setTitle("Publish Item");
modal.addStyleName("insert-metadata-modal-style"); modal.addStyleName("insert-metadata-modal-style");
modal.addStyleName("modal-top-custom"); modal.addStyleName("modal-top-custom");
((Element)modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-ws-tree "); // ((Element)modal.getElement().getChildNodes().getItem(1)).addClassName("modal-body-custom");
modal.add(new CreateDatasetForm(folderId, eventBus)); modal.add(new CreateDatasetForm(folderId, eventBus));
modal.setCloseVisible(true); modal.setCloseVisible(true);
modal.show(); modal.show();
@ -692,35 +690,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onGetInfo(GetInfoEvent getInfoEvent) { public void onGetInfo(GetInfoEvent getInfoEvent) {
//new DialogGetInfo(getInfoEvent.getSourceFile()); new DialogGetInfo(getInfoEvent.getSourceFile());
//new DialogInfoboot(getInfoEvent.getSourceFile());
final FileModel fileItem = getInfoEvent.getSourceFile();
if(fileItem!=null) {
/*final Modal modal = new Modal(true);
modal.setCloseVisible(true);
modal.setTitle(fileItem.getName() + " - Details");
modal.setMaxHeigth("800px");
ModalFooter modalFooter = new ModalFooter();
final Button buttClose = new Button("Close");
modalFooter.add(buttClose);
buttClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modal.hide();
}
});
DialogGetInfoBootstrap dlg = new DialogGetInfoBootstrap(fileItem);
modal.add(dlg);
modal.add(modalFooter);
modal.show();*/
notifySubscriber(new GetInfoEvent(fileItem));
}
} }
}); });
@ -2131,9 +2102,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} else if (event instanceof LoadFolderEvent) { } else if (event instanceof LoadFolderEvent) {
LoadFolderEvent loadFolderEvent = (LoadFolderEvent) event; LoadFolderEvent loadFolderEvent = (LoadFolderEvent) event;
sub.loadFolder(loadFolderEvent.getTargetFolder()); sub.loadFolder(loadFolderEvent.getTargetFolder());
} else if (event instanceof GetInfoEvent) {
GetInfoEvent getInfoEvent = (GetInfoEvent) event;
sub.showDetails(getInfoEvent.getSourceFile(), mapOfAllowedMimeTypesForPreview);
} }
} }
@ -2329,7 +2297,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
this.explorerPanel = new ExplorerPanel(true, true); this.explorerPanel = new ExplorerPanel(true, true);
loadMyLogin(); loadMyLogin();
loadMyFirstName(); loadMyFirstName();
loadAllowedMimeTypesForPreview();
return this.explorerPanel; return this.explorerPanel;
} }
@ -2351,12 +2318,9 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
this.selectRootItem = selectRootItem; this.selectRootItem = selectRootItem;
loadMyLogin(); loadMyLogin();
loadMyFirstName(); loadMyFirstName();
loadAllowedMimeTypesForPreview();
return this.explorerPanel; return this.explorerPanel;
} }
/** /**
* Edi permissions. * Edi permissions.
* *
@ -2641,22 +2605,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}); });
} }
private void loadAllowedMimeTypesForPreview() {
rpcWorkspaceService.getAllowedMimetypesForPreview(new AsyncCallback<Map<String,List<String>>>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(Map<String, List<String>> result) {
mapOfAllowedMimeTypesForPreview = result;
}
});
}
/** /**
* Load my first name. * Load my first name.
*/ */

View File

@ -4,6 +4,7 @@ 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;
@ -216,7 +217,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";

View File

@ -1,7 +1,5 @@
package org.gcube.portlets.user.workspace.client.event; package org.gcube.portlets.user.workspace.client.event;
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
import org.gcube.portlets.user.workspace.client.model.FileModel; import org.gcube.portlets.user.workspace.client.model.FileModel;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
@ -11,7 +9,7 @@ import com.google.gwt.event.shared.GwtEvent;
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* *
*/ */
public class GetInfoEvent extends GwtEvent<GetInfoEventHandler> implements GuiEventInterface{ public class GetInfoEvent extends GwtEvent<GetInfoEventHandler> {
public static Type<GetInfoEventHandler> TYPE = new Type<GetInfoEventHandler>(); public static Type<GetInfoEventHandler> TYPE = new Type<GetInfoEventHandler>();
private FileModel targetFile = null; private FileModel targetFile = null;
@ -34,9 +32,4 @@ public class GetInfoEvent extends GwtEvent<GetInfoEventHandler> implements GuiEv
public FileModel getSourceFile() { public FileModel getSourceFile() {
return targetFile; return targetFile;
} }
@Override
public EventsTypeEnum getKey() {
return EventsTypeEnum.GET_DETAILS_FOR_ITEM;
}
} }

View File

@ -35,6 +35,5 @@ public enum EventsTypeEnum
UPDATE_WORKSPACE_SIZE, UPDATE_WORKSPACE_SIZE,
ADD_ADMINISTRATOR_EVENT, ADD_ADMINISTRATOR_EVENT,
FILE_VERSIONING_HISTORY_EVENT, FILE_VERSIONING_HISTORY_EVENT,
GET_DETAILS_FOR_ITEM,
LOAD_FOLDER_EVENT; LOAD_FOLDER_EVENT;
} }

View File

@ -2,7 +2,6 @@ package org.gcube.portlets.user.workspace.client.interfaces;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType; import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE; import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE;
@ -11,7 +10,6 @@ import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation; import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
// TODO: Auto-generated Javadoc
// Implements this interface to receive events by tree async // Implements this interface to receive events by tree async
/** /**
* The Interface SubscriberInterface. * The Interface SubscriberInterface.
@ -199,15 +197,4 @@ public interface SubscriberInterface {
*/ */
void loadFolder(FileModel folderTarget); void loadFolder(FileModel folderTarget);
/**
* Show details.
*
* @param fileModel the file model
* @param mapAllowedMimeTypesForPreview the map allowed mime types for preview
*/
void showDetails(FileModel fileModel, Map<String,List<String>> mapAllowedMimeTypesForPreview);
} }

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.workspace.client.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer; import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder; import org.gcube.portlets.user.workspace.client.interfaces.GXTCategorySmartFolder;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum; import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
@ -15,7 +16,8 @@ import com.google.gwt.user.client.rpc.IsSerializable;
import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.Image;
// TODO: Auto-generated Javadoc
/** /**
* The Class FileModel. * The Class FileModel.
* *
@ -53,8 +55,8 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
public static final String OWNERFULLNAME = "Owner Name"; public static final String OWNERFULLNAME = "Owner Name";
public static final String HUMAN_REDABLE_CATEGORY = "HR Category"; public static final String HUMAN_REDABLE_CATEGORY = "HR Category";
// Synched with thredds //Thredds Synch status
private Boolean synchedWithWsThredds = null; private Sync_Status synchedThreddsStatus;
/** /**
* Instantiates a new file model. * Instantiates a new file model.
@ -152,8 +154,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
* @param isDirectory the is directory * @param isDirectory the is directory
* @param isShared the is shared * @param isShared the is shared
*/ */
public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, public FileModel(String identifier, String name, String type, GXTFolderItemTypeEnum folderItemTypeEnum, boolean isDirectory, boolean isShared) {
boolean isDirectory, boolean isShared) {
setIdentifier(identifier); setIdentifier(identifier);
setName(name); setName(name);
setType(type); setType(type);
@ -172,8 +173,10 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
set(PARENT,parent); set(PARENT,parent);
} }
/** /**
* Status values ConstantsExplorer.FOLDERNOTLOAD = "notload"; * Status values
* ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded"; * ConstantsExplorer.FOLDERLOADED = "loaded";
* *
* @param status the new status * @param status the new status
@ -276,6 +279,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
this.isRoot = isRoot; this.isRoot = isRoot;
} }
/** /**
* Gets the icon. * Gets the icon.
* *
@ -304,9 +308,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
}else if(this.isShared()){ //IS A SHARED FOLDER? }else if(this.isShared()){ //IS A SHARED FOLDER?
// GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ", //GWT.log("setting icon "+this.getName()+" is shared: "+this.isShared() + ", this.isVreFolder() "+this.isVreFolder() +", this.isShareable() "+this.isShareable());
// this.isVreFolder() "+this.isVreFolder() +", this.isShareable()
// "+this.isShareable());
if(this.isVreFolder()) if(this.isVreFolder())
absImgPr = Resources.getIconVREFolder(); absImgPr = Resources.getIconVREFolder();
@ -320,8 +322,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
if(this.isPublic()) //IS PLUBIC if(this.isPublic()) //IS PLUBIC
absImgPr = Resources.getIconFolderPublic(); absImgPr = Resources.getIconFolderPublic();
else else
absImgPr = Resources.getIconSharedFolder(); // IS A SHARED FOLDER DESCENDANT OF ROOT SHARED absImgPr = Resources.getIconSharedFolder(); //IS A SHARED FOLDER DESCENDANT OF ROOT SHARED FOLDER
// FOLDER
} }
} }
@ -330,18 +331,26 @@ 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 {
Boolean isSynched = this.getSynchedWithWsThredds(); if(this.getSynchedThreddsStatus()!=null) {
if (isSynched != null && isSynched) { switch(this.getSynchedThreddsStatus()) {
absImgPr = Resources.getIconSynchedFolder(); case OUTDATED_REMOTE:
} else { absImgPr = Resources.getIconSyncTo();
absImgPr = Resources.getIconFolder(); break;
case OUTDATED_WS:
absImgPr = Resources.getIconSyncFrom();
break;
case UP_TO_DATE:
absImgPr = Resources.getIconSynched();
break;
} }
}else
absImgPr = Resources.getIconFolder();
} }
} }
} }
@ -349,6 +358,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return absImgPr; return absImgPr;
} }
/** /**
* Gets the status. * Gets the status.
* *
@ -358,6 +368,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return get("status"); return get("status");
} }
/** /**
* Sets the checks if is directory. * Sets the checks if is directory.
* *
@ -396,6 +407,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
set(HUMAN_REDABLE_CATEGORY, smfDocuments.getValue()); set(HUMAN_REDABLE_CATEGORY, smfDocuments.getValue());
} }
/** /**
* Gets the shortcut category. * Gets the shortcut category.
* *
@ -405,6 +417,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return (GXTCategorySmartFolder) get(SHORTCUTCATEGORY); return (GXTCategorySmartFolder) get(SHORTCUTCATEGORY);
} }
/** /**
* Sets the name. * Sets the name.
* *
@ -444,9 +457,7 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return false; return false;
} }
/* /* (non-Javadoc)
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object) * @see java.lang.Object#equals(java.lang.Object)
*/ */
/** /**
@ -564,27 +575,17 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return isPublic; return isPublic;
} }
/** public void setSyncThreddsStatus(Sync_Status status) {
* Sets the synched with ws thredds. this.synchedThreddsStatus = status;
*
* @param bool the new synched with ws thredds
*/
public void setSynchedWithWsThredds(Boolean bool) {
this.synchedWithWsThredds = bool;
} }
/** public Sync_Status getSynchedThreddsStatus() {
* Gets the synched with ws thredds. return synchedThreddsStatus;
*
* @return the synched with ws thredds
*/
public Boolean getSynchedWithWsThredds() {
return synchedWithWsThredds;
} }
/*
* (non-Javadoc)
* /* (non-Javadoc)
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
/** /**
@ -619,4 +620,5 @@ public class FileModel extends BaseModelData implements Serializable, IsSerializ
return builder.toString(); return builder.toString();
} }
} }

View File

@ -412,23 +412,13 @@ public interface Icons extends ClientBundle {
@Source("icons/sync-icon-to.png") @Source("icons/sync-icon-to.png")
ImageResource syncIconTo(); ImageResource syncIconTo();
@Source("icons/folder_sync.png") @Source("icons/sync-icon-from.png")
ImageResource synchedFolder(); ImageResource syncIconFrom();
// @Source("icons/sync-icon-from.png") @Source("icons/sync-icon-synched.png")
// ImageResource syncIconFrom(); ImageResource syncIconSynched();
//
// @Source("icons/sync-icon-synched.png")
// ImageResource syncIconSynched();
@Source("icons/no-preview-available.png")
ImageResource previewNotAvailable();
@Source("icons/no-preview-available-no-border.png")
ImageResource previewNotAvailableNoBorder();
@Source("icons/spinner2.gif")
ImageResource spinner();
} }

View File

@ -7,7 +7,6 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ImageResource; import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.AbstractImagePrototype;
// TODO: Auto-generated Javadoc
/** /**
* The Class Resources. * The Class Resources.
* *
@ -80,6 +79,8 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.TXT()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.TXT());
} }
/** /**
* Gets the data catalogue publish. * Gets the data catalogue publish.
* *
@ -100,6 +101,7 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.switchboard()); return AbstractImagePrototype.create(ICONS.switchboard());
} }
/** /**
* Gets the icon postscript. * Gets the icon postscript.
* *
@ -120,6 +122,8 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.dvi()); return AbstractImagePrototype.create(ICONS.dvi());
} }
/** /**
* Gets the icon folder shared public. * Gets the icon folder shared public.
* *
@ -130,6 +134,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.FOLDER_LINK()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.FOLDER_LINK());
} }
/** /**
* Gets the icon information. * Gets the icon information.
* *
@ -148,6 +153,8 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.SCRIPT()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.SCRIPT());
} }
/** /**
* Gets the icon information. * Gets the icon information.
* *
@ -166,6 +173,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.ARCHIVE()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.ARCHIVE());
} }
/** /**
* Gets the icon odp. * Gets the icon odp.
* *
@ -184,6 +192,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.DOC()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.DOC());
} }
/** /**
* Gets the icon odp. * Gets the icon odp.
* *
@ -193,6 +202,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.DOC()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.DOC());
} }
/** /**
* Gets the icon folder link. * Gets the icon folder link.
* *
@ -202,6 +212,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.FOLDER_LINK()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.FOLDER_LINK());
} }
/** /**
* Gets the icon odp. * Gets the icon odp.
* *
@ -251,6 +262,7 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.undo()); return AbstractImagePrototype.create(ICONS.undo());
} }
/** /**
* Gets the icon archive. * Gets the icon archive.
* *
@ -454,15 +466,6 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.notread()); return AbstractImagePrototype.create(ICONS.notread());
} }
/**
* Gets the icon not read.
*
* @return the icon not read
*/
public static AbstractImagePrototype getSpinner() {
return AbstractImagePrototype.create(ICONS.spinner());
}
/** /**
* Gets the close icon. * Gets the close icon.
@ -543,7 +546,6 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.XML()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.XML());
} }
/** /**
* Gets the icon permissions. * Gets the icon permissions.
* *
@ -552,7 +554,6 @@ public class Resources {
public static AbstractImagePrototype getIconCalendar() { public static AbstractImagePrototype getIconCalendar() {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.CALENDAR()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.CALENDAR());
} }
/** /**
* Gets the icon html. * Gets the icon html.
* *
@ -794,6 +795,7 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.search()); return AbstractImagePrototype.create(ICONS.search());
} }
/** /**
* Gets the icon search ws. * Gets the icon search ws.
* *
@ -804,6 +806,7 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.search2()); return AbstractImagePrototype.create(ICONS.search2());
} }
/** /**
* Gets the icon links. * Gets the icon links.
* *
@ -957,7 +960,6 @@ public class Resources {
public static AbstractImagePrototype getIconCheckUser() { public static AbstractImagePrototype getIconCheckUser() {
return AbstractImagePrototype.create(ICONS.checkUser()); return AbstractImagePrototype.create(ICONS.checkUser());
} }
/** /**
* Gets the icon hand. * Gets the icon hand.
* *
@ -975,7 +977,6 @@ public class Resources {
public static AbstractImagePrototype getIconSaveAttachments() { public static AbstractImagePrototype getIconSaveAttachments() {
return AbstractImagePrototype.create(ICONS.saveAttachs()); return AbstractImagePrototype.create(ICONS.saveAttachs());
} }
/** /**
* Gets the icon copy. * Gets the icon copy.
* *
@ -1066,6 +1067,7 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.removeFilter()); return AbstractImagePrototype.create(ICONS.removeFilter());
} }
/** /**
* Gets the icon public link. * Gets the icon public link.
* *
@ -1075,6 +1077,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.PUBLIC_LINK()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.PUBLIC_LINK());
} }
/** /**
* Gets the icon versioning. * Gets the icon versioning.
* *
@ -1084,6 +1087,9 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.VERSIONS()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.VERSIONS());
} }
/** /**
* Gets the icon web dav. * Gets the icon web dav.
* *
@ -1210,6 +1216,7 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.folderPublicRemove()); return AbstractImagePrototype.create(ICONS.folderPublicRemove());
} }
/** /**
* Gets the icon add administrator. * Gets the icon add administrator.
* *
@ -1228,6 +1235,8 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.manageAdmin()); return AbstractImagePrototype.create(ICONS.manageAdmin());
} }
/** /**
* Gets the icon thredds publish. * Gets the icon thredds publish.
* *
@ -1238,22 +1247,18 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.thredds()); return AbstractImagePrototype.create(ICONS.thredds());
} }
/**
* Gets the icon sync to.
*
* @return the icon sync to
*/
public static AbstractImagePrototype getIconSyncTo() { public static AbstractImagePrototype getIconSyncTo() {
return AbstractImagePrototype.create(ICONS.syncIconTo()); return AbstractImagePrototype.create(ICONS.syncIconTo());
} }
/** public static AbstractImagePrototype getIconSyncFrom() {
* Gets the icon synched folder. return AbstractImagePrototype.create(ICONS.syncIconFrom());
* }
* @return the icon synched folder
*/
public static AbstractImagePrototype getIconSynchedFolder() { public static AbstractImagePrototype getIconSynched() {
return AbstractImagePrototype.create(ICONS.synchedFolder()); return AbstractImagePrototype.create(ICONS.syncIconSynched());
} }
/** /**
@ -1265,6 +1270,7 @@ public class Resources {
return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.move24()); return AbstractImagePrototype.create(StorageHubIconResources.INSTANCE.move24());
} }
//ImageResources //ImageResources
/** /**
* Gets the image path separator. * Gets the image path separator.
@ -1320,6 +1326,7 @@ public class Resources {
return ICONS.cancel(); return ICONS.cancel();
} }
/** /**
* Gets the image delete. * Gets the image delete.
* *
@ -1338,24 +1345,6 @@ public class Resources {
return ICONS.attach(); return ICONS.attach();
} }
/**
* Gets the preview not available.
*
* @return the preview not available
*/
public static ImageResource getPreviewNotAvailable() {
return ICONS.previewNotAvailable();
}
/**
* Gets the preview not available.
*
* @return the preview not available
*/
public static ImageResource getPreviewNotAvailableNoBorder() {
return ICONS.previewNotAvailableNoBorder();
}
/** /**
* Gets the icon by media type name. * Gets the icon by media type name.
* *
@ -1365,8 +1354,7 @@ public class Resources {
*/ */
public static AbstractImagePrototype getIconByMediaTypeName(String name, String mediaTypeName) { public static AbstractImagePrototype getIconByMediaTypeName(String name, String mediaTypeName) {
if (MPEG.equals(mediaTypeName) || SWF.equals(mediaTypeName) || FLV.equals(mediaTypeName) if (MPEG.equals(mediaTypeName) || SWF.equals(mediaTypeName) || FLV.equals(mediaTypeName) || AVI.equals(mediaTypeName)) {
|| AVI.equals(mediaTypeName)) {
return Resources.getIconMovie(); return Resources.getIconMovie();
} else if (JPEG.equals(mediaTypeName) || JPG.equals(mediaTypeName)) { } else if (JPEG.equals(mediaTypeName) || JPG.equals(mediaTypeName)) {
return Resources.getIconJpeg(); return Resources.getIconJpeg();
@ -1476,6 +1464,7 @@ public class Resources {
return Resources.getIconTxt(); return Resources.getIconTxt();
} }
/** /**
* Gets the icon by type. * Gets the icon by type.
* *
@ -1491,6 +1480,8 @@ public class Resources {
return Resources.getIconByMediaTypeName(name, mediaTypeName); return Resources.getIconByMediaTypeName(name, mediaTypeName);
} }
/** /**
* Gets the icon by folder enum. * Gets the icon by folder enum.
* *
@ -1512,4 +1503,10 @@ public class Resources {
return null; return null;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -28,7 +28,6 @@ import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingField;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
// TODO: Auto-generated Javadoc
/** /**
* The Interface GWTWorkspaceService. * The Interface GWTWorkspaceService.
* *
@ -677,22 +676,4 @@ public interface GWTWorkspaceService extends RemoteService {
*/ */
FileModel getItemForFileTree(String itemId) throws Exception; FileModel getItemForFileTree(String itemId) throws Exception;
/**
* Update description for item.
*
* @param itemId the item id
* @param newDescription the new description
* @return the description updated on the server
* @throws Exception the exception
*/
String updateDescriptionForItem(String itemId, String newDescription) throws Exception;
/**
* Gets the allowed mimetypes for preview.
*
* @return the allowed mimetypes for preview
*/
Map<String, List<String>> getAllowedMimetypesForPreview();
} }

View File

@ -613,23 +613,4 @@ public interface GWTWorkspaceServiceAsync {
*/ */
void getLinkForSendToSwitchBoard(String itemId, AsyncCallback<String> callback); void getLinkForSendToSwitchBoard(String itemId, AsyncCallback<String> callback);
/**
* Update description for item.
*
* @param itemId the item id
* @param newDescription the new description
* @param callback the callback
*/
void updateDescriptionForItem(String itemId, String newDescription, AsyncCallback<String> callback);
/**
* Gets the allowed mimetypes for preview.
*
* @return the allowed mimetypes for preview
*/
void getAllowedMimetypesForPreview(AsyncCallback<Map<String, List<String>>> callback);
} }

View File

@ -1,42 +0,0 @@
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];
}
}

View File

@ -65,6 +65,7 @@ public class AsyncTreePanel extends LayoutContainer {
private static final String ROOT_SUFFIX = "'s workspace"; private static final String ROOT_SUFFIX = "'s workspace";
private String myRootDisplayName = null; private String myRootDisplayName = null;
// private TreeLoader<FileModel> loader;
private TreePanel<FileModel> treePanel; private TreePanel<FileModel> treePanel;
private TreeStore<FileModel> store; private TreeStore<FileModel> store;
private ContextMenuTree contextMenuTree; private ContextMenuTree contextMenuTree;
@ -72,6 +73,7 @@ public class AsyncTreePanel extends LayoutContainer {
private ContentPanel cp = new ContentPanel(); private ContentPanel cp = new ContentPanel();
private boolean isSubTreeLoaded = false; private boolean isSubTreeLoaded = false;
private boolean isSearch = false; private boolean isSearch = false;
//private String scopeId = null;
/** /**
* The Enum DragType. * The Enum DragType.
@ -79,10 +81,7 @@ public class AsyncTreePanel extends LayoutContainer {
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Aug 29, 2016 * Aug 29, 2016
*/ */
private enum DragType { private enum DragType {INSERT, APPEND};
INSERT, APPEND
};
private boolean rightClick = false; private boolean rightClick = false;
/** /**
@ -141,6 +140,7 @@ public class AsyncTreePanel extends LayoutContainer {
} }
}; };
treePanel.setStateful(false); treePanel.setStateful(false);
treePanel.setDisplayProperty(FileModel.NAME); treePanel.setDisplayProperty(FileModel.NAME);
@ -163,10 +163,8 @@ public class AsyncTreePanel extends LayoutContainer {
if (model.isRoot()) { //IS ROOT? if (model.isRoot()) { //IS ROOT?
//ConstantsExplorer.log("getIcon isRoot Model is: "+model); //ConstantsExplorer.log("getIcon isRoot Model is: "+model);
if (AppControllerExplorer.myLoginFirstName == null if(AppControllerExplorer.myLoginFirstName==null || AppControllerExplorer.myLoginFirstName.isEmpty()){
|| AppControllerExplorer.myLoginFirstName.isEmpty()) { ConstantsExplorer.log("Getting My First Name from server, into myLoginFirstName call is null yet");
ConstantsExplorer
.log("Getting My First Name from server, into myLoginFirstName call is null yet");
AppControllerExplorer.rpcWorkspaceService.getMyFirstName(new AsyncCallback<String>() { AppControllerExplorer.rpcWorkspaceService.getMyFirstName(new AsyncCallback<String>() {
@Override @Override
@ -181,8 +179,7 @@ public class AsyncTreePanel extends LayoutContainer {
if(firstName==null || firstName.isEmpty()) if(firstName==null || firstName.isEmpty())
model.setName("My Workspace"); model.setName("My Workspace");
else else
setRootDisplayName(model, AppControllerExplorer.myLoginFirstName + ROOT_SUFFIX, setRootDisplayName(model, AppControllerExplorer.myLoginFirstName+ROOT_SUFFIX, true);
true);
} }
}); });
}else{ }else{
@ -221,9 +218,14 @@ public class AsyncTreePanel extends LayoutContainer {
if(model.isPublic()) //IS PLUBIC if(model.isPublic()) //IS PLUBIC
return Resources.getIconFolderPublic(); return Resources.getIconFolderPublic();
else{ else{
if (model.getSynchedWithWsThredds() != null) { if(model.getSynchedThreddsStatus()!=null) {
if (model.getSynchedWithWsThredds()) { switch(model.getSynchedThreddsStatus()) {
return Resources.getIconSynchedFolder(); case OUTDATED_REMOTE:
return Resources.getIconSyncTo();
case OUTDATED_WS:
return Resources.getIconSyncFrom();
case UP_TO_DATE:
return Resources.getIconSynched();
} }
} }
return Resources.getIconFolder(); return Resources.getIconFolder();
@ -270,8 +272,7 @@ public class AsyncTreePanel extends LayoutContainer {
System.out.println("\n\nStore by root"); System.out.println("\n\nStore by root");
for (FileModel item : listFileModel) { for (FileModel item : listFileModel) {
System.out.println( System.out.println(item.getName() + " ID " + item.getIdentifier() + " isDirectory " + item.isDirectory());
item.getName() + " ID " + item.getIdentifier() + " isDirectory " + item.isDirectory());
// eventBus.fireEvent(new SelectedItemEvent(treePanel.getStore().getRootItems().get(0))); // eventBus.fireEvent(new SelectedItemEvent(treePanel.getStore().getRootItems().get(0)));
printingTreeLevel(item); printingTreeLevel(item);
@ -279,12 +280,18 @@ public class AsyncTreePanel extends LayoutContainer {
} }
}); });
// cp.add(butt); // cp.add(butt);
//***End Debug the store //***End Debug the store
cp.add(treePanel); cp.add(treePanel);
add(cp); add(cp);
} }
/** /**
* Sets the root display name. * Sets the root display name.
* *
@ -300,7 +307,8 @@ public class AsyncTreePanel extends LayoutContainer {
} }
/** /**
* Status values ConstantsExplorer.FOLDERNOTLOAD = "notload"; * Status values
* ConstantsExplorer.FOLDERNOTLOAD = "notload";
* ConstantsExplorer.FOLDERLOADED = "loaded"; * ConstantsExplorer.FOLDERLOADED = "loaded";
* *
* @param itemIdentifier the item identifier * @param itemIdentifier the item identifier
@ -313,19 +321,24 @@ public class AsyncTreePanel extends LayoutContainer {
fileModel.setStatus(status); fileModel.setStatus(status);
} }
/** /**
* Load root item. * Load root item.
* *
* @param selectRoot the select root * @param selectRoot the select root
*/ */
public void loadRootItem(final boolean selectRoot){ public void loadRootItem(final boolean selectRoot){
//this.scopeId = scopeId;
System.out.println("***Start Root load");
//Load Root without filtering on scope id //Load Root without filtering on scope id
AppControllerExplorer.rpcWorkspaceService.getRootForTree(new AsyncCallback<FolderModel>() { AppControllerExplorer.rpcWorkspaceService.getRootForTree(new AsyncCallback<FolderModel>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
new MessageBoxAlert("Error", new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting root item. " +ConstantsExplorer.TRY_AGAIN, null);
ConstantsExplorer.SERVER_ERROR + " getting root item. " + ConstantsExplorer.TRY_AGAIN, null);
} }
@ -336,6 +349,7 @@ public class AsyncTreePanel extends LayoutContainer {
}); });
} }
/** /**
* Load root in store. * Load root in store.
* *
@ -353,9 +367,9 @@ public class AsyncTreePanel extends LayoutContainer {
selectRootItem(); //select root item selectRootItem(); //select root item
System.out.println("***End Root load "); System.out.println("***End Root load ");
} else }
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting root item. Root item is null " else
+ ConstantsExplorer.TRY_AGAIN, null); new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting root item. Root item is null " +ConstantsExplorer.TRY_AGAIN, null);
} }
@ -392,6 +406,7 @@ public class AsyncTreePanel extends LayoutContainer {
} }
}); });
TreePanelDropTarget targetTreePanel = new TreePanelDropTarget(treePanel){ TreePanelDropTarget targetTreePanel = new TreePanelDropTarget(treePanel){
// @Override // @Override
// protected void onDragDrop(DNDEvent event) { // protected void onDragDrop(DNDEvent event) {
@ -434,8 +449,7 @@ public class AsyncTreePanel extends LayoutContainer {
for (FileModel model : selection) { for (FileModel model : selection) {
// check the "model" against "zone" and return false // check the "model" against "zone" and return false
// if "zone" is not a valid drop target for "model", otherwise check the next // if "zone" is not a valid drop target for "model", otherwise check the next "model"
// "model"
// example: // example:
if (source.getStore().getParent(model) == zone.getModel()) if (source.getStore().getParent(model) == zone.getModel())
return false; return false;
@ -480,8 +494,7 @@ public class AsyncTreePanel extends LayoutContainer {
FileModel destination = getDragDestination(item, DragType.APPEND); FileModel destination = getDragDestination(item, DragType.APPEND);
if(destination != null){ if(destination != null){
//REMOVE THIS COMMENT TODO //REMOVE THIS COMMENT TODO
eventBus.fireEvent( eventBus.fireEvent(new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
GWT.log("Destination: " +destination.getName() + " id "+ destination.getIdentifier()); GWT.log("Destination: " +destination.getName() + " id "+ destination.getIdentifier());
} }
}else{ }else{
@ -509,8 +522,7 @@ public class AsyncTreePanel extends LayoutContainer {
if(destination != null){ if(destination != null){
GWT.log("Destination: " +destination.getName() + " id "+ destination.getIdentifier()); GWT.log("Destination: " +destination.getName() + " id "+ destination.getIdentifier());
//REMOVE THIS COMMENT TODO //REMOVE THIS COMMENT TODO
eventBus.fireEvent( eventBus.fireEvent(new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
new DragOnTreeMoveItemEvent(listFileModel.get(0), (FolderModel) destination));
} }
}else{ }else{
//multi drag //multi drag
@ -547,13 +559,9 @@ public class AsyncTreePanel extends LayoutContainer {
listDraggedFile.add((FileModel) itemSource.getModel()); listDraggedFile.add((FileModel) itemSource.getModel());
sourceFileModel = (FileModel) itemSource.getModel(); sourceFileModel = (FileModel) itemSource.getModel();
if(sourceFileModel.getParentFileModel()!=null) if(sourceFileModel.getParentFileModel()!=null)
GWT.log("Source Name " + sourceFileModel.getName() + " id " GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag " + " Parent Name: " + sourceFileModel.getParentFileModel().getName() + "id " + sourceFileModel.getParentFileModel().getIdentifier());
+ sourceFileModel.getIdentifier() + " end drag " + " Parent Name: "
+ sourceFileModel.getParentFileModel().getName() + "id "
+ sourceFileModel.getParentFileModel().getIdentifier());
else else
GWT.log("Source Name " + sourceFileModel.getName() + " id " GWT.log("Source Name " + sourceFileModel.getName() + " id " + sourceFileModel.getIdentifier() + " end drag ");
+ sourceFileModel.getIdentifier() + " end drag ");
GWT.log("Child count: " + itemSource.getChildCount()); GWT.log("Child count: " + itemSource.getChildCount());
} }
@ -574,6 +582,7 @@ public class AsyncTreePanel extends LayoutContainer {
// targetTreePanel.setAllowDropOnLeaf(true); // targetTreePanel.setAllowDropOnLeaf(true);
} }
/** /**
* Adds the listners. * Adds the listners.
*/ */
@ -621,6 +630,7 @@ public class AsyncTreePanel extends LayoutContainer {
} }
System.out.println("***End Event selection change"); System.out.println("***End Event selection change");
} }
@ -660,6 +670,7 @@ public class AsyncTreePanel extends LayoutContainer {
} }
}); });
treePanel.addListener(Events.BeforeExpand, new Listener<TreePanelEvent<ModelData>>() { treePanel.addListener(Events.BeforeExpand, new Listener<TreePanelEvent<ModelData>>() {
public void handleEvent(final TreePanelEvent<ModelData> be) { public void handleEvent(final TreePanelEvent<ModelData> be) {
@ -707,22 +718,24 @@ public class AsyncTreePanel extends LayoutContainer {
// //
} }
}); });
} }
/** /**
* Manage context menu. * Manage context menu.
*/ */
private void manageContextMenu(){ private void manageContextMenu(){
contextMenuTree.setListSelectedItems(treePanel.getSelectionModel().getSelectedItems()); // Set items list contextMenuTree.setListSelectedItems(treePanel.getSelectionModel().getSelectedItems()); //Set items list selected in context menu tree
// selected in context
// menu tree
List<FileModel> selectedItems = treePanel.getSelectionModel().getSelectedItems(); List<FileModel> selectedItems = treePanel.getSelectionModel().getSelectedItems();
contextMenuTree.viewContextMenu(selectedItems,-1,-1); contextMenuTree.viewContextMenu(selectedItems,-1,-1);
} }
/** /**
* Reload tree level and expand folder. * Reload tree level and expand folder.
* *
@ -757,9 +770,7 @@ public class AsyncTreePanel extends LayoutContainer {
return; return;
} }
treePanel.unmask(); treePanel.unmask();
new MessageBoxAlert("Error", new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting item from workspace." +ConstantsExplorer.TRY_AGAIN, null);
ConstantsExplorer.SERVER_ERROR + " getting item from workspace." + ConstantsExplorer.TRY_AGAIN,
null);
removeAllAndRecoveryRoot(); removeAllAndRecoveryRoot();
} }
@ -792,8 +803,7 @@ public class AsyncTreePanel extends LayoutContainer {
return; return;
} }
treePanel.unmask(); treePanel.unmask();
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items." new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items." +ConstantsExplorer.TRY_AGAIN, null);
+ ConstantsExplorer.TRY_AGAIN, null);
removeAllAndRecoveryRoot(); removeAllAndRecoveryRoot();
} }
@ -832,8 +842,7 @@ public class AsyncTreePanel extends LayoutContainer {
return; return;
} }
new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items. " new MessageBoxAlert("Error", ConstantsExplorer.SERVER_ERROR + " getting folder children items. " +ConstantsExplorer.TRY_AGAIN, null);
+ ConstantsExplorer.TRY_AGAIN, null);
removeAllAndRecoveryRoot(); removeAllAndRecoveryRoot();
} }
@ -893,6 +902,15 @@ public class AsyncTreePanel extends LayoutContainer {
} }
// /**
// * Sets the visibile get web dav url.
// *
// * @param bool the new visibile get web dav url
// */
// private void setVisibileGetWebDavUrl(boolean bool){
// treePanel.getContextMenu().getItemByItemId(WorkspaceOperation.WEBDAV_URL.getId()).setVisible(bool);
// }
/** /**
* Sets the alphanumeric store sorter. * Sets the alphanumeric store sorter.
*/ */
@ -922,20 +940,25 @@ public class AsyncTreePanel extends LayoutContainer {
}); });
} }
// for debugging //TODO for debug
/** /**
* Printing tree level. * Printing tree level.
* *
* @param item the item * @param item the item
*/ */
private void printingTreeLevel(FileModel item){ private void printingTreeLevel(FileModel item){
List<FileModel> children = treePanel.getStore().getChildren(item); List<FileModel> children = treePanel.getStore().getChildren(item);
if (children != null) { if (children != null) {
for (FileModel item2 : children) { for (FileModel item2 : children) {
System.out.println(" " + item2.getName() + " ID " + item2.getIdentifier() + " isDirectory "
+ item.isDirectory()); System.out.println(" " + item2.getName() + " ID " + item2.getIdentifier() + " isDirectory " + item.isDirectory());
printingTreeLevel(item2); printingTreeLevel(item2);
} }
System.out.println(" "); System.out.println(" ");
} }
} }
@ -974,6 +997,7 @@ public class AsyncTreePanel extends LayoutContainer {
return store.getChildCount(folder); return store.getChildCount(folder);
} }
/** /**
* Delete item. * Delete item.
* *
@ -986,12 +1010,14 @@ public class AsyncTreePanel extends LayoutContainer {
if(fileTarget!=null){ if(fileTarget!=null){
return deleteItem(fileTarget); return deleteItem(fileTarget);
} else }
else
System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" ); System.out.println("Delete Error: file target with " + identifier + " identifier not exist in store" );
return false; return false;
} }
/** /**
* Rename item. * Rename item.
* *
@ -1011,15 +1037,17 @@ public class AsyncTreePanel extends LayoutContainer {
record.set(FileModel.NAME, newName); record.set(FileModel.NAME, newName);
return true; return true;
} else }
System.out.println("Record Error: file target with " + fileTarget.getIdentifier() else
+ " identifier not exist in store"); System.out.println("Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store" );
} else }
else
System.out.println("Rename Error: file target not exist in store" ); System.out.println("Rename Error: file target not exist in store" );
return false; return false;
} }
/** /**
* Rename item. * Rename item.
* *
@ -1055,8 +1083,9 @@ public class AsyncTreePanel extends LayoutContainer {
return true; return true;
} else } else
System.out.println( System.out.println("Record Error: file target with "
"Record Error: file target with " + fileTarget.getIdentifier() + " identifier not exist in store"); + fileTarget.getIdentifier()
+ " identifier not exist in store");
return false; return false;
@ -1075,6 +1104,7 @@ public class AsyncTreePanel extends LayoutContainer {
addItem(parent,child,addChildren); addItem(parent,child,addChildren);
} }
/** /**
* Adds the item. * Adds the item.
* *
@ -1107,6 +1137,7 @@ public class AsyncTreePanel extends LayoutContainer {
if(identifier==null) if(identifier==null)
return false; return false;
FileModel fileTarget = getFileModelByIdentifier(identifier); FileModel fileTarget = getFileModelByIdentifier(identifier);
if(fileTarget==null) if(fileTarget==null)
@ -1286,6 +1317,7 @@ public class AsyncTreePanel extends LayoutContainer {
treePanel.setSize(width, height); treePanel.setSize(width, height);
} }
/** /**
* Gets the context menu tree. * Gets the context menu tree.
* *

View File

@ -31,8 +31,8 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
public class DialogEditProperties extends Dialog { public class DialogEditProperties extends Dialog {
private FileModel item; private FileModel item;
private int widthDialog = 800; private int widthDialog = 450;
private int heigthDialog = 400; private int heigthDialog = 300;
private Command commad; private Command commad;
private List<TextField<String>> fields; private List<TextField<String>> fields;
private FormLayout layout; private FormLayout layout;
@ -50,8 +50,8 @@ public class DialogEditProperties extends Dialog {
this.commad = command; this.commad = command;
layout = new FormLayout(); layout = new FormLayout();
layout.setLabelWidth(200); layout.setLabelWidth(90);
layout.setDefaultWidth(550); layout.setDefaultWidth(300);
setLayout(layout); setLayout(layout);
setHeading("Edit Properties: " + item.getName()); setHeading("Edit Properties: " + item.getName());
@ -72,15 +72,6 @@ public class DialogEditProperties extends Dialog {
saveProperties(true); saveProperties(true);
} }
}); });
//SET TOGGLE BUTTON GRID VIEW
/*Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
setZIndex(99999);
}
});*/
} }
/* /*
@ -91,7 +82,7 @@ public class DialogEditProperties extends Dialog {
@Override @Override
public void show() { public void show() {
resetForm(); resetForm();
//loadGcubeItemProperties(); loadGcubeItemProperties();
super.show(); super.show();
} }
@ -130,33 +121,31 @@ public class DialogEditProperties extends Dialog {
} }
// private void loadGcubeItemProperties() { private void loadGcubeItemProperties() {
// // mask("Loading properties..."); // mask("Loading properties...");
// AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(), AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(item.getIdentifier(),
// new AsyncCallback<Map<String, String>>() { new AsyncCallback<Map<String, String>>() {
//
// @Override
// public void onSuccess(Map<String, String> result) {
// // unmask();
// setProperties(result);
// }
//
// @Override
// public void onFailure(Throwable caught) {
// // unmask();
// GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
// }
// });
// }
public void setProperties(Map<String, String> result) { @Override
public void onSuccess(Map<String, String> result) {
// unmask();
setProperties(result);
}
@Override
public void onFailure(Throwable caught) {
// unmask();
GWT.log("an error occured in loadGcubeItemProperties " + item + " " + caught.getMessage());
}
});
}
private void setProperties(Map<String, String> result) {
fields = new ArrayList<TextField<String>>(result.size()); fields = new ArrayList<TextField<String>>(result.size());
for (String key : result.keySet()) { for (String key : result.keySet()) {
TextField<String> field = new TextField<String>(); TextField<String> field = new TextField<String>();
GWT.log("Adding field: "+key);
field.setFieldLabel(key); field.setFieldLabel(key);
field.setValue(result.get(key)); field.setValue(result.get(key));
field.setReadOnly(false);
add(field); add(field);
fields.add(field); fields.add(field);
} }

View File

@ -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,6 +26,7 @@ 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;
@ -59,7 +60,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;
@ -113,11 +114,11 @@ public class DialogGetInfo extends Dialog {
txtIsPublic.setValue(fileModel.isPublic() + ""); txtIsPublic.setValue(fileModel.isPublic() + "");
add(txtIsPublic); add(txtIsPublic);
if (fileModel.getSynchedWithWsThredds() != null) { if (fileModel.getSynchedThreddsStatus() != null) {
txtThreddsSynched = new TextField<String>(); txtThreddsSynched = new TextField<String>();
txtThreddsSynched.setFieldLabel("Synched with Thredds"); txtThreddsSynched.setFieldLabel("Thredds Sync");
txtThreddsSynched.setReadOnly(true); txtThreddsSynched.setReadOnly(true);
txtThreddsSynched.setValue(fileModel.getSynchedWithWsThredds() + ""); txtThreddsSynched.setValue(fileModel.getSynchedThreddsStatus() + "");
add(txtThreddsSynched); add(txtThreddsSynched);
} }
@ -447,7 +448,10 @@ public class DialogGetInfo extends Dialog {
private String getFormattedSize(long value) { private String getFormattedSize(long value) {
if (value > 0) { if (value > 0) {
return SizeUtil.readableFileSize(value); double kb = value / 1024;
if (kb < 1)
kb = 1;
return number.format(kb);
} else if (value == 0) { } else if (value == 0) {
return EMPTY; return EMPTY;
} else } else

View File

@ -1,938 +0,0 @@
package org.gcube.portlets.user.workspace.client.view.windows;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.workspace.client.AppControllerExplorer;
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.DownloadType;
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.FileModel;
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.folder.item.GWTExternalImage;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
import org.gcube.portlets.user.workspace.shared.PublicLink;
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingServiceAsync;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.github.gwtbootstrap.client.ui.Tooltip;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.github.gwtbootstrap.client.ui.constants.ResizeType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
import com.google.gwt.http.client.URL;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.NamedFrame;
import com.google.gwt.user.client.ui.Widget;
// TODO: Auto-generated Javadoc
/**
* The Class DialogGetInfoBootstrap.
*
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
* Jul 13, 2020
*/
public class DialogGetInfoBootstrap extends Composite {
private static final int PREVIEW_WAITING_TIME = 9000; //9 sec
private static final int PREVIEW_MAX_RETRIES = 3;
private int showPreviewAttempt = 0;
private long loaderPreviewStartTime = 0;
private static DialogGetInfoBootstrapUiBinder uiBinder = GWT.create(DialogGetInfoBootstrapUiBinder.class);
/**
* The Interface DialogGetInfoBootstrapUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR Pisa (Italy)
* Jul 13, 2020
*/
interface DialogGetInfoBootstrapUiBinder extends UiBinder<Widget, DialogGetInfoBootstrap> {
}
public static final String EMPTY = "empty";
//private final NumberFormat number = ConstantsExplorer.numberFormatterKB;
/**
* Instantiates a new dialog get info bootstrap.
*/
public DialogGetInfoBootstrap() {
initWidget(uiBinder.createAndBindUi(this));
}
public static final String NOT_AVAILABLE = "n.a.";
private Map<String, String> gCubeProperties;
@UiField
HorizontalPanel hpItemType;
@UiField
HorizontalPanel hpHeaderDetails;
@UiField
Button buttonClose;
@UiField
HTMLPanel htmlPanelImagePreview;
@UiField
HTMLPanel htmlPanelFilePreview;
@UiField
HTML txtName;
@UiField
HTML txtId;
@UiField
HTML txtLocation;
@UiField
ControlGroup cgTxtIsPublic;
@UiField
HTML txtIsPublic;
@UiField
HTML txtMimeType;
@UiField
ControlGroup cgTxtMimeType;
@UiField
ControlGroup cgThreddsSynched;
@UiField
HTML txtThreddsSynched;
@UiField
ControlGroup cgGcubeProperties;
@UiField
TextArea txtAreaGcubeProperties;
@UiField
TextArea txtAreaDescription;
@UiField
HTML txtOwner;
@UiField
HTML txtCreated;
@UiField
HTML txtLastMofication;
@UiField
HTML txtSize;
@UiField
HTML txtShared;
@UiField
Button buttonUpdateDescription;
@UiField
Button buttonSaveDescription;
@UiField
Button buttonUpdateGcubeProperties;
@UiField
Button buttonUpdateShare;
@UiField
ControlGroup cgSharedWith;
@UiField
HTML txtSharedWith;
private FileModel fileModel;
private Command onCloseCommand;
private Tooltip tooltipDownload = new Tooltip("Download");
private Button buttonDownload = new Button("Download");
// private Tooltip tooltipSharebleLink = new Tooltip("Get Shareable Link");
// private Button buttonShareableLink = new Button();
private DateTimeFormat dateFormatter = DateTimeFormat.getFormat("dd MMM yyyy, hh:mm aaa");
private boolean iFrameGoogleDocViewerLoaded = false;
private Long fileSize = null;
private Map<String, List<String>> mapAllowedMimeTypesForPreview;
private Image spinnerImage = Resources.getSpinner().createImage();
private Image noPreviewAvailable = new Image(Resources.getPreviewNotAvailableNoBorder());
private Frame iFrameGDV = null;
private Timer timerGDV = null;
/**
* Instantiates a new dialog get info bootstrap.
*
* @param fileModel the file model
* @param onCloseCommand the on close command
* @param mapAllowedMimeTypesForPreview the map allowed mime types for preview
*/
public DialogGetInfoBootstrap(final FileModel fileModel, final Command onCloseCommand, Map<String,List<String>> mapAllowedMimeTypesForPreview) {
initWidget(uiBinder.createAndBindUi(this));
this.fileModel = fileModel;
this.onCloseCommand = onCloseCommand;
this.mapAllowedMimeTypesForPreview = mapAllowedMimeTypesForPreview;
this.cgTxtMimeType.setVisible(true);
buttonClose.getElement().getStyle().setFloat(Float.RIGHT);
hpItemType.add(fileModel.getIcon());
Label labelItemType = new Label();
labelItemType.setType(LabelType.DEFAULT);
//labelItemType.getElement().getStyle().setMarginLeft(10, Unit.PX);
String label = null;
GXTFolderItemTypeEnum typeEnum = fileModel.getGXTFolderItemType();
//in case of folder see #19600
if(fileModel.isDirectory()) {
label = "Private Folder";
if(fileModel.isPublic()) {
//is public
label = "Public Folder";
if(fileModel.isShared()) {
label = "Shared and Public Folder";
}
}else {
//is not public
if(fileModel.isShared()) {
//is shared
label = "Shared Folder";
if(fileModel.isVreFolder()) {
label = "VRE Folder";
}
}
}
//hiding the type
cgTxtMimeType.setVisible(false);
}else {
//in case of file see #19600
if (typeEnum != null) {
//the file is categorized
label = typeEnum.getLabel();
label = label.replace("External ", "");
} else {
//the file is NOT categorized using the default "File"
label = "File";
}
}
labelItemType.setText(label);
hpItemType.add(labelItemType);
buttonDownload.setType(ButtonType.LINK);
buttonDownload.setIcon(IconType.CLOUD_DOWNLOAD);
tooltipDownload.add(buttonDownload);
hpItemType.add(tooltipDownload);
// buttonShareableLink.setType(ButtonType.LINK);
// buttonShareableLink.setIcon(IconType.LINK);
// buttonShareableLink.set
// tooltipSharebleLink.add(buttonShareableLink);
// hpItemType.add(tooltipSharebleLink);
// Setting name
htmlSetValue(txtName, fileModel.getName());
htmlSetValue(txtId, fileModel.getIdentifier());
if (fileModel.isRoot())
txtLocation.setHTML("/");
else
loadLocation(fileModel);
if (fileModel.isDirectory()) {
cgTxtIsPublic.setVisible(true);
htmlSetValue(txtIsPublic, fileModel.isPublic() + "");
GWT.log("Is synched? "+fileModel.getSynchedWithWsThredds());
if (fileModel.getSynchedWithWsThredds() != null) {
if (fileModel.getSynchedWithWsThredds()) {
cgThreddsSynched.setVisible(true);
//txtThreddsSynched.setVisible(true);
htmlSetValue(txtThreddsSynched, fileModel.getSynchedWithWsThredds() + "");
txtThreddsSynched.setHTML(fileModel.getSynchedWithWsThredds() + "");
}
}
}
//mimetype
htmlSetValue(txtMimeType, fileModel.getType());
txtAreaDescription.setResize(ResizeType.VERTICAL);
//load description
loadDescription(fileModel.getIdentifier());
//owner
htmlSetValue(txtOwner, fileModel.getOwnerFullName());
//creation date
loadCreationDate(fileModel.getIdentifier());
if(fileModel instanceof FileGridModel) {
FileGridModel fileGridModel = ((FileGridModel) fileModel);
//last update
htmlSetValue(txtLastMofication, dateFormatter.format(fileGridModel.getLastModification()));
//size
fileSize = fileGridModel.getSize();
htmlSetValue(txtSize, getFormattedSize(fileGridModel.getSize()));
}else {
loadLastModificationDate(fileModel.getIdentifier());
loadSize(fileModel.getIdentifier());
}
htmlSetValue(txtShared, fileModel.isShared()+"");
// USERS SHARED
if (fileModel.isShared()) {
cgSharedWith.setVisible(true);
loadACLsDescriptionForSharedFolder(fileModel.getIdentifier());
}
boolean previewManaged = false;
if (typeEnum != null) {
// is it an image?
if (typeEnum.equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)
|| typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE)) {
previewManaged = true;
loadThumbnailsForImage();
}
// is it a GCUBE-Item?
if (typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM)) {
previewManaged = true; //preview not avaible for the type GCUBE_ITEM
loadGcubeItemProperties();
}
}
//If the preview is not managed
//through the previous code
//managing it by checking the mime-type
if(!previewManaged) {
if (!fileModel.isDirectory() && mapAllowedMimeTypesForPreview.containsKey(fileModel.getType())) {
// SOLUTION BASED ON GOOGLE DOC VIEWER
GWT.log("Mime type " + fileModel.getType() + " allowed for preview, try to display it");
final HTML loadingPreviewHTML = new HTML();
setPlaceholder(loadingPreviewHTML, true, "loading preview...");
htmlPanelFilePreview.add(loadingPreviewHTML);
htmlPanelFilePreview.setVisible(true);
AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFileItemId(fileModel.getIdentifier(), false,
new AsyncCallback<PublicLink>() {
@Override
public void onFailure(Throwable caught) {
removePlaceHolder(loadingPreviewHTML);
GWT.log("Error on loading the Public link for: "+fileModel.getIdentifier());
htmlPanelFilePreview.add(noPreviewAvailable);
htmlPanelFilePreview.setVisible(true);
}
@Override
public void onSuccess(PublicLink result) {
GWT.log("The PublicLink link is: " + result);
if (result != null) {
// if file size is null or greater than 25MB
long byteTo25MB = 1024 * 1024 * 25;
GWT.log("The file size is: " + fileSize);
if (fileSize == null || fileSize > byteTo25MB) {
GWT.log("The file size is null or greater than " + byteTo25MB + ", returning");
// htmlPanelFilePreview.add(new Image(Resources.getPreviewNotAvailable()));
return;
}
final String googleDocViewerURL = "https://docs.google.com/viewer?url="
+ URL.encode(result.getCompleteURL()) + "&embedded=true";
iFrameGDV = instanceFrame(googleDocViewerURL, loadingPreviewHTML);
loaderPreviewStartTime = new Date().getTime();
showPreviewAttempt = 1;
timerGDV = new Timer() {
@Override
public void run() {
GWT.log("Checking if the iFrameGoogleDocViewer is ready");
if (iFrameGoogleDocViewerLoaded) {
removePlaceHolder(loadingPreviewHTML);
GWT.log("iFrameGoogleDocViewer currently loaded, cancelling timer");
cancel();
return;
}
long checkTime = new Date().getTime();
long diff = checkTime - loaderPreviewStartTime;
if (diff > PREVIEW_WAITING_TIME) { // is greater than PREVIEW_WAITING_TIME, performs a new attempt or terminate
if(showPreviewAttempt >= PREVIEW_MAX_RETRIES) {
try {
GWT.log("iFrameGoogleDocViewer not loaded within "+PREVIEW_WAITING_TIME+" sec and max retries "+PREVIEW_MAX_RETRIES+", cancelling timer, removing iframe");
cancel();
removePlaceHolder(loadingPreviewHTML);
htmlPanelFilePreview.add(noPreviewAvailable);
iFrameGDV.setVisible(false);
htmlPanelFilePreview.remove(iFrameGDV);
} catch (Exception e) {
// Silent
}
}else {
GWT.log("iFrameGoogleDocViewer not loaded on attempt "+showPreviewAttempt+", instancing new iFrame");
//new retry by instancing the iFrame again...
iFrameGDV = instanceFrame(googleDocViewerURL, loadingPreviewHTML);
try {
//removing old iFrame
htmlPanelFilePreview.remove(iFrameGDV);
}catch (Exception e) {
//silent
}
//adding the new one
htmlPanelFilePreview.add(iFrameGDV);
//new attempt so incrementing it
showPreviewAttempt++;
GWT.log("Retry, go to attempt "+showPreviewAttempt);
//resetting start time for new attempt
loaderPreviewStartTime = new Date().getTime();
}
}
}
};
int attemptRepeater = PREVIEW_WAITING_TIME / 3;
timerGDV.scheduleRepeating(attemptRepeater);
htmlPanelFilePreview.add(iFrameGDV);
}
}
});
} else {
GWT.log("Mime type " + fileModel.getType() + " NOT allowed for preview, displaying 'No preview available'");
htmlPanelFilePreview.add(noPreviewAvailable);
htmlPanelFilePreview.setVisible(true);
}
}
addHandlers();
}
/**
* On detach.
*/
@Override
protected void onDetach() {
super.onDetach();
GWT.log("Detached...");
htmlPanelFilePreview.clear();
if(timerGDV!=null) {
try {
timerGDV.cancel();
}catch (Exception e) {
// TODO: handle exception
}
}
}
/**
* Instance frame.
*
* @param fileURL the file URL
* @param thePreviewPlaceholder the the preview placeholder
* @return the frame
*/
public Frame instanceFrame(String fileURL, final HTML thePreviewPlaceholder) {
//addLoading();
String urlEncoded = URL.encode(fileURL);
GWT.log("Encoded url for instanciating frame is " + urlEncoded);
iFrameGoogleDocViewerLoaded = false;
final NamedFrame frame = new NamedFrame("iFrameGoogleDocViewer");
frame.setUrl(urlEncoded);
frame.setVisible(false);
frame.getElement().setId("iFrameGoogleDocViewer");
frame.getElement().getStyle().setBorderWidth(0, Unit.PX);
frame.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent arg0) {
GWT.log("iFrameGoogleDocViewer loaded");
iFrameGoogleDocViewerLoaded = true;
removePlaceHolder(thePreviewPlaceholder);
frame.getElement().addClassName("my-preview-doc");
frame.setVisible(true);
}
});
return frame;
}
/**
* Adds the handlers.
*/
private void addHandlers() {
buttonClose.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
onCloseCommand.execute();
}
});
buttonUpdateDescription.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
txtAreaDescription.setReadOnly(false);
txtAreaDescription.setFocus(true);
buttonSaveDescription.setVisible(true);
}
});
buttonSaveDescription.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
buttonSaveDescription.setVisible(false);
txtAreaDescription.setReadOnly(true);
AppControllerExplorer.rpcWorkspaceService.updateDescriptionForItem(fileModel.getIdentifier(), txtAreaDescription.getValue(), new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
loadDescription(fileModel.getIdentifier());
new MessageBoxAlert("Error on updating description...", caught.getMessage(), null);
}
@Override
public void onSuccess(String result) {
GWT.log("Updated the description as: "+result);
txtAreaDescription.setValue(result);
}
});
}
});
final Command cmdReloadProperties = new Command() {
@Override
public void execute() {
loadGcubeItemProperties();
}
};
buttonUpdateGcubeProperties.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
final DialogEditProperties editProperties = new DialogEditProperties(fileModel, cmdReloadProperties);
editProperties.show();
editProperties.setProperties(gCubeProperties);
}
});
buttonUpdateShare.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
AppControllerExplorer.getEventBus().fireEvent(new CreateSharedFolderEvent(fileModel, fileModel.getParentFileModel(),false));
onCloseCommand.execute();
}
});
buttonDownload.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
AppControllerExplorer.getEventBus()
.fireEvent(new FileDownloadEvent(fileModel.getIdentifier(), fileModel.getName(),
DownloadType.SHOW, fileModel.isDirectory() || fileModel.isVreFolder(), null));
}
});
}
/**
* Html set value.
*
* @param field the field
* @param value the value
*/
private void htmlSetValue(HTML field, String value) {
if (value == null || value.isEmpty())
field.setHTML(NOT_AVAILABLE);
else
field.setHTML(value);
}
/**
* Gets the formatted size.
*
* @param value the value
* @return the formatted size
*/
private String getFormattedSize(long value) {
if (value > 0) {
return SizeUtil.readableFileSize(value);
} else if (value == 0) {
return EMPTY;
} else
return "";
}
/**
* Load location.
*
* @param fileModel the file model
*/
private void loadLocation(FileModel fileModel) {
setPlaceholder(txtLocation, false, "loading...");
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(fileModel.getIdentifier(), false,
new AsyncCallback<List<FileModel>>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("failure get list parents by item identifier " + caught);
removePlaceHolder(txtLocation);
txtLocation.setHTML(NOT_AVAILABLE);
// txtLocation.set(false);
}
@Override
public void onSuccess(List<FileModel> result) {
removePlaceHolder(txtLocation);
String location = "";
if (result != null) {
for (FileModel fileModel : result) {
if (fileModel != null)
location += "/" + fileModel.getName();
}
}
if (location.isEmpty())
location = "/";
txtLocation.setHTML(location);
}
});
}
/**
* Load size.
*
* @param itemId the item id
*/
private void loadSize(final String itemId) {
GWT.log("Load size");
setPlaceholder(txtSize, false, "loading...");
fileSize = new Long(-1); //means is loading
AppControllerExplorer.rpcWorkspaceService.loadSizeByItemId(itemId, new AsyncCallback<Long>() {
@Override
public void onFailure(Throwable caught) {
fileSize = null;
GWT.log("an error occured in load creation date by Id " + itemId + " " + caught.getMessage());
removePlaceHolder(txtSize);
}
@Override
public void onSuccess(Long result) {
GWT.log("Loaded size=" + result);
fileSize = result;
removePlaceHolder(txtSize);
if(result!=null)
htmlSetValue(txtSize, getFormattedSize(result));
else
htmlSetValue(txtSize, null);
}
});
}
/**
* Load creation date.
*
* @param itemId the item id
*/
private void loadCreationDate(final String itemId) {
setPlaceholder(txtCreated, false, "loading...");
AppControllerExplorer.rpcWorkspaceService.getItemCreationDateById(itemId, new AsyncCallback<Date>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("an error occured in load creation date by Id " + itemId + " " + caught.getMessage());
removePlaceHolder(txtCreated);
}
@Override
public void onSuccess(Date dateResult) {
removePlaceHolder(txtCreated);
if (dateResult != null) {
htmlSetValue(txtCreated, dateFormatter.format(dateResult));
}else
htmlSetValue(txtCreated, null);
}
});
}
/**
* Load last modification date.
*
* @param itemId the item id
*/
private void loadLastModificationDate(final String itemId) {
setPlaceholder(txtLastMofication, false, "loading...");
AppControllerExplorer.rpcWorkspaceService.loadLastModificationDateById(itemId, new AsyncCallback<Date>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("an error occured in loadLastModificationDateById " + itemId + " " + caught.getMessage());
removePlaceHolder(txtLastMofication);
}
@Override
public void onSuccess(Date dateResult) {
removePlaceHolder(txtLastMofication);
if (dateResult != null) {
htmlSetValue(txtLastMofication, dateFormatter.format(dateResult));
}else
htmlSetValue(txtLastMofication, null);
}
});
}
/**
* Load description.
*
* @param identifier the identifier
*/
private void loadDescription(String identifier) {
txtAreaDescription.setEnabled(false);
AppControllerExplorer.rpcWorkspaceService.getItemDescriptionById(identifier, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable arg0) {
txtAreaDescription.setEnabled(false);
}
@Override
public void onSuccess(String result) {
if (result != null)
txtAreaDescription.setValue(result);
else
txtAreaDescription.setValue("");
txtAreaDescription.setEnabled(true);
}
});
}
/**
* Load gcube item properties.
*/
private void loadGcubeItemProperties() {
// mask("Loading properties...");
AppControllerExplorer.rpcWorkspaceService.loadGcubeItemProperties(fileModel.getIdentifier(),
new AsyncCallback<Map<String, String>>() {
@Override
public void onSuccess(Map<String, String> result) {
txtAreaGcubeProperties.setText("");
GWT.log("Gcube Item Properties: " + result);
gCubeProperties = result;
// unmask();
if (result != null && result.size() > 0) {
for (String key : result.keySet()) {
String text = txtAreaGcubeProperties.getText();
text += key + "=" + result.get(key) + ";\n";
txtAreaGcubeProperties.setText(text);
}
cgGcubeProperties.setVisible(true);
}
}
@Override
public void onFailure(Throwable caught) {
// unmask();
cgGcubeProperties.setVisible(false);
GWT.log("an error occured in loadGcubeItemProperties " + fileModel.getIdentifier() + " "
+ caught.getMessage());
}
});
}
/**
* Load AC ls description for shared folder.
*
* @param sharedId the shared id
*/
private void loadACLsDescriptionForSharedFolder(String sharedId) {
setPlaceholder(txtSharedWith, true, "loading...");
WorkspaceSharingServiceAsync.INSTANCE.getACLsDescriptionForSharedFolderId(sharedId,
new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
removePlaceHolder(txtSharedWith);
txtSharedWith.setHTML("Error on recovering users");
}
@Override
public void onSuccess(String result) {
removePlaceHolder(txtSharedWith);
txtSharedWith.getElement().addClassName("shared-with-style");
GWT.log("Loaded ACLs: " + result);
txtSharedWith.setHTML(result);
}
});
}
/**
* Load thumbnails for image.
*/
private void loadThumbnailsForImage() {
htmlPanelImagePreview.setVisible(true);
final HTML txtLoadingPreview = new HTML();
htmlPanelImagePreview.add(txtLoadingPreview);
setPlaceholder(txtLoadingPreview, true, "loading preview...");
AppControllerExplorer.rpcWorkspaceService.getImageById(fileModel.getIdentifier(),
fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT), false,
new AsyncCallback<GWTWorkspaceItem>() {
@Override
public void onFailure(Throwable caught) {
removePlaceHolder(txtLoadingPreview);
}
@Override
public void onSuccess(GWTWorkspaceItem item) {
GWT.log("Image loaded: " + item.getName() + " label: " + item.getLabel() + " type: "
+ fileModel.getGXTFolderItemType());
if (fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)) {
GWTImageDocument theItemImage = (GWTImageDocument) item;
htmlPanelImagePreview.add(new Image(theItemImage.getThumbnailUrl()));
htmlPanelImagePreview.setVisible(true);
}else {
GWTExternalImage theExternalImage = (GWTExternalImage) item;
htmlPanelImagePreview.add(new Image(theExternalImage.getThumbnailUrl()));
htmlPanelImagePreview.setVisible(true);
}
removePlaceHolder(txtLoadingPreview);
}
});
}
/**
* Sets the placeholder.
*
* @param html the html
* @param spinner the spinner
* @param placeholder the placeholder
*/
private void setPlaceholder(HTML html, boolean spinner, String placeholder) {
String loadingHMTL = placeholder;
if(spinner) {
loadingHMTL = "<span><img src=\""+spinnerImage.getUrl()+"\" style=\"padding-right:5px;\">"+placeholder+"</span>";
}
html.setHTML(loadingHMTL);
html.getElement().addClassName("placeholder-loading");
}
/**
* Removes the place holder.
*
* @param html the html
*/
private void removePlaceHolder(HTML html) {
html.setHTML("");
html.getElement().removeClassName("placeholder-loading");
}
/**
* 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)/*-{
var theDivContainer = "#"+divId;
$wnd.PDFObject.embed(pdfURL, theDivContainer);
}-*/;
}

View File

@ -1,173 +0,0 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.no-border {
border: 0px;
}
</ui:style>
<g:HTMLPanel>
<g:HorizontalPanel ui:field="hpHeaderDetails"
addStyleNames="item-details-header">
<g:HTML>Details</g:HTML>
<b:Button icon="REMOVE" ui:field="buttonClose" type="LINK"></b:Button>
</g:HorizontalPanel>
<g:HorizontalPanel ui:field="hpItemType"
addStyleNames="item-type-style">
</g:HorizontalPanel>
<g:HTMLPanel ui:field="htmlPanelImagePreview"
visible="false" addStyleNames="preview-image-style">
</g:HTMLPanel>
<g:HTMLPanel ui:field="htmlPanelFilePreview"
visible="false" addStyleNames="preview-file-style">
</g:HTMLPanel>
<b:Form type="HORIZONTAL">
<b:Alert ui:field="actionAlert" close="false" type="INFO"
visible="false">
<b:Icon type="ROTATE_RIGHT" spin="true" />
</b:Alert>
<b:Fieldset ui:field="fieldSetGetInfo"
styleName="{style.noBorder}">
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Name</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtName">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Id</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtId">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Location</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtLocation">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info" ui:field="cgTxtIsPublic"
visible="false">
<b:ControlLabel>Public</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtIsPublic">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info" ui:field="cgTxtMimeType">
<b:ControlLabel>Type</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtMimeType">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info"
ui:field="cgThreddsSynched" visible="false">
<b:ControlLabel title="Synched with THREDDS">Synched</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtThreddsSynched">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Description</b:ControlLabel>
<b:Controls>
<b:TextArea ui:field="txtAreaDescription"
readOnly="true">
</b:TextArea>
<b:Tooltip text="Edit the Description">
<b:Button icon="EDIT" ui:field="buttonUpdateDescription"
type="LINK">Edit</b:Button>
</b:Tooltip>
<b:Tooltip text="Save the Description">
<b:Button icon="SAVE" ui:field="buttonSaveDescription"
type="LINK" visible="false">Save</b:Button>
</b:Tooltip>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info"
ui:field="cgGcubeProperties" visible="false">
<b:ControlLabel>Gcube Properties</b:ControlLabel>
<b:Controls>
<b:TextArea ui:field="txtAreaGcubeProperties"
readOnly="true">
</b:TextArea>
<b:Tooltip text="Update the Gcube Properties">
<b:Button icon="PENCIL"
ui:field="buttonUpdateGcubeProperties" type="LINK">Edit</b:Button>
</b:Tooltip>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Owner</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtOwner">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Created</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtCreated">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Modified</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtLastMofication">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Size</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtSize">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info">
<b:ControlLabel>Shared</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtShared">
</g:HTML>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup
addStyleNames="my-control-group-get-info" ui:field="cgSharedWith"
visible="false">
<b:ControlLabel>Shared with</b:ControlLabel>
<b:Controls>
<g:HTML ui:field="txtSharedWith">
</g:HTML>
<b:Tooltip text="Go to Share">
<b:Button icon="USER" ui:field="buttonUpdateShare"
type="LINK">Share</b:Button>
</b:Tooltip>
</b:Controls>
</b:ControlGroup>
<b:Alert close="false" ui:field="errorAlert" type="ERROR"
visible="false"></b:Alert>
</b:Fieldset>
</b:Form>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -9,7 +9,6 @@ import java.util.Map;
import org.gcube.portlets.user.workspace.client.resources.Resources; import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType; import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
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 com.extjs.gxt.ui.client.Style.ButtonScale; import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.Style.HorizontalAlignment; import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
@ -55,7 +54,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
*/ */
private static final String TYPEOPERATION = "typeoperation"; private static final String TYPEOPERATION = "typeoperation";
protected static final String DATE = "Date"; protected static final String DATE = "Date";
protected static final String USER = "User"; protected static final String AUTHOR = "Author";
protected static final String OPERATION = "Operation"; protected static final String OPERATION = "Operation";
protected static final String DESCRIPTION = "Description"; protected static final String DESCRIPTION = "Description";
private ColumnModel cm; private ColumnModel cm;
@ -129,7 +128,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
List<ColumnConfig> columns = new ArrayList<ColumnConfig>(); List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig icon = createSortableColumnConfig("Type", "", 35); ColumnConfig icon = createSortableColumnConfig("Type", "", 20);
columns.add(icon); columns.add(icon);
icon.setRenderer(new GridCellRenderer<ModelData>() { icon.setRenderer(new GridCellRenderer<ModelData>() {
@ -184,7 +183,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
}); });
ColumnConfig descr = createSortableColumnConfig(DESCRIPTION, DESCRIPTION, 220); ColumnConfig descr = createSortableColumnConfig(DESCRIPTION, DESCRIPTION, 230);
columns.add(descr); columns.add(descr);
descr.setRenderer(new GridCellRenderer<ModelData>() { descr.setRenderer(new GridCellRenderer<ModelData>() {
@ -192,12 +191,10 @@ public class AccoutingInfoContainer extends LayoutContainer {
public Object render(ModelData model, String property, public Object render(ModelData model, String property,
ColumnData config, int rowIndex, int colIndex, ColumnData config, int rowIndex, int colIndex,
ListStore<ModelData> store, Grid<ModelData> grid) { ListStore<ModelData> store, Grid<ModelData> grid) {
String thevalue = model.get(DESCRIPTION); // if(model.get(OPERATION).equals(GxtAccountingEntryType.READ))
//I'm adding the tooltip // return "<b><p style=\"color: red;\">"
if(thevalue==null) // + model.get(DESCRIPTION)+ "</p></b>";
return ""; return model.get(DESCRIPTION);
return "<span title='" + thevalue + "' style='white-space:pre-line;'>" + thevalue + "</span>";
} }
}); });
@ -205,7 +202,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
ColumnConfig oper = createSortableColumnConfig(OPERATION_NAME, OPERATION, 70); ColumnConfig oper = createSortableColumnConfig(OPERATION_NAME, OPERATION, 70);
columns.add(oper); columns.add(oper);
ColumnConfig auth = createSortableColumnConfig(USER, USER, 120); ColumnConfig auth = createSortableColumnConfig(AUTHOR, AUTHOR, 120);
columns.add(auth); columns.add(auth);
ColumnConfig date = createSortableColumnConfig(DATE, DATE, 140); ColumnConfig date = createSortableColumnConfig(DATE, DATE, 140);
@ -239,7 +236,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
StringFilter descrFilter = new StringFilter(DESCRIPTION); StringFilter descrFilter = new StringFilter(DESCRIPTION);
filters.addFilter(descrFilter); filters.addFilter(descrFilter);
StringFilter authorFilter = new StringFilter(USER); StringFilter authorFilter = new StringFilter(AUTHOR);
filters.addFilter(authorFilter); filters.addFilter(authorFilter);
ListFilter listFilter = new ListFilter(OPERATION_NAME, typeStoreOperation); ListFilter listFilter = new ListFilter(OPERATION_NAME, typeStoreOperation);
@ -342,13 +339,7 @@ public class AccoutingInfoContainer extends LayoutContainer {
// typeStoreOperation.add(type((gxtAccountingField.getOperation().getId()))); // typeStoreOperation.add(type((gxtAccountingField.getOperation().getId())));
} }
InfoContactModel user = gxtAccountingField.getUser(); baseModel.set(AUTHOR, gxtAccountingField.getUser().getName());
if(user!=null)
baseModel.set(USER, user.getName());
else
baseModel.set(USER, "");
baseModel.set(DATE, gxtAccountingField.getDate()); baseModel.set(DATE, gxtAccountingField.getDate());
listModelData.add(baseModel); listModelData.add(baseModel);

View File

@ -1,286 +0,0 @@
/*global ActiveXObject, window, console, define, module, jQuery */
//jshint unused:false, strict: false
/*
PDFObject v2.1.1
https://github.com/pipwerks/PDFObject
Copyright (c) 2008-2018 Philip Hutchison
MIT-style license: http://pipwerks.mit-license.org/
UMD module pattern from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
*/
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.PDFObject = factory();
}
}(this, function () {
"use strict";
//jshint unused:true
//PDFObject is designed for client-side (browsers), not server-side (node)
//Will choke on undefined navigator and window vars when run on server
//Return boolean false and exit function when running server-side
if(typeof window === "undefined" || typeof navigator === "undefined"){ return false; }
var pdfobjectversion = "2.1.1",
ua = window.navigator.userAgent,
//declare booleans
supportsPDFs,
isIE,
supportsPdfMimeType = (typeof navigator.mimeTypes['application/pdf'] !== "undefined"),
supportsPdfActiveX,
isModernBrowser = (function (){ return (typeof window.Promise !== "undefined"); })(),
isFirefox = (function (){ return (ua.indexOf("irefox") !== -1); } )(),
isFirefoxWithPDFJS = (function (){
//Firefox started shipping PDF.js in Firefox 19.
//If this is Firefox 19 or greater, assume PDF.js is available
if(!isFirefox){ return false; }
//parse userAgent string to get release version ("rv")
//ex: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0
return (parseInt(ua.split("rv:")[1].split(".")[0], 10) > 18);
})(),
isIOS = (function (){ return (/iphone|ipad|ipod/i.test(ua.toLowerCase())); })(),
//declare functions
createAXO,
buildFragmentString,
log,
embedError,
embed,
getTargetElement,
generatePDFJSiframe,
generateEmbedElement;
/* ----------------------------------------------------
Supporting functions
---------------------------------------------------- */
createAXO = function (type){
var ax;
try {
ax = new ActiveXObject(type);
} catch (e) {
ax = null; //ensure ax remains null
}
return ax;
};
//IE11 still uses ActiveX for Adobe Reader, but IE 11 doesn't expose
//window.ActiveXObject the same way previous versions of IE did
//window.ActiveXObject will evaluate to false in IE 11, but "ActiveXObject" in window evaluates to true
//so check the first one for older IE, and the second for IE11
//FWIW, MS Edge (replacing IE11) does not support ActiveX at all, both will evaluate false
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
isIE = function (){ return !!(window.ActiveXObject || "ActiveXObject" in window); };
//If either ActiveX support for "AcroPDF.PDF" or "PDF.PdfCtrl" are found, return true
//Constructed as a method (not a prop) to avoid unneccesarry overhead -- will only be evaluated if needed
supportsPdfActiveX = function (){ return !!(createAXO("AcroPDF.PDF") || createAXO("PDF.PdfCtrl")); };
//Determines whether PDF support is available
supportsPDFs = (
//as of iOS 12, inline PDF rendering is still not supported in Safari or native webview
//3rd-party browsers (eg Chrome, Firefox) use Apple's webview for rendering, and thus the same result as Safari
//Therefore if iOS, we shall assume that PDF support is not available
!isIOS && (
//Modern versions of Firefox come bundled with PDFJS
isFirefoxWithPDFJS ||
//Browsers that still support the original MIME type check
supportsPdfMimeType || (
//Pity the poor souls still using IE
isIE() && supportsPdfActiveX()
)
)
);
//Create a fragment identifier for using PDF Open parameters when embedding PDF
buildFragmentString = function(pdfParams){
var string = "",
prop;
if(pdfParams){
for (prop in pdfParams) {
if (pdfParams.hasOwnProperty(prop)) {
string += encodeURIComponent(prop) + "=" + encodeURIComponent(pdfParams[prop]) + "&";
}
}
//The string will be empty if no PDF Params found
if(string){
string = "#" + string;
//Remove last ampersand
string = string.slice(0, string.length - 1);
}
}
return string;
};
log = function (msg){
if(typeof console !== "undefined" && console.log){
console.log("[PDFObject] " + msg);
}
};
embedError = function (msg){
log(msg);
return false;
};
getTargetElement = function (targetSelector){
//Default to body for full-browser PDF
var targetNode = document.body;
//If a targetSelector is specified, check to see whether
//it's passing a selector, jQuery object, or an HTML element
if(typeof targetSelector === "string"){
//Is CSS selector
targetNode = document.querySelector(targetSelector);
} else if (typeof jQuery !== "undefined" && targetSelector instanceof jQuery && targetSelector.length) {
//Is jQuery element. Extract HTML node
targetNode = targetSelector.get(0);
} else if (typeof targetSelector.nodeType !== "undefined" && targetSelector.nodeType === 1){
//Is HTML element
targetNode = targetSelector;
}
return targetNode;
};
generatePDFJSiframe = function (targetNode, url, pdfOpenFragment, PDFJS_URL, id){
var fullURL = PDFJS_URL + "?file=" + encodeURIComponent(url) + pdfOpenFragment;
var scrollfix = (isIOS) ? "-webkit-overflow-scrolling: touch; overflow-y: scroll; " : "overflow: hidden; ";
var iframe = "<div style='" + scrollfix + "position: absolute; top: 0; right: 0; bottom: 0; left: 0;'><iframe " + id + " src='" + fullURL + "' style='border: none; width: 100%; height: 100%;' frameborder='0'></iframe></div>";
targetNode.className += " pdfobject-container";
targetNode.style.position = "relative";
targetNode.style.overflow = "auto";
targetNode.innerHTML = iframe;
return targetNode.getElementsByTagName("iframe")[0];
};
generateEmbedElement = function (targetNode, targetSelector, url, pdfOpenFragment, width, height, id){
var style = "";
if(targetSelector && targetSelector !== document.body){
style = "width: " + width + "; height: " + height + ";";
} else {
style = "position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%;";
}
targetNode.className += " pdfobject-container";
targetNode.innerHTML = "<embed " + id + " class='pdfobject' src='" + url + pdfOpenFragment + "' type='application/pdf' style='overflow: auto; " + style + "'/>";
return targetNode.getElementsByTagName("embed")[0];
};
embed = function(url, targetSelector, options){
//Ensure URL is available. If not, exit now.
if(typeof url !== "string"){ return embedError("URL is not valid"); }
//If targetSelector is not defined, convert to boolean
targetSelector = (typeof targetSelector !== "undefined") ? targetSelector : false;
//Ensure options object is not undefined -- enables easier error checking below
options = (typeof options !== "undefined") ? options : {};
//Get passed options, or set reasonable defaults
var id = (options.id && typeof options.id === "string") ? "id='" + options.id + "'" : "",
page = (options.page) ? options.page : false,
pdfOpenParams = (options.pdfOpenParams) ? options.pdfOpenParams : {},
fallbackLink = (typeof options.fallbackLink !== "undefined") ? options.fallbackLink : true,
width = (options.width) ? options.width : "100%",
height = (options.height) ? options.height : "100%",
assumptionMode = (typeof options.assumptionMode === "boolean") ? options.assumptionMode : true,
forcePDFJS = (typeof options.forcePDFJS === "boolean") ? options.forcePDFJS : false,
PDFJS_URL = (options.PDFJS_URL) ? options.PDFJS_URL : false,
targetNode = getTargetElement(targetSelector),
fallbackHTML = "",
pdfOpenFragment = "",
fallbackHTML_default = "<p>This browser does not support inline PDFs. Please download the PDF to view it: <a href='[url]'>Download PDF</a></p>";
//If target element is specified but is not valid, exit without doing anything
if(!targetNode){ return embedError("Target element cannot be determined"); }
//page option overrides pdfOpenParams, if found
if(page){
pdfOpenParams.page = page;
}
//Stringify optional Adobe params for opening document (as fragment identifier)
pdfOpenFragment = buildFragmentString(pdfOpenParams);
//Do the dance
//If the forcePDFJS option is invoked, skip everything else and embed as directed
if(forcePDFJS && PDFJS_URL){
return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
//If traditional support is provided, or if this is a modern browser and not iOS (see comment for supportsPDFs declaration)
} else if(supportsPDFs || (assumptionMode && isModernBrowser && !isIOS)){
return generateEmbedElement(targetNode, targetSelector, url, pdfOpenFragment, width, height, id);
//If everything else has failed and a PDFJS fallback is provided, try to use it
} else if(PDFJS_URL){
return generatePDFJSiframe(targetNode, url, pdfOpenFragment, PDFJS_URL, id);
} else {
//Display the fallback link if available
if(fallbackLink){
fallbackHTML = (typeof fallbackLink === "string") ? fallbackLink : fallbackHTML_default;
targetNode.innerHTML = fallbackHTML.replace(/\[url\]/g, url);
}
return embedError("This browser does not support embedded PDFs");
}
};
return {
embed: function (a,b,c){ return embed(a,b,c); },
pdfobjectversion: (function () { return pdfobjectversion; })(),
supportsPDFs: (function (){ return supportsPDFs; })()
};
}));

View File

@ -264,8 +264,9 @@ table.userssuggest th {
margin-left: -600px !important; margin-left: -600px !important;
} }
.modal-body-ws-tree { .modal-body-custom {
max-height: 700px !important; height: 550px !important;
max-height: none !important;
} }
.modal-top-custom { .modal-top-custom {
@ -300,144 +301,3 @@ table.userssuggest th {
color: gray !important; color: gray !important;
text-decoration: none; text-decoration: none;
} }
.my-control-group-get-info {
margin-bottom: 5px !important;
margin-left: 15px;
font-size: 14px !important;
font-family: Arial, serif;
color: #222;
}
.my-control-group-get-info .controls {
margin-left: 70px !important;
}
.my-control-group-get-info .control-label {
width: 80px !important;
text-align: left !important;
padding-right: 10px !important;
font-family: Roboto, Arial, serif !important;
color: #959595;
}
.my-control-group-get-info .add-on {
width: 20px !important;
}
.my-control-group-get-info .gwt-HTML {
padding-top: 5px;
font-family: Roboto, Arial, serif !important;
word-wrap: break-word;
overflow-wrap: anywhere;
overflow: hidden;
}
.my-control-group-get-info .gwt-TextBox:hover {
cursor: text !important;
}
.my-control-group-get-info .gwt-TextArea {
width: 260px;
min-height: 60px;
height: 60px;
}
.my-control-group-get-info .btn-link {
margin-left: 7px !important;
}
.item-type-style {
margin-top: 1px;
margin-left: 10px;
margin-bottom: 10px;
padding-top: 5px;
padding-bottom: 5px;
}
.item-type-style td {
height: 30px;
}
.item-type-style td:first-child {
width: 30px;
padding-left: 5px;
}
.item-type-style td {
vertical-align: middle !important;
}
/*THIS IS THE SIZE OF DOWNLOAD ICON
IN THE 'DETAILS' PANEL*/
.item-type-style td a i{
font-size: 22px;
}
.item-details-header {
margin-top: 15px;
margin-left: 15px;
margin-right: 15px;
}
.item-details-header td {
vertical-align: middle !important;
}
.item-details-header td:last-child {
width: 85%;
color: #555;
}
.item-details-header .gwt-HTML {
font-size: 20px;
font-family: Roboto, Arial, serif !important;
color: #555;
}
.placeholder-loading {
color: rgb(142, 142, 142);
}
.shared-with-style{
width: 90% !important;
font-size: 12px !important;
display: inline-block !important;
}
.preview-image-style {
width: 95%;
display: flex;
align-items: center;
justify-content: center;
margin-left: 10px;
border: 1px solid #e6e6e6;
padding-top: 5px;
padding-bottom: 5px;
border-left: none;
border-right: none;
}
.preview-image-style img {
max-width: 400px;
}
.preview-file-style {
width: 95%;
display: flex;
align-items: center;
justify-content: center;
margin-left: 10px;
border: 1px solid #e6e6e6;
padding-top: 5px;
padding-bottom: 5px;
border-left: none;
border-right: none;
}
.my-preview-doc {
width: 350px;
height: 350px;
}

View File

@ -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, false); String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), urlMimeType);
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,true); String itemName = MimeTypeUtility.getNameWithExtension(item.getName(), mimeType);
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,false); String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType);
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,false); String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), mimeType);
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,false); String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), urlMimeType);
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(),false); String itemName = MimeTypeUtility.getNameWithExtension(descr.getItemName(), workspaceFileItem.getMimeType());
logger.info("Downloading default item: "+workspaceFileItem); logger.info("Downloading default item: "+workspaceFileItem);
//String contentDisposition = viewContent?"inline":"attachment"; //String contentDisposition = viewContent?"inline":"attachment";

View File

@ -145,21 +145,17 @@ public class ImageServlet extends HttpServlet{
try{ try{
streamDescr = wa.getThumbnailData(image.getId()); streamDescr = wa.getThumbnailData(image.getId());
logger.debug("Thumbnail data has size: "+streamDescr.getSize());
//CHECKING IF THE STREAM IS A VALID IMAGE
/*TODO /*TODO
* ReusableInputStream ris = new ReusableInputStream(streamDescr.getStream()); * UNCOMMENT THIS IF YOU WANT TO ADD MORE CONTROLS
ReusableInputStream ris = new ReusableInputStream(streamDescr.getStream());
boolean isAvalidImage = isAnImage(ris, image.getName()); boolean isAvalidImage = isAnImage(ris, image.getName());
if(!isAvalidImage) { if(!isAvalidImage)
//CREATING THE THUMBNAIL //CREATING THE THUMBNAIL
logger.debug("the stream seems not be a valid image, creating the thumbnail");
streamDescr = createThumbnailForImage(wa, image); streamDescr = createThumbnailForImage(wa, image);
}else { else {
//ASSIGNING THE REUSABLE STREAM //ASSIGNING THE REUSABLE STREAM
logger.debug("using reusable stream"); streamDescr = new org.gcube.common.storagehubwrapper.shared.tohl.impl.StreamDescriptor(ris, image.getName(), null, image.getMimeType());
size = streamDescr.getSize()==null?0:streamDescr.getSize();
logger.debug("ReusableInputStream has size: "+size);
streamDescr = new org.gcube.common.storagehubwrapper.shared.tohl.impl.StreamDescriptor(ris, image.getName(), size, streamDescr.getMimeType());
}*/ }*/
@ -190,9 +186,8 @@ public class ImageServlet extends HttpServlet{
resp.setContentType(mimeType); resp.setContentType(mimeType);
//if image/thumbnail size is 0, skipping setContentLength //if image/thumbnail size is 0, skipping setContentLength
//AVOIDING TO SET IT, SOME CASES THE SIZE MISMATCH if(size!=0)
// if(size!=0) resp.setContentLength((int)size);
// resp.setContentLength((int)size);
InputStream in = streamDescr.getStream(); InputStream in = streamDescr.getStream();

View File

@ -9,7 +9,6 @@ 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;
@ -161,13 +160,18 @@ public class NotificationStorageHubUtil {
if(isFolderAndShared(rootSharedFolder)){ //JUST TO BE SURE if(isFolderAndShared(rootSharedFolder)){ //JUST TO BE SURE
List<Member> listMembers = workspace.getSharedFolderMembers(rootSharedFolder.getId()); List<String> listPortalLogin = workspace.getSharedFolderMembers(rootSharedFolder.getId());
logger.debug("StorageHub returned "+ listMembers.size() + " user/s"); logger.debug("StorageHub returned "+ listPortalLogin.size() + " user/s");
if(!WsUtil.isWithinPortal()) if(!WsUtil.isWithinPortal())
return StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLoginTestMode(listMembers); return StorageHubToWorkpaceConverter.buildGxtInfoContactFromPortalLoginTestMode(listPortalLogin);
return StorageHubToWorkpaceConverter.listMembersToListContact(listMembers); List<InfoContactModel> listContacts = new ArrayList<InfoContactModel>(listPortalLogin.size());
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);

View File

@ -10,8 +10,7 @@ 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.common.scope.impl.ScopeBean; import org.gcube.portlets.user.workspace.server.util.WsUtil;
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;
@ -20,6 +19,7 @@ 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.
* *
@ -48,20 +48,6 @@ 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.
@ -78,17 +64,15 @@ 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 * this method looks up the generic resource among the ones available in the infrastructure using scope provider {@link ScopeProvider.instance.get()}
* infrastructure using scope provider {@link ScopeProvider.instance.get()} * resource name {@value #WORKSPACE_EXPLORER_APP_NAME} and secondaryType {@value #SECONDARY_TYPE}
* 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 * this method looks up the applicationProfile profile among the ones available in the infrastructure.
* in the infrastructure.
* *
* @return the applicationProfile profile * @return the applicationProfile profile
*/ */
@ -102,15 +86,13 @@ public class ApplicationProfileReader {
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 " + SECONDARY_TYPE + " in the scope: " + scope + ", SecondaryType: " logger.info("Trying to fetch ApplicationProfile in the scope: "+scope+", SecondaryType: " + secondaryType + ", AppId: " + appID);
+ secondaryType + ", AppId: " + appID);
Query q = new QueryBox(queryString); Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client(); DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q); List<String> appProfile = client.submit(q);
if (appProfile == null || appProfile.size() == 0) if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("Generic Resource with SecondaryType: " + secondaryType throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType + ", AppId: " + appID +" is not registered in the scope: "+scope);
+ ", AppId: " + appID + " is not registered in the scope: " + scope);
else { else {
String elem = appProfile.get(0); String elem = appProfile.get(0);
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
@ -121,36 +103,77 @@ public class ApplicationProfileReader {
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 }
throw new ApplicationProfileNotFoundException( else throw new ApplicationProfileNotFoundException("Your applicationProfile NAME was not found in the profile");
"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 }
logger.warn("No Description exists for " + appProf.getName()); else 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 }
throw new ApplicationProfileNotFoundException("Your " + SECONDARY_TYPE else throw new ApplicationProfileNotFoundException("Your applicationProfile ID n was not found in the profile, consider adding <AppId> element in <Body>");
+ " 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 { }
logger.warn("Null or empty <ThumbnailURL> element in <Body> of " + appProf.getName()); else{
logger.warn("Null or empty <ThumbnailURL> element in <Body>" + appProf.getName());
} }
currValue = helper currValue = helper.evaluate("/Resource/Profile/Body/EndPoint[Scope='"+scope.toString()+"']/Scope/text()");
.evaluate("/Resource/Profile/Body/EndPoint[Scope='" + scope.toString() + "']/Scope/text()");
appProf = readEndPointForScopeWithRetry(helper, scope, APPLICATION_PROFILE_ITEM.SCOPE, appProf); if (currValue != null && currValue.size() > 0) {
List<String> scopes = currValue;
String currentScope = scopes.get(0);
appProf = readEndPointForScopeWithRetry(helper, scope, APPLICATION_PROFILE_ITEM.URL, appProf); //int slashCount = StringUtils.countMatches(currentScope, "/");
boolean isVRE = WsUtil.isVRE(currentScope);
//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); logger.debug("returning: "+appProf);
return appProf; return appProf;
@ -161,84 +184,30 @@ public class ApplicationProfileReader {
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); }else{ logger.info("scope provider setted to orginal scope: "+originalScope);
* ScopeProvider.instance.reset(); logger.info("scope provider reset"); } }else{
*/ 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 xPath string. * Gets the gcube generic query 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 xPath string * @return the gcube generic query 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 "where $profile/Profile/SecondaryType/string() eq '"+secondaryType+"' and $profile/Profile/Body/AppId/string() " +
+ "' and $profile/Profile/Body/AppId/string() " + " eq '" + appId + "'" + "return $profile"; " eq '" + appId + "'" +
"return $profile";
} }
/** /**
@ -250,6 +219,7 @@ public class ApplicationProfileReader {
return secondaryType; return secondaryType;
} }
/** /**
* Gets the scope. * Gets the scope.
* *
@ -268,9 +238,8 @@ public class ApplicationProfileReader {
return resourceName; return resourceName;
} }
/*
* (non-Javadoc) /* (non-Javadoc)
*
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
@Override @Override
@ -289,4 +258,20 @@ 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();
// }
//
//
// }
} }

View File

@ -63,6 +63,9 @@ public class ObjectStorageHubToWorkpaceMapper {
isVreFolder = sharedFolder.isVreFolder(); isVreFolder = sharedFolder.isVreFolder();
} }
// FolderModel root = new FolderModel(workspaceRoot.getId(),workspaceRoot.getName(),null, true, workspaceRoot.isShared(), false, workspaceRoot.isPublic());
// root.setIsRoot(true);
FolderModel theFolder = new FolderModel(folder.getId(), folder.getName(), null, folder.isFolder(), folder.isShared(), isVreFolder, isPublicFolder); FolderModel theFolder = new FolderModel(folder.getId(), folder.getName(), null, folder.isFolder(), folder.isShared(), isVreFolder, isPublicFolder);
theFolder.setIsRoot(folder.isRoot()); theFolder.setIsRoot(folder.isRoot());
return theFolder; return theFolder;
@ -79,7 +82,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, GCubeUser loggedUser) throws InternalErrorException{ public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared) throws InternalErrorException{
FileModel fileModel = null; FileModel fileModel = null;
//boolean isPublic = false; //boolean isPublic = false;
@ -145,8 +148,6 @@ 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);
@ -249,32 +250,27 @@ 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
fileModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459 fileGridModel.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();
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername)); fileGridModel.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){
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername)); fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
}else }else
fileModel.setOwnerFullName(loggedUser.getFullname()); fileGridModel.setOwnerFullName(loggedUser.getFullname());
} }
logger.trace("Returning converted grid item: "+fileGridModel);
return fileGridModel;
} }

View File

@ -3,6 +3,7 @@
*/ */
package org.gcube.portlets.user.workspace.server.tostoragehub; package org.gcube.portlets.user.workspace.server.tostoragehub;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -25,7 +26,6 @@ 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;
@ -33,6 +33,7 @@ import org.gcube.common.storagehubwrapper.shared.tohl.exceptions.InternalErrorEx
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion; import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem; import org.gcube.common.storagehubwrapper.shared.tohl.items.GCubeItem;
import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap; import org.gcube.common.storagehubwrapper.shared.tohl.items.PropertyMap;
import org.gcube.portal.wssynclibrary.shared.thredds.Sync_Status;
import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize; import org.gcube.portal.wssynclibrary.thredds.WorkspaceThreddsSynchronize;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer; 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;
@ -44,16 +45,13 @@ import org.gcube.portlets.user.workspace.server.util.UserUtil;
import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType; import org.gcube.portlets.user.workspace.shared.accounting.GxtAccountingEntryType;
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.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;
/** /**
* The Class StorageHubToWorkpaceConverter. * The Class StorageHubToWorkpaceConverter.
* *
@ -62,6 +60,7 @@ import org.slf4j.LoggerFactory;
*/ */
public class StorageHubToWorkpaceConverter implements Serializable{ public class StorageHubToWorkpaceConverter implements Serializable{
/** /**
* *
*/ */
@ -72,6 +71,8 @@ public class StorageHubToWorkpaceConverter implements Serializable {
private GCubeUser loggedUser; private GCubeUser loggedUser;
private String workspaceRootId; private String workspaceRootId;
/** /**
* Instantiates a new storage hub to workpace converter. * Instantiates a new storage hub to workpace converter.
*/ */
@ -79,6 +80,68 @@ public class StorageHubToWorkpaceConverter implements Serializable {
} }
/**********************************************************************************************************************************************
*
*
*
*
* TESTING MODE METHODS
*
*
*
*
***********************************************************************************************************************************************/
protected static HashMap<String, InfoContactModel> hashTestUser = null;
/**
* Used in test mode.
*
* @return the hash test users
*/
public static HashMap<String, InfoContactModel> getHashTestUsers(){
if(hashTestUser==null){
hashTestUser = new HashMap<String, InfoContactModel>();
//USERS
hashTestUser.put("federico.defaveri", new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri",null, false));
hashTestUser.put("antonio.gioia", new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia",null, false));
hashTestUser.put("fabio.sinibaldi", new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi",null, false));
hashTestUser.put("pasquale.pagano", new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano",null, false));
hashTestUser.put("valentina.marioli", new InfoContactModel("valentina.marioli", "valentina.marioli", "Valentina Marioli",null, false));
hashTestUser.put("roberto.cirillo", new InfoContactModel("roberto.cirillo", "roberto.cirillo", "Roberto Cirillo",null, false));
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa", "francesco.mangiacrapa", "Francesco Mangiacrapa",null, false));
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante", "massimiliano.assante", "Massimiliano Assante",null, false));
}
return hashTestUser;
}
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<String> listPortalLogin){
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
for (String portalLogin : listPortalLogin)
listContact.add(getHashTestUsers().get(portalLogin));
return listContact;
}
/**********************************************************************************************************************************************
*
*
*
*
* END TESTING MODE
*
*
*
*
***********************************************************************************************************************************************/
/** /**
* To version history. * To version history.
* *
@ -95,14 +158,14 @@ public class StorageHubToWorkpaceConverter implements Serializable {
List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size()); List<FileVersionModel> listVersions = new ArrayList<FileVersionModel>(versions.size());
for (WorkspaceFileVersion wsVersion : versions) { for (WorkspaceFileVersion wsVersion : versions) {
String user = UserUtil.getUserFullName(wsVersion.getOwner()); String user = UserUtil.getUserFullName(wsVersion.getOwner());
FileVersionModel file = new FileVersionModel(wsVersion.getId(), wsVersion.getName(), FileVersionModel file = new FileVersionModel(wsVersion.getId(), wsVersion.getName(), wsVersion.getRemotePath(), user, FormatterUtil.toDate(wsVersion.getCreated()), wsVersion.isCurrentVersion());
wsVersion.getRemotePath(), user, FormatterUtil.toDate(wsVersion.getCreated()),
wsVersion.isCurrentVersion());
listVersions.add(file); listVersions.add(file);
} }
return listVersions; return listVersions;
} }
/** /**
* Instantiates a new storage hub to workpace converter. * Instantiates a new storage hub to workpace converter.
* *
@ -114,6 +177,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
this.loggedUser = loggedUser; this.loggedUser = loggedUser;
} }
/** /**
* To root folder. * To root folder.
* *
@ -121,8 +185,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
* @return the folder model * @return the folder model
* @throws InternalErrorException the internal error exception * @throws InternalErrorException the internal error exception
*/ */
public FolderModel toRootFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder folder) public FolderModel toRootFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder folder) throws InternalErrorException{
throws InternalErrorException {
return ObjectStorageHubToWorkpaceMapper.toRootFolder(folder); return ObjectStorageHubToWorkpaceMapper.toRootFolder(folder);
@ -137,14 +200,14 @@ public class StorageHubToWorkpaceConverter implements Serializable {
* @return the file model * @return the file model
* @throws InternalErrorException the internal error exception * @throws InternalErrorException the internal error exception
*/ */
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, FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
isParentShared, loggedUser); return setSynchedThreddsStateFor(fileModel, wrappedItem);
return setSynchedWithWsThredds(fileModel, wrappedItem);
} }
/** /**
* To grid file model. * To grid file model.
* *
@ -153,70 +216,48 @@ public class StorageHubToWorkpaceConverter implements Serializable {
* @return the file grid model * @return the file grid model
* @throws InternalErrorException the internal error exception * @throws InternalErrorException the internal error exception
*/ */
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, FileGridModel fileGridModel = ObjectStorageHubToWorkpaceMapper.toGridFileModelItem(wrappedItem, parentFolderModel, loggedUser);
parentFolderModel, loggedUser); return (FileGridModel) setSynchedThreddsStateFor(fileGridModel, wrappedItem);
return (FileGridModel) setSynchedWithWsThredds(fileGridModel, wrappedItem);
} }
protected FileModel setSynchedWithWsThredds(FileModel fileModel, WorkspaceItem wrappedItem) {
logger.debug("called setSynchedThreddsStateFor item id: " + wrappedItem.getId());
boolean isItemSynched = false; /**
* Sets the synched thredds state for.
*
* @param fileModel the file model
* @param wrappedItem item
* @return the file model
*/
protected FileModel setSynchedThreddsStateFor(FileModel fileModel, WorkspaceItem wrappedItem) {
Sync_Status status = null;
try {
if(wrappedItem.getPropertyMap()!=null) {
String wsSyncStatus = null;
try{ try{
Map<String, Object> mapProperties = wrappedItem.getPropertyMap().getValues(); PropertyMap map = wrappedItem.getPropertyMap();
ContainerType containerItemType = null; logger.debug("Property Map for folder: "+fileModel.getName()+" has value: "+map.getValues());
wsSyncStatus = (String) map.getValues().get(WorkspaceThreddsSynchronize.WS_SYNCH_SYNCH_STATUS);
// is it a directory? logger.debug("Item id: "+wrappedItem.getId()+" read from Shub has current: "+WorkspaceThreddsSynchronize.WS_SYNCH_SYNCH_STATUS +" value at: "+wsSyncStatus);
if (fileModel.isDirectory()) { if(wsSyncStatus!=null)
containerItemType = ContainerType.FOLDER; status = Sync_Status.valueOf(wsSyncStatus);
}
// checking other cases
if (containerItemType == null) {
switch (wrappedItem.getType()) {
case FOLDER:
case VRE_FOLDER:
case SHARED_FOLDER:
case SMART_FOLDER:
containerItemType = ContainerType.FOLDER;
break;
case FILE_ITEM:
containerItemType = ContainerType.FILE;
break;
case URL_ITEM:
containerItemType = ContainerType.URL;
break;
default:
containerItemType = ContainerType.GENERIC_ITEM;
break;
}
}
logger.debug(
"calling isItemSynched for id: " + wrappedItem.getId() + ", with name: " + wrappedItem.getName()
+ ", with map: " + mapProperties + ", containerItemType: " + containerItemType);
isItemSynched = WorkspaceThreddsSynchronize.getInstance().isItemSynched(wrappedItem.getId(), mapProperties,
containerItemType);
}catch (Exception e) { }catch (Exception e) {
logger.info("Error on calling isItemSynched for the item id: " + wrappedItem.getId() logger.warn(wsSyncStatus + " is not value of "+Sync_Status.values()+", returning null");
+ ", (means not synched)"); }
}
} catch (Exception e) {
logger.warn("It is not possible to get synched status for item: "+fileModel.getIdentifier());
} }
logger.debug("the item id: " + wrappedItem.getId() + " with name: " + wrappedItem.getName() + " is synched: " fileModel.setSyncThreddsStatus(status);
+ isItemSynched);
fileModel.setSynchedWithWsThredds(isItemSynched);
return fileModel; return fileModel;
} }
/** /**
* To file trashed model. * To file trashed model.
* *
@ -260,15 +301,13 @@ public class StorageHubToWorkpaceConverter implements Serializable {
fileTrashModel.setShared(trashItem.isShared()); fileTrashModel.setShared(trashItem.isShared());
logger.debug("Converting return trash item: " + fileTrashModel.getName() + " id: " logger.debug("Converting return trash item: "+fileTrashModel.getName() +" id: "+fileTrashModel.getIdentifier());
+ fileTrashModel.getIdentifier());
logger.trace("Returning trash item: "+fileTrashModel); logger.trace("Returning trash item: "+fileTrashModel);
}catch (Exception e) { }catch (Exception e) {
logger.debug("Error into toFileTrashedModel for item: " + fileTrashModel.getName() + " id: " logger.debug("Error into toFileTrashedModel for item: "+fileTrashModel.getName() +" id: "+fileTrashModel.getIdentifier());
+ fileTrashModel.getIdentifier());
return null; return null;
} }
@ -277,6 +316,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
} }
/** /**
* Builds the gxt info contact from portal login. * Builds the gxt info contact from portal login.
* *
@ -304,51 +344,9 @@ 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****
* WORKSPACESPECIALFOLDER**** REMOVE THIS METHOD AND ADDING INSTANCE OF AT * REMOVE THIS METHOD AND ADDING INSTANCE OF AT buildGXTFolderModelItem.
* buildGXTFolderModelItem.
* *
* @param wsFolder the ws folder * @param wsFolder the ws folder
* @param parent the parent * @param parent the parent
@ -356,10 +354,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
* @return the folder model * @return the folder model
* @throws InternalErrorException the internal error exception * @throws InternalErrorException the internal error exception
*/ */
public FolderModel buildGXTFolderModelItemHandleSpecialFolder( public FolderModel buildGXTFolderModelItemHandleSpecialFolder(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsFolder, org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem parent, String specialFolderName) throws InternalErrorException {
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wsFolder,
org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem parent, String specialFolderName)
throws InternalErrorException {
String name = ""; String name = "";
@ -376,8 +371,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
name = shared.getName(); name = shared.getName();
//MANAGEMENT SPECIAL FOLDER //MANAGEMENT SPECIAL FOLDER
} else if (wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS) == 0 && parent != null }else if(wsFolder.getName().compareTo(ConstantsExplorer.MY_SPECIAL_FOLDERS)==0 && parent!=null && parent.isRoot()){
&& parent.isRoot()) {
//MANAGEMENT SPECIAL FOLDER //MANAGEMENT SPECIAL FOLDER
logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: "+specialFolderName); logger.debug("MANAGEMENT SPECIAL FOLDER NAME REWRITING AS: "+specialFolderName);
if(specialFolderName!=null && !specialFolderName.isEmpty()) if(specialFolderName!=null && !specialFolderName.isEmpty())
@ -390,15 +384,12 @@ public class StorageHubToWorkpaceConverter implements Serializable {
} }
logger.debug("Name is: "+name); logger.debug("Name is: "+name);
boolean isPublicDir = ((org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) wsFolder) boolean isPublicDir = ((org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceFolder) wsFolder).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);
folder.setShareable(true); folder.setShareable(true);
folder.setIsRoot(wsFolder.isRoot()); folder.setIsRoot(wsFolder.isRoot());
folder.setDescription(wsFolder.getDescription()); folder.setDescription(wsFolder.getDescription());
@ -411,6 +402,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
return folder; return folder;
} }
/** /**
* Gets the workspace root id. * Gets the workspace root id.
* *
@ -421,6 +413,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
return workspaceRootId; return workspaceRootId;
} }
/** /**
* Sets the workspace root id. * Sets the workspace root id.
* *
@ -431,6 +424,8 @@ public class StorageHubToWorkpaceConverter implements Serializable {
this.workspaceRootId = workspaceRootId; this.workspaceRootId = workspaceRootId;
} }
/** /**
* To simple map. * To simple map.
* *
@ -464,6 +459,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
} }
} }
/** /**
* Builds the GXT accounting item. * Builds the GXT accounting item.
* *
@ -471,8 +467,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
* @param gxtEntryType the gxt entry type * @param gxtEntryType the gxt entry type
* @return the list * @return the list
*/ */
public List<GxtAccountingField> buildGXTAccountingItem(List<AccountEntry> accoutings, public List<GxtAccountingField> buildGXTAccountingItem(List<AccountEntry> accoutings, GxtAccountingEntryType gxtEntryType) {
GxtAccountingEntryType gxtEntryType) {
List<GxtAccountingField> listAccFields = new ArrayList<GxtAccountingField>(); List<GxtAccountingField> listAccFields = new ArrayList<GxtAccountingField>();
@ -482,14 +477,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
for (AccountEntry shubAccEntry : accoutings) { for (AccountEntry shubAccEntry : accoutings) {
GxtAccountingField af = new GxtAccountingField(); GxtAccountingField af = new GxtAccountingField();
InfoContactModel user = buildGxtInfoContactFromPortalLogin(shubAccEntry.getUser());
String theUser = shubAccEntry.getUser();
InfoContactModel user = null;
// Ignoring get user details from Liferay in case of user equal to 'ALL'
if (theUser != null && !theUser.equalsIgnoreCase("ALL")) {
user = buildGxtInfoContactFromPortalLogin(shubAccEntry.getUser());
}
af.setUser(user); af.setUser(user);
af.setDate(FormatterUtil.toDate(shubAccEntry.getDate())); af.setDate(FormatterUtil.toDate(shubAccEntry.getDate()));
@ -497,25 +485,20 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case CREATE: case CREATE:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CREATE)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.CREATE)) {
AccountEntryCreate create = (AccountEntryCreate) shubAccEntry; AccountEntryCreate create = (AccountEntryCreate) shubAccEntry;
af.setOperation(GxtAccountingEntryType.CREATE); af.setOperation(GxtAccountingEntryType.CREATE);
// af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by // af.setDescription(GxtAccountingEntryType.CREATE.getName() + " by "+user.getName());
// "+user.getName());
String msg = ""; String msg = "";
if(create.getItemName()==null || create.getItemName().isEmpty()) if(create.getItemName()==null || create.getItemName().isEmpty())
msg = GxtAccountingEntryType.CREATE.getId() + " by "+user.getName(); msg = GxtAccountingEntryType.CREATE.getId() + " by "+user.getName();
else{ else{
if(create.getVersion()==null) if(create.getVersion()==null)
msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by " msg = create.getItemName() + " " + GxtAccountingEntryType.CREATE.getName() + " by "+user.getName();
+ user.getName();
else else
msg = create.getItemName() + " v. " + create.getVersion() + " " msg = create.getItemName() + " v. "+create.getVersion()+" "+ GxtAccountingEntryType.CREATE.getName() + " by "+user.getName();
+ GxtAccountingEntryType.CREATE.getName() + " by " + user.getName();
} }
af.setDescription(msg); af.setDescription(msg);
@ -525,13 +508,11 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case READ: case READ:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.READ)){
|| gxtEntryType.equals(GxtAccountingEntryType.READ)) {
AccountEntryRead read = (AccountEntryRead) shubAccEntry; AccountEntryRead read = (AccountEntryRead) shubAccEntry;
af.setOperation(GxtAccountingEntryType.READ); af.setOperation(GxtAccountingEntryType.READ);
af.setDescription(read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by " af.setDescription(read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName());
+ user.getName());
String msg = ""; String msg = "";
if(read.getItemName()==null || read.getItemName().isEmpty()) if(read.getItemName()==null || read.getItemName().isEmpty())
@ -539,11 +520,9 @@ public class StorageHubToWorkpaceConverter implements Serializable {
else{ else{
if(read.getVersion()==null) if(read.getVersion()==null)
msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by " msg = read.getItemName() + " " + GxtAccountingEntryType.READ.getName() + " by "+user.getName();
+ user.getName();
else else
msg = read.getItemName() + " v." + read.getVersion() + " " msg = read.getItemName() + " v."+read.getVersion() +" "+ GxtAccountingEntryType.READ.getName() + " by "+user.getName();
+ GxtAccountingEntryType.READ.getName() + " by " + user.getName();
} }
af.setDescription(msg); af.setDescription(msg);
@ -553,9 +532,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case CUT: case CUT:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.CUT)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.CUT)) {
af.setOperation(GxtAccountingEntryType.CUT); af.setOperation(GxtAccountingEntryType.CUT);
@ -568,18 +545,14 @@ public class StorageHubToWorkpaceConverter implements Serializable {
msg = GxtAccountingEntryType.CUT.getName() +" by "+user.getName(); msg = GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
else{ else{
if(cut.getVersion()==null) if(cut.getVersion()==null)
msg = cut.getItemName() + " " + GxtAccountingEntryType.CUT.getName() + " by " msg = cut.getItemName()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
+ user.getName();
else else
msg = cut.getItemName() + " v." + cut.getVersion() + " " msg = cut.getItemName()+" v."+cut.getVersion()+" "+GxtAccountingEntryType.CUT.getName() +" by "+user.getName();
+ GxtAccountingEntryType.CUT.getName() + " by " + user.getName();
} }
af.setDescription(msg); af.setDescription(msg);
}else { }else {
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind " logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryCut.class.getSimpleName());
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryCut.class.getSimpleName());
} }
} }
@ -587,118 +560,91 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case PASTE: case PASTE:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.PASTE)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.PASTE)) {
af.setOperation(GxtAccountingEntryType.PASTE); af.setOperation(GxtAccountingEntryType.PASTE);
AccountEntryPaste paste = (AccountEntryPaste) shubAccEntry; AccountEntryPaste paste = (AccountEntryPaste) shubAccEntry;
if(paste.getVersion()==null) if(paste.getVersion()==null)
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " from " + paste.getFromPath() af.setDescription(GxtAccountingEntryType.PASTE.getName() + " from "+paste.getFromPath()+" by "+user.getName());
+ " by " + user.getName());
else else
af.setDescription(GxtAccountingEntryType.PASTE.getName() + " v. " + paste.getVersion() af.setDescription(GxtAccountingEntryType.PASTE.getName() + " v. "+paste.getVersion()+" from "+paste.getFromPath()+" by "+user.getName());
+ " from " + paste.getFromPath() + " by " + user.getName());
} }
break; break;
case REMOVAL: case REMOVAL:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.REMOVE)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.REMOVE)) {
if(shubAccEntry instanceof AccountFolderEntryRemoval) { if(shubAccEntry instanceof AccountFolderEntryRemoval) {
af.setOperation(GxtAccountingEntryType.REMOVE); af.setOperation(GxtAccountingEntryType.REMOVE);
AccountFolderEntryRemoval rem = (AccountFolderEntryRemoval) shubAccEntry; AccountFolderEntryRemoval rem = (AccountFolderEntryRemoval) shubAccEntry;
String msg = rem.getItemName() == null || rem.getItemName().isEmpty() ? "" String msg = rem.getItemName()==null || rem.getItemName().isEmpty()?"":rem.getItemName()+" ";
: rem.getItemName() + " ";
if(rem.getVersion()==null) if(rem.getVersion()==null)
msg+= GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName(); msg+= GxtAccountingEntryType.REMOVE.getName() +" by "+user.getName();
else else
msg += GxtAccountingEntryType.REMOVE.getName() + " v." + rem.getVersion() + " by " msg+= GxtAccountingEntryType.REMOVE.getName() +" v."+rem.getVersion()+" by "+user.getName();
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
}else { }else {
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind " logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryRemoval.class.getSimpleName());
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryRemoval.class.getSimpleName());
} }
} }
break; break;
case RENAMING: case RENAMING:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RENAME)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.RENAME)) {
if(shubAccEntry instanceof AccountFolderEntryRenaming) { if(shubAccEntry instanceof AccountFolderEntryRenaming) {
af.setOperation(GxtAccountingEntryType.RENAME); af.setOperation(GxtAccountingEntryType.RENAME);
AccountFolderEntryRenaming ren = (AccountFolderEntryRenaming) shubAccEntry; AccountFolderEntryRenaming ren = (AccountFolderEntryRenaming) shubAccEntry;
String msg = ren.getOldItemName() == null || ren.getOldItemName().isEmpty() ? "" String msg = ren.getOldItemName()==null || ren.getOldItemName().isEmpty()?"":ren.getOldItemName()+" ";
: ren.getOldItemName() + " ";
if(ren.getVersion()==null) if(ren.getVersion()==null)
msg += GxtAccountingEntryType.RENAME.getName() + " to " + ren.getNewItemName() + " by " msg+= GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
+ user.getName();
else else
msg += " v." + ren.getVersion() + " " + GxtAccountingEntryType.RENAME.getName() + " to " msg+= " v."+ren.getVersion() +" "+GxtAccountingEntryType.RENAME.getName() +" to "+ ren.getNewItemName()+ " by "+user.getName();
+ ren.getNewItemName() + " by " + user.getName();
af.setDescription(msg); af.setDescription(msg);
}else { }else {
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind " logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryRenaming.class.getSimpleName());
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryRenaming.class.getSimpleName());
} }
} }
break; break;
case ADD: case ADD:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ADD)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.ADD)) {
if(shubAccEntry instanceof AccountFolderEntryAdd) { if(shubAccEntry instanceof AccountFolderEntryAdd) {
af.setOperation(GxtAccountingEntryType.ADD); af.setOperation(GxtAccountingEntryType.ADD);
AccountFolderEntryAdd acc = (AccountFolderEntryAdd) shubAccEntry; AccountFolderEntryAdd acc = (AccountFolderEntryAdd) shubAccEntry;
String msg = acc.getItemName() == null || acc.getItemName().isEmpty() ? "" String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
: acc.getItemName() + " ";
if(acc.getVersion()==null) if(acc.getVersion()==null)
msg+=GxtAccountingEntryType.ADD.getName()+ " by "+user.getName(); msg+=GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
else else
msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.ADD.getName() + " by " msg+=" v."+acc.getVersion()+ " "+GxtAccountingEntryType.ADD.getName()+ " by "+user.getName();
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
}else { }else {
logger.warn("Found an " + AccountingEntryType.class.getSimpleName() + " of kind " logger.warn("Found an "+AccountingEntryType.class.getSimpleName()+" of kind "+shubAccEntry.getType()+ " not castable to (instance of) "+AccountFolderEntryAdd.class.getSimpleName());
+ shubAccEntry.getType() + " not castable to (instance of) "
+ AccountFolderEntryAdd.class.getSimpleName());
} }
} }
break; break;
case UPDATE: case UPDATE:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UPDATE)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.UPDATE)) {
af.setOperation(GxtAccountingEntryType.UPDATE); af.setOperation(GxtAccountingEntryType.UPDATE);
AccountEntryUpdate upd = (AccountEntryUpdate) shubAccEntry; AccountEntryUpdate upd = (AccountEntryUpdate) shubAccEntry;
String msg = upd.getItemName() == null || upd.getItemName().isEmpty() ? "" String msg = upd.getItemName()==null || upd.getItemName().isEmpty()?"":upd.getItemName()+" ";
: upd.getItemName() + " ";
if(upd.getVersion()==null) if(upd.getVersion()==null)
msg+=GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName(); msg+=GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
else else
msg += " v." + upd.getVersion() + " " + GxtAccountingEntryType.UPDATE.getName() + " by " msg+=" v."+upd.getVersion()+" "+GxtAccountingEntryType.UPDATE.getName()+" by "+user.getName();
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -706,9 +652,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case SHARE: case SHARE:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.SHARE)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.SHARE)) {
af.setOperation(GxtAccountingEntryType.SHARE); af.setOperation(GxtAccountingEntryType.SHARE);
@ -716,14 +660,12 @@ public class StorageHubToWorkpaceConverter implements Serializable {
String msg = ""; String msg = "";
if(acc.getItemName()==null || acc.getItemName().isEmpty()) if(acc.getItemName()==null || acc.getItemName().isEmpty())
msg = "\"" + user.getName() + "\" " + GxtAccountingEntryType.SHARE.getName() + " folder"; msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder";
else else
msg = user.getName() + " " + GxtAccountingEntryType.SHARE.getName() + " folder " msg = user.getName() + " "+GxtAccountingEntryType.SHARE.getName()+ " workspace folder "+acc.getItemName();
+ acc.getItemName();
if(acc.getMembers()!=null && acc.getMembers().length>0) if(acc.getMembers()!=null && acc.getMembers().length>0)
msg += " with " msg+=" with "+UserUtil.separateFullNameToCommaForPortalLogin(Arrays.asList(acc.getMembers()));
+ UserUtil.separateFullNameToCommaForPortalLogin(Arrays.asList(acc.getMembers()));
af.setDescription(msg); af.setDescription(msg);
} }
@ -731,45 +673,28 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case UNSHARE: case UNSHARE:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.UNSHARE)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.UNSHARE)) {
af.setOperation(GxtAccountingEntryType.UNSHARE); af.setOperation(GxtAccountingEntryType.UNSHARE);
AccountEntryUnshare uns = (AccountEntryUnshare) shubAccEntry; AccountEntryUnshare uns = (AccountEntryUnshare) shubAccEntry;
String msg = "Folder "; String msg = uns.getItemName()==null || uns.getItemName().isEmpty()?"":uns.getItemName()+" ";
msg += uns.getItemName() == null || uns.getItemName().isEmpty() ? "" msg+=GxtAccountingEntryType.UNSHARE.getName()+" by "+user.getName();
: "\"" + uns.getItemName() + "\" ";
// see Task #19544
if (shubAccEntry.getUser().equalsIgnoreCase("ALL")) {
// CASE ALL
msg = "The folder is no longer shared with others";
user = new InfoContactModel(theUser, "n.a.", "n.a.", null, false);
} else {
msg += "is no longer shared with " + user.getName();
user = new InfoContactModel(theUser, "Owner / Admin", "Owner / Admin", null, false);
}
af.setUser(user);
af.setDescription(msg); af.setDescription(msg);
} }
break; break;
case RESTORE: case RESTORE:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.RESTORE)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.RESTORE)) {
af.setOperation(GxtAccountingEntryType.RESTORE); af.setOperation(GxtAccountingEntryType.RESTORE);
AccountEntryRestore acc = (AccountEntryRestore) shubAccEntry; AccountEntryRestore acc = (AccountEntryRestore) shubAccEntry;
String msg = acc.getItemName() == null || acc.getItemName().isEmpty() ? "" String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
: acc.getItemName() + " ";
if(acc.getVersion()==null) if(acc.getVersion()==null)
msg+=GxtAccountingEntryType.RESTORE.getName()+" by "+user.getName(); msg+=GxtAccountingEntryType.RESTORE.getName()+" by "+user.getName();
else else
msg += " v." + acc.getVersion() + " " + GxtAccountingEntryType.RESTORE.getName() + " by " msg+=" v."+acc.getVersion()+" "+GxtAccountingEntryType.RESTORE.getName() +" by "+user.getName();
+ user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -777,15 +702,12 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case DISABLED_PUBLIC_ACCESS: case DISABLED_PUBLIC_ACCESS:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS)) {
af.setOperation(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS); af.setOperation(GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS);
AccountEntryDisabledPublicAccess acc = (AccountEntryDisabledPublicAccess) shubAccEntry; AccountEntryDisabledPublicAccess acc = (AccountEntryDisabledPublicAccess) shubAccEntry;
//TODO acc.getItemName() is missing in SHUB //TODO acc.getItemName() is missing in SHUB
// String msg = acc.getItemName()==null || //String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
// acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
String msg=GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS.getName()+" by "+user.getName(); String msg=GxtAccountingEntryType.DISABLED_PUBLIC_ACCESS.getName()+" by "+user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -794,15 +716,12 @@ public class StorageHubToWorkpaceConverter implements Serializable {
case ENABLED_PUBLIC_ACCESS: case ENABLED_PUBLIC_ACCESS:
if (gxtEntryType == null || gxtEntryType.equals(GxtAccountingEntryType.ALL) if(gxtEntryType==null || gxtEntryType.equals(GxtAccountingEntryType.ALL) || gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD) || gxtEntryType.equals(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS)){
|| gxtEntryType.equals(GxtAccountingEntryType.ALLWITHOUTREAD)
|| gxtEntryType.equals(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS)) {
af.setOperation(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS); af.setOperation(GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS);
AccountEntryEnabledPublicAccess acc = (AccountEntryEnabledPublicAccess) shubAccEntry; AccountEntryEnabledPublicAccess acc = (AccountEntryEnabledPublicAccess) shubAccEntry;
//TODO acc.getItemName() is missing in SHUB //TODO acc.getItemName() is missing in SHUB
// String msg = acc.getItemName()==null || //String msg = acc.getItemName()==null || acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
// acc.getItemName().isEmpty()?"":acc.getItemName()+" ";
String msg=GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS.getName()+" by "+user.getName(); String msg=GxtAccountingEntryType.ENABLED_PUBLIC_ACCESS.getName()+" by "+user.getName();
af.setDescription(msg); af.setDescription(msg);
} }
@ -823,6 +742,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
} }
/** /**
* Gets the gcube item properties for gcube item as HTML. * Gets the gcube item properties for gcube item as HTML.
* *
@ -831,6 +751,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
*/ */
public String getGcubeItemPropertiesForGcubeItemAsHTML(WorkspaceItem wsItem) { public String getGcubeItemPropertiesForGcubeItemAsHTML(WorkspaceItem wsItem) {
Map<String, String> properties = getGcubeItemProperties(wsItem); Map<String, String> properties = getGcubeItemProperties(wsItem);
if(properties!=null){ if(properties!=null){
@ -860,6 +781,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
} }
} }
/** /**
* Gets the gcube item properties. * Gets the gcube item properties.
* *
@ -883,73 +805,4 @@ public class StorageHubToWorkpaceConverter implements Serializable {
return null; return null;
} }
/**********************************************************************************************************************************************
*
*
*
*
* TESTING MODE METHODS
*
*
*
*
***********************************************************************************************************************************************/
protected static HashMap<String, InfoContactModel> hashTestUser = null;
/**
* Used in test mode.
*
* @return the hash test users
*/
public static HashMap<String, InfoContactModel> getHashTestUsers() {
if (hashTestUser == null) {
hashTestUser = new HashMap<String, InfoContactModel>();
// USERS
hashTestUser.put("federico.defaveri",
new InfoContactModel("federico.defaveri", "federico.defaveri", "Federico de Faveri", null, false));
hashTestUser.put("antonio.gioia",
new InfoContactModel("antonio.gioia", "antonio.gioia", "Antonio Gioia", null, false));
hashTestUser.put("fabio.sinibaldi",
new InfoContactModel("fabio.sinibaldi", "fabio.sinibaldi", "Fabio Sinibaldi", null, false));
hashTestUser.put("pasquale.pagano",
new InfoContactModel("pasquale.pagano", "pasquale.pagano", "Pasquale Pagano", null, false));
hashTestUser.put("valentina.marioli",
new InfoContactModel("valentina.marioli", "valentina.marioli", "Valentina Marioli", null, false));
hashTestUser.put("roberto.cirillo",
new InfoContactModel("roberto.cirillo", "roberto.cirillo", "Roberto Cirillo", null, false));
hashTestUser.put("francesco.mangiacrapa", new InfoContactModel("francesco.mangiacrapa",
"francesco.mangiacrapa", "Francesco Mangiacrapa", null, false));
hashTestUser.put("massimiliano.assante", new InfoContactModel("massimiliano.assante",
"massimiliano.assante", "Massimiliano Assante", null, false));
}
return hashTestUser;
}
public static List<InfoContactModel> buildGxtInfoContactFromPortalLoginTestMode(List<Member> listMemebers) {
List<InfoContactModel> listContact = new ArrayList<InfoContactModel>();
for (Member member : listMemebers)
listContact.add(getHashTestUsers().get(member.getIdentity()));
return listContact;
}
/**********************************************************************************************************************************************
*
*
*
*
* END TESTING MODE
*
*
*
*
***********************************************************************************************************************************************/
} }

View File

@ -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
/** /**
* The Class MimeTypeUtil. * The Class MimeTypeUtil.
* *
@ -49,19 +48,15 @@ public class MimeTypeUtility {
protected static final Map<String, List<String>> mimetype_extension_map = new LinkedHashMap<String, List<String>>(); protected static final Map<String, List<String>> mimetype_extension_map = new LinkedHashMap<String, List<String>>();
protected static final Map<String, String> extension_mimetype_map = new LinkedHashMap<String, String>(); protected static final Map<String, String> extension_mimetype_map = new LinkedHashMap<String, String>();
protected static final Map<String, List<String>> preview_mimetype_extension_map = new LinkedHashMap<String, List<String>>();
static { static {
InputStream extensionToMimetype = MimeTypeUtility.class InputStream extensionToMimetype = MimeTypeUtility.class
.getResourceAsStream("/WsExtensionToMimeTypeMap.properties"); .getResourceAsStream("/WsExtensionToMimeTypeMap.properties");
InputStream mimetypeToExtension = MimeTypeUtility.class InputStream mimetypeToExtension = MimeTypeUtility.class
.getResourceAsStream("/WsMimeTypeToExtensionMap.properties"); .getResourceAsStream("/WsMimeTypeToExtensionMap.properties");
InputStream previewMimeTypeToExtension = MimeTypeUtility.class
.getResourceAsStream("/PreviewMimeTypeToExtensionMap.properties");
try { try {
loadExtensions(extensionToMimetype); loadExtensions(extensionToMimetype);
loadMimeTypes(mimetypeToExtension); loadMimeTypes(mimetypeToExtension);
loadPreviewMimeTypes(previewMimeTypeToExtension);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -120,34 +115,6 @@ public class MimeTypeUtility {
br.close(); br.close();
} }
/**
* Load preview mime types.
*
* @param is the is
* @throws IOException Signals that an I/O exception has occurred.
*/
protected static void loadPreviewMimeTypes(InputStream is) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = br.readLine();
while (line != null) {
String[] split = line.split("=");
if (split.length == 2) {
String mimeType = split[0];
String extension = split[1];
List<String> toExtensions = preview_mimetype_extension_map.get(mimeType);
if (toExtensions == null) {
toExtensions = new ArrayList<String>();
}
toExtensions.add(extension);
preview_mimetype_extension_map.put(mimeType, toExtensions);
}
line = br.readLine();
}
br.close();
}
/** /**
* Gets the extension. * Gets the extension.
* *
@ -163,12 +130,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, boolean isFolder) throws IOException { public static String getNameWithExtension(String name, String mimeType) 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);
@ -176,30 +143,52 @@ public class MimeTypeUtility {
} }
String declaredExtension = FilenameUtils.getExtension(name); String declaredExtension = FilenameUtils.getExtension(name);
logger.info("The name " + name + " contains the extension: " + declaredExtension); logger.debug("The name " + name + " contains the extension: " + declaredExtension);
//If the filename contains the extension returning the name like it is (skipping the folder) if (declaredExtension.equals("exe"))
if (declaredExtension != null && !declaredExtension.isEmpty() && !isFolder) { return name;
logger.debug(
"The filename contains a not empty extension: " + declaredExtension + ", so returning the name like it is"); List<String> extensions = MimeTypeUtility.getExtension(mimeType);
logger.trace("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);
}
// 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; return name;
} }
logger.debug("Either the name does not contains the extension or it is a folder, deriving extension from mimeType"); // if(!dEextL.trim().contains(" ")) {
List<String> extensions = MimeTypeUtility.getExtension(mimeType); // logger.trace("The Extension declared in the name "+name+" seems a valid suffix (without other spaces) so returning the input name: "+name);
logger.debug("Extension/s available for input mimetype: " + mimeType + " into map is/are: " + extensions); // return name;
// }
String toMimeTypeExtension = ""; logger.debug("No logic seems to match the extension declared in the name " + declaredExtension
String fullName = name; + " as a valid extension so I'm adding the extension derived from mime type map: "
if (extensions != null && extensions.size() > 0) { + toMimeTypeExtension);
// 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);
} }
logger.info("returning full name:" + fullName); // CHECKING THE FOLLOWING IN ORDER TO AVOID THE DOT AS LAST CHAR OF FILENAME
return fullName; if (toMimeTypeExtension.isEmpty()) {
return name;
}
String fullname = String.format("%s%s%s", name, DOT_STRING, toMimeTypeExtension);
logger.trace("returning full name:" + fullname);
return fullname;
} }
@ -291,14 +280,4 @@ public class MimeTypeUtility {
return extension_mimetype_map; return extension_mimetype_map;
} }
/**
* Gets the preview mimetype extension map with the mime types allowed for
* preview displaying
*
* @return the preview mimetype extension map
*/
public static Map<String, List<String>> getPreviewMimetypeExtensionMap() {
return preview_mimetype_extension_map;
}
} }

View File

@ -136,7 +136,7 @@ public class ThumbnailGenerator {
extension = extension.startsWith(".") ? extension : "." + extension; extension = extension.startsWith(".") ? extension : "." + extension;
final File tempFile = File.createTempFile(filename, extension); final File tempFile = File.createTempFile(filename, extension);
tempFile.deleteOnExit(); //tempFile.deleteOnExit();
try (FileOutputStream out = new FileOutputStream(tempFile)) { try (FileOutputStream out = new FileOutputStream(tempFile)) {
IOUtils.copy(in, out); IOUtils.copy(in, out);
} }

View File

@ -1,62 +0,0 @@
application/msword=doc
application/pdf=pdf
application/rtf=rtf
application/vnd.ms-excel=xls
application/vnd.ms-powerpoint=ppt
application/vnd.openxmlformats-officedocument.wordprocessingml.document=docx
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=xlsx
application/vnd.openxmlformats-officedocument.presentationml.presentation=pptx
application/x-javascript=js
application/json=json
audio/mid=mid
audio/mpeg=mp3
audio/x-wav=wav
image/bmp=bmp
image/gif=gif
image/ief=ief
image/jpeg=jpe
image/jpeg=jpeg
image/jpeg=jpg
image/pipeg=jfif
image/svg+xml=svg
image/tiff=tif
image/tiff=tiff
image/x-cmu-raster=ras
image/x-cmx=cmx
image/x-icon=ico
image/x-rgb=rgb
text/css=css
text/html=htm
text/html=stm
text/html=html
text/plain=bas
text/plain=c
text/plain=h
text/plain=txt
text/richtext=rtx
text/scriptlet=sct
text/tab-separated-values=tsv
text/uri-list=txt
text/webviewhtml=htt
text/x-component=htc
video/mpeg=mp2
video/mpeg=mpa
video/mpeg=mpe
video/mpeg=mpeg
video/mpeg=mpg
video/mpeg=mpv2
video/quicktime=mov
video/quicktime=qt
video/x-la-asf=lsf
video/x-la-asf=lsx
video/x-ms-asf=asf
video/x-ms-asf=asr
video/x-ms-asf=asx
video/x-msvideo=avi
video/x-sgi-movie=movie
x-world/x-vrml=flr
x-world/x-vrml=vrml
x-world/x-vrml=wrl
x-world/x-vrml=wrz
x-world/x-vrml=xaf
x-world/x-vrml=xof

View File

@ -181,7 +181,6 @@ 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

View File

@ -149,7 +149,6 @@ 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

1
src/test/.gitignore vendored
View File

@ -1 +0,0 @@
/resources/

View File

@ -1,71 +0,0 @@
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()) { 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), false); String toFileName = MimeTypeUtility.getNameWithExtension(keyFileName, fileNamesToMimeTypes.get(keyFileName));
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();

View File

@ -3,7 +3,10 @@
*/ */
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;

View File

@ -1,25 +1,29 @@
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();
}
}
} }

View File

@ -1,26 +0,0 @@
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();
}
}
}