Compare commits
203 Commits
task_21856
...
master
10
.classpath
10
.classpath
|
@ -1,16 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
|
@ -35,5 +31,5 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
eclipse.preferences.version=1
|
||||
jarsExcludedFromWebInfLib=
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.2.0
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -13,8 +13,210 @@
|
|||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-2.0.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-3.2.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -29,7 +231,108 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -44,7 +347,108 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -59,7 +463,60 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -74,10 +531,108 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="geoportal-data-common-1.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -92,7 +647,108 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -107,7 +763,108 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -122,7 +879,108 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
86
CHANGELOG.md
86
CHANGELOG.md
|
@ -4,7 +4,91 @@
|
|||
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).
|
||||
|
||||
## [v2.0.0-SNAPSHOT] - 2021-09-29
|
||||
## [v3.2.2] - 2024-01-11
|
||||
|
||||
- Improved display of results on multiple fields (in the table) [#26372]
|
||||
|
||||
## [v3.2.1] - 2023-06-16
|
||||
|
||||
- Fixed issue in the Search facility [#25265]
|
||||
|
||||
## [v3.2.0] - 2023-05-12
|
||||
|
||||
- Implemented the Update facility [#24166]
|
||||
- Integrated with the geoportal-data-mapper library [#24244]
|
||||
- Integrated the Geoportal Data-Viewer Widget [#25015]
|
||||
- Passed to Geoportal_Resolver service [#25031]
|
||||
- Provided the "View Document" and "View As JSON" facilities
|
||||
- DELETE relation operation allowed only in DRAFT phase [#25104]
|
||||
|
||||
## [v3.1.0] - 2023-03-06
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#24569] The Edit operation is available only in the "DRAFT" phase
|
||||
- [#24571] The "Create Relation" operation is available only in the "DRAFT" phase
|
||||
|
||||
## [v3.0.2] - 2023-02-02
|
||||
|
||||
#### Fixes
|
||||
|
||||
- [#24520] Added parameter "force=true" to Delete Project
|
||||
- [#24475] Propagated the Access Policy in the fileset
|
||||
|
||||
## [v3.0.1] - 2023-01-19
|
||||
|
||||
#### Fixes
|
||||
|
||||
- [#24281] Fixed filtering selection label
|
||||
- [#24049] Fixed "Show on Map" facility vs Chrome browser
|
||||
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
|
||||
|
||||
## [v3.0.0] - 2022-11-09
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#22684] Migrated to geoportal-data-entry-app configuration for UCD
|
||||
- [#23587] GUI model viewer passed to tree data structure
|
||||
- [#22883] Integrated with (the new) geoportal-client (>= 1.1.0-SNAPSHOT)
|
||||
- [#22685] Migrated to geoportal-data-list configuration for UCD
|
||||
- [#23784] Migrated list and reload, searching and ordering functionalities
|
||||
- [#23785] Migrated the GNA functionalities
|
||||
- [#23834] Integrated with the create/view/delete Relationship facility
|
||||
- [#23913] Integrated with GUI presentation configurations read from IS
|
||||
- [#23926] Integrated a Post Creation Action in the UCD and manage it
|
||||
- [#24136] Integrated the temporal dimension on the front-end side
|
||||
- [#24458] Published projects cannot be edited/updated
|
||||
|
||||
|
||||
## [v2.2.1] - 2022-06-29
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#23593] Shown the published/unpublished field in the table
|
||||
- Passed to maven-portal-bom 3.6.4
|
||||
|
||||
## [v2.2.0] - 2022-06-08
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#23390] Implemented facility: "Clone Project"
|
||||
- [#23457] Implemented the "Publish/UnPublish Project" facility
|
||||
|
||||
## [v2.1.0] - 2021-11-24
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#22455] Integrated with roles: (Data-Member as default), Data-Manager, Data-Editor
|
||||
- [#22287] Integrated with base search, ordering and filtering facility provided by MongoDB
|
||||
- [#22506] Re-engineered the common utilities
|
||||
|
||||
|
||||
## [v2.0.1] - 2021-11-17
|
||||
|
||||
- [#22369] Just to include the bug fix for Policy and LicenseID in the geoportal-common
|
||||
|
||||
|
||||
## [v2.0.0] - 2021-09-29
|
||||
|
||||
#### Enhancements
|
||||
|
||||
|
|
42
README.md
42
README.md
|
@ -1,6 +1,6 @@
|
|||
# GeoPortal Data Entry App
|
||||
|
||||
The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project
|
||||
Geoportal data-entry technology allows the actors who use it, the project management of spatio-temporal documents specified by meta-documents called "Use Case Descriptor" (UCD) which determine the document model, management, life cycle, etc. The system allows you to: (i) access and search for published projects by role for VRE, (ii) access the project publication report, view the publication status (SUCCESS, WARNING, ERROR), etc., (iii ) generate links for visualization on the map, (iv) update the contents of the registered projects through the workflow, (v) manage the relationships (quantity and quality temporal links) between the documents. In general, the technology allows the data entry of any document having spatio-temporal characteristics, whose metadata and payload are specified by one or more "gCube Profile" profiles which determine the structure of the resulting document (JSON).
|
||||
|
||||
## Built With
|
||||
|
||||
|
@ -9,14 +9,50 @@ The GeoPortal Data Entry App is an application to build the web forms for data e
|
|||
|
||||
**Uses**
|
||||
|
||||
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
|
||||
* GWT v.2.10.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
|
||||
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* pretty-print-json v.1.1. [pretty-print-json](https://github.com/center-key/pretty-print-json) is licensed under [MIT](https://github.com/center-key/pretty-print-json/blob/main/LICENSE.txt)
|
||||
* jsoneditor v.9.5.5. [jsoneditor](https://github.com/josdejong/jsoneditor) is licensed under [Apache License 2.0](https://github.com/josdejong/jsoneditor/blob/master/LICENSE)
|
||||
|
||||
## Architecture
|
||||
|
||||
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/8e/GeoPortalDataEntry_Architecture.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Architecture" />
|
||||
|
||||
## Showcase
|
||||
|
||||
##### D4GNA instance of Geoportal D4Science
|
||||
|
||||
see at [Dataset per il Geoportale Nazionale per l’Archeologia (D4GNA)](https://gna.d4science.org/)
|
||||
|
||||
**New Project facility**
|
||||
|
||||
<img src="https://gcube.wiki.gcube-system.org/images_gcube/c/c0/D4GNA_New_Project.png" style="max-width:800px;" alt="Workspace Home" />
|
||||
|
||||
**List of Projects facility**
|
||||
|
||||
<img src="https://gcube.wiki.gcube-system.org/images_gcube/6/67/D4GNA_List_Of_Projects.png" style="max-width:800px;" alt="List of Projects" />
|
||||
|
||||
|
||||
**UnPublish facility**
|
||||
|
||||
<img src="https://gcube.wiki.gcube-system.org/images_gcube/6/6a/D4GNA_Unpublish.png" style="max-width:800px;" alt="UnPublish" />
|
||||
|
||||
|
||||
**View Relations facility**
|
||||
|
||||
<img src="https://gcube.wiki.gcube-system.org/images_gcube/7/76/D4GNA_ViewRelations.png" style="max-width:800px;" alt="View Relations" />
|
||||
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
N/A
|
||||
Geoportal Service Documentation is available at [gCube CMS Suite](https://geoportal.d4science.org/geoportal-service/docs/index.html)
|
||||
|
||||
User Guide (DRAFT ITA) is available at [Guida al Sistema D4GNA (DRAFT-ITA)](https://gcube.wiki.gcube-system.org/images_gcube/b/b7/D4science_Guida_al_Sistema_D4GNA_bozza.pdf)
|
||||
|
||||
D4GNA Use Case - 3 Phase Lifecycle
|
||||
|
||||
<img src="https://gcube.wiki.gcube-system.org/images_gcube/4/46/D4GNA_Workflow_Phases_and_Operations.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Workflow & Phases & Operations" />
|
||||
|
||||
## Change log
|
||||
|
||||
|
|
115
pom.xml
115
pom.xml
|
@ -7,16 +7,16 @@
|
|||
<parent>
|
||||
<artifactId>maven-parent</artifactId>
|
||||
<groupId>org.gcube.tools</groupId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.2.0</version>
|
||||
<relativePath />
|
||||
</parent>
|
||||
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-entry-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<version>3.2.2</version>
|
||||
<name>GeoPortal Data Entry App</name>
|
||||
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project</description>
|
||||
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to create projects/documents (based on UCD) in the D4Science Geoportal service</description>
|
||||
<scm>
|
||||
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>
|
||||
|
@ -25,7 +25,7 @@
|
|||
|
||||
<properties>
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.9.0</gwtVersion>
|
||||
<gwt.version>2.9.0</gwt.version>
|
||||
<!-- GWT needs at least java 1.6 -->
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -51,7 +51,7 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.distribution</groupId>
|
||||
<artifactId>maven-portal-bom</artifactId>
|
||||
<version>3.6.3-SNAPSHOT</version>
|
||||
<version>3.7.0</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
@ -68,47 +68,65 @@
|
|||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- needed to compile with gwt > 2.7 -->
|
||||
<dependency>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
<version>1.4.01</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-servlet</artifactId>
|
||||
<version>${gwt.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-user</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<version>${gwt.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-dev</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<version>${gwt.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gwt</groupId>
|
||||
<artifactId>gwt-servlet</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.gwtbootstrap</groupId>
|
||||
<artifactId>gwt-bootstrap</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>geoportal-data-viewer-widget</artifactId>
|
||||
<version>[1.0.1, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-data-mapper</artifactId>
|
||||
<version>[1.0.1, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>openlayer-basic-widgets</artifactId>
|
||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
<!-- does not remove these exclusions, there are conflict with jackson
|
||||
2.7 used by geo-json dependency -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>de.grundid.opendatalab</groupId>
|
||||
<artifactId>geojson-jackson</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- FWS -->
|
||||
<dependency>
|
||||
|
@ -139,19 +157,29 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-data-common</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>2.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.application</groupId>
|
||||
<artifactId>geoportal-client</artifactId>
|
||||
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
|
||||
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -196,12 +224,27 @@
|
|||
<artifactId>slf4j-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- TESTS -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -209,13 +252,29 @@
|
|||
update them in DevMode -->
|
||||
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.csv</include>
|
||||
</includes>
|
||||
</resource>
|
||||
|
||||
<!-- <resource> -->
|
||||
<!-- <directory>src/main/resources</directory> -->
|
||||
<!-- <includes> -->
|
||||
<!-- <include>**/*.*</include> -->
|
||||
<!-- </includes> -->
|
||||
<!-- </resource> -->
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
|
||||
<!-- GWT Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>gwt-maven-plugin</artifactId>
|
||||
<version>${gwtVersion}</version>
|
||||
<version>${gwt.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
@ -13,9 +13,17 @@
|
|||
<inherits name="com.google.gwt.json.JSON" />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
||||
name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
|
||||
|
||||
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
|
||||
<inherits
|
||||
name='org.gcube.application.geoportaldatamapper.GeoportalDataMapper' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.gdvw.geoportal_data_viewer_widget' />
|
||||
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
||||
|
||||
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client;
|
||||
|
||||
|
||||
/**
|
||||
* The Enum ConcessioniFormCardTitle.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Nov 30, 2020
|
||||
*/
|
||||
public enum ConcessioniFormCardTitle {
|
||||
|
||||
INFORMAZIONI_DI_PROGETTO("Informazioni", "Informazioni di Progetto", 1, false, null),
|
||||
ABSTRACT_RELAZIONE_DI_SCAVO("Abstract Relazione di Scavo", "Abstract Relazione di Scavo", 2, false, null),
|
||||
RELAZIONE_DI_SCAVO("Relazione di Scavo", "Relazione di Scavo", 3, false, null),
|
||||
IMMAGINI_RAPPRESENTATIVE("Immagini Rappresentative", "Immagini Rappresentative", 4, true, 8),
|
||||
POSIZIONAMENTO_DELL_AREA_DI_INDAGINE("Posizionamento", "Posizionamento dell'Area di Indagine", 5, false, null),
|
||||
PIANTA_DI_FINE_SCAVO("Pianta di Fine Scavo", "Pianta di Fine Scavo", 6, true, null);
|
||||
|
||||
private String key;
|
||||
private String title;
|
||||
private Integer order;
|
||||
private boolean internalRepeatibleForm;
|
||||
private Integer maxFormRepeatability;
|
||||
|
||||
/**
|
||||
* Instantiates a new concessioni form card title.
|
||||
*
|
||||
* @param key the key
|
||||
* @param title the title
|
||||
* @param order the order
|
||||
* @param internalRepeatibleForm the internal repeatible form
|
||||
* @param maxFormRepeatability the max form repeatability
|
||||
*/
|
||||
private ConcessioniFormCardTitle(String key, String title, int order, boolean internalRepeatibleForm, Integer maxFormRepeatability) {
|
||||
this.key = key;
|
||||
this.title = title;
|
||||
this.order = order;
|
||||
this.internalRepeatibleForm = internalRepeatibleForm;
|
||||
this.maxFormRepeatability = maxFormRepeatability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the key.
|
||||
*
|
||||
* @return the key
|
||||
*/
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order.
|
||||
*
|
||||
* @return the order
|
||||
*/
|
||||
public Integer getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is internal repeatible form.
|
||||
*
|
||||
* @return true, if is internal repeatible form
|
||||
*/
|
||||
public boolean isInternalRepeatibleForm() {
|
||||
return internalRepeatibleForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max form repeatability.
|
||||
*
|
||||
* @return the max form repeatability
|
||||
*/
|
||||
public Integer getMaxFormRepeatability() {
|
||||
return maxFormRepeatability;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,18 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.WORKFLOW_PHASE;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
/**
|
||||
* The Class ConstantsGeoPortalDataEntryApp.
|
||||
*
|
||||
|
@ -11,69 +22,75 @@ import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
|||
*/
|
||||
public class ConstantsGeoPortalDataEntryApp {
|
||||
|
||||
public static final String DIV_PORTLET_ID = "geoportal-data-entry";
|
||||
|
||||
public static final String DIV_LOADERS_ID = "geoportal-loaders";
|
||||
|
||||
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;
|
||||
|
||||
public static final String TIME_FORMAT = ConstantsMPFormBuilder.TIME_FORMAT;
|
||||
|
||||
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
|
||||
|
||||
public static final String ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!";
|
||||
public static final int MAX_COLUMN_DISPLAYED_IN_THE_TABLE = 5;
|
||||
|
||||
public static final int PAGINATION_SIZE = 20;
|
||||
|
||||
public static final String DEFAULT_DOCUMENT_PROJECTION_NAME = "_theDocument";
|
||||
|
||||
public static final String CSS_CLASS_ANIMATE_FADE_IN_OUT = "animate-fadeInOut";
|
||||
|
||||
public static final RootPanel ROOT_PANEL_DIV_LOADERS = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_LOADERS_ID);
|
||||
|
||||
public static final RootPanel ROOT_PANEL_DIV_PORTLET = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID);
|
||||
|
||||
public static final String CSS_CLASS_GEOPORTAL_LOADERS_CENTER = "geoportal-loaders-center";
|
||||
|
||||
public static final String WORKFLOW_ACTION_POST_CREATION_ACTION_ID = "post_creation_action";
|
||||
|
||||
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
|
||||
|
||||
public static final String SHOW_ON_MAP_NOT_AVAILABLE_IN_DRAFT = "The 'Show on Map' facility is not available in DRAFT phase";
|
||||
|
||||
public static final String ALERT_MESSAGE_PROJECT_NOT_EDITABLE = "A Project can only be updated in "
|
||||
+ WORKFLOW_PHASE.DRAFT.name()
|
||||
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
|
||||
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
|
||||
|
||||
public static final String ALERT_MESSAGE_CREATE_RELATION_FORBIDDEN = "The Create Relation operation can be performed only in "
|
||||
+ WORKFLOW_PHASE.DRAFT.name()
|
||||
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
|
||||
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
|
||||
|
||||
|
||||
public static final String ALERT_MESSAGE_DELETE_RELATION_FORBIDDEN = "The Delete Relation operation can be performed only in "
|
||||
+ WORKFLOW_PHASE.DRAFT.name()
|
||||
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
|
||||
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
|
||||
|
||||
/**
|
||||
* The Enum RECORD_TYPE.
|
||||
* The Enum ACTION_PERFORMED_ON_ITEM.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 6, 2021
|
||||
* Nov 25, 2021
|
||||
*/
|
||||
public enum RECORD_TYPE {
|
||||
CONCESSIONE
|
||||
public enum ACTION_PERFORMED_ON_ITEM {
|
||||
UPDATED_PROJECT
|
||||
}
|
||||
|
||||
/**
|
||||
* The Enum ACTION_ON_ITEM.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 6, 2021
|
||||
*/
|
||||
public enum ACTION_ON_ITEM {
|
||||
SHOW_ON_MAP, SHOW_METADATA, SHOW_REPORT, SHOW_EDIT_MODE, DELETE_RECORD, UPDATED_RECORD
|
||||
}
|
||||
public static final List<String> HANDLERS_IDS = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId(),
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
|
||||
|
||||
/**
|
||||
* The Enum RECORD_FIELD.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 2, 2021
|
||||
*/
|
||||
public static enum RECORD_FIELD {
|
||||
NAME("name", "Name"), INTRODUCTION("introduction", "Introduction"), AUTHOR("author", "Author/s"),
|
||||
PROJECT_START_END_DATE("", "Project Start/End Date"), RECORD_STATUS("recordStatus", "Published with"), CREATED("created", "Created"),
|
||||
CREATED_BY("createdBy", "Created by");
|
||||
|
||||
String jsonFieldName;
|
||||
String displayName;
|
||||
|
||||
/**
|
||||
* Instantiates a new record field.
|
||||
*
|
||||
* @param jsonFieldName the json field name
|
||||
* @param displayName the display name
|
||||
*/
|
||||
RECORD_FIELD(String jsonFieldName, String displayName) {
|
||||
this.jsonFieldName = jsonFieldName;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getJsonFieldName() {
|
||||
return jsonFieldName;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
public static void printUCDs(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||
GWT.log("print - UCDs");
|
||||
for (UseCaseDescriptorDV useCaseDescriptorDV : listUCDescriptors) {
|
||||
GWT.log("print UCD name: " + useCaseDescriptorDV.getName() + ", profileID: "
|
||||
+ useCaseDescriptorDV.getProfileID());
|
||||
for (HandlerDeclarationDV handler : useCaseDescriptorDV.getHandlers()) {
|
||||
GWT.log("\t print handler getDataHandlerType: " + handler.getDataHandlerType() + ", type: "
|
||||
+ handler.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,295 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
* The Class GeoPortalClientCaches.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 11, 2022
|
||||
*/
|
||||
public class GeoPortalClientCaches {
|
||||
|
||||
private TreeMap<String, List<GeoNaFormCardModel>> mapGcubeProfilePerItemType;
|
||||
|
||||
//private Map<String, List<HandlerDeclarationDV>> mapHandlersConfigurationsForProfileId;
|
||||
|
||||
private Map<String, UseCaseDescriptorDV> mapUseCaseDescriptor;
|
||||
|
||||
private Map<String, CacheSearchingFilterParametersFromConfig> mapSearchingFilterParametersForProfileId;
|
||||
|
||||
private Map<String, List<RelationshipDefinitionDV>> mapRelationsNamesForProfileId;
|
||||
|
||||
/**
|
||||
* Instantiates a new geo portal client caches.
|
||||
*/
|
||||
public GeoPortalClientCaches() {
|
||||
mapGcubeProfilePerItemType = new TreeMap<String, List<GeoNaFormCardModel>>();
|
||||
mapSearchingFilterParametersForProfileId = new HashMap<String, GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig>();
|
||||
mapUseCaseDescriptor = new HashMap<String, UseCaseDescriptorDV>();
|
||||
mapRelationsNamesForProfileId = new HashMap<String, List<RelationshipDefinitionDV>>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Put list relationships definition for profile ID.
|
||||
*
|
||||
* @param profileId the profile id
|
||||
* @param relationshipDef the relationship def
|
||||
*/
|
||||
public void putListRelationshipsDefinitionForProfileID(String profileId,
|
||||
List<RelationshipDefinitionDV> relationshipDef) {
|
||||
mapRelationsNamesForProfileId.put(profileId, relationshipDef);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list relationship definition for profile id.
|
||||
*
|
||||
* @param profileId the profile id
|
||||
* @return the list relationship definition for profile id
|
||||
*/
|
||||
public List<RelationshipDefinitionDV> getListRelationshipDefinitionForProfileId(String profileId) {
|
||||
return mapRelationsNamesForProfileId.get(profileId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put UCD for profile id.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param ucdDV the ucd DV
|
||||
*/
|
||||
public void putUCDForProfileId(String profileID, UseCaseDescriptorDV ucdDV) {
|
||||
mapUseCaseDescriptor.put(profileID, ucdDV);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the UCD for profile ID.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @return the UCD for profile ID
|
||||
*/
|
||||
public UseCaseDescriptorDV getUCDForProfileID(String profileID) {
|
||||
return mapUseCaseDescriptor.get(profileID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Put gcube profile per item type.
|
||||
*
|
||||
* @param itemType the item type
|
||||
* @param listGcubeProfiles the list gcube profiles
|
||||
*/
|
||||
public void putGcubeProfilePerItemType(String itemType, List<GeoNaFormCardModel> listGcubeProfiles) {
|
||||
mapGcubeProfilePerItemType.put(itemType, listGcubeProfiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the gcube profile per item type.
|
||||
*
|
||||
* @param itemType the item type
|
||||
* @return the gcube profile per item type
|
||||
*/
|
||||
public List<GeoNaFormCardModel> getGcubeProfilePerItemType(String itemType) {
|
||||
return mapGcubeProfilePerItemType.get(itemType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the filter parameters for profile id.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @return the filter parameters for profile id
|
||||
*/
|
||||
public CacheSearchingFilterParametersFromConfig getFilterParametersForProfileId(String profileID,
|
||||
GEOPORTAL_DATA_HANDLER handlerType) {
|
||||
GWT.log("getFilterParametersForProfileId for: " + profileID);
|
||||
|
||||
CacheSearchingFilterParametersFromConfig searchingFilterParameters = mapSearchingFilterParametersForProfileId
|
||||
.get(profileID);
|
||||
|
||||
if (searchingFilterParameters == null) {
|
||||
|
||||
searchingFilterParameters = new CacheSearchingFilterParametersFromConfig();
|
||||
UseCaseDescriptorDV ucd = mapUseCaseDescriptor.get(profileID);
|
||||
|
||||
for (HandlerDeclarationDV handler : ucd.getHandlers()) {
|
||||
|
||||
if (handler.getDataHandlerType().equals(handlerType)) {
|
||||
ConfigurationDV<?> configurationDV = handler.getConfiguration();
|
||||
GWT.log("For profileID " + profileID + " and handler type " + handlerType + ", read config for : "
|
||||
+ configurationDV);
|
||||
|
||||
switch (configurationDV.getConfigurationType()) {
|
||||
case item_fields: {
|
||||
List<ItemFieldDV> listItemFields = (List<ItemFieldDV>) configurationDV.getConfiguration();
|
||||
for (ItemFieldDV itemField : listItemFields) {
|
||||
if (itemField.isDisplayAsResult()) {
|
||||
searchingFilterParameters.addDisplayField(itemField);
|
||||
// adding to projection for filtering
|
||||
for (String jsonFieldPath : itemField.getJsonFields()) {
|
||||
// String mongoProjection = itemField.getProjection() + "." + jsonField;
|
||||
searchingFilterParameters.putMongoProjection(jsonFieldPath, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemField.isSearchable()) {
|
||||
searchingFilterParameters.addSearchByField(itemField);
|
||||
}
|
||||
|
||||
if (itemField.isSortable()) {
|
||||
searchingFilterParameters.addOrderByField(itemField);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mapSearchingFilterParametersForProfileId.put(profileID, searchingFilterParameters);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return searchingFilterParameters;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Prints the cache handler configurations.
|
||||
// */
|
||||
// // DEBUGGING
|
||||
// public void printCacheHandlerConfigurations() {
|
||||
// GWT.log("print - mapHandlersConfigurationsForProfileId is:");
|
||||
// for (String key : mapHandlersConfigurationsForProfileId.keySet()) {
|
||||
// GWT.log("print - key: " + key + ", value: " + mapHandlersConfigurationsForProfileId.get(key));
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Prints the cache gcube profile per item type.
|
||||
*/
|
||||
// DEBUGGING
|
||||
public void printCacheGcubeProfilePerItemType() {
|
||||
GWT.log("print - mapGcubeProfilePerItemType is:");
|
||||
for (String key : mapGcubeProfilePerItemType.keySet()) {
|
||||
GWT.log("print - key: " + key + ", value: " + mapGcubeProfilePerItemType.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class CacheSearchingFilterParametersFromConfig.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 13, 2022
|
||||
*/
|
||||
public class CacheSearchingFilterParametersFromConfig {
|
||||
|
||||
List<ItemFieldDV> displayFields;
|
||||
List<ItemFieldDV> searchByFields;
|
||||
List<ItemFieldDV> orderByFields;
|
||||
|
||||
// The projection
|
||||
LinkedHashMap<String, Object> projection;
|
||||
|
||||
/**
|
||||
* Instantiates a new cache searching filter parameters from config.
|
||||
*/
|
||||
public CacheSearchingFilterParametersFromConfig() {
|
||||
displayFields = new ArrayList<ItemFieldDV>();
|
||||
searchByFields = new ArrayList<ItemFieldDV>();
|
||||
orderByFields = new ArrayList<ItemFieldDV>();
|
||||
projection = new LinkedHashMap<String, Object>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Put mongo projection.
|
||||
*
|
||||
* @param keyField the key field
|
||||
* @param value the value
|
||||
*/
|
||||
public void putMongoProjection(String keyField, Object value) {
|
||||
projection.put(keyField, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the display field.
|
||||
*
|
||||
* @param itemField the item field
|
||||
*/
|
||||
public void addDisplayField(ItemFieldDV itemField) {
|
||||
displayFields.add(itemField);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the search by field.
|
||||
*
|
||||
* @param itemField the item field
|
||||
*/
|
||||
public void addSearchByField(ItemFieldDV itemField) {
|
||||
searchByFields.add(itemField);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the order by field.
|
||||
*
|
||||
* @param itemField the item field
|
||||
*/
|
||||
public void addOrderByField(ItemFieldDV itemField) {
|
||||
orderByFields.add(itemField);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the display fields.
|
||||
*
|
||||
* @return the display fields
|
||||
*/
|
||||
public List<ItemFieldDV> getDisplayFields() {
|
||||
return displayFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the search by fields.
|
||||
*
|
||||
* @return the search by fields
|
||||
*/
|
||||
public List<ItemFieldDV> getSearchByFields() {
|
||||
return searchByFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order by fields.
|
||||
*
|
||||
* @return the order by fields
|
||||
*/
|
||||
public List<ItemFieldDV> getOrderByFields() {
|
||||
return orderByFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projection.
|
||||
*
|
||||
* @return the projection
|
||||
*/
|
||||
public LinkedHashMap<String, Object> getProjection() {
|
||||
return projection;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -2,17 +2,24 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
import org.gcube.application.geoportaldatamapper.shared.ProjectEdit;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
@ -30,101 +37,204 @@ public interface GeoportalDataEntryService extends RemoteService {
|
|||
/**
|
||||
* Save geona data forms.
|
||||
*
|
||||
* @param listGeonaFormObjects the list geona form objects
|
||||
* @param profileID the profile ID
|
||||
* @param tree_Node the tree node
|
||||
* @param stepsOnPostCreation the steps on post creation
|
||||
* @return the commit report
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception;
|
||||
CommitReport saveGeonaDataForms(String profileID, Tree_Node<GeoNaFormDataObject> tree_Node,
|
||||
List<String> stepsOnPostCreation) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the geona init config.
|
||||
*
|
||||
* @return the geona init config
|
||||
*/
|
||||
GeonaISConfig getGeonaInitConfig();
|
||||
GeoportalISConfig getGeonaInitConfig();
|
||||
|
||||
/**
|
||||
* Gets the links for.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param recordType the record type
|
||||
* @param itemId the item id
|
||||
* @param profileID the profile ID
|
||||
* @return the links for
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
GeoNaItemRef getLinksFor(String itemId, RECORD_TYPE recordType) throws Exception;
|
||||
GeoportalItemReferences getLinksFor(String itemId, String profileID) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the list concessioni.
|
||||
* Gets the list projects.
|
||||
*
|
||||
* @param theProfileID the the profile ID
|
||||
* @param start the start
|
||||
* @param limit the limit
|
||||
* @param filter the filter
|
||||
* @param reloadFromService the reload from service
|
||||
* @return the list concessioni
|
||||
* @return the list projects
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SortFilter filter,
|
||||
boolean reloadFromService) throws Exception;
|
||||
|
||||
/**
|
||||
* Delete record.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param recordType the record type
|
||||
* @return true, if successful
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
boolean deleteRecord(String itemId, RECORD_TYPE recordType) throws Exception;
|
||||
public ResultSetPaginatedData getListProjects(String theProfileID, Integer start, Integer limit,
|
||||
SearchingFilter filter, boolean reloadFromService) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the JSON record.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param recordType the record type
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the JSON record
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
String getJSONRecord(String itemId, RECORD_TYPE recordType) throws Exception;
|
||||
String getJSONDocumentInTheProject(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Update record.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param jsonUpdate the json update
|
||||
* @param recordType the record type
|
||||
* @return the concessione DV
|
||||
* @return the project DV
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ConcessioneDV updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType) throws Exception;
|
||||
ProjectDV updateRecord(String profileID, String projectID, String jsonUpdate) throws Exception;
|
||||
|
||||
/**
|
||||
* Read file set paths.
|
||||
* Read data viewer config.
|
||||
*
|
||||
* @return the file set paths DV
|
||||
* @return the GNA data entry ext config profile
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
FileSetPathsDV readFileSetPaths() throws Exception;
|
||||
GNADataEntryExtendedConfigProfile readDataViewerConfig() throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the record.
|
||||
* Gets the list use case descriptors.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param recordType the record type
|
||||
* @return the record
|
||||
* @param handlersIds the handlers ids
|
||||
* @return the list use case descriptors
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ConcessioneDV getRecord(String itemId, RECORD_TYPE recordType) throws Exception;
|
||||
List<UseCaseDescriptorDV> getListUseCaseDescriptors(List<String> handlersIds) throws Exception;
|
||||
|
||||
/**
|
||||
* Update record.
|
||||
* Gets the lifecycle info for project id.
|
||||
*
|
||||
* @param itemId the item id
|
||||
* @param jsonUpdate the json update
|
||||
* @param recordType the record type
|
||||
* @return the updated JSON string representing the itemId
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the lifecycle info for project id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ConcessioneDV updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
||||
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean) throws Exception;
|
||||
LifecycleInformationDV getLifecycleInfoForProjectId(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Delete project.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return true, if successful
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
boolean deleteProject(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Perform action steps.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param action the action
|
||||
* @return the project DV
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ProjectDV performActionSteps(String profileID, String projectID, ActionDefinitionDV action) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the relationships definition.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @return the relationships definition
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
List<RelationshipDefinitionDV> getRelationshipsDefinition(String profileID) throws Exception;
|
||||
|
||||
/**
|
||||
* Creates the relationship.
|
||||
*
|
||||
* @param fromProfileID the from profile ID
|
||||
* @param fromProjectID the from project ID
|
||||
* @param relationshipID the relationship ID
|
||||
* @param toProfileID the to profile ID
|
||||
* @param toProjectID the to project ID
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
void createRelationship(String fromProfileID, String fromProjectID, String relationshipID, String toProfileID,
|
||||
String toProjectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the project by ID.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the project by ID
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ProjectDV getProjectByID(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the result document fo project by ID.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the result document fo project by ID
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ResultDocumentDV getResultDocumentFoProjectByID(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Delete relationship.
|
||||
*
|
||||
* @param fromProfileID the from profile ID
|
||||
* @param fromProjectID the from project ID
|
||||
* @param id the id
|
||||
* @param toProfileID the to profile ID
|
||||
* @param toProjectID the to project ID
|
||||
* @return the result document DV
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ResultDocumentDV deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
|
||||
String toProjectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Temporal reference for project.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the temporal reference DV
|
||||
*/
|
||||
TemporalReferenceDV temporalReferenceForProject(String profileID, String projectID);
|
||||
|
||||
/**
|
||||
* Gets the project edit.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @return the project edit
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ProjectEdit getProjectEdit(String profileID, String projectID) throws Exception;
|
||||
|
||||
/**
|
||||
* Update geportal data form.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param projectID the project ID
|
||||
* @param section the section
|
||||
* @param sectionPath the section path
|
||||
* @param listFilePaths the list file paths
|
||||
* @return the commit report
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
CommitReport updateGeportalDataForm(String profileID, String projectID, GeoNaFormDataObject section,
|
||||
String sectionPath, List<FilePathDV> listFilePaths) throws Exception;
|
||||
|
||||
ProjectView getProjectView(String profileID, String projectID) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,76 +2,100 @@ package org.gcube.portlets.user.geoportaldataentry.client;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||
import org.gcube.application.geoportaldatamapper.shared.ProjectEdit;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
public interface GeoportalDataEntryServiceAsync
|
||||
{
|
||||
/**
|
||||
* The Interface GeoportalDataEntryServiceAsync.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 1, 2022
|
||||
*/
|
||||
public interface GeoportalDataEntryServiceAsync {
|
||||
|
||||
/**
|
||||
* Utility class to get the RPC Async interface from client-side code
|
||||
*/
|
||||
public static final class Util
|
||||
{
|
||||
private static GeoportalDataEntryServiceAsync instance;
|
||||
/**
|
||||
* Utility class to get the RPC Async interface from client-side code
|
||||
*/
|
||||
public static final class Util {
|
||||
private static GeoportalDataEntryServiceAsync instance;
|
||||
|
||||
public static final GeoportalDataEntryServiceAsync getInstance()
|
||||
{
|
||||
if ( instance == null )
|
||||
{
|
||||
instance = (GeoportalDataEntryServiceAsync) GWT.create( GeoportalDataEntryService.class );
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
public static final GeoportalDataEntryServiceAsync getInstance() {
|
||||
if (instance == null) {
|
||||
instance = (GeoportalDataEntryServiceAsync) GWT.create(GeoportalDataEntryService.class);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private Util()
|
||||
{
|
||||
// Utility class should not be instantiated
|
||||
}
|
||||
}
|
||||
private Util() {
|
||||
// Utility class should not be instantiated
|
||||
}
|
||||
}
|
||||
|
||||
void saveGeonaDataForms(String profileID, Tree_Node<GeoNaFormDataObject> tree_Node,
|
||||
List<String> stepsOnPostCreation, AsyncCallback<CommitReport> callback);
|
||||
|
||||
void updateGeportalDataForm(String profileID, String projectID, GeoNaFormDataObject section,
|
||||
String sectionPath, List<FilePathDV> listFilePaths, AsyncCallback<CommitReport> callback);
|
||||
|
||||
void saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects, AsyncCallback<CommitReport> callback);
|
||||
void getGeonaInitConfig(AsyncCallback<GeoportalISConfig> callback);
|
||||
|
||||
void getLinksFor(String itemId, String profileID, AsyncCallback<GeoportalItemReferences> callback);
|
||||
|
||||
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
|
||||
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
|
||||
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
|
||||
|
||||
void deleteProject(String profileID, String projectID, AsyncCallback<Boolean> callback);
|
||||
|
||||
void getLinksFor(String itemId, RECORD_TYPE recordType, AsyncCallback<GeoNaItemRef> callback);
|
||||
void getJSONDocumentInTheProject(String profileID, String projectID, AsyncCallback<String> callback);
|
||||
|
||||
void updateRecord(String profileID, String projectID, String jsonUpdate, AsyncCallback<ProjectDV> callback);
|
||||
|
||||
void getListConcessioni(Integer start, Integer limit, SortFilter filter, boolean reloadFromService,
|
||||
AsyncCallback<ResultSetPaginatedData> callback);
|
||||
void readDataViewerConfig(AsyncCallback<GNADataEntryExtendedConfigProfile> asyncCallback);
|
||||
|
||||
void getListUseCaseDescriptors(List<String> handlersIds, AsyncCallback<List<UseCaseDescriptorDV>> callback);
|
||||
|
||||
void deleteRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<Boolean> callback);
|
||||
void getLifecycleInfoForProjectId(String profileID, String projectID,
|
||||
AsyncCallback<LifecycleInformationDV> callback);
|
||||
|
||||
void performActionSteps(String profileID, String projectID, ActionDefinitionDV action,
|
||||
AsyncCallback<ProjectDV> callback);
|
||||
|
||||
void getJSONRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<String> callback);
|
||||
void getRelationshipsDefinition(String profileID, AsyncCallback<List<RelationshipDefinitionDV>> callback);
|
||||
|
||||
void createRelationship(String fromProfileID, String fromProjectID, String relationshipID, String toProfileID,
|
||||
String toProjectID, AsyncCallback<Void> callback);
|
||||
|
||||
void updateRecord(String itemId, String jsonUpdate, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
||||
void getProjectByID(String profileID, String projectID, AsyncCallback<ProjectDV> callback);
|
||||
|
||||
void getResultDocumentFoProjectByID(String profileID, String projectID, AsyncCallback<ResultDocumentDV> callback);
|
||||
|
||||
void readFileSetPaths(AsyncCallback<FileSetPathsDV> callback);
|
||||
void deleteRelationship(String fromProfileID, String fromProjectID, String id, String toProfileID,
|
||||
String toProjectID, AsyncCallback<ResultDocumentDV> asyncCallback);
|
||||
|
||||
void temporalReferenceForProject(String profileID, String projectID, AsyncCallback<TemporalReferenceDV> callback);
|
||||
|
||||
void getRecord(String itemId, RECORD_TYPE recordType, AsyncCallback<ConcessioneDV> callback);
|
||||
void getProjectEdit(String profileID, String projectID, AsyncCallback<ProjectEdit> callback);
|
||||
|
||||
void getProjectView(String profileID, String projectID, AsyncCallback<ProjectView> callback);
|
||||
|
||||
void updateSectionForRecord(String itemId, String recordType, String section, int pathIndex,
|
||||
List<WorkspaceContentDV> keepCurrentContent, GenericDatasetBean gDBean,
|
||||
AsyncCallback<ConcessioneDV> callback);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,123 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client;
|
||||
|
||||
/**
|
||||
* The Class ProjectFormCard.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 4, 2022
|
||||
*/
|
||||
public class ProjectFormCard {
|
||||
|
||||
private String key;
|
||||
private String title; //is the profile title (read from geoportal config)
|
||||
private Integer order;
|
||||
private boolean internalRepeatibleForm;
|
||||
private Integer maxFormRepeatability;
|
||||
private Integer minFormRepeatability;
|
||||
|
||||
/**
|
||||
* Instantiates a new project form card.
|
||||
*
|
||||
* @param key the key
|
||||
* @param title the title
|
||||
* @param order the order
|
||||
* @param internalRepeatibleForm the internal repeatible form
|
||||
* @param minFormRepeatability the min form repeatability
|
||||
* @param maxFormRepeatability the max form repeatability
|
||||
*/
|
||||
public ProjectFormCard(String key, String title, int order, boolean internalRepeatibleForm,
|
||||
Integer minFormRepeatability, Integer maxFormRepeatability) {
|
||||
this.key = key;
|
||||
this.title = title;
|
||||
this.order = order;
|
||||
this.internalRepeatibleForm = internalRepeatibleForm;
|
||||
this.minFormRepeatability = minFormRepeatability;
|
||||
this.maxFormRepeatability = maxFormRepeatability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the key.
|
||||
*
|
||||
* @return the key
|
||||
*/
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title.
|
||||
*
|
||||
* @return the title
|
||||
*/
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order.
|
||||
*
|
||||
* @return the order
|
||||
*/
|
||||
public Integer getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is internal repeatible form.
|
||||
*
|
||||
* @return true, if is internal repeatible form
|
||||
*/
|
||||
public boolean isInternalRepeatibleForm() {
|
||||
return internalRepeatibleForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max form repeatability.
|
||||
*
|
||||
* @return the max form repeatability
|
||||
*/
|
||||
public Integer getMaxFormRepeatability() {
|
||||
return maxFormRepeatability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the min form repeatability.
|
||||
*
|
||||
* @return the min form repeatability
|
||||
*/
|
||||
public Integer getMinFormRepeatability() {
|
||||
return minFormRepeatability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the min form repeatability.
|
||||
*
|
||||
* @param minFormRepeatability the new min form repeatability
|
||||
*/
|
||||
public void setMinFormRepeatability(Integer minFormRepeatability) {
|
||||
this.minFormRepeatability = minFormRepeatability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ProjectFormCard [key=");
|
||||
builder.append(key);
|
||||
builder.append(", title=");
|
||||
builder.append(title);
|
||||
builder.append(", order=");
|
||||
builder.append(order);
|
||||
builder.append(", internalRepeatibleForm=");
|
||||
builder.append(internalRepeatibleForm);
|
||||
builder.append(", maxFormRepeatability=");
|
||||
builder.append(maxFormRepeatability);
|
||||
builder.append(", minFormRepeatability=");
|
||||
builder.append(minFormRepeatability);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class CloseCreateRelationGUIEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 19, 2022
|
||||
*/
|
||||
public class CloseCreateRelationGUIEvent extends GwtEvent<CloseCreateRelationGUIEventHandler> {
|
||||
public static Type<CloseCreateRelationGUIEventHandler> TYPE = new Type<CloseCreateRelationGUIEventHandler>();
|
||||
|
||||
/**
|
||||
* Instantiates a new close create relation GUI.
|
||||
*/
|
||||
public CloseCreateRelationGUIEvent() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<CloseCreateRelationGUIEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(CloseCreateRelationGUIEventHandler handler) {
|
||||
handler.onClose(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface CloseCreateRelationGUIEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 19, 2022
|
||||
*/
|
||||
public interface CloseCreateRelationGUIEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On close.
|
||||
*
|
||||
* @param closeCreateRelationGUI the close create relation GUI
|
||||
*/
|
||||
void onClose(CloseCreateRelationGUIEvent closeCreateRelationGUI);
|
||||
|
||||
}
|
|
@ -1,25 +1,40 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Class CreateNewProjectEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Oct 13, 2020
|
||||
* Mar 17, 2022
|
||||
*/
|
||||
public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler> {
|
||||
|
||||
|
||||
/** The type. */
|
||||
public static Type<CreateNewProjectEventHandler> TYPE = new Type<CreateNewProjectEventHandler>();
|
||||
private HandlerDeclarationDV handler;
|
||||
private List<GcubeProfileDV> listGcubeProfiles;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new cancel upload event.
|
||||
* Instantiates a new creates the new project event.
|
||||
*
|
||||
* @param handler the handler
|
||||
* @param listGcubeProfiles the list gcube profiles
|
||||
*/
|
||||
public CreateNewProjectEvent() {
|
||||
// (passing this second argument in order to avoid twice the casting as
|
||||
// List<GcubeProfileDV>)
|
||||
public CreateNewProjectEvent(String profileID, HandlerDeclarationDV handler,
|
||||
List<GcubeProfileDV> listGcubeProfiles) {
|
||||
this.profileID = profileID;
|
||||
this.handler = handler;
|
||||
this.listGcubeProfiles = listGcubeProfiles;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +42,9 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
|
@ -40,12 +57,33 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
|
|||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(CreateNewProjectEventHandler handler) {
|
||||
handler.onCreateNewProject(this);
|
||||
}
|
||||
|
||||
public HandlerDeclarationDV getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list gcube profiles.
|
||||
*
|
||||
* @return the list gcube profiles
|
||||
*/
|
||||
public List<GcubeProfileDV> getListGcubeProfiles() {
|
||||
return listGcubeProfiles;
|
||||
}
|
||||
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -17,15 +15,26 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
|||
|
||||
/** The type. */
|
||||
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
|
||||
private RECORD_TYPE recordType;
|
||||
private SortFilter sortFilter;
|
||||
private SearchingFilter searchingFilter;
|
||||
private String profileID;
|
||||
private String projectName;
|
||||
private Boolean reloadFilteringParameters = false;
|
||||
private boolean onApplicationInit = false;
|
||||
|
||||
/**
|
||||
* Instantiates a new cancel upload event.
|
||||
* Instantiates a new gets the list of records event.
|
||||
*
|
||||
* @param onApplicationInit the on application init
|
||||
* @param profileID the profile ID
|
||||
* @param searchingFilter the searching filter
|
||||
* @param reloadFilteringParameters the reload filtering parameters
|
||||
*/
|
||||
public GetListOfRecordsEvent(ConstantsGeoPortalDataEntryApp.RECORD_TYPE recordType, SortFilter sortFilter) {
|
||||
this.recordType = recordType;
|
||||
this.sortFilter = sortFilter;
|
||||
public GetListOfRecordsEvent(boolean onApplicationInit, String profileID, SearchingFilter searchingFilter,
|
||||
Boolean reloadFilteringParameters) {
|
||||
this.onApplicationInit = onApplicationInit;
|
||||
this.searchingFilter = searchingFilter;
|
||||
this.profileID = profileID;
|
||||
this.reloadFilteringParameters = reloadFilteringParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,12 +69,60 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
|
|||
handler.onGetList(this);
|
||||
}
|
||||
|
||||
public RECORD_TYPE getRecordType() {
|
||||
return recordType;
|
||||
/**
|
||||
* Gets the searching filter.
|
||||
*
|
||||
* @return the searching filter
|
||||
*/
|
||||
public SearchingFilter getSearchingFilter() {
|
||||
return searchingFilter;
|
||||
}
|
||||
|
||||
public SortFilter getSortFilter() {
|
||||
return sortFilter;
|
||||
/**
|
||||
* Gets the profile ID.
|
||||
*
|
||||
* @return the profile ID
|
||||
*/
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is on application init.
|
||||
*
|
||||
* @return true, if is on application init
|
||||
*/
|
||||
public boolean isOnApplicationInit() {
|
||||
return onApplicationInit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reload filtering parameters.
|
||||
*
|
||||
* @return the reload filtering parameters
|
||||
*/
|
||||
public boolean isReloadFilteringParameters() {
|
||||
return reloadFilteringParameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GetListOfRecordsEvent [searchingFilter=");
|
||||
builder.append(searchingFilter);
|
||||
builder.append(", profileID=");
|
||||
builder.append(profileID);
|
||||
builder.append(", projectName=");
|
||||
builder.append(projectName);
|
||||
builder.append(", reloadFilteringParameters=");
|
||||
builder.append(reloadFilteringParameters);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,31 +2,34 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
import com.google.gwt.user.client.Element;
|
||||
|
||||
/**
|
||||
* The Class ActionOnItemEvent.
|
||||
* The Class OperationOnItemEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 15, 2021
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItemEventHandler> {
|
||||
public static Type<ActionOnItemEventHandler> TYPE = new Type<ActionOnItemEventHandler>();
|
||||
public class OperationOnItemEvent<T extends DocumentDV> extends GwtEvent<OperationOnItemEventHandler> {
|
||||
public static Type<OperationOnItemEventHandler> TYPE = new Type<OperationOnItemEventHandler>();
|
||||
private List<T> selectItems;
|
||||
private ACTION_ON_ITEM action;
|
||||
private OPERATION_ON_ITEM action;
|
||||
private Element sourceElement;
|
||||
|
||||
/**
|
||||
* Instantiates a new action on item event.
|
||||
*
|
||||
* @param selectItems the select items
|
||||
* @param doAction the do action
|
||||
* @param profileID the profile ID
|
||||
*/
|
||||
public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction) {
|
||||
public OperationOnItemEvent(List<T> selectItems, OPERATION_ON_ITEM doAction) {
|
||||
this.selectItems = selectItems;
|
||||
this.action = doAction;
|
||||
}
|
||||
|
@ -42,7 +45,7 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
|||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<ActionOnItemEventHandler> getAssociatedType() {
|
||||
public Type<OperationOnItemEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
|
@ -59,7 +62,7 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
|||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ActionOnItemEventHandler handler) {
|
||||
protected void dispatch(OperationOnItemEventHandler handler) {
|
||||
handler.onDoActionFired(this);
|
||||
}
|
||||
|
||||
|
@ -77,24 +80,27 @@ public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItem
|
|||
*
|
||||
* @return the action
|
||||
*/
|
||||
public ACTION_ON_ITEM getAction() {
|
||||
public OPERATION_ON_ITEM getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
public void setSourceElement(Element element) {
|
||||
this.sourceElement = element;
|
||||
|
||||
}
|
||||
|
||||
public Element getSourceElement() {
|
||||
return sourceElement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ActionOnItemEvent [selectItems=");
|
||||
builder.append("OperationOnItemEvent [selectItems=");
|
||||
builder.append(selectItems);
|
||||
builder.append(", action=");
|
||||
builder.append(action);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,17 +1,17 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
* The Interface ActionOnItemEventHandler.
|
||||
* The Interface OperationOnItemEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 5, 2021
|
||||
*/
|
||||
public interface ActionOnItemEventHandler extends EventHandler {
|
||||
public interface OperationOnItemEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On do action fired.
|
||||
|
@ -19,5 +19,5 @@ public interface ActionOnItemEventHandler extends EventHandler {
|
|||
* @param <T> the generic type
|
||||
* @param showItemEvent the show item event
|
||||
*/
|
||||
<T extends RecordDV> void onDoActionFired(ActionOnItemEvent<T> showItemEvent);
|
||||
<T extends DocumentDV> void onDoActionFired(OperationOnItemEvent<T> showItemEvent);
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class OperationOnItemEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 15, 2021
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public class OperationPerformedOnItemEvent<T extends DocumentDV> extends GwtEvent<OperationPerformedOnItemEventHandler> {
|
||||
public static Type<OperationPerformedOnItemEventHandler> TYPE = new Type<OperationPerformedOnItemEventHandler>();
|
||||
private List<T> selectItems;
|
||||
private ACTION_PERFORMED_ON_ITEM action;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new action performed on item event.
|
||||
*
|
||||
* @param selectItems the select items
|
||||
* @param doAction the do action
|
||||
*/
|
||||
public OperationPerformedOnItemEvent(String profileID, List<T> selectItems, ACTION_PERFORMED_ON_ITEM doAction) {
|
||||
this.profileID = profileID;
|
||||
this.selectItems = selectItems;
|
||||
this.action = doAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<OperationPerformedOnItemEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(OperationPerformedOnItemEventHandler handler) {
|
||||
handler.onDoActionPerformedFired(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the select items.
|
||||
*
|
||||
* @return the select items
|
||||
*/
|
||||
public List<T> getSelectItems() {
|
||||
return selectItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the action.
|
||||
*
|
||||
* @return the action
|
||||
*/
|
||||
public ACTION_PERFORMED_ON_ITEM getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface OperationPerformedOnItemEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Nov 25, 2021
|
||||
*/
|
||||
public interface OperationPerformedOnItemEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On do action performed fired.
|
||||
* @param <T>
|
||||
*
|
||||
* @param actionPerformedOnItemEvent the action performed on item event
|
||||
*/
|
||||
<T extends DocumentDV> void onDoActionPerformedFired(OperationPerformedOnItemEvent<T> actionPerformedOnItemEvent);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
* The Interface RelationActionHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Oct 5, 2022
|
||||
*/
|
||||
public interface RelationActionHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On create relation.
|
||||
*
|
||||
* @param createRelationHandlerEvent the create relation handler event
|
||||
*/
|
||||
void onCreateRelation(RelationActionHandlerEvent createRelationHandlerEvent);
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class RelationActionHandlerEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Oct 5, 2022
|
||||
*/
|
||||
public class RelationActionHandlerEvent extends GwtEvent<RelationActionHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<RelationActionHandler> TYPE = new Type<RelationActionHandler>();
|
||||
private ResultDocumentDV fromProject;
|
||||
private RelationshipDefinitionDV relationSelected;
|
||||
private ResultDocumentDV toProject;
|
||||
private RELACTION_ACTION_TYPE relactionActionType;
|
||||
private String relationName;
|
||||
|
||||
/**
|
||||
* The Enum RELACTION_ACTION_TYPE.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Oct 5, 2022
|
||||
*/
|
||||
public static enum RELACTION_ACTION_TYPE {
|
||||
CREATE, DELETE
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new relation action handler event.
|
||||
*
|
||||
* @param fromProject the from project
|
||||
* @param relationSelected the relation selected
|
||||
* @param toProject the to project
|
||||
*/
|
||||
public RelationActionHandlerEvent(ResultDocumentDV fromProject, RelationshipDefinitionDV relationSelected,
|
||||
ResultDocumentDV toProject) {
|
||||
this.fromProject = fromProject;
|
||||
this.relationSelected = relationSelected;
|
||||
this.toProject = toProject;
|
||||
this.relactionActionType = RELACTION_ACTION_TYPE.CREATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new relation action handler event.
|
||||
*
|
||||
* @param fromProject the from project
|
||||
* @param relationName the relation name
|
||||
* @param toProject the to project
|
||||
*/
|
||||
public RelationActionHandlerEvent(ResultDocumentDV fromProject, String relationName, ResultDocumentDV toProject) {
|
||||
this.fromProject = fromProject;
|
||||
this.toProject = toProject;
|
||||
this.relationName = relationName;
|
||||
this.relactionActionType = RELACTION_ACTION_TYPE.DELETE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<RelationActionHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(RelationActionHandler handler) {
|
||||
handler.onCreateRelation(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the from project.
|
||||
*
|
||||
* @return the from project
|
||||
*/
|
||||
public ResultDocumentDV getFromProject() {
|
||||
return fromProject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relation selected.
|
||||
*
|
||||
* @return the relation selected
|
||||
*/
|
||||
public RelationshipDefinitionDV getRelationSelected() {
|
||||
return relationSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the to project.
|
||||
*
|
||||
* @return the to project
|
||||
*/
|
||||
public ResultDocumentDV getToProject() {
|
||||
return toProject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relaction action type.
|
||||
*
|
||||
* @return the relaction action type
|
||||
*/
|
||||
public RELACTION_ACTION_TYPE getRelactionActionType() {
|
||||
return relactionActionType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relation name.
|
||||
*
|
||||
* @return the relation name
|
||||
*/
|
||||
public String getRelationName() {
|
||||
return relationName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
@ -12,22 +11,24 @@ import com.google.gwt.event.shared.GwtEvent;
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 20, 2020
|
||||
* Oct 20, 2020
|
||||
*/
|
||||
public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler> {
|
||||
|
||||
|
||||
/** The type. */
|
||||
public static Type<SaveGeonaDataFormsHandler> TYPE = new Type<SaveGeonaDataFormsHandler>();
|
||||
private List<GeoNaFormDataObject> listGeonaDataForms;
|
||||
|
||||
private Tree_Node<GeoNaFormDataObject> treeNode;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new save geona data forms event.
|
||||
*
|
||||
* @param listGeonaDataForms the list geona data forms
|
||||
* @param profileID the profile ID
|
||||
* @param treeNode the tree node
|
||||
*/
|
||||
public SaveGeonaDataFormsEvent(List<GeoNaFormDataObject> listGeonaDataForms) {
|
||||
this.listGeonaDataForms = listGeonaDataForms;
|
||||
public SaveGeonaDataFormsEvent(String profileID, Tree_Node<GeoNaFormDataObject> treeNode) {
|
||||
this.treeNode = treeNode;
|
||||
this.profileID = profileID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +36,9 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
|
|||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
|
@ -48,16 +51,29 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
|
|||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/* (non-Javadoc)
|
||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(SaveGeonaDataFormsHandler handler) {
|
||||
handler.onSave(this);
|
||||
}
|
||||
|
||||
public List<GeoNaFormDataObject> getListGeonaDataForms() {
|
||||
return listGeonaDataForms;
|
||||
|
||||
public Tree_Node<GeoNaFormDataObject> getTreeNode() {
|
||||
return treeNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile ID.
|
||||
*
|
||||
* @return the profile ID
|
||||
*/
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.NodeItem;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
import com.google.gwt.user.client.ui.TreeItem;
|
||||
|
||||
|
||||
/**
|
||||
* The Class TreeItemEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jul 4, 2022
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public class TreeItemEvent extends GwtEvent<TreeItemEventHandler> {
|
||||
public static Type<TreeItemEventHandler> TYPE = new Type<TreeItemEventHandler>();
|
||||
private TreeItem treeItem;
|
||||
private ACTION actionPerformed;
|
||||
|
||||
/**
|
||||
* The Enum ACTION.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jul 4, 2022
|
||||
*/
|
||||
public enum ACTION {
|
||||
SELECTED, DELETE, DUPLICATE
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new click item event.
|
||||
*
|
||||
* @param selectItems the select items
|
||||
* @param action the action
|
||||
*/
|
||||
public TreeItemEvent(TreeItem treeItem, ACTION action) {
|
||||
this.treeItem = treeItem;
|
||||
this.actionPerformed = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<TreeItemEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(TreeItemEventHandler handler) {
|
||||
handler.onTreeItemEvent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the select items.
|
||||
*
|
||||
* @return the select items
|
||||
*/
|
||||
public TreeItem getSelectItem() {
|
||||
return treeItem;
|
||||
}
|
||||
|
||||
public NodeItem selectedAsNodeItem(){
|
||||
if(treeItem!=null) {
|
||||
return (NodeItem) treeItem.getWidget();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the action performed.
|
||||
*
|
||||
* @return the action performed
|
||||
*/
|
||||
public ACTION getActionPerformed() {
|
||||
return actionPerformed;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
* The Interface TreeItemEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jul 4, 2022
|
||||
*/
|
||||
public interface TreeItemEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On tree item event.
|
||||
*
|
||||
* @param treeItemEvent the tree item event
|
||||
*/
|
||||
void onTreeItemEvent(TreeItemEvent treeItemEvent);
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
public class WorkflowActionOnSelectedItemEvent<T extends DocumentDV> extends GwtEvent<WorkflowActionOnSelectedItemEventHandler> {
|
||||
public static Type<WorkflowActionOnSelectedItemEventHandler> TYPE = new Type<WorkflowActionOnSelectedItemEventHandler>();
|
||||
private ActionDefinitionDV action;
|
||||
|
||||
public WorkflowActionOnSelectedItemEvent(ActionDefinitionDV doAction) {
|
||||
this.action = doAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<WorkflowActionOnSelectedItemEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(WorkflowActionOnSelectedItemEventHandler handler) {
|
||||
handler.onDoActionFired(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the action.
|
||||
*
|
||||
* @return the action
|
||||
*/
|
||||
public ActionDefinitionDV getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
* The Interface WorkflowActionOnSelectedItemEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 13, 2022
|
||||
*/
|
||||
public interface WorkflowActionOnSelectedItemEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On do action fired.
|
||||
*
|
||||
* @param <T> the generic type
|
||||
* @param workflowActionOnItemEvent the workflow action on item event
|
||||
*/
|
||||
<T extends DocumentDV> void onDoActionFired(WorkflowActionOnSelectedItemEvent<T> workflowActionOnItemEvent);
|
||||
}
|
|
@ -10,4 +10,10 @@ public interface Images extends ClientBundle {
|
|||
|
||||
@Source("loading.gif")
|
||||
ImageResource loading();
|
||||
|
||||
@Source("access_denied.png")
|
||||
ImageResource accessDenied();
|
||||
|
||||
@Source("one-finger-icon.png")
|
||||
ImageResource oneFingerIcon();
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 962 B |
Binary file not shown.
After Width: | Height: | Size: 429 B |
|
@ -1,32 +1,59 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
||||
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.application.geoportalcommon.shared.guipresentation.BodyWelcome;
|
||||
import org.gcube.application.geoportalcommon.shared.guipresentation.DataEntryGUIPresentationConfig;
|
||||
import org.gcube.application.geoportalcommon.shared.guipresentation.Header;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationOnItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.projects.ListOfProjectTablePanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.projects.ListOfProjectWorkflowActionsPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.relation.CreateRelationProjectsPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.relation.ViewRelationshipPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DEFAULT_DISPLAYING_COLUMN_NAME;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter.ORDER;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.UCD_Util;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Dropdown;
|
||||
import com.github.gwtbootstrap.client.ui.Heading;
|
||||
import com.github.gwtbootstrap.client.ui.Hero;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.DockLayoutPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
|
@ -34,14 +61,10 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 5, 2021
|
||||
* Sep 21, 2022
|
||||
*/
|
||||
public class GeonaMainTabPanel extends Composite {
|
||||
|
||||
private static final String YOU_MUST_TO_SELECT_A_PROJECT_IN_THE_TABLE = "You must to select a Project in the table";
|
||||
|
||||
private static final String LABEL_FILTER_SEPARATOR = " - ";
|
||||
|
||||
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
|
||||
|
||||
/**
|
||||
|
@ -49,7 +72,7 @@ public class GeonaMainTabPanel extends Composite {
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 5, 2021
|
||||
* Sep 21, 2022
|
||||
*/
|
||||
interface GeonaMainTabPanelUiBinder extends UiBinder<Widget, GeonaMainTabPanel> {
|
||||
}
|
||||
|
@ -58,25 +81,16 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@UiField
|
||||
HTMLPanel geonaMainFormPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel geonaListOfConcessioniPanel;
|
||||
|
||||
/** The geona main form panel. */
|
||||
@UiField
|
||||
HTMLPanel contTabNewProject;
|
||||
|
||||
@UiField
|
||||
HTMLPanel contTabGetListOfProjects;
|
||||
|
||||
/** The loader. */
|
||||
@UiField
|
||||
LoaderIcon loader;
|
||||
|
||||
@UiField
|
||||
NavLink buttCreateNewProject;
|
||||
|
||||
@UiField
|
||||
NavLink buttonReloadConcessioni;
|
||||
TabPanel tabPanel;
|
||||
|
||||
@UiField
|
||||
Tab tabNewProject;
|
||||
|
@ -85,10 +99,10 @@ public class GeonaMainTabPanel extends Composite {
|
|||
Tab tabGetListOfProjects;
|
||||
|
||||
@UiField
|
||||
Dropdown dropdownSortBy;
|
||||
NavLink navViewAsDocument;
|
||||
|
||||
@UiField
|
||||
TextBox textBoxSortBy;
|
||||
NavLink navViewAsJSON;
|
||||
|
||||
@UiField
|
||||
NavLink navShowOnMap;
|
||||
|
@ -102,33 +116,109 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@UiField
|
||||
NavLink navDelete;
|
||||
|
||||
@UiField
|
||||
NavLink navCreateRelation;
|
||||
|
||||
@UiField
|
||||
NavLink navViewRelations;
|
||||
|
||||
@UiField
|
||||
Label roleLabel;
|
||||
|
||||
@UiField
|
||||
Dropdown ddCreateNewProject;
|
||||
|
||||
@UiField
|
||||
PageHeader pageHeaderDataEntry;
|
||||
|
||||
@UiField
|
||||
Hero introGNAHero;
|
||||
|
||||
@UiField
|
||||
DockLayoutPanel theDockLayoutPanel;
|
||||
|
||||
@UiField
|
||||
PageHeader pageHeader;
|
||||
|
||||
@UiField
|
||||
Heading welcomeTitle;
|
||||
|
||||
@UiField
|
||||
Paragraph welcomeDescription;
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private RECORD_FIELD[] sortByFields;
|
||||
|
||||
private SortFilter currentSortFilter;
|
||||
|
||||
private GeonaRecordsPaginatedView grpw = null;
|
||||
|
||||
private List<UseCaseDescriptorDV> ucdProjectTypesForListingDataView = new ArrayList<UseCaseDescriptorDV>();
|
||||
|
||||
private CacheSearchingFilterParametersFromConfig cacheSearchingFilterParameters;
|
||||
|
||||
private GcubeUserRole userRole;
|
||||
|
||||
private CreateRelationProjectsPanel createRelationProjectsPanel;
|
||||
|
||||
private ViewRelationshipPanel viewRelationshipPanel;
|
||||
|
||||
private ScrollPanel detailsPanel = new ScrollPanel();
|
||||
|
||||
private ListOfProjectTablePanel listOfProjectTablePanel;
|
||||
|
||||
private ListOfProjectWorkflowActionsPanel listOfProjectWorkflowActionsPanel;
|
||||
|
||||
private DataEntryGUIPresentationConfig dataGUIPresentation;
|
||||
|
||||
private Map<String, String[]> mapProfileIdForPostCreationActionSteps = new HashMap<String, String[]>();
|
||||
|
||||
/**
|
||||
* Instantiates a new geona main tab panel.
|
||||
*
|
||||
* @param appManagerBus the first name
|
||||
* @param sortByFields the sort by fields
|
||||
* @param initialSortFilter
|
||||
* @param appManagerBus the app manager bus
|
||||
*/
|
||||
public GeonaMainTabPanel(HandlerManager appManagerBus, RECORD_FIELD[] sortByFields, SortFilter initialSortFilter) {
|
||||
public GeonaMainTabPanel(HandlerManager appManagerBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
this.sortByFields = sortByFields;
|
||||
setCurrentSortFilter(initialSortFilter);
|
||||
bindEvents();
|
||||
|
||||
listOfProjectWorkflowActionsPanel = new ListOfProjectWorkflowActionsPanel(appManagerBus);
|
||||
|
||||
// listOfProjectWorkflowActionsPanel.setHeight("40px");
|
||||
theDockLayoutPanel.addNorth(listOfProjectWorkflowActionsPanel, 40);
|
||||
theDockLayoutPanel.setWidgetHidden(listOfProjectWorkflowActionsPanel, true);
|
||||
|
||||
detailsPanel.addStyleName("theDetailsPanel");
|
||||
theDockLayoutPanel.addEast(detailsPanel, 450);
|
||||
theDockLayoutPanel.setWidgetHidden(detailsPanel, true);
|
||||
|
||||
listOfProjectTablePanel = new ListOfProjectTablePanel(appManagerBus);
|
||||
listOfProjectWorkflowActionsPanel.setHeight("100%");
|
||||
theDockLayoutPanel.add(listOfProjectTablePanel);
|
||||
|
||||
setLoaderVisible("", false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the filtering parameters.
|
||||
*
|
||||
* @param sfp the sfp
|
||||
*/
|
||||
public void setFilteringParameters(CacheSearchingFilterParametersFromConfig sfp) {
|
||||
GWT.log("setFilteringParameters instancied");
|
||||
this.cacheSearchingFilterParameters = sfp;
|
||||
this.listOfProjectTablePanel.setFilteringParameters(cacheSearchingFilterParameters);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the internal height.
|
||||
*
|
||||
* @param height the new internal height
|
||||
*/
|
||||
public void setInternalHeight(int height) {
|
||||
contTabNewProject.asWidget().setHeight(height + "px");
|
||||
contTabGetListOfProjects.asWidget().setHeight(height + "px");
|
||||
theDockLayoutPanel.setHeight((height - 40) + "px");
|
||||
detailsPanel.setHeight((height - 90) + "px");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,80 +226,56 @@ public class GeonaMainTabPanel extends Composite {
|
|||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
buttCreateNewProject.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
appManagerBus.fireEvent(new CreateNewProjectEvent());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
buttonReloadConcessioni.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
tabGetListOfProjects.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null, currentSortFilter);
|
||||
showListOfConcessioniView(grpw);
|
||||
|
||||
// instanceAndShowListOfProjects(false);
|
||||
}
|
||||
});
|
||||
|
||||
for (RECORD_FIELD record_FIELD : sortByFields) {
|
||||
|
||||
// ASC
|
||||
SortFilter sortFilter = new SortFilter(record_FIELD, ORDER.ASC);
|
||||
String labelASC = toLabelFilter(sortFilter);
|
||||
NavLink nav = new NavLink(labelASC);
|
||||
dropdownSortBy.add(nav);
|
||||
|
||||
nav.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Sort by: " + sortFilter);
|
||||
setCurrentSortFilter(sortFilter);
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
}
|
||||
});
|
||||
|
||||
// //DESC
|
||||
SortFilter sortFilter2 = new SortFilter(record_FIELD, ORDER.DESC);
|
||||
String labelASC2 = toLabelFilter(sortFilter2);
|
||||
NavLink nav2 = new NavLink(labelASC2);
|
||||
dropdownSortBy.add(nav2);
|
||||
|
||||
nav2.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Sort by: " + sortFilter2);
|
||||
setCurrentSortFilter(sortFilter2);
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
navShowOnMap.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<ConcessioneDV> listConcessioni = null;
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_ON_MAP));
|
||||
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_ON_MAP));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
navViewAsDocument.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
appManagerBus.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments,
|
||||
OPERATION_ON_ITEM.VIEW_PROJECT_AS_DOCUMENT));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
navViewAsJSON.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
appManagerBus.fireEvent(
|
||||
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_PROJECT_AS_JSON));
|
||||
|
||||
}
|
||||
});
|
||||
|
@ -218,12 +284,14 @@ public class GeonaMainTabPanel extends Composite {
|
|||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<ConcessioneDV> listConcessioni = null;
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_REPORT));
|
||||
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_REPORT));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -232,12 +300,13 @@ public class GeonaMainTabPanel extends Composite {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
List<ConcessioneDV> listConcessioni = null;
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_EDIT_MODE));
|
||||
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.EDIT_PROJECT));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -245,15 +314,65 @@ public class GeonaMainTabPanel extends Composite {
|
|||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<ConcessioneDV> listConcessioni = null;
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listConcessioni = grpw.getSelectItems();
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
appManagerBus
|
||||
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.DELETE_RECORD));
|
||||
|
||||
appManagerBus.fireEvent(
|
||||
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.DELETE_PROJECT));
|
||||
}
|
||||
});
|
||||
|
||||
navCreateRelation.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
OperationOnItemEvent oIE = new OperationOnItemEvent<DocumentDV>(listDocuments,
|
||||
OPERATION_ON_ITEM.CREATE_RELATION);
|
||||
oIE.setSourceElement(navCreateRelation.getElement());
|
||||
appManagerBus.fireEvent(
|
||||
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.CREATE_RELATION));
|
||||
}
|
||||
});
|
||||
|
||||
navViewRelations.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
List<DocumentDV> listDocuments = null;
|
||||
if (grpw != null && grpw.getSelectItems() != null) {
|
||||
listDocuments = grpw.getSelectItems();
|
||||
}
|
||||
|
||||
OperationOnItemEvent oIE = new OperationOnItemEvent<DocumentDV>(listDocuments,
|
||||
OPERATION_ON_ITEM.VIEW_RELATIONSHIPS);
|
||||
oIE.setSourceElement(navViewRelations.getElement());
|
||||
appManagerBus.fireEvent(
|
||||
new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.VIEW_RELATIONSHIPS));
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the role label.
|
||||
*
|
||||
* @param userRole the user role
|
||||
*/
|
||||
public void setRole(GcubeUserRole userRole) {
|
||||
this.userRole = userRole;
|
||||
String msg = "Logged in as ";
|
||||
if (userRole != null && userRole.getName() != null) {
|
||||
msg += userRole.getName().substring(userRole.getName().indexOf("-") + 1, userRole.getName().length());
|
||||
} else
|
||||
msg += "Member";
|
||||
roleLabel.setText(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,17 +385,13 @@ public class GeonaMainTabPanel extends Composite {
|
|||
}
|
||||
|
||||
/**
|
||||
* Show list of concessioni view.
|
||||
* Show list of projects view.
|
||||
*
|
||||
* @param grpw the grpw
|
||||
*/
|
||||
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
|
||||
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
|
||||
this.grpw = grpw;
|
||||
geonaListOfConcessioniPanel.clear();
|
||||
VerticalPanel htmllPanel = new VerticalPanel();
|
||||
htmllPanel.add(grpw.getCellPanel());
|
||||
htmllPanel.add(grpw.getPagerPanel());
|
||||
geonaListOfConcessioniPanel.add(htmllPanel);
|
||||
listOfProjectTablePanel.showListOfProjectsView(grpw);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -290,49 +405,294 @@ public class GeonaMainTabPanel extends Composite {
|
|||
loader.setVisible(visible);
|
||||
}
|
||||
|
||||
private void setCurrentSortFilter(SortFilter sortFilter) {
|
||||
this.currentSortFilter = sortFilter;
|
||||
this.textBoxSortBy.setText(toLabelFilter(sortFilter));
|
||||
/**
|
||||
* Gets the current projects searching filter.
|
||||
*
|
||||
* @return the current projects searching filter
|
||||
*/
|
||||
public SearchingFilter getCurrentProjectsSearchingFilter() {
|
||||
return listOfProjectTablePanel.builtSearchingFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* To label filter.
|
||||
* Removes the tab.
|
||||
*
|
||||
* @param sortFilter the sort filter
|
||||
* @return the string
|
||||
* @param index the index
|
||||
*/
|
||||
public String toLabelFilter(SortFilter sortFilter) {
|
||||
|
||||
String labelFilter = sortFilter.getOrderByField().getDisplayName() + LABEL_FILTER_SEPARATOR
|
||||
+ sortFilter.getOrder().name();
|
||||
GWT.log("Got " + sortFilter);
|
||||
return labelFilter;
|
||||
public void removeTab(int index) {
|
||||
tabPanel.remove(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* To sort filter.
|
||||
* Sets the tab active.
|
||||
*
|
||||
* @param labelFilter the label filter
|
||||
* @return the sort filter
|
||||
*/
|
||||
/*
|
||||
* public SortFilter toSortFilter(String labelFilter) {
|
||||
*
|
||||
* String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||
*
|
||||
* SortFilter sortFilter = null; try { RECORD_FIELD recordField =
|
||||
* RECORD_FIELD.valueOf(array[0]); ORDER orderField = ORDER.valueOf(array[1]);
|
||||
* sortFilter = new SortFilter(recordField, orderField); } catch (Exception e) {
|
||||
*
|
||||
* }
|
||||
*
|
||||
* GWT.log("Got " + sortFilter); return sortFilter;
|
||||
*
|
||||
* }
|
||||
* @param index the new tab active
|
||||
*/
|
||||
public void setTabActive(int index) {
|
||||
tabPanel.selectTab(index);
|
||||
}
|
||||
|
||||
public SortFilter getCurrentSortFilter() {
|
||||
return currentSortFilter;
|
||||
/**
|
||||
* Dirty solution. I created this one because I had problem on firing click
|
||||
* event for Tab element
|
||||
*
|
||||
*/
|
||||
public void instanceAndShowListOfProjects() {
|
||||
GWT.log("instanceAndShowListOfProjects called");
|
||||
listOfProjectTablePanel.instanceAndShowListOfProjects(ucdProjectTypesForListingDataView);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the main according to list use case descriptors.
|
||||
*
|
||||
* @param listUCDescriptors the list UC descriptors
|
||||
*/
|
||||
public void initMainAccordingToListUseCaseDescriptors(List<UseCaseDescriptorDV> listUCDescriptors) {
|
||||
GWT.log("initMainAccordingToListUseCaseDescriptors: " + listUCDescriptors);
|
||||
// this.listUCDescriptors = listUCDescriptors;
|
||||
ddCreateNewProject.clear();
|
||||
listOfProjectTablePanel.projectTypeReset();
|
||||
|
||||
ucdProjectTypesForListingDataView.clear();
|
||||
|
||||
for (final UseCaseDescriptorDV ucd : listUCDescriptors) {
|
||||
|
||||
HandlerDeclarationDV dataEntryHandler = UCD_Util.getHandlerDeclarationFor(ucd,
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_data_entry);
|
||||
|
||||
if (dataEntryHandler != null) {
|
||||
ConfigurationDV<?> config = dataEntryHandler.getConfiguration();
|
||||
List<GcubeProfileDV> listGcubeProfiles = toListGcubeProfiles(config);
|
||||
|
||||
final List<GcubeProfileDV> listProfiles = listGcubeProfiles;
|
||||
|
||||
NavLink link = new NavLink(ucd.getName());
|
||||
link.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
if (listProfiles == null || listProfiles.size() == 0) {
|
||||
DialogInform di = new DialogInform(null, "No configuration found",
|
||||
"No GcubeProfile found in the Configuration for " + config.getConfiguration());
|
||||
di.center();
|
||||
return;
|
||||
}
|
||||
|
||||
appManagerBus.fireEvent(
|
||||
new CreateNewProjectEvent(ucd.getProfileID(), dataEntryHandler, listProfiles));
|
||||
}
|
||||
});
|
||||
|
||||
ddCreateNewProject.add(link);
|
||||
}
|
||||
|
||||
// Setting Project type having HANDLER DATA LIST
|
||||
HandlerDeclarationDV dataListHandler = UCD_Util.getHandlerDeclarationFor(ucd,
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_data_list);
|
||||
|
||||
if (dataListHandler != null) {
|
||||
ucdProjectTypesForListingDataView.add(ucd);
|
||||
listOfProjectTablePanel.addProjectType(ucd);
|
||||
|
||||
}
|
||||
|
||||
initActionListPanel(ucd);
|
||||
|
||||
}
|
||||
|
||||
// IF one type of document is available, fire
|
||||
// CreateNewProjectEvent(documentConfigDV));
|
||||
if (listUCDescriptors.size() == 1) {
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
GWT.log("One Config loaded. Firing CreateNewProjectEvent");
|
||||
UseCaseDescriptorDV useCaseDescriptor = listUCDescriptors.get(0);
|
||||
HandlerDeclarationDV dataEntryHandler = UCD_Util.getHandlerDeclarationFor(useCaseDescriptor,
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_data_entry);
|
||||
if (dataEntryHandler != null) {
|
||||
ConfigurationDV<?> config = dataEntryHandler.getConfiguration();
|
||||
List<GcubeProfileDV> listGcubeProfiles = toListGcubeProfiles(config);
|
||||
appManagerBus.fireEvent(new CreateNewProjectEvent(useCaseDescriptor.getProfileID(),
|
||||
dataEntryHandler, listGcubeProfiles));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the GUI presentation.
|
||||
*
|
||||
* @param dataEntryGUIPresentation the new GUI presentation
|
||||
*/
|
||||
public void setGUIPresentation(DataEntryGUIPresentationConfig dataEntryGUIPresentation) {
|
||||
this.dataGUIPresentation = dataEntryGUIPresentation;
|
||||
GWT.log("Setting: " + dataEntryGUIPresentation);
|
||||
|
||||
Header header = dataGUIPresentation.getHeader();
|
||||
if (header != null) {
|
||||
if (header.getTitle() != null) {
|
||||
pageHeader.setText(header.getTitle());
|
||||
}
|
||||
if (header.getSubtitle() != null) {
|
||||
pageHeader.setSubtext(header.getSubtitle());
|
||||
}
|
||||
}
|
||||
|
||||
BodyWelcome bodyWelcome = dataGUIPresentation.getBodyWelcome();
|
||||
if (bodyWelcome != null) {
|
||||
if (bodyWelcome.getTitle() != null) {
|
||||
welcomeTitle.setText(bodyWelcome.getTitle());
|
||||
}
|
||||
if (bodyWelcome.getDescription() != null) {
|
||||
welcomeDescription.setText(bodyWelcome.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the action list panel.
|
||||
*
|
||||
* @param ucd the ucd
|
||||
*/
|
||||
public void initActionListPanel(UseCaseDescriptorDV ucd) {
|
||||
GWT.log("Init ActionListPanel for UCD: " + ucd);
|
||||
listOfProjectWorkflowActionsPanel.initActionListPanel(ucd);
|
||||
|
||||
// Setting Project type having HANDLER WORKFLOW ACTION
|
||||
HandlerDeclarationDV dataListHandler = UCD_Util.getHandlerDeclarationFor(ucd,
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_workflow_action_list);
|
||||
|
||||
String[] callSteps = null;
|
||||
if (dataListHandler != null) {
|
||||
ConfigurationDV<?> config = dataListHandler.getConfiguration();
|
||||
List<ActionDefinitionDV> listActionDef = (List<ActionDefinitionDV>) config.getConfiguration();
|
||||
for (ActionDefinitionDV actionDefinitionDV : listActionDef) {
|
||||
// skipping the special workflow action
|
||||
if (actionDefinitionDV.getId()
|
||||
.equals(ConstantsGeoPortalDataEntryApp.WORKFLOW_ACTION_POST_CREATION_ACTION_ID)) {
|
||||
callSteps = actionDefinitionDV.getCallSteps();
|
||||
mapProfileIdForPostCreationActionSteps.put(ucd.getProfileID(), callSteps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the post creation action on save.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @return the post creation action on save
|
||||
*/
|
||||
public String[] getPostCreationActionOnSave(String profileID) {
|
||||
return mapProfileIdForPostCreationActionSteps.get(profileID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show actions on selected.
|
||||
*
|
||||
* @param <T> the generic type
|
||||
* @param selectItems the select items
|
||||
*/
|
||||
public <T> void showActionsOnSelected(List<T> selectItems) {
|
||||
|
||||
theDockLayoutPanel.setWidgetHidden(listOfProjectWorkflowActionsPanel, false);
|
||||
|
||||
listOfProjectWorkflowActionsPanel.showActionsOnSelected(selectItems, userRole);
|
||||
|
||||
if (createRelationProjectsPanel != null && createRelationProjectsPanel.isVisible()) {
|
||||
createRelationProjectsPanel.selectedProject((ResultDocumentDV) selectItems.get(0));
|
||||
}
|
||||
|
||||
if (viewRelationshipPanel != null && viewRelationshipPanel.isVisible()) {
|
||||
viewRelationshipPanel.showRelationsOf((ResultDocumentDV) selectItems.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* To list gcube profiles.
|
||||
*
|
||||
* @param config the config
|
||||
* @return the list
|
||||
*/
|
||||
private List<GcubeProfileDV> toListGcubeProfiles(ConfigurationDV<?> config) {
|
||||
|
||||
try {
|
||||
return (List<GcubeProfileDV>) config.getConfiguration();
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error on casting " + ConfigurationDV.class.getName() + " to List of "
|
||||
+ GcubeProfileDV.class.getName());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the page header.
|
||||
*
|
||||
* @param hDV the new page header
|
||||
*/
|
||||
public void setPageHeader(HandlerDeclarationDV hDV) {
|
||||
introGNAHero.setVisible(false);
|
||||
this.pageHeaderDataEntry.setVisible(true);
|
||||
this.pageHeaderDataEntry.setText("");
|
||||
this.pageHeaderDataEntry.setSubtext("New: " + hDV.getItemType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Show create relation panel.
|
||||
*
|
||||
* @param bool the bool
|
||||
* @param selectedDocument the document DV
|
||||
*/
|
||||
public void showCreateRelationPanel(boolean bool, ResultDocumentDV selectedDocument) {
|
||||
detailsPanel.clear();
|
||||
// theDetailsPanel.setVisible(bool);
|
||||
theDockLayoutPanel.setWidgetHidden(detailsPanel, !bool);
|
||||
// if hiding, returns
|
||||
if (!bool) {
|
||||
return;
|
||||
}
|
||||
createRelationProjectsPanel = new CreateRelationProjectsPanel(appManagerBus, selectedDocument);
|
||||
detailsPanel.add(createRelationProjectsPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show view project relations panel.
|
||||
*
|
||||
* @param bool the bool
|
||||
* @param selectedDocument the selected document
|
||||
*/
|
||||
public void showViewProjectRelationsPanel(boolean bool, ResultDocumentDV selectedDocument) {
|
||||
detailsPanel.clear();
|
||||
// theDetailsPanel.setVisible(bool);
|
||||
theDockLayoutPanel.setWidgetHidden(detailsPanel, !bool);
|
||||
// if hiding, returns
|
||||
if (!bool) {
|
||||
return;
|
||||
}
|
||||
viewRelationshipPanel = new ViewRelationshipPanel(appManagerBus, selectedDocument, true);
|
||||
detailsPanel.add(viewRelationshipPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable relatioship facilities.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
public void enableRelatioshipFacilities(boolean bool) {
|
||||
navCreateRelation.setVisible(bool);
|
||||
if (!bool) {
|
||||
grpw.removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
}
|
||||
|
||||
.custom-page-header {
|
||||
padding: 10px;
|
||||
background-color: #f5f5f5;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
.margin-top-8 {
|
||||
margin-top: 8px !important;
|
||||
.custom-page-header h1 {
|
||||
font-size: 32px;
|
||||
}
|
||||
|
||||
.margin-top-5 {
|
||||
|
@ -32,35 +31,63 @@
|
|||
text-align: right;
|
||||
}
|
||||
|
||||
.max-height-300 {
|
||||
max-height: auto;
|
||||
.display-right {
|
||||
float: right;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.margin-botttom-5 {
|
||||
margin-bottom: 5px !important;
|
||||
.sub-page-header {
|
||||
height: 25px;
|
||||
margin: 0 !important;
|
||||
position: relative;
|
||||
top: -20px;
|
||||
}
|
||||
|
||||
.divider-border-right {
|
||||
border-left: 1px solid #ccc !important;
|
||||
height: 35px !important;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<b:PageHeader subtext="data entry facility"
|
||||
styleName="{style.custom-page-header}">GeoNa</b:PageHeader>
|
||||
styleName="{style.custom-page-header}" ui:field="pageHeader">GeoPortal</b:PageHeader>
|
||||
<g:Label ui:field="roleLabel"
|
||||
addStyleNames="{style.display-right}"></g:Label>
|
||||
<b:TabPanel tabPosition="above" ui:field="tabPanel">
|
||||
<b:Tab icon="FILE_TEXT" heading="New Project" active="true"
|
||||
ui:field="tabNewProject">
|
||||
<g:ScrollPanel>
|
||||
<g:HTMLPanel ui:field="contTabNewProject">
|
||||
<b:Navbar addStyleNames="{style.margin-botttom-5}">
|
||||
<b:Navbar addStyleNames="nav-toolbar-style">
|
||||
<b:Brand addStyleNames="{style.margin-top-5}">New Project</b:Brand>
|
||||
<b:Nav>
|
||||
<b:NavLink ui:field="buttCreateNewProject"
|
||||
title="Create a new Project" icon="FILE">Create New Project</b:NavLink>
|
||||
<b:Dropdown text="Create New Project"
|
||||
ui:field="ddCreateNewProject" icon="FILE">
|
||||
</b:Dropdown>
|
||||
</b:Nav>
|
||||
</b:Navbar>
|
||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||
<div id="topPage"></div>
|
||||
<a href="#bottomPage">Go to bottom</a>
|
||||
</g:HTMLPanel>
|
||||
|
||||
<g:HTMLPanel ui:field="introGNA">
|
||||
<b:Hero ui:field="introGNAHero">
|
||||
<b:Heading size="2" ui:field="welcomeTitle">Welcome
|
||||
to GeoPortal Data
|
||||
Entry</b:Heading>
|
||||
<b:Paragraph ui:field="welcomeDescription"></b:Paragraph>
|
||||
<b:Paragraph>select "Create New Project"</b:Paragraph>
|
||||
</b:Hero>
|
||||
<b:PageHeader subtext=" "
|
||||
ui:field="pageHeaderDataEntry"
|
||||
addStyleNames="{style.sub-page-header}" visible="false">
|
||||
</b:PageHeader>
|
||||
</g:HTMLPanel>
|
||||
|
||||
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
|
||||
<g:HTMLPanel ui:field="geonaMainFormPanel"></g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="geonaMainFormPanel">
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||
<div id="bottomPage"></div>
|
||||
<a href="#topPage">Go to top</a>
|
||||
|
@ -73,45 +100,31 @@
|
|||
<g:FlowPanel>
|
||||
<g:FlowPanel addStyleNames="move-sticky">
|
||||
<b:NavPills>
|
||||
<b:NavLink ui:field="navViewAsDocument"
|
||||
title="View Document" icon="FILE">View Document</b:NavLink>
|
||||
<b:NavLink ui:field="navViewAsJSON"
|
||||
title="View Document as JSON" icon="CODE">View as JSON</b:NavLink>
|
||||
<b:Divider addStyleNames="{style.divider-border-right}" />
|
||||
<b:NavLink ui:field="navShowOnMap" title="Show on Map"
|
||||
icon="MAP_MARKER">Show on Map</b:NavLink>
|
||||
<b:Divider addStyleNames="{style.divider-border-right}" />
|
||||
<b:NavLink ui:field="navShowReport"
|
||||
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>
|
||||
<b:NavLink ui:field="navEditMode" title="Edit"
|
||||
icon="PENCIL">Edit</b:NavLink>
|
||||
icon="PENCIL">Update</b:NavLink>
|
||||
<b:NavLink ui:field="navDelete" title="Delete Project"
|
||||
icon="TRASH">Delete Project</b:NavLink>
|
||||
<b:Divider addStyleNames="{style.divider-border-right}" />
|
||||
<b:NavLink ui:field="navCreateRelation"
|
||||
title="Create Relation between two Projects" icon="LINK">Create
|
||||
Relation</b:NavLink>
|
||||
<b:NavLink ui:field="navViewRelations"
|
||||
title="View the relations created for a Project" icon="LIST_ALT">View
|
||||
Relations</b:NavLink>
|
||||
</b:NavPills>
|
||||
</g:FlowPanel>
|
||||
<g:ScrollPanel>
|
||||
<g:HTMLPanel ui:field="contTabGetListOfProjects">
|
||||
<b:Navbar addStyleNames="{style.margin-botttom-5}">
|
||||
<b:Brand addStyleNames="{style.margin-top-5}">List of Projects</b:Brand>
|
||||
<b:Nav>
|
||||
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
||||
</b:Dropdown>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:TextBox ui:field="textBoxSortBy" readOnly="true"
|
||||
addStyleNames="{style.margin-top-8}"></b:TextBox>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:NavLink ui:field="buttonReloadConcessioni"
|
||||
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
|
||||
</b:Nav>
|
||||
</b:Navbar>
|
||||
|
||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||
<div id="topPage2"></div>
|
||||
<a href="#bottomPage2">Go to bottom</a>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="geonaListOfConcessioniPanel"></g:HTMLPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||
<div id="bottomPage2"></div>
|
||||
<a href="#topPage2">Go to top</a>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</g:ScrollPanel>
|
||||
<g:DockLayoutPanel ui:field="theDockLayoutPanel">
|
||||
</g:DockLayoutPanel>
|
||||
</g:FlowPanel>
|
||||
</b:Tab>
|
||||
</b:TabPanel>
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.ItemsTable.DEFAULT_DISPLAYING_COLUMN_NAME;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.table.SortedCellTable;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
@ -39,40 +42,38 @@ import com.google.gwt.view.client.SingleSelectionModel;
|
|||
public class GeonaRecordsPaginatedView {
|
||||
|
||||
private static final int ITEM_START_INDEX = 0;
|
||||
private static final int ITEMS_PER_PAGE = 30;
|
||||
private static final int ITEMS_PER_PAGE = ConstantsGeoPortalDataEntryApp.PAGINATION_SIZE;
|
||||
private VerticalPanel vPanel = new VerticalPanel();
|
||||
private FlowPanel pagerPanel = new FlowPanel();
|
||||
private Boolean initClassFirstRangeChanged = false;
|
||||
private ItemsTable<ConcessioneDV> itemsTable;
|
||||
private MyCustomDataProvider<ConcessioneDV> dataProvider = new MyCustomDataProvider<ConcessioneDV>();
|
||||
private ItemsTable<DocumentDV> itemsTable;
|
||||
private MyCustomDataProvider<DocumentDV> dataProvider = new MyCustomDataProvider<DocumentDV>();
|
||||
protected Widget orginalLoadingIndicator = null;
|
||||
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
|
||||
private int serverStartIndex;
|
||||
private HandlerManager eventBus;
|
||||
private RECORD_TYPE recordType;
|
||||
private SortFilter currentSortFilter;
|
||||
private SearchingFilter currentSearchingFilter;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new geona records paginated view.
|
||||
*
|
||||
* @param eventbus the eventbus
|
||||
* @param recordType the record type
|
||||
* @param displayFields the display fields
|
||||
* @param currentSortFilter the sort by field
|
||||
* @param eventBus the eventbus
|
||||
* @param profileID the profile ID
|
||||
* @param displayFields the display fields
|
||||
* @param currentSearchingFilter the current searching filter
|
||||
*/
|
||||
public GeonaRecordsPaginatedView(HandlerManager eventbus, RECORD_TYPE recordType,
|
||||
RECORD_FIELD[] displayFields, SortFilter currentSortFilter) {
|
||||
this.recordType = recordType;
|
||||
this.currentSortFilter = currentSortFilter;
|
||||
public GeonaRecordsPaginatedView(HandlerManager eventBus, String profileID, List<ItemFieldDV> displayFields,
|
||||
SearchingFilter currentSearchingFilter) {
|
||||
this.profileID = profileID;
|
||||
this.currentSearchingFilter = currentSearchingFilter;
|
||||
this.initClassFirstRangeChanged = true;
|
||||
this.eventBus = eventbus;
|
||||
itemsTable = new ItemsTable<ConcessioneDV>(eventbus, displayFields, currentSortFilter);
|
||||
this.eventBus = eventBus;
|
||||
itemsTable = new ItemsTable<DocumentDV>(eventBus, displayFields);
|
||||
itemsTable.initTable(null, null, dataProvider);
|
||||
|
||||
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
|
||||
initPagination(ITEMS_PER_PAGE);
|
||||
// loadNewPage(ITEM_START_INDEX, ITEMS_PER_PAGE, false);
|
||||
loadItemsForType(recordType);
|
||||
loadItemsForType(profileID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,8 +81,8 @@ public class GeonaRecordsPaginatedView {
|
|||
*
|
||||
* @return the table data provider
|
||||
*/
|
||||
public AsyncDataProvider<ConcessioneDV> getTableDataProvider() {
|
||||
return (AsyncDataProvider<ConcessioneDV>) getCellTable().getDataProvider();
|
||||
public AsyncDataProvider<DocumentDV> getTableDataProvider() {
|
||||
return (AsyncDataProvider<DocumentDV>) getCellTable().getDataProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +90,7 @@ public class GeonaRecordsPaginatedView {
|
|||
*
|
||||
* @return the cell tale
|
||||
*/
|
||||
private SortedCellTable<ConcessioneDV> getCellTable() {
|
||||
private SortedCellTable<DocumentDV> getCellTable() {
|
||||
return itemsTable.getCellTable();
|
||||
}
|
||||
|
||||
|
@ -114,40 +115,38 @@ public class GeonaRecordsPaginatedView {
|
|||
/**
|
||||
* Load new page.
|
||||
*
|
||||
* @param startIdx the start idx
|
||||
* @param limit the limit
|
||||
* @param resetStore the reset store
|
||||
* @param invalidCache the invalid cache
|
||||
* @param profileID the profile ID
|
||||
* @param startIdx the start idx
|
||||
* @param limit the limit
|
||||
* @param resetStore the reset store
|
||||
* @param currentSearchFilter the current search filter
|
||||
* @param invalidCache the invalid cache
|
||||
*/
|
||||
private void loadNewPage(final int startIdx, final int limit, final boolean resetStore,
|
||||
final SortFilter currentSortFilter, final boolean invalidCache) {
|
||||
// initFirstRangeChanged = resetStore;
|
||||
private void loadNewPage(String profileID, final int startIdx, final int limit, final boolean resetStore,
|
||||
final SearchingFilter currentSearchFilter, final boolean invalidCache) {
|
||||
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
|
||||
+ resetStore + "]");
|
||||
// showLoading(true);
|
||||
|
||||
int newStartIndex = startIdx;
|
||||
|
||||
if (resetStore) {
|
||||
GWT.log("Cleaning all data...");
|
||||
newStartIndex = 0;
|
||||
serverStartIndex = 0;
|
||||
GWT.log("Store reset performed start index is: " + newStartIndex);
|
||||
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
|
||||
}
|
||||
|
||||
loadConcessioni(newStartIndex, limit, serverStartIndex, currentSortFilter, invalidCache);
|
||||
loadProjects(profileID, newStartIndex, limit, currentSearchFilter, invalidCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load items for type.
|
||||
*
|
||||
* @param recordType the record type
|
||||
* @param profileID the profile ID
|
||||
*/
|
||||
public void loadItemsForType(RECORD_TYPE recordType) {
|
||||
this.recordType = recordType;
|
||||
private void loadItemsForType(String profileID) {
|
||||
this.profileID = profileID;
|
||||
getCellTable().setVisibleRangeAndClearData(new Range(ITEM_START_INDEX, ITEMS_PER_PAGE), false);
|
||||
loadNewPage(ITEM_START_INDEX, ITEMS_PER_PAGE, true, currentSortFilter, true);
|
||||
loadNewPage(profileID, ITEM_START_INDEX, ITEMS_PER_PAGE, true, currentSearchingFilter, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,19 +156,21 @@ public class GeonaRecordsPaginatedView {
|
|||
*/
|
||||
private void setNewPageResult(ResultSetPaginatedData result) {
|
||||
GWT.log("setNewPageResult: " + result);
|
||||
serverStartIndex = result.getServerEndIndex();
|
||||
SelectionModel<? super ConcessioneDV> sm = getCellTable().getSelectionModel();
|
||||
// serverStartIndex = result.getServerEndIndex();
|
||||
SelectionModel<? super DocumentDV> sm = getCellTable().getSelectionModel();
|
||||
|
||||
if (sm instanceof SingleSelectionModel) {
|
||||
SingleSelectionModel<ConcessioneDV> ssm = (SingleSelectionModel<ConcessioneDV>) sm;
|
||||
SingleSelectionModel<? super DocumentDV> ssm = (SingleSelectionModel<DocumentDV>) sm;
|
||||
ssm.clear();
|
||||
} else if (sm instanceof MultiSelectionModel) {
|
||||
MultiSelectionModel<ConcessioneDV> msm = (MultiSelectionModel<ConcessioneDV>) sm;
|
||||
MultiSelectionModel<? super DocumentDV> msm = (MultiSelectionModel<DocumentDV>) sm;
|
||||
msm.clear();
|
||||
}
|
||||
|
||||
getTableDataProvider().updateRowCount((int) result.getTotalItems(), true);
|
||||
getTableDataProvider().updateRowData(result.getClientStartIndex(), result.getData());
|
||||
|
||||
// TODO MUST USE PROJECT
|
||||
getTableDataProvider().updateRowData(result.getClientStartIndex(), (List<DocumentDV>) result.getData());
|
||||
|
||||
if (result.getData().size() == 0) {
|
||||
getCellTable().setLoadingIndicator(new Label("No data"));
|
||||
|
@ -187,24 +188,54 @@ public class GeonaRecordsPaginatedView {
|
|||
}
|
||||
// initFirstRangeChanged = false;
|
||||
|
||||
//printData((List<DocumentDV>) result.getData());
|
||||
}
|
||||
|
||||
private void printData(List<DocumentDV> data) {
|
||||
GWT.log("printData");
|
||||
int i = 0;
|
||||
for (DocumentDV documentDV : data) {
|
||||
GWT.log(++i + ") json: " + documentDV.getDocumentAsJSON());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load concessioni.
|
||||
* To list document DV.
|
||||
*
|
||||
* @param data the data
|
||||
* @return the list
|
||||
*/
|
||||
private List<DocumentDV> toListDocumentDV(List<ProjectDV> data) {
|
||||
if (data == null)
|
||||
return null;
|
||||
|
||||
List<DocumentDV> listDocuments = new ArrayList<DocumentDV>(data.size());
|
||||
for (ProjectDV projectDV : data) {
|
||||
listDocuments.add(projectDV.getTheDocument());
|
||||
}
|
||||
|
||||
return listDocuments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load projects.
|
||||
*
|
||||
* @param <T> the generic type
|
||||
* @param theProfileID the the profile ID
|
||||
* @param newStartIndex the new start index
|
||||
* @param limit the limit
|
||||
* @param serverIndex the server index
|
||||
* @param searchFilter the search filter
|
||||
* @param invalidCache the invalid cache
|
||||
*/
|
||||
private <T> void loadConcessioni(int newStartIndex, int limit, int serverIndex, SortFilter sortFilter,
|
||||
private <T> void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter searchFilter,
|
||||
boolean invalidCache) {
|
||||
showLoading(true);
|
||||
|
||||
GWT.log("calling loadItemsForStatus with parameters [startIndex: " + newStartIndex + ", limit: " + limit
|
||||
+ ", serverIndex:" + serverIndex + ", sortFilter: " + sortFilter + "]");
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getListConcessioni(newStartIndex, limit, sortFilter, invalidCache,
|
||||
new AsyncCallback<ResultSetPaginatedData>() {
|
||||
GWT.log("calling loadItemsForStatus with parameters [theProfileID: " + theProfileID + ", startIndex: "
|
||||
+ newStartIndex + ", limit: " + limit + ", searchFilter: " + searchFilter + "]");
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit,
|
||||
searchFilter, invalidCache, new AsyncCallback<ResultSetPaginatedData>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -230,27 +261,37 @@ public class GeonaRecordsPaginatedView {
|
|||
* @param limitToPage the limit to page
|
||||
*/
|
||||
public void selectItems(boolean select, boolean limitToPage) {
|
||||
SortedCellTable<ConcessioneDV> table = getCellTable();
|
||||
SortedCellTable<DocumentDV> table = getCellTable();
|
||||
int rowSize = table.getVisibleItemCount();
|
||||
|
||||
for (int i = 0; i < rowSize; i++) {
|
||||
ConcessioneDV item = table.getVisibleItem(i);
|
||||
DocumentDV item = table.getVisibleItem(i);
|
||||
itemsTable.getSelectionModel().setSelected(item, select);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the column.
|
||||
*
|
||||
* @param columnName the column name
|
||||
*/
|
||||
public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) {
|
||||
try {
|
||||
itemsTable.removeColumn(columnName);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the select items.
|
||||
*
|
||||
* @return the select items
|
||||
*/
|
||||
public List<ConcessioneDV> getSelectItems() {
|
||||
public List<DocumentDV> getSelectItems() {
|
||||
return itemsTable.getSelectedItems();
|
||||
}
|
||||
|
||||
// int latestRangeStart = -1;
|
||||
// int latestRangeLenght = -1;
|
||||
|
||||
/**
|
||||
* A custom {@link AsyncDataProvider}.
|
||||
*
|
||||
|
@ -275,24 +316,13 @@ public class GeonaRecordsPaginatedView {
|
|||
int start = range.getStart();
|
||||
int length = range.getLength();
|
||||
|
||||
// if(latestRangeStart!=start || latestRangeLenght!=length) {
|
||||
// GWT.log("ranges really changed");
|
||||
// latestRangeStart = start;
|
||||
// latestRangeLenght = length;
|
||||
// }else {
|
||||
// GWT.log("ranges DO NOT changed");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (initClassFirstRangeChanged) {
|
||||
GWT.log("initClassFirstRangeChanged is true.. returning");
|
||||
initClassFirstRangeChanged = false;
|
||||
return;
|
||||
}
|
||||
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
|
||||
loadNewPage(start, length, false, currentSortFilter, false);
|
||||
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
|
||||
|
||||
loadNewPage(profileID, start, length, false, currentSearchingFilter, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -324,4 +354,13 @@ public class GeonaRecordsPaginatedView {
|
|||
return pagerPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile ID.
|
||||
*
|
||||
* @return the profile ID
|
||||
*/
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.ModalFooter;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
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.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
public class ModalWindow {
|
||||
|
||||
private HorizontalPanel hp = new HorizontalPanel();
|
||||
private Modal modal;
|
||||
|
||||
public ModalWindow(Image icon, String title, String msg, AlertType alertType) {
|
||||
|
||||
modal = new Modal(true,true);
|
||||
modal.hide(false);
|
||||
modal.setTitle(title);
|
||||
modal.setCloseVisible(true);
|
||||
|
||||
|
||||
Alert alert = new Alert();
|
||||
alert.setType(alertType);
|
||||
alert.setClose(false);
|
||||
alert.setText(msg);
|
||||
alert.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
|
||||
|
||||
if (icon != null)
|
||||
hp.add(icon);
|
||||
hp.add(alert);
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
modal.add(hp);
|
||||
modal.add(modalFooter);
|
||||
}
|
||||
|
||||
public void show() {
|
||||
modal.show();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
|
||||
public class ActionDefButton {
|
||||
|
||||
private ActionDefinitionDV actionDefinitionDV;
|
||||
private Button button;
|
||||
|
||||
public ActionDefButton(ActionDefinitionDV actionDefinitionDV, Button button) {
|
||||
this.actionDefinitionDV = actionDefinitionDV;
|
||||
this.button = button;
|
||||
}
|
||||
|
||||
public ActionDefinitionDV getActionDefinitionDV() {
|
||||
return actionDefinitionDV;
|
||||
}
|
||||
|
||||
public Button getButton() {
|
||||
return button;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.WorkflowActionOnSelectedItemEvent;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ButtonGroup;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class ActionListPanel extends Composite {
|
||||
|
||||
private static ActionListPanelUiBinder uiBinder = GWT.create(ActionListPanelUiBinder.class);
|
||||
|
||||
interface ActionListPanelUiBinder extends UiBinder<Widget, ActionListPanel> {
|
||||
}
|
||||
|
||||
private String projectName;
|
||||
private String profileID;
|
||||
private List<ActionDefinitionDV> listActionDefinition;
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
public ActionListPanel(HandlerManager appManagerBus, String projectName, String profileID,
|
||||
List<ActionDefinitionDV> listActionDef) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
GWT.log("Adding list of actions: " + listActionDef);
|
||||
this.appManagerBus = appManagerBus;
|
||||
this.projectName = projectName;
|
||||
this.profileID = profileID;
|
||||
this.listActionDefinition = listActionDef;
|
||||
initActions(listActionDefinition);
|
||||
actionListBasePanel.setVisible(false);
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel actionListContainer;
|
||||
|
||||
@UiField
|
||||
HTMLPanel actionListBasePanel;
|
||||
|
||||
private Map<String, List<ActionDefButton>> mapPhaseListButtons;
|
||||
|
||||
private void initActions(List<ActionDefinitionDV> listActionDef) {
|
||||
|
||||
if (listActionDef.size() > 0) {
|
||||
// actionListBasePanel.setVisible(true);
|
||||
|
||||
ButtonGroup buttonGroup = new ButtonGroup();
|
||||
buttonGroup.getElement().addClassName("actions-button-group");
|
||||
|
||||
mapPhaseListButtons = new LinkedHashMap<String, List<ActionDefButton>>();
|
||||
|
||||
for (ActionDefinitionDV actionDefinitionDV : listActionDef) {
|
||||
|
||||
// skipping the special workflow action
|
||||
if (actionDefinitionDV.getId()
|
||||
.equals(ConstantsGeoPortalDataEntryApp.WORKFLOW_ACTION_POST_CREATION_ACTION_ID)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Button butt = new Button();
|
||||
butt.setText(actionDefinitionDV.getTitle());
|
||||
butt.setTitle(actionDefinitionDV.getDescription());
|
||||
butt.setType(ButtonType.INFO);
|
||||
butt.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
appManagerBus
|
||||
.fireEvent(new WorkflowActionOnSelectedItemEvent<ResultDocumentDV>(actionDefinitionDV));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
String[] displayOnPhases = actionDefinitionDV.getDisplayOnPhase();
|
||||
|
||||
for (String displayOnPhase : displayOnPhases) {
|
||||
List<ActionDefButton> mapPhase = mapPhaseListButtons.get(displayOnPhase);
|
||||
if (mapPhase == null)
|
||||
mapPhase = new ArrayList<ActionDefButton>();
|
||||
|
||||
mapPhase.add(new ActionDefButton(actionDefinitionDV, butt));
|
||||
mapPhaseListButtons.put(displayOnPhase, mapPhase);
|
||||
}
|
||||
buttonGroup.add(butt);
|
||||
}
|
||||
|
||||
actionListContainer.add(buttonGroup);
|
||||
} else {
|
||||
actionListBasePanel.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public <T> void showActionsOnSelected(List<T> listSelected, GcubeUserRole userRole) {
|
||||
setAllActionsVisible(false);
|
||||
|
||||
if (listSelected.size() == 1) {
|
||||
|
||||
for (T item : listSelected) {
|
||||
|
||||
if (item instanceof ResultDocumentDV) {
|
||||
|
||||
String itemPhase = ((ResultDocumentDV) item).getLifecycleInfo().getPhase();
|
||||
|
||||
List<ActionDefButton> listButtons = mapPhaseListButtons.get(itemPhase);
|
||||
|
||||
if (listButtons != null) {
|
||||
|
||||
for (ActionDefButton actionDefButton : listButtons) {
|
||||
|
||||
Set<String> roles = actionDefButton.getActionDefinitionDV().getRoles();
|
||||
|
||||
// No role/s defined means enable the action by default
|
||||
if (roles.isEmpty()) {
|
||||
actionDefButton.getButton().setVisible(true);
|
||||
actionListBasePanel.setVisible(true);
|
||||
} else {
|
||||
// Checking if the userRole is matching the role defined in the ActionDefinition
|
||||
boolean isRoleIntoActionDef = roles.stream()
|
||||
.anyMatch(userRole.getName()::equalsIgnoreCase);
|
||||
if (isRoleIntoActionDef) {
|
||||
actionDefButton.getButton().setVisible(true);
|
||||
actionListBasePanel.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setAllActionsVisible(boolean bool) {
|
||||
|
||||
if (mapPhaseListButtons != null && mapPhaseListButtons.values().size() > 0) {
|
||||
|
||||
Iterator<List<ActionDefButton>> collIterator = mapPhaseListButtons.values().iterator();
|
||||
if (collIterator != null) {
|
||||
while (collIterator.hasNext()) {
|
||||
List<ActionDefButton> listButton = collIterator.next();
|
||||
for (ActionDefButton actionDefButton : listButton) {
|
||||
actionDefButton.getButton().setVisible(bool);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<!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>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.action-panel {
|
||||
display: flex;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.action-title {
|
||||
color: #777;
|
||||
font-size: 14px;
|
||||
text-shadow: 0 1px 0 #eee;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="actionListBasePanel"
|
||||
addStyleNames="{style.action-panel}">
|
||||
<g:HTML addStyleNames="{style.action-title}">WORKFLOW ACTIONS</g:HTML>
|
||||
<g:HTMLPanel ui:field="actionListContainer"></g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -1,32 +1,35 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
|
||||
public class GeoNaFormCardModel {
|
||||
public class GeoNaFormCardModel<T extends MetaDataProfileBean> {
|
||||
|
||||
private MetaDataProfileBean metadataProfileBean;
|
||||
private T metadataProfileBean;
|
||||
private CreateMetadataForm metadataForm;
|
||||
private ConcessioniFormCardTitle formCardTitle; //matching with metadata profile type
|
||||
private ProjectFormCard formCard; // matching with metadata profile
|
||||
private GcubeProfileDV gcubeProfile;
|
||||
|
||||
public GeoNaFormCardModel() {
|
||||
|
||||
}
|
||||
|
||||
public GeoNaFormCardModel(MetaDataProfileBean metadataProfileBean, CreateMetadataForm metadataForm,
|
||||
ConcessioniFormCardTitle formCardTitle) {
|
||||
public GeoNaFormCardModel(T metadataProfileBean, CreateMetadataForm metadataForm, ProjectFormCard formCard,
|
||||
GcubeProfileDV gcubeProfile) {
|
||||
super();
|
||||
this.metadataProfileBean = metadataProfileBean;
|
||||
this.metadataForm = metadataForm;
|
||||
this.formCardTitle = formCardTitle;
|
||||
this.formCard = formCard;
|
||||
this.gcubeProfile = gcubeProfile;
|
||||
}
|
||||
|
||||
public MetaDataProfileBean getMetadataProfileBean() {
|
||||
public T getMetadataProfileBean() {
|
||||
return metadataProfileBean;
|
||||
}
|
||||
|
||||
public void setMetadataProfileBean(MetaDataProfileBean metadataProfileBean) {
|
||||
public void setMetadataProfileBean(T metadataProfileBean) {
|
||||
this.metadataProfileBean = metadataProfileBean;
|
||||
}
|
||||
|
||||
|
@ -38,18 +41,35 @@ public class GeoNaFormCardModel {
|
|||
this.metadataForm = metadataForm;
|
||||
}
|
||||
|
||||
public ConcessioniFormCardTitle getFormCardTitle() {
|
||||
return formCardTitle;
|
||||
public ProjectFormCard getFormCard() {
|
||||
return formCard;
|
||||
}
|
||||
|
||||
public void setFormCardTitle(ConcessioniFormCardTitle formCardTitle) {
|
||||
this.formCardTitle = formCardTitle;
|
||||
public void setFormCard(ProjectFormCard formCard) {
|
||||
this.formCard = formCard;
|
||||
}
|
||||
|
||||
public GcubeProfileDV getGcubeProfile() {
|
||||
return gcubeProfile;
|
||||
}
|
||||
|
||||
public void setGcubeProfile(GcubeProfileDV gcubeProfile) {
|
||||
this.gcubeProfile = gcubeProfile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GeoNaForm [metadataProfileBean=" + metadataProfileBean + ", metadataForm=" + metadataForm
|
||||
+ ", formCardTitle=" + formCardTitle + "]";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaFormCardModel [metadataProfileBean=");
|
||||
builder.append(metadataProfileBean);
|
||||
builder.append(", metadataForm=");
|
||||
builder.append(metadataForm);
|
||||
builder.append(", formCard=");
|
||||
builder.append(formCard);
|
||||
builder.append(", gcubeProfile=");
|
||||
builder.append(gcubeProfile);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,63 +3,70 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.AlertClosable;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
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.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
/**
|
||||
* The Class MetadataFormCard.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 12, 2020
|
||||
* Oct 12, 2020
|
||||
*/
|
||||
public class MetadataFormCard {
|
||||
|
||||
|
||||
/** The heading. */
|
||||
private String heading;
|
||||
|
||||
|
||||
/** The tab. */
|
||||
private Tab tab;
|
||||
|
||||
|
||||
/** The repeatible. */
|
||||
private boolean repeatible;
|
||||
|
||||
|
||||
/** The list forms. */
|
||||
private List<CreateMetadataForm> listForms = new ArrayList<CreateMetadataForm>();
|
||||
|
||||
|
||||
/** The form card event handler. */
|
||||
private MetadataFormCardEventHandler formCardEventHandler = new MetadataFormCardEventHandler();
|
||||
|
||||
|
||||
/** The geona form model. */
|
||||
private GeoNaFormCardModel geonaFormModel;
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private Integer maxFormRepeatability;
|
||||
|
||||
|
||||
private FlowPanel tabContainer = new FlowPanel();
|
||||
|
||||
private int minFormRepeatability;
|
||||
|
||||
/**
|
||||
* The Class MetadataFormCardEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 12, 2020
|
||||
* Oct 12, 2020
|
||||
*/
|
||||
private class MetadataFormCardEventHandler implements GenericFormEventsListener{
|
||||
|
||||
private class MetadataFormCardEventHandler implements GenericFormEventsListener {
|
||||
|
||||
/**
|
||||
* On form data valid.
|
||||
*
|
||||
|
@ -68,7 +75,7 @@ public class MetadataFormCard {
|
|||
@Override
|
||||
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
|
||||
setTabStatus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +84,7 @@ public class MetadataFormCard {
|
|||
@Override
|
||||
public void onFormDataEdit() {
|
||||
resetTabStatus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,38 +93,58 @@ public class MetadataFormCard {
|
|||
@Override
|
||||
public void onFormAborted() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On validation error.
|
||||
*
|
||||
* @param throwable the throwable
|
||||
* @param errorMsg the error msg
|
||||
* @param errorMsg the error msg
|
||||
*/
|
||||
@Override
|
||||
public void onValidationError(Throwable throwable, String errorMsg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new metadata form card.
|
||||
*
|
||||
* @param tab the tab
|
||||
* @param tab the tab
|
||||
* @param geonaFormModel the geona form model
|
||||
* @param appManagerBus the app manager bus
|
||||
* @param appManagerBus the app manager bus
|
||||
*/
|
||||
public MetadataFormCard(Tab tab, GeoNaFormCardModel geonaFormModel, HandlerManager appManagerBus) {
|
||||
this.tab = tab;
|
||||
this.geonaFormModel = geonaFormModel;
|
||||
this.appManagerBus = appManagerBus;
|
||||
this.repeatible = geonaFormModel.getFormCardTitle().isInternalRepeatibleForm();
|
||||
this.maxFormRepeatability = geonaFormModel.getFormCardTitle().getMaxFormRepeatability()!=null?geonaFormModel.getFormCardTitle().getMaxFormRepeatability():Integer.MAX_VALUE;
|
||||
this.buildCard(geonaFormModel.getMetadataForm());
|
||||
//geonaFormModel.getMetadataForm().addListener(formCardEventHandler);
|
||||
ProjectFormCard formCard = geonaFormModel.getFormCard();
|
||||
this.repeatible = formCard.isInternalRepeatibleForm();
|
||||
this.minFormRepeatability = formCard.getMinFormRepeatability() != null
|
||||
? geonaFormModel.getFormCard().getMinFormRepeatability()
|
||||
: 1;
|
||||
this.maxFormRepeatability = formCard.getMaxFormRepeatability() != null
|
||||
? geonaFormModel.getFormCard().getMaxFormRepeatability()
|
||||
: Integer.MAX_VALUE;
|
||||
|
||||
boolean repeatibleFormIsRemovable = true;
|
||||
if (minFormRepeatability > 1) {
|
||||
repeatibleFormIsRemovable = false;
|
||||
for (int i = 1; i < minFormRepeatability; i++) {
|
||||
CreateMetadataForm newForm = new CreateMetadataForm(
|
||||
geonaFormModel.getMetadataForm().getMetadataProfiles(), appManagerBus,
|
||||
CreateMetadataForm.OPERATION.UPDATE);
|
||||
// newForm.addListener(formCardEventHandler);
|
||||
// here removableForm is false because the min > 1 must be respected
|
||||
addNewForm(newForm, repeatibleFormIsRemovable);
|
||||
}
|
||||
}
|
||||
|
||||
this.buildCard(geonaFormModel.getMetadataForm(), repeatibleFormIsRemovable);
|
||||
// geonaFormModel.getMetadataForm().addListener(formCardEventHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -125,62 +152,74 @@ public class MetadataFormCard {
|
|||
*
|
||||
* @param createMetadataForm the create metadata form
|
||||
*/
|
||||
private void buildCard(final CreateMetadataForm createMetadataForm) {
|
||||
|
||||
if(repeatible) {
|
||||
private void buildCard(final CreateMetadataForm createMetadataForm, boolean repeatibleFormIsRemovable) {
|
||||
|
||||
if (repeatible) {
|
||||
Button buttonAddNew = new Button("Add New...");
|
||||
tab.add(buttonAddNew);
|
||||
|
||||
|
||||
buttonAddNew.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
if(listForms.size() < maxFormRepeatability) {
|
||||
|
||||
CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),appManagerBus);
|
||||
//newForm.addListener(formCardEventHandler);
|
||||
addNewForm(newForm);
|
||||
}else
|
||||
Window.alert("Maximun number of data reached for "+geonaFormModel.getFormCardTitle().getTitle());
|
||||
//newForm.getCreateButton().setFocus(true);
|
||||
|
||||
if (listForms.size() < maxFormRepeatability) {
|
||||
|
||||
CreateMetadataForm newForm = new CreateMetadataForm(createMetadataForm.getMetadataProfiles(),
|
||||
appManagerBus, CreateMetadataForm.OPERATION.UPDATE);
|
||||
// newForm.addListener(formCardEventHandler);
|
||||
addNewForm(newForm, true);
|
||||
} else {
|
||||
DialogInform di = new DialogInform(new Image(Images.ICONS.accessDenied()), "Maximun reached",
|
||||
"Maximun number of data reached for " + geonaFormModel.getFormCard().getTitle());
|
||||
di.center();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
tab.add(tabContainer);
|
||||
addNewForm(createMetadataForm);
|
||||
addNewForm(createMetadataForm, repeatibleFormIsRemovable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the new form.
|
||||
*
|
||||
* @param newForm the new form
|
||||
*/
|
||||
private void addNewForm(final CreateMetadataForm newForm) {
|
||||
tabContainer.insert(newForm,0);
|
||||
private void addNewForm(final CreateMetadataForm newForm, boolean repeatibleFormIsRemovable) {
|
||||
tabContainer.insert(newForm, 0);
|
||||
listForms.add(newForm);
|
||||
|
||||
if(listForms.size()>1) {
|
||||
|
||||
if (listForms.size() > 1 && repeatibleFormIsRemovable) {
|
||||
final Button buttonRemoveLatestForm = new Button("Remove");
|
||||
buttonRemoveLatestForm.setIcon(IconType.TRASH);
|
||||
tabContainer.insert(buttonRemoveLatestForm,1);
|
||||
|
||||
tabContainer.insert(buttonRemoveLatestForm, 1);
|
||||
|
||||
buttonRemoveLatestForm.addClickHandler(new ClickHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
tabContainer.remove(newForm);
|
||||
listForms.remove(newForm);
|
||||
tabContainer.remove(buttonRemoveLatestForm);
|
||||
|
||||
|
||||
AlertClosable alertCloasable = new AlertClosable();
|
||||
alertCloasable.setHTML("Data Entry form removed!");
|
||||
alertCloasable.setAnimation(true);
|
||||
alertCloasable.setType(AlertType.DEFAULT);
|
||||
alertCloasable.setClose(true);
|
||||
alertCloasable.closeAfter(3000);
|
||||
alertCloasable.getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
tabContainer.insert(alertCloasable,0);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
newForm.addListener(formCardEventHandler);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list forms.
|
||||
*
|
||||
|
@ -189,7 +228,7 @@ public class MetadataFormCard {
|
|||
public List<CreateMetadataForm> getListForms() {
|
||||
return listForms;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the heading.
|
||||
*
|
||||
|
@ -199,7 +238,6 @@ public class MetadataFormCard {
|
|||
return heading;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate form.
|
||||
*
|
||||
|
@ -208,8 +246,8 @@ public class MetadataFormCard {
|
|||
public boolean validateForm() {
|
||||
for (CreateMetadataForm createMetadataForm : listForms) {
|
||||
boolean isFormDataValid = createMetadataForm.isFormDataValid();
|
||||
GWT.log("Is form data valid: "+isFormDataValid);
|
||||
if(!isFormDataValid) {
|
||||
GWT.log("Is form data valid: " + isFormDataValid);
|
||||
if (!isFormDataValid) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -222,43 +260,41 @@ public class MetadataFormCard {
|
|||
* @param bool the new valid card
|
||||
*/
|
||||
public void setValidCard(boolean bool) {
|
||||
if(bool) {
|
||||
if (bool) {
|
||||
tab.setIcon(IconType.OK_SIGN);
|
||||
tab.asWidget().getElement().removeClassName("red-text");
|
||||
tab.asWidget().getElement().addClassName("green-text");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tab.setIcon(IconType.MINUS_SIGN);
|
||||
tab.asWidget().getElement().removeClassName("green-text");
|
||||
tab.asWidget().getElement().addClassName("red-text");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the tab status.
|
||||
*/
|
||||
private void setTabStatus() {
|
||||
boolean isValid = validateForm();
|
||||
if(isValid) {
|
||||
if (isValid) {
|
||||
tab.setIcon(IconType.OK_SIGN);
|
||||
tab.asWidget().getElement().removeClassName("red-text");
|
||||
tab.asWidget().getElement().addClassName("green-text");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
tab.setIcon(IconType.MINUS_SIGN);
|
||||
tab.asWidget().getElement().removeClassName("red-text");
|
||||
tab.asWidget().getElement().addClassName("red-text");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset tab status.
|
||||
*/
|
||||
private void resetTabStatus() {
|
||||
tab.setIcon(null);
|
||||
}
|
||||
|
||||
|
||||
public GeoNaFormCardModel getGeonaFormModel() {
|
||||
return geonaFormModel;
|
||||
}
|
||||
|
|
|
@ -3,22 +3,25 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.paths.FileSetPathsDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor.JSONEditorWrapper;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.dom.client.Style.Visibility;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
|
@ -26,11 +29,11 @@ import com.google.gwt.uibinder.client.UiBinder;
|
|||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Random;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
|
@ -59,16 +62,16 @@ public class EditModeRecord extends Composite {
|
|||
@UiField
|
||||
Button buttonJSONUpdate;
|
||||
|
||||
private BaseConcessioneDV selectedConcessione;
|
||||
|
||||
private RECORD_TYPE recordType;
|
||||
private ResultDocumentDV selectedProject;
|
||||
|
||||
private JSONEditorWrapper jsEditor;
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
|
||||
private final HandlerManager editorManagerBus = new HandlerManager(null);
|
||||
|
||||
private int modalHeight;
|
||||
|
||||
/**
|
||||
* The Interface EditModeRecordUiBinder.
|
||||
*
|
||||
|
@ -79,20 +82,17 @@ public class EditModeRecord extends Composite {
|
|||
interface EditModeRecordUiBinder extends UiBinder<Widget, EditModeRecord> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new edits the mode record.
|
||||
*
|
||||
* @param appManagerBus the app manager bus
|
||||
* @param selectedConcessione the selected concessione
|
||||
* @param type the type
|
||||
*/
|
||||
public EditModeRecord(HandlerManager appManagerBus, BaseConcessioneDV selectedConcessione, RECORD_TYPE type) {
|
||||
public EditModeRecord(HandlerManager appManagerBus, ResultDocumentDV selectedProject, int modalHeight) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.selectedConcessione = selectedConcessione;
|
||||
this.recordType = type;
|
||||
this.modalHeight = modalHeight;
|
||||
this.selectedProject = selectedProject;
|
||||
this.appManagerBus = appManagerBus;
|
||||
this.filesUpdatePanel.setHeight("490px");
|
||||
// filesUpdatePanel.getElement().getStyle().setProperty("maxHeight", "550px");
|
||||
this.filesUpdatePanel.setHeight((modalHeight - 50) + "px");
|
||||
// filesUpdatePanel.getElement().modalHeight().setProperty("maxHeight",
|
||||
// "550px");
|
||||
|
||||
// TODO Must be instanceUpdateFilesetEditor
|
||||
tabUploadFiles.asWidget().getElement().getStyle().setVisibility(Visibility.HIDDEN);
|
||||
|
||||
instanceJSONEditor();
|
||||
instanceUpdateFilesetEditor();
|
||||
|
@ -100,66 +100,90 @@ public class EditModeRecord extends Composite {
|
|||
}
|
||||
|
||||
private void instanceUpdateFilesetEditor() {
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.readFileSetPaths(new AsyncCallback<FileSetPathsDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
// Window.alert("instanceUpdateFilesetEditor must be revisited");
|
||||
|
||||
}
|
||||
/*
|
||||
* GeoPortalDataEntryApp.geoportalDataEntryService.readFileSetPaths(new
|
||||
* AsyncCallback<FileSetPathsDV>() {
|
||||
*
|
||||
* @Override public void onFailure(Throwable caught) { // TODO Auto-generated
|
||||
* method stub
|
||||
*
|
||||
* }
|
||||
*
|
||||
* @Override public void onSuccess(FileSetPathsDV fileSetPaths) { UpdateFileset
|
||||
* updateFileset = new UpdateFileset(editorManagerBus, selectedProject,
|
||||
* recordType, fileSetPaths.getFileSetPaths());
|
||||
* filesUpdatePanel.add(updateFileset); } });
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onSuccess(FileSetPathsDV fileSetPaths) {
|
||||
UpdateFileset updateFileset = new UpdateFileset(editorManagerBus, selectedConcessione, recordType,
|
||||
fileSetPaths.getFileSetPaths());
|
||||
filesUpdatePanel.add(updateFileset);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void noUpdateMode() {
|
||||
buttonJSONUpdate.setVisible(false);
|
||||
}
|
||||
|
||||
private void instanceJSONEditor() {
|
||||
|
||||
rawUpdatePanel.clear();
|
||||
|
||||
final HorizontalPanel hpLoader = new HorizontalPanel();
|
||||
final LoaderIcon lc = new LoaderIcon("Loading Project... please wait");
|
||||
hpLoader.add(lc);
|
||||
rawUpdatePanel.add(hpLoader);
|
||||
final FlowPanel fp = new FlowPanel();
|
||||
fp.getElement().setId("jsoneditor" + Random.nextInt());
|
||||
fp.setHeight("410px");
|
||||
fp.setHeight((modalHeight - 160) + "px");
|
||||
rawUpdatePanel.add(fp);
|
||||
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONRecord(selectedConcessione.getItemId(), recordType,
|
||||
new AsyncCallback<String>() {
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
public void execute() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(String jsonData) {
|
||||
GWT.log("Instance JSON Editor with: " + jsonData);
|
||||
jsEditor = JSONEditorWrapper.init(fp.getElement().getId());
|
||||
jsEditor.setName(selectedConcessione.getNome());
|
||||
jsEditor.set(jsonData);
|
||||
|
||||
new Timer() {
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONDocumentInTheProject(
|
||||
selectedProject.getProfileID(), selectedProject.getId(), new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
jsEditor.setMode("tree");
|
||||
public void onSuccess(String jsonData) {
|
||||
hpLoader.clear();
|
||||
GWT.log("Instance JSON Editor with: " + jsonData);
|
||||
jsEditor = JSONEditorWrapper.init(fp.getElement().getId());
|
||||
jsEditor.setName(selectedProject.getId());
|
||||
jsEditor.set(jsonData);
|
||||
|
||||
new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
jsEditor.setMode("tree");
|
||||
|
||||
}
|
||||
}.schedule(200);
|
||||
|
||||
}
|
||||
}.schedule(200);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
rawUpdatePanel.clear();
|
||||
Alert alert = new Alert(
|
||||
"Sorry, I cannot show the source Project with id '" + selectedProject.getId()
|
||||
+ "' Refresh an try again. Error: " + caught.getMessage(),
|
||||
AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
rawUpdatePanel.add(alert);
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
|
||||
buttonJSONUpdate.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
|
@ -168,8 +192,8 @@ public class EditModeRecord extends Composite {
|
|||
buttonJSONUpdate.setEnabled(false);
|
||||
final LoaderIcon loader = new LoaderIcon("Updating the project...");
|
||||
tabRawUpdate.add(loader);
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.updateRecord(selectedConcessione.getItemId(),
|
||||
jsEditor.getText(), recordType, new AsyncCallback<ConcessioneDV>() {
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.updateRecord(selectedProject.getProfileID(),
|
||||
selectedProject.getId(), jsEditor.getText(), new AsyncCallback<ProjectDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -181,13 +205,14 @@ public class EditModeRecord extends Composite {
|
|||
// TODO: handle exception
|
||||
}
|
||||
|
||||
editorManagerBus.fireEvent(
|
||||
new ActionOnItemEvent<ConcessioneDV>(null, ACTION_ON_ITEM.UPDATED_RECORD));
|
||||
editorManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
|
||||
selectedProject.getProfileID(), Arrays.asList(selectedProject),
|
||||
ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ConcessioneDV result) {
|
||||
public void onSuccess(ProjectDV result) {
|
||||
buttonJSONUpdate.setEnabled(true);
|
||||
try {
|
||||
rawUpdatePanel.getElement().removeClassName("disable-div");
|
||||
|
@ -195,38 +220,38 @@ public class EditModeRecord extends Composite {
|
|||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
DialogInform di = new DialogInform(null, "Project updated!", "Project '" + result.getNome() + "' updated correctly");
|
||||
|
||||
DialogInform di = new DialogInform(null, "Project updated!",
|
||||
"Project ID '" + result.getId() + "' updated correctly");
|
||||
di.setZIndex(100000);
|
||||
di.center();
|
||||
editorManagerBus.fireEvent(
|
||||
new ActionOnItemEvent<ConcessioneDV>(Arrays.asList(result), ACTION_ON_ITEM.UPDATED_RECORD));
|
||||
|
||||
editorManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
|
||||
selectedProject.getProfileID(), Arrays.asList(selectedProject),
|
||||
ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
editorManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() {
|
||||
|
||||
editorManagerBus.addHandler(OperationPerformedOnItemEvent.TYPE, new OperationPerformedOnItemEventHandler() {
|
||||
|
||||
@Override
|
||||
public <T extends RecordDV> void onDoActionFired(ActionOnItemEvent<T> showItemEvent) {
|
||||
|
||||
ACTION_ON_ITEM action = showItemEvent.getAction();
|
||||
List<T> items = showItemEvent.getSelectItems();
|
||||
|
||||
if(items!=null) {
|
||||
selectedConcessione = (BaseConcessioneDV) items.get(0);
|
||||
public <T extends DocumentDV> void onDoActionPerformedFired(
|
||||
OperationPerformedOnItemEvent<T> actionPerformedOnItemEvent) {
|
||||
ACTION_PERFORMED_ON_ITEM action = actionPerformedOnItemEvent.getAction();
|
||||
List<T> items = actionPerformedOnItemEvent.getSelectItems();
|
||||
|
||||
if (items != null) {
|
||||
instanceJSONEditor();
|
||||
|
||||
if(action.equals(ACTION_ON_ITEM.UPDATED_RECORD)) {
|
||||
appManagerBus.fireEvent(
|
||||
new ActionOnItemEvent<ConcessioneDV>((List<ConcessioneDV>) items, ACTION_ON_ITEM.UPDATED_RECORD));
|
||||
}
|
||||
|
||||
appManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
|
||||
selectedProject.getProfileID(), (List<ResultDocumentDV>) items, action));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,13 +21,13 @@
|
|||
<g:HTMLPanel>
|
||||
|
||||
<b:TabPanel tabPosition="left" ui:field="tabPanel">
|
||||
<b:Tab icon="PENCIL" active="true" heading="Edit the Project"
|
||||
<b:Tab icon="CODE" active="true" heading="Project"
|
||||
ui:field="tabRawUpdate">
|
||||
<b:Heading size="3">Source Project Editor</b:Heading>
|
||||
<b:Label type="INFO">You can update the Source Project by editing
|
||||
its model
|
||||
data displayed in the following Editor.</b:Label>
|
||||
<g:HTML addStyleNames="{style.info-panel}">
|
||||
<b:Heading size="3">Source Project as JSON</b:Heading>
|
||||
<b:Label type="INFO" visible="false">You can update the project by editing
|
||||
the
|
||||
model data displayed in the following editor.</b:Label>
|
||||
<g:HTML visible="false" addStyleNames="{style.info-panel}">
|
||||
<p style='color: #585858'>
|
||||
Be careful not to change the
|
||||
keys (e.g. nome, introduzione,
|
||||
|
@ -52,7 +52,7 @@
|
|||
</g:FlowPanel>
|
||||
<b:Button icon="SAVE" type="INFO"
|
||||
addStyleNames="{style.button-save-style}"
|
||||
ui:field="buttonJSONUpdate">UPDATE</b:Button>
|
||||
ui:field="buttonJSONUpdate" visible="false">UPDATE</b:Button>
|
||||
</b:Tab>
|
||||
<b:Tab icon="UPLOAD_ALT" heading="Manage File/s"
|
||||
ui:field="tabUploadFiles">
|
||||
|
|
|
@ -1,541 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.DataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Controls;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.DomEvent;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* The Class UpdateFileset.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 27, 2021
|
||||
*/
|
||||
public class UpdateFileset extends Composite {
|
||||
|
||||
private static final String SECTION_PIANTE = "piante";
|
||||
|
||||
private static final String SECTION_POSIZIONAMENTO_SCAVO = "posizionamentoScavo";
|
||||
|
||||
private static final String SECTION_RELAZIONE = "relazione";
|
||||
|
||||
private static final String SECTION_IMMAGINI = "immagini";
|
||||
|
||||
private static final String SECTION_ABSTRACT_RELAZIONE = "abstract_relazione";
|
||||
|
||||
private static final String _FORM_WIDTH_FIELDS_SIZE = "730px";
|
||||
|
||||
private static UpdateFilesetUiBinder uiBinder = GWT.create(UpdateFilesetUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface UpdateFilesetUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 27, 2021
|
||||
*/
|
||||
interface UpdateFilesetUiBinder extends UiBinder<Widget, UpdateFileset> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
ListBox listBoxPaths;
|
||||
|
||||
@UiField
|
||||
ControlGroup cgSelectFile;
|
||||
|
||||
@UiField
|
||||
Controls controlsContent;
|
||||
|
||||
@UiField
|
||||
HTMLPanel uploadFileContainer;
|
||||
|
||||
@UiField
|
||||
Button buttonUpdate;
|
||||
|
||||
private List<String> listFileSetPaths;
|
||||
|
||||
private boolean placeholderListBoxPaths = true;
|
||||
|
||||
private BaseConcessioneDV selectedConcessione;
|
||||
|
||||
private ConcessioneDV fullConcessione;
|
||||
|
||||
private RECORD_TYPE recordType;
|
||||
|
||||
private boolean placeholderListBoxIndex = true;
|
||||
|
||||
private HandlerManager uiBus = new HandlerManager(null);
|
||||
|
||||
private MetaDataField fieldUploadWidget;
|
||||
|
||||
private Integer pathIndex = null;
|
||||
|
||||
private Map<Integer, WorkspaceContentDV> mapForCCUploading = null;
|
||||
|
||||
private Map<Integer, List<WorkspaceContentDV>> mapWSContentListBox = null;
|
||||
|
||||
private HandlerManager editorManagerBus;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new update fileset.
|
||||
*
|
||||
* @param editorManagerBus the editor manager bus
|
||||
* @param selectedConcessione the selected concessione
|
||||
* @param recordType the record type
|
||||
* @param listFileSetPaths the list file set paths
|
||||
*/
|
||||
public UpdateFileset(HandlerManager editorManagerBus, BaseConcessioneDV selectedConcessione, RECORD_TYPE recordType, List<String> listFileSetPaths) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.editorManagerBus = editorManagerBus;
|
||||
this.selectedConcessione = selectedConcessione;
|
||||
this.recordType = recordType;
|
||||
this.listFileSetPaths = listFileSetPaths;
|
||||
listBoxPaths.addItem("Select a section...");
|
||||
for (String path : listFileSetPaths) {
|
||||
listBoxPaths.addItem(path);
|
||||
}
|
||||
listBoxPaths.setWidth(_FORM_WIDTH_FIELDS_SIZE);
|
||||
|
||||
// add handler on select
|
||||
listBoxPaths.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
GWT.log("Profile type selection changed...");
|
||||
cgSelectFile.setVisible(false);
|
||||
|
||||
if (placeholderListBoxPaths) {
|
||||
listBoxPaths.removeItem(0); // this is the placeholder, removing it once
|
||||
placeholderListBoxPaths = false;
|
||||
}
|
||||
showUploadFileGUI();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getRecord(selectedConcessione.getItemId(), recordType,
|
||||
new AsyncCallback<ConcessioneDV>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ConcessioneDV theRecord) {
|
||||
fullConcessione = theRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
buttonUpdate.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
String errorMsg = checkValidUpload();
|
||||
if (errorMsg == null) {
|
||||
List<FileUploaded> listFilesUploaded = new ArrayList<FileUploaded>();
|
||||
List<MetaDataFieldSkeleton> listMetaDataFieldSkeleton = fieldUploadWidget.getListOfMetadataFields();
|
||||
for (MetaDataFieldSkeleton field : listMetaDataFieldSkeleton) {
|
||||
DialogUpload dUpload = (DialogUpload) field.getHolder();
|
||||
// adding it only if exists
|
||||
if (dUpload.getFileUploadingState() != null)
|
||||
listFilesUploaded.add(dUpload.getFileUploadingState().getFile());
|
||||
}
|
||||
|
||||
GenericDatasetBean gdb = new GenericDatasetBean();
|
||||
gdb.setFilesUploaded(listFilesUploaded);
|
||||
// adding it only if exists
|
||||
|
||||
GWT.log("Section selected: " + listBoxPaths.getSelectedItemText());
|
||||
GWT.log("Content index selected: " + pathIndex);
|
||||
GWT.log("FileUploaded selected: " + gdb.getFilesUploaded());
|
||||
|
||||
List<WorkspaceContentDV> listCurrentContent = new ArrayList<WorkspaceContentDV>();
|
||||
if (mapForCCUploading != null) {
|
||||
Collection<WorkspaceContentDV> currentContent = mapForCCUploading.values();
|
||||
if (currentContent != null)
|
||||
listCurrentContent.addAll(currentContent);
|
||||
}
|
||||
|
||||
String htmlMsg = "Going to update the section " + listBoxPaths.getSelectedItemText() + ":";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>keeping " + listCurrentContent.size() + " current file/s </li>";
|
||||
htmlMsg += "<li>uploading " + listFilesUploaded.size() + " new file/s </li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "<br>";
|
||||
htmlMsg += "This operation cannot be undone. Would you like to proceed?";
|
||||
|
||||
GWT.log(htmlMsg);
|
||||
|
||||
final DialogConfirm dialogConfirm = new DialogConfirm(null, "Update Confirm?", htmlMsg);
|
||||
dialogConfirm.getElement().getStyle().setZIndex(100000);
|
||||
dialogConfirm.getYesButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
dialogConfirm.hide();
|
||||
buttonUpdate.setEnabled(false);
|
||||
|
||||
final DialogInform dialogInf = new DialogInform(null, "Updating Project...", "");
|
||||
dialogInf.setZIndex(100000);
|
||||
dialogInf.showLoader("Updating file/s for project: "+fullConcessione.getNome());
|
||||
//dialogInf.setWidth("400px");
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().updateSectionForRecord(
|
||||
fullConcessione.getItemId(), fullConcessione.getRecordType(),
|
||||
listBoxPaths.getSelectedItemText(), pathIndex, listCurrentContent, gdb,
|
||||
new AsyncCallback<ConcessioneDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
dialogInf.hideLoader();
|
||||
dialogInf.setMsg(
|
||||
"Sorry error occurred during project update. Error reported: "
|
||||
+ caught.getMessage());
|
||||
buttonUpdate.setEnabled(true);
|
||||
showUploadFileGUI();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ConcessioneDV result) {
|
||||
dialogInf.hideLoader();
|
||||
dialogInf.setText("Project updated!");
|
||||
dialogInf.setMsg(result.getNome() + " updated correclty");
|
||||
dialogInf.center();
|
||||
fullConcessione = result;
|
||||
GWT.log("new concessione: "+fullConcessione);
|
||||
buttonUpdate.setEnabled(true);
|
||||
showUploadFileGUI();
|
||||
editorManagerBus.fireEvent(
|
||||
new ActionOnItemEvent<ConcessioneDV>(Arrays.asList(fullConcessione), ACTION_ON_ITEM.UPDATED_RECORD));
|
||||
|
||||
}
|
||||
});
|
||||
dialogInf.center();
|
||||
}
|
||||
});
|
||||
dialogConfirm.center();
|
||||
|
||||
} else {
|
||||
Window.alert(errorMsg);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show upload file GUI.
|
||||
*/
|
||||
private void showUploadFileGUI() {
|
||||
uploadFileContainer.setVisible(true);
|
||||
buttonUpdate.setVisible(false);
|
||||
uploadFileContainer.clear();
|
||||
controlsContent.clear();
|
||||
placeholderListBoxIndex = true;
|
||||
fieldUploadWidget = null;
|
||||
pathIndex = null;
|
||||
mapForCCUploading = null;
|
||||
mapWSContentListBox = null;
|
||||
|
||||
// listBoxIndex.clear();
|
||||
cgSelectFile.setVisible(true);
|
||||
|
||||
ListBox listBoxContentIndex = new ListBox();
|
||||
listBoxContentIndex.setWidth(_FORM_WIDTH_FIELDS_SIZE);
|
||||
listBoxContentIndex.addItem("Select a content...");
|
||||
String section = null;
|
||||
Integer posizIndex = 0;
|
||||
if (listBoxPaths.getSelectedItemText().contains(SECTION_ABSTRACT_RELAZIONE)) {
|
||||
section = SECTION_ABSTRACT_RELAZIONE;
|
||||
AbstractRelazioneScavoDV ar = fullConcessione.getAbstractRelazioneScavo();
|
||||
|
||||
if (ar == null) {
|
||||
showMessage(SECTION_ABSTRACT_RELAZIONE + " NOT AVAILABLE", LabelType.WARNING);
|
||||
// pathIndex = 0;
|
||||
// showNewFileUpload();
|
||||
return;
|
||||
}
|
||||
|
||||
fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, ar.getTitolo(),
|
||||
ar.getListWsContent());
|
||||
|
||||
} else if (listBoxPaths.getSelectedItemText().contains(SECTION_IMMAGINI)) {
|
||||
section = SECTION_IMMAGINI;
|
||||
List<UploadedImageDV> listImmagini = fullConcessione.getImmaginiRappresentative();
|
||||
if (listImmagini == null || listImmagini.isEmpty()) {
|
||||
showMessage(SECTION_IMMAGINI + " NOT AVAILABLE", LabelType.WARNING);
|
||||
// pathIndex = 0;
|
||||
// showNewFileUpload();
|
||||
return;
|
||||
}
|
||||
|
||||
for (UploadedImageDV uploadedImageDV : listImmagini) {
|
||||
fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, uploadedImageDV.getTitolo(),
|
||||
uploadedImageDV.getListWsContent());
|
||||
posizIndex++;
|
||||
}
|
||||
|
||||
} else if (listBoxPaths.getSelectedItemText().contains(SECTION_RELAZIONE)) {
|
||||
section = SECTION_RELAZIONE;
|
||||
RelazioneScavoDV relazioneScavo = fullConcessione.getRelazioneScavo();
|
||||
if (relazioneScavo == null) {
|
||||
showMessage(SECTION_RELAZIONE + " NOT AVAILABLE", LabelType.WARNING);
|
||||
// pathIndex = 0;
|
||||
// showNewFileUpload();
|
||||
return;
|
||||
}
|
||||
|
||||
fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, relazioneScavo.getTitolo(),
|
||||
relazioneScavo.getListWsContent());
|
||||
|
||||
} else if (listBoxPaths.getSelectedItemText().contains(SECTION_POSIZIONAMENTO_SCAVO)) {
|
||||
section = SECTION_POSIZIONAMENTO_SCAVO;
|
||||
LayerConcessioneDV posiz = fullConcessione.getPosizionamentoScavo();
|
||||
if (posiz == null) {
|
||||
showMessage(SECTION_POSIZIONAMENTO_SCAVO + " NOT AVAILABLE", LabelType.WARNING);
|
||||
// pathIndex = 0;
|
||||
// showNewFileUpload();
|
||||
return;
|
||||
}
|
||||
|
||||
fillListBoxToBeReplaced(listBoxContentIndex, section, posizIndex, posiz.getTitolo(),
|
||||
posiz.getListWsContent());
|
||||
|
||||
} else if (listBoxPaths.getSelectedItemText().contains(SECTION_PIANTE)) {
|
||||
section = SECTION_PIANTE;
|
||||
List<LayerConcessioneDV> piante = fullConcessione.getPianteFineScavo();
|
||||
if (piante == null || piante.isEmpty()) {
|
||||
showMessage(SECTION_PIANTE + " NOT AVAILABLE", LabelType.WARNING);
|
||||
// pathIndex = 0;
|
||||
// showNewFileUpload();
|
||||
return;
|
||||
}
|
||||
|
||||
for (LayerConcessioneDV lcDV : piante) {
|
||||
fillListBoxToBeReplaced(listBoxContentIndex, SECTION_PIANTE, posizIndex, lcDV.getTitolo(),
|
||||
lcDV.getListWsContent());
|
||||
posizIndex++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
controlsContent.add(listBoxContentIndex);
|
||||
|
||||
if (listBoxContentIndex.getItemCount() == 2) {
|
||||
// listBoxContentIndex.setSelectedIndex(1);
|
||||
listBoxContentIndex.setSelectedValue(listBoxContentIndex.getItemText(1));
|
||||
|
||||
DomEvent.fireNativeEvent(Document.get().createChangeEvent(), listBoxContentIndex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void fillListBoxToBeReplaced(ListBox listBoxContentIndex, String section, int posizIndex, String title,
|
||||
List<WorkspaceContentDV> listWSC) {
|
||||
GWT.log("fillListBoxToBeReplaced called, posizIndex: "+posizIndex+", listWSC: "+listWSC);
|
||||
|
||||
if (listWSC == null || listWSC.isEmpty()) {
|
||||
showMessage(section + " does not contain file!", LabelType.WARNING);
|
||||
pathIndex = posizIndex;
|
||||
showNewFileUpload();
|
||||
return;
|
||||
}
|
||||
|
||||
if(mapWSContentListBox==null) {
|
||||
mapWSContentListBox = new HashMap<Integer, List<WorkspaceContentDV>>();
|
||||
}
|
||||
|
||||
listBoxContentIndex.addItem(title, posizIndex + "");
|
||||
mapWSContentListBox.put(posizIndex, listWSC);
|
||||
|
||||
// adding handler once
|
||||
if (posizIndex == 0) {
|
||||
|
||||
listBoxContentIndex.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
GWT.log("listBoxContentIndex changed, posizIndex: "+posizIndex);
|
||||
|
||||
if (placeholderListBoxIndex) {
|
||||
listBoxContentIndex.removeItem(0); // this is the placeholder, removing it once
|
||||
placeholderListBoxIndex = false;
|
||||
}
|
||||
int selectedIndex = listBoxContentIndex.getSelectedIndex();
|
||||
GWT.log("selected index: "+selectedIndex);
|
||||
showFileBrowseInteraction(selectedIndex, mapWSContentListBox.get(selectedIndex));
|
||||
}
|
||||
});
|
||||
}
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
private void showFileBrowseInteraction(int pathContentIndex, List<WorkspaceContentDV> listWSC) {
|
||||
uploadFileContainer.clear();
|
||||
pathIndex = pathContentIndex;
|
||||
GWT.log("showing pathContentIndex: "+pathContentIndex);
|
||||
GWT.log("showing ws content: "+listWSC);
|
||||
|
||||
// map for current content uploading
|
||||
mapForCCUploading = new HashMap<Integer, WorkspaceContentDV>(listWSC.size());
|
||||
int index = 0;
|
||||
for (WorkspaceContentDV workspaceContentDV : listWSC) {
|
||||
workspaceContentDV.setCliendId(index);
|
||||
mapForCCUploading.put(index, workspaceContentDV);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (listWSC.size() > 0) {
|
||||
FlexTable table = new FlexTable();
|
||||
table.addStyleName("table-current-content");
|
||||
table.setHTML(0, 0, "<span style='color:rgb(155, 80, 78); font-weight:bold;'>Current content:</span>");
|
||||
table.setHTML(1, 0, "<span style='color:rgb(155, 80, 78);'>Filename</span>");
|
||||
table.setHTML(1, 1, "<span style='color:rgb(155, 80, 78);'>MimeType<span>");
|
||||
table.setHTML(1, 2, "<span style='color:rgb(155, 80, 78);'>Link</span>");
|
||||
|
||||
int i = 2;
|
||||
for (final WorkspaceContentDV wsContent : listWSC) {
|
||||
table.setHTML(i, 0, wsContent.getName());
|
||||
table.setHTML(i, 1, wsContent.getMimetype());
|
||||
String link = "<a target=\"_blank\" href=" + wsContent.getLink() + ">View</a>";
|
||||
table.setHTML(i, 2, link);
|
||||
|
||||
final int rowIndexToRem = i;
|
||||
Button buttonRemoveFile = new Button();
|
||||
buttonRemoveFile.setIcon(IconType.TRASH);
|
||||
buttonRemoveFile.setTitle("Remove this file");
|
||||
buttonRemoveFile.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
mapForCCUploading.remove(wsContent.getCliendId());
|
||||
table.getRowFormatter().getElement(rowIndexToRem).setAttribute("hidden", "hidden");
|
||||
}
|
||||
});
|
||||
table.setWidget(i, 3, buttonRemoveFile);
|
||||
i++;
|
||||
}
|
||||
|
||||
uploadFileContainer.add(table);
|
||||
}
|
||||
|
||||
showNewFileUpload();
|
||||
}
|
||||
|
||||
|
||||
private void showNewFileUpload() {
|
||||
|
||||
HTML label = new HTML();
|
||||
label.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||
label.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
label.setHTML("<b>Add new file/s:</b>");
|
||||
uploadFileContainer.add(label);
|
||||
// mDU = new MultipleDilaogUpload();
|
||||
|
||||
MetadataFieldWrapper uploadField = new MetadataFieldWrapper();
|
||||
uploadField.setFieldName("File");
|
||||
uploadField.setMandatory(false);
|
||||
uploadField.setType(DataTypeWrapper.File);
|
||||
uploadField.setMaxOccurs(1000);
|
||||
|
||||
try {
|
||||
fieldUploadWidget = new MetaDataField(uploadField, uiBus);
|
||||
uploadFileContainer.add(fieldUploadWidget);
|
||||
|
||||
buttonUpdate.setVisible(true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if profile data are valid.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
private String checkValidUpload() {
|
||||
|
||||
if (fieldUploadWidget == null)
|
||||
return "No file uploaded";
|
||||
|
||||
for (MetaDataFieldSkeleton field : fieldUploadWidget.getListOfMetadataFields()) {
|
||||
|
||||
field.removeError();
|
||||
|
||||
String error = field.isFieldValueValid();
|
||||
if (error != null) {
|
||||
field.showError();
|
||||
String errorMsg = field.getFieldNameOriginal() + " is not valid. Suggestion: " + error;
|
||||
return errorMsg;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void showMessage(String txt, LabelType type) {
|
||||
Label l = new Label();
|
||||
l.setType(type);
|
||||
l.setText(txt);
|
||||
uploadFileContainer.add(l);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,50 +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>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.button-save-style {
|
||||
margin-top: 10px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.max-height-500 {
|
||||
max-height: 450px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:ScrollPanel addStyleNames="{style.max-height-500}">
|
||||
<b:Form type="INLINE">
|
||||
<b:Fieldset addStyleNames="form-fieldset-edit">
|
||||
<b:ControlGroup>
|
||||
<b:ControlLabel>Section</b:ControlLabel>
|
||||
<b:Controls>
|
||||
<b:ListBox ui:field="listBoxPaths"></b:ListBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="cgSelectFile"
|
||||
visible="false">
|
||||
<b:ControlLabel>Manage the content of</b:ControlLabel>
|
||||
<b:Controls ui:field="controlsContent">
|
||||
<!-- <b:ListBox ui:field="listBoxIndex" -->
|
||||
<!-- addStyleNames="{style.width-500}"></b:ListBox> -->
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<g:ScrollPanel>
|
||||
<g:HTMLPanel ui:field="uploadFileContainer"
|
||||
addStyleNames="upload-file-container"></g:HTMLPanel>
|
||||
</g:ScrollPanel>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:ScrollPanel>
|
||||
<b:Button icon="SAVE" type="INFO"
|
||||
addStyleNames="{style.button-save-style}" ui:field="buttonUpdate"
|
||||
visible="false">UPDATE</b:Button>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,383 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.application.geoportaldatamapper.shared.MetaDataProfileBeanExt;
|
||||
import org.gcube.application.geoportaldatamapper.shared.ProjectEdit;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_PERFORMED_ON_ITEM;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.OperationPerformedOnItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.NodeList;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class UpdateRecord extends Composite {
|
||||
|
||||
private static UpdateRecordUiBinder uiBinder = GWT.create(UpdateRecordUiBinder.class);
|
||||
|
||||
interface UpdateRecordUiBinder extends UiBinder<Widget, UpdateRecord> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
ListBox listBoxSections;
|
||||
|
||||
@UiField
|
||||
ScrollPanel scrollSectionContent;
|
||||
|
||||
@UiField
|
||||
HTMLPanel htmlPanelContainer;
|
||||
|
||||
@UiField
|
||||
HTMLPanel alertHTMLPanel;
|
||||
|
||||
@UiField
|
||||
ControlGroup controlsControlGroup;
|
||||
|
||||
@UiField
|
||||
Button buttonUpdate;
|
||||
|
||||
public static final String PLACEHOLDER_LIST_BOX = "Select section...";
|
||||
|
||||
private LoaderIcon loaderProjectSections = new LoaderIcon("Loading Project sections... please wait");
|
||||
|
||||
private GeoNaFormCardModel currentCardSelected;
|
||||
|
||||
private String profileID;
|
||||
|
||||
private String projectID;
|
||||
|
||||
private HashMap<String, List<FilePathDV>> sectionPathFilePaths = new HashMap<>();
|
||||
|
||||
private MetadataFormCardEventHandler formCardEventHandler = new MetadataFormCardEventHandler();
|
||||
|
||||
private ProjectEdit projectEditDTO;
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
public UpdateRecord(HandlerManager appManagerBus, String profileID, String projectID, int modalWidth, int modalHeight) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
this.profileID = profileID;
|
||||
this.projectID = projectID;
|
||||
setUpdateButtonEnabled(false);
|
||||
|
||||
htmlPanelContainer.setVisible(false);
|
||||
|
||||
alertHTMLPanel.add(loaderProjectSections);
|
||||
|
||||
scrollSectionContent.setHeight((modalHeight-350)+"px");
|
||||
|
||||
listBoxSections.setWidth((modalWidth-50)+"px");
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getProjectEdit(profileID, projectID,
|
||||
new AsyncCallback<ProjectEdit>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(ProjectEdit result) {
|
||||
projectEditDTO = result;
|
||||
htmlPanelContainer.setVisible(true);
|
||||
|
||||
try {
|
||||
alertHTMLPanel.remove(loaderProjectSections);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
listBoxSections.addItem(PLACEHOLDER_LIST_BOX, PLACEHOLDER_LIST_BOX);
|
||||
listBoxSections.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled",
|
||||
"disabled");
|
||||
listBoxSections.setSelectedValue(PLACEHOLDER_LIST_BOX);
|
||||
|
||||
int sectionArray = 0;
|
||||
|
||||
for (final MetaDataProfileBeanExt profileBean : result.getTheProfileBeans()) {
|
||||
|
||||
GcubeProfileDV profileDV = profileBean.getGcubeProfileDV();
|
||||
|
||||
String sectionPath = profileDV.getParentName() != null ? profileDV.getParentName() : "";
|
||||
|
||||
sectionPath += profileDV.getSectionName();
|
||||
|
||||
// increment section stored as array
|
||||
if (profileDV.getMaxOccurs() == 0 || profileDV.getMaxOccurs() > 1) {
|
||||
sectionPath += "[" + sectionArray + "]";
|
||||
sectionArray++;
|
||||
} else {
|
||||
sectionArray = 0;
|
||||
}
|
||||
|
||||
List<FilePathDV> filePaths = profileDV.getFilePaths();
|
||||
|
||||
if (filePaths != null)
|
||||
sectionPathFilePaths.put(sectionPath, filePaths);
|
||||
|
||||
GWT.log("Adding type: " + profileBean.getType() + ", in the section path: " + sectionPath);
|
||||
|
||||
listBoxSections.addItem(profileBean.getType(), sectionPath);
|
||||
}
|
||||
|
||||
listBoxSections.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
setUpdateButtonEnabled(false);
|
||||
|
||||
// -1 because the first element is the PLACEHOLDER "Select section..."
|
||||
int selectedIndex = listBoxSections.getSelectedIndex() - 1;
|
||||
|
||||
MetaDataProfileBeanExt selectedBean = result.getTheProfileBeans()
|
||||
.get(selectedIndex);
|
||||
GWT.log("Change handler fired " + selectedBean);
|
||||
controlsControlGroup.setVisible(true);
|
||||
scrollSectionContent.clear();
|
||||
|
||||
GcubeProfileDV gcubeProfile = selectedBean.getGcubeProfileDV();
|
||||
|
||||
currentCardSelected = GeoPortalDataEntryApp.buildNewFormCardModelFromProfile(
|
||||
gcubeProfile, 1, selectedBean, OPERATION.UPDATE, appManagerBus);
|
||||
|
||||
currentCardSelected.getMetadataForm().addListener(formCardEventHandler);
|
||||
|
||||
scrollSectionContent.add(currentCardSelected.getMetadataForm());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
projectEditDTO = null;
|
||||
htmlPanelContainer.setVisible(true);
|
||||
alertHTMLPanel.remove(loaderProjectSections);
|
||||
|
||||
String errorMsg = caught.getMessage();
|
||||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
try {
|
||||
alertHTMLPanel.remove(loaderProjectSections);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
alertHTMLPanel.add(alert);
|
||||
Window.alert(errorMsg);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
private void setUpdateButtonEnabled(boolean bool) {
|
||||
buttonUpdate.setEnabled(bool);
|
||||
}
|
||||
|
||||
private void bindEvents() {
|
||||
|
||||
buttonUpdate.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
alertHTMLPanel.clear();
|
||||
boolean isFormValid = currentCardSelected.getMetadataForm().isFormDataValid();
|
||||
|
||||
if (!isFormValid) {
|
||||
Alert alert = new Alert("Error/s detected, please check your data entry...", AlertType.WARNING);
|
||||
alert.setClose(true);
|
||||
alertHTMLPanel.add(alert);
|
||||
return;
|
||||
}
|
||||
|
||||
GeoNaFormDataObject gfdo = new GeoNaFormDataObject(
|
||||
Arrays.asList(currentCardSelected.getMetadataForm().getFormDataBean()),
|
||||
currentCardSelected.getGcubeProfile());
|
||||
|
||||
String sectionPath = listBoxSections.getSelectedValue();
|
||||
|
||||
GWT.log("sectionPath is: " + sectionPath);
|
||||
|
||||
List<FilePathDV> listFilePaths = sectionPathFilePaths.get(sectionPath);
|
||||
|
||||
final Modal modal = new Modal(true, true);
|
||||
DocumentDV theDocument = projectEditDTO.getTheProjectDV().getTheDocument();
|
||||
|
||||
modal.setTitle("Updating...");
|
||||
|
||||
final FlowPanel panelContainer = new FlowPanel();
|
||||
|
||||
LoaderIcon loader = new LoaderIcon("Operation in progress... please wait");
|
||||
modal.add(loader);
|
||||
String htmlMsg = "Updating the section <b>"+listBoxSections.getSelectedItemText()+"</b> of the project with:";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + projectID + "</li>";
|
||||
htmlMsg += "<li>" + theDocument.getFirstEntryOfMap().getKey() + ": "
|
||||
+ theDocument.getFirstEntryOfMap().getValue() + "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "<br>";
|
||||
panelContainer.add(new HTML(htmlMsg));
|
||||
panelContainer.add(loader);
|
||||
panelContainer.add(new HTML("<br><br>"));
|
||||
|
||||
modal.add(panelContainer);
|
||||
// modal3.setWidth(950);
|
||||
// modal3.setHeight("700px");
|
||||
modal.setCloseVisible(false);
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().updateGeportalDataForm(profileID, projectID, gfdo,
|
||||
sectionPath, listFilePaths, new AsyncCallback<CommitReport>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
modal.setCloseVisible(true);
|
||||
modal.setTitle("Error :-(");
|
||||
panelContainer.clear();
|
||||
String errorMsg = "Sorry, an error occurred when updating the project with id: "+projectID+". Please, try again. If the problem persists, please contact the support";
|
||||
Alert alert = new Alert(errorMsg, AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
modal.add(alert);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(CommitReport result) {
|
||||
modal.setCloseVisible(true);
|
||||
modal.setTitle("Project updated!");
|
||||
panelContainer.clear();
|
||||
Alert alert = new Alert();
|
||||
alert.setClose(false);
|
||||
alert.setType(AlertType.SUCCESS);
|
||||
String htmlMsg = "The project with:";
|
||||
htmlMsg += "<ul>";
|
||||
htmlMsg += "<li>id: " + projectID + "</li>";
|
||||
htmlMsg += "<li>" + theDocument.getFirstEntryOfMap().getKey() + ": "
|
||||
+ theDocument.getFirstEntryOfMap().getValue() + "</li>";
|
||||
htmlMsg += "</ul>";
|
||||
htmlMsg += "<br>";
|
||||
htmlMsg += "has been updated successfully!";
|
||||
alert.setHTML(htmlMsg);
|
||||
|
||||
ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("Project", result.getProjectAsJSON(),
|
||||
false, false);
|
||||
rtth2.showAsJSON(false);
|
||||
|
||||
panelContainer.add(alert);
|
||||
panelContainer.add(rtth2);
|
||||
|
||||
appManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
|
||||
profileID, null, ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
modal.show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void noUpdateMode() {
|
||||
buttonUpdate.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class MetadataFormCardEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 12, 2020
|
||||
*/
|
||||
private class MetadataFormCardEventHandler implements GenericFormEventsListener {
|
||||
|
||||
/**
|
||||
* On form data valid.
|
||||
*
|
||||
* @param genericDatasetBean the generic dataset bean
|
||||
*/
|
||||
@Override
|
||||
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
|
||||
setUpdateButtonEnabled(true);
|
||||
//Disabling option not selected
|
||||
int selectedIndex = listBoxSections.getSelectedIndex();
|
||||
NodeList<Element> elementOption = listBoxSections.getElement().getElementsByTagName("option");
|
||||
for (int i = 0; i < listBoxSections.getItemCount(); i++) {
|
||||
if (i != selectedIndex) {
|
||||
elementOption.getItem(i).setAttribute("disabled", "disabled");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On form data edit.
|
||||
*/
|
||||
@Override
|
||||
public void onFormDataEdit() {
|
||||
setUpdateButtonEnabled(false);
|
||||
NodeList<Element> elementOption = listBoxSections.getElement().getElementsByTagName("option");
|
||||
//i==0 is the PLACEHOLDER
|
||||
for (int i = 1; i < listBoxSections.getItemCount(); i++) {
|
||||
elementOption.getItem(i).removeAttribute("disabled");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On form aborted.
|
||||
*/
|
||||
@Override
|
||||
public void onFormAborted() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On validation error.
|
||||
*
|
||||
* @param throwable the throwable
|
||||
* @param errorMsg the error msg
|
||||
*/
|
||||
@Override
|
||||
public void onValidationError(Throwable throwable, String errorMsg) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
<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>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.button-save-style {
|
||||
margin-top: 10px;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.max-height-500 {
|
||||
max-height: 450px;
|
||||
}
|
||||
|
||||
.margin-top-10 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.info-operation {
|
||||
font-size: 12px;
|
||||
color: gray;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="alertHTMLPanel">
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="htmlPanelContainer">
|
||||
<b:Form type="INLINE">
|
||||
<b:Fieldset addStyleNames="form-fieldset-edit">
|
||||
<b:ControlGroup>
|
||||
<b:Label type="INFO">Select the section of the document you want
|
||||
to update...</b:Label>
|
||||
<b:Controls>
|
||||
<b:ListBox ui:field="listBoxSections"></b:ListBox>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup ui:field="controlsControlGroup"
|
||||
visible="false">
|
||||
<b:Label type="INFO">Manage the content of</b:Label>
|
||||
<b:Controls>
|
||||
<g:ScrollPanel ui:field="scrollSectionContent"></g:ScrollPanel>
|
||||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
<b:ControlGroup>
|
||||
<g:ScrollPanel>
|
||||
<g:HTMLPanel ui:field="uploadFileContainer"
|
||||
addStyleNames="upload-file-container"></g:HTMLPanel>
|
||||
</g:ScrollPanel>
|
||||
</b:ControlGroup>
|
||||
</b:Fieldset>
|
||||
</b:Form>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.info-operation}">
|
||||
To update the document:
|
||||
"Select the Section you wish to update, update the metadata and/or
|
||||
the
|
||||
file/s and then confirm by clicking on "Create".
|
||||
Finally select
|
||||
"Update".
|
||||
</g:HTMLPanel>
|
||||
<b:Button icon="SAVE" type="INFO"
|
||||
addStyleNames="{style.button-save-style}" ui:field="buttonUpdate">UPDATE</b:Button>
|
||||
</g:HTMLPanel>
|
||||
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -35,7 +35,7 @@ public class JSONEditorWrapper extends JavaScriptObject {
|
|||
console.log("JSONEditorWrapper error: " + error)
|
||||
}
|
||||
};
|
||||
console.log("container is: " + container);
|
||||
//console.log("container is: " + container);
|
||||
return new $wnd.JSONEditor(container, options);
|
||||
}-*/;
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class JSONEditorWrapper extends JavaScriptObject {
|
|||
public final native void set(String json) /*-{
|
||||
var toJSONObject = JSON.parse(json);
|
||||
// set json
|
||||
console.log("displayng JSON: " + toJSONObject);
|
||||
//console.log("displayng JSON: " + toJSONObject);
|
||||
this.set(toJSONObject);
|
||||
this.refresh();
|
||||
}-*/;
|
||||
|
@ -58,7 +58,7 @@ public class JSONEditorWrapper extends JavaScriptObject {
|
|||
* @return the text
|
||||
*/
|
||||
public final native String getText() /*-{
|
||||
console.log("this.get(): " +this.getText());
|
||||
//console.log("this.get(): " +this.getText());
|
||||
return this.getText();
|
||||
}-*/;
|
||||
|
||||
|
|
|
@ -1,23 +1,28 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.form;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent.ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.MetadataFormCard;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.NodeItem;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.TreeItemPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.TreeVisitUtil;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Tab;
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
import com.github.gwtbootstrap.client.ui.FormActions;
|
||||
import com.github.gwtbootstrap.client.ui.NavList;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
|
@ -25,123 +30,305 @@ import com.google.gwt.uibinder.client.UiHandler;
|
|||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.TreeItem;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* The Class GeonaDataEntryMainForm.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 4, 2022
|
||||
*/
|
||||
public class GeonaDataEntryMainForm extends Composite {
|
||||
|
||||
private static GeonaDataEntryMainFormUiBinder uiBinder = GWT.create(GeonaDataEntryMainFormUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface GeonaDataEntryMainFormUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 4, 2022
|
||||
*/
|
||||
interface GeonaDataEntryMainFormUiBinder extends UiBinder<Widget, GeonaDataEntryMainForm> {
|
||||
}
|
||||
|
||||
private List<GeoNaFormCardModel> listCards = new ArrayList<GeoNaFormCardModel>();
|
||||
|
||||
private Tree_Node<GeoNaFormCardModel> nodes = new Tree_Node<GeoNaFormCardModel>();
|
||||
|
||||
@UiField
|
||||
HTMLPanel mainHTMLPanel;
|
||||
|
||||
|
||||
@UiField
|
||||
TabPanel mainTabPanel;
|
||||
|
||||
ScrollPanel treePanel;
|
||||
|
||||
@UiField
|
||||
NavList navbarTree;
|
||||
|
||||
@UiField
|
||||
ScrollPanel inputPanel;
|
||||
|
||||
@UiField
|
||||
AlertBlock alertFormAction;
|
||||
|
||||
|
||||
@UiField
|
||||
Button duplicateSelected;
|
||||
|
||||
@UiField
|
||||
Button removeSelected;
|
||||
|
||||
@UiField
|
||||
Button buttonSave;
|
||||
|
||||
private LinkedHashMap<String,MetadataFormCard> mapForms = new LinkedHashMap<String,MetadataFormCard>();
|
||||
|
||||
private List<Tab> listTabs = new ArrayList<Tab>();
|
||||
|
||||
@UiField
|
||||
FormActions formActions;
|
||||
|
||||
private LinkedHashMap<String, MetadataFormCard> mapForms = new LinkedHashMap<String, MetadataFormCard>();
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private TreeItemPanel treeItemPanel;
|
||||
|
||||
private boolean canSave = true;
|
||||
|
||||
/**
|
||||
* Instantiates a new geona data entry main form.
|
||||
*
|
||||
* @param appManagerBus the app manager bus
|
||||
*/
|
||||
public GeonaDataEntryMainForm(HandlerManager appManagerBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
|
||||
duplicateSelected.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
appManagerBus.fireEvent(new TreeItemEvent(null, ACTION.DUPLICATE));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeSelected.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
appManagerBus.fireEvent(new TreeItemEvent(null, ACTION.DELETE));
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void addForm(String tabHeading, GeoNaFormCardModel geonFormModel){
|
||||
listCards.add(geonFormModel);
|
||||
createNewCard(tabHeading, geonFormModel);
|
||||
/**
|
||||
* Adds the tree.
|
||||
*
|
||||
* @param treeItemPanel the tree item panel
|
||||
*/
|
||||
public void addTree(TreeItemPanel treeItemPanel) {
|
||||
this.treeItemPanel = treeItemPanel;
|
||||
navbarTree.setVisible(true);
|
||||
treePanel.add(treeItemPanel.getTree());
|
||||
}
|
||||
|
||||
|
||||
private void createNewCard(String tabHeading, final GeoNaFormCardModel geonFormModel){
|
||||
final Tab tab = new Tab();
|
||||
tab.setHeading(tabHeading);
|
||||
//MetadataFormCard mfc = new MetadataFormCard(tab, createMetadataForm, repeatible);
|
||||
MetadataFormCard mfc = new MetadataFormCard(tab,geonFormModel,appManagerBus);
|
||||
listTabs.add(tab);
|
||||
mainTabPanel.add(tab);
|
||||
|
||||
if(listTabs.size()==1) {
|
||||
tab.setActive(true);
|
||||
mainTabPanel.selectTab(0);
|
||||
|
||||
public void removeTree(TreeItemPanel treeItemPanel) {
|
||||
try {
|
||||
treePanel.remove(treeItemPanel.getTree());
|
||||
} catch (Exception e) {
|
||||
GWT.log("error: "+e.getMessage());
|
||||
}
|
||||
|
||||
mapForms.put(tabHeading, mfc);
|
||||
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
||||
/**
|
||||
* Gets the tree item panel.
|
||||
*
|
||||
* @return the tree item panel
|
||||
*/
|
||||
public TreeItemPanel getTreeItemPanel() {
|
||||
return treeItemPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selected form.
|
||||
*
|
||||
* @param form the new selected form
|
||||
*/
|
||||
public void setSelectedForm(CreateMetadataForm form) {
|
||||
inputPanel.clear();
|
||||
GWT.log("Showing form: " + form);
|
||||
|
||||
form.getElement().addClassName("gna-dataentry-form-fieldset");
|
||||
inputPanel.add(form);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset.
|
||||
*/
|
||||
public void resetUI() {
|
||||
navbarTree.setVisible(false);
|
||||
mapForms.clear();
|
||||
mainTabPanel.clear();
|
||||
listTabs.clear();
|
||||
// mainHTMLPanel.clear();
|
||||
inputPanel.clear();
|
||||
//inputPanel = new ScrollPanel();
|
||||
//removeTree(treeItemPanel);
|
||||
treePanel.clear();
|
||||
alertFormAction.clear();
|
||||
alertFormAction.setVisible(false);
|
||||
//treePanel = new ScrollPanel();
|
||||
// treePanel = new ScrollPanel();
|
||||
// listTabs.clear();
|
||||
}
|
||||
|
||||
|
||||
public void selectTab(int index){
|
||||
|
||||
GWT.log("Selecting tab index: "+ index +" of "+listTabs.size());
|
||||
|
||||
if(listTabs.size()<index) {
|
||||
mainTabPanel.selectTab(index);
|
||||
|
||||
|
||||
/**
|
||||
* Reset.
|
||||
*/
|
||||
public void resetInputPanel() {
|
||||
inputPanel.clear();
|
||||
}
|
||||
|
||||
public void validateFormsIntoTree(TreeItem root) {
|
||||
GWT.log("validateFormsIntoTree called");
|
||||
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
GWT.log("validateFormsIntoTree called for: " + root.getText());
|
||||
|
||||
for (int i = 0; i < root.getChildCount(); i++) {
|
||||
TreeItem child = root.getChild(i);
|
||||
validateFormsIntoTree(child);
|
||||
}
|
||||
|
||||
NodeItem node = (NodeItem) root.getWidget();
|
||||
GWT.log("validateFormsIntoTree called for: " + root.getText() + " node: " + node);
|
||||
|
||||
// Is root
|
||||
if (node.isRoot()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isValid = node.validateForm();
|
||||
GWT.log("validateFormsIntoTree called for: " + root.getText() + " is valid: " + isValid);
|
||||
node.setValidCard(isValid);
|
||||
if (!isValid) {
|
||||
canSave = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save data.
|
||||
*
|
||||
* @param e the e
|
||||
*/
|
||||
@UiHandler("buttonSave")
|
||||
void saveData(ClickEvent e){
|
||||
|
||||
boolean canSave = true;
|
||||
|
||||
for (String metadataType : mapForms.keySet()) {
|
||||
MetadataFormCard card = mapForms.get(metadataType);
|
||||
boolean isValid = card.validateForm();
|
||||
card.setValidCard(isValid);
|
||||
if(isValid==false)
|
||||
canSave = false;
|
||||
}
|
||||
|
||||
List<GeoNaFormDataObject> listGeonaFormObjects = new ArrayList<GeoNaFormDataObject>();
|
||||
|
||||
if(canSave) {
|
||||
for (String metadataType : mapForms.keySet()) {
|
||||
MetadataFormCard card = mapForms.get(metadataType);
|
||||
List<GenericDatasetBean> listGDB = new ArrayList<GenericDatasetBean>(card.getListForms().size());
|
||||
for (CreateMetadataForm form : card.getListForms()) {
|
||||
listGDB.add(form.getFormDataBean());
|
||||
|
||||
}
|
||||
listGeonaFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getFormCardTitle()));
|
||||
}
|
||||
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(listGeonaFormObjects));
|
||||
}else {
|
||||
void saveData(ClickEvent e) {
|
||||
|
||||
canSave = true;
|
||||
final TreeItem root = treeItemPanel.getRoot();
|
||||
validateFormsIntoTree(root);
|
||||
|
||||
if (canSave) {
|
||||
|
||||
Tree_Node<GeoNaFormDataObject> treeNode = buildTree(root);
|
||||
GWT.log("Tree node built correctly!");
|
||||
// System.out.println(treeNode);
|
||||
|
||||
// for (String metadataType : mapForms.keySet()) {
|
||||
// MetadataFormCard card = mapForms.get(metadataType);
|
||||
// List<GenericDatasetBean> listGDB = new ArrayList<GenericDatasetBean>(card.getListForms().size());
|
||||
// for (CreateMetadataForm form : card.getListForms()) {
|
||||
// listGDB.add(form.getFormDataBean());
|
||||
//
|
||||
// }
|
||||
// listGeonaFormObjects.add(new GeoNaFormDataObject(listGDB, card.getGeonaFormModel().getGcubeProfile()));
|
||||
// }
|
||||
// appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(profileID, listGeonaFormObjects));
|
||||
|
||||
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(treeItemPanel.getProfileID(), treeNode));
|
||||
TreeVisitUtil.preOrderVisit(treeNode);
|
||||
showAlertOnSaveAction("Andiamo a salvare", AlertType.INFO, true);
|
||||
|
||||
} else {
|
||||
showAlertOnSaveAction("Detected errors, please fix it/them", AlertType.ERROR, true);
|
||||
}
|
||||
|
||||
|
||||
//Window.alert("I can save: "+listGeonaFormObjects);
|
||||
|
||||
|
||||
// Window.alert("I can save: "+listGeonaFormObjects);
|
||||
|
||||
}
|
||||
|
||||
public void showAlertOnSaveAction(String text, AlertType type, boolean hideAfterAWhile){
|
||||
|
||||
//Window.alert("Called alertOnCreate");
|
||||
|
||||
public <T> void printTree(Tree_Node<T> node) {
|
||||
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(node);
|
||||
|
||||
for (Tree_Node<T> children : node.getChildren()) {
|
||||
printTree(children);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Tree_Node<GeoNaFormDataObject> buildTree(TreeItem root) {
|
||||
GWT.log("buildTree called");
|
||||
|
||||
if (root == null) {
|
||||
GWT.log("buildTree returns, node is null");
|
||||
return null;
|
||||
}
|
||||
|
||||
GWT.log("buildTree called on: " + root.getText());
|
||||
|
||||
// Cloning
|
||||
NodeItem rootNodeItem = (NodeItem) root.getWidget();
|
||||
GWT.log("buildTree called on: " + root.getText() + ", node json section: "
|
||||
+ rootNodeItem.getJsonSectionFullPath());
|
||||
|
||||
Tree_Node<GeoNaFormDataObject> tNode;
|
||||
|
||||
// Children
|
||||
if (!rootNodeItem.isRoot()) {
|
||||
GeoNaFormCardModel nodeCard = rootNodeItem.getGeoNaFormCardModel();
|
||||
GeoNaFormDataObject gfdo = new GeoNaFormDataObject(
|
||||
Arrays.asList(nodeCard.getMetadataForm().getFormDataBean()), nodeCard.getGcubeProfile());
|
||||
tNode = new Tree_Node<GeoNaFormDataObject>(nodeCard.getGcubeProfile().getSectionTitle(), gfdo);
|
||||
} else {
|
||||
// root of the tree
|
||||
tNode = new Tree_Node<GeoNaFormDataObject>(root.getText(), null);
|
||||
tNode.setRoot(true);
|
||||
}
|
||||
|
||||
// Total children count
|
||||
int total = root.getChildCount();
|
||||
// All the children
|
||||
for (int i = 0; i < total; i++) {
|
||||
Tree_Node<GeoNaFormDataObject> childCloned = buildTree(root.getChild(i));
|
||||
tNode.addChild(childCloned);
|
||||
}
|
||||
|
||||
return tNode;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show alert on save action.
|
||||
*
|
||||
* @param text the text
|
||||
* @param type the type
|
||||
* @param hideAfterAWhile the hide after A while
|
||||
*/
|
||||
public void showAlertOnSaveAction(String text, AlertType type, boolean hideAfterAWhile) {
|
||||
|
||||
// Window.alert("Called alertOnCreate");
|
||||
alertFormAction.setText(text);
|
||||
alertFormAction.setType(type);
|
||||
alertFormAction.setVisible(true);
|
||||
//goBackButtonSecondStep.setEnabled(true);
|
||||
// goBackButtonSecondStep.setEnabled(true);
|
||||
|
||||
if(hideAfterAWhile){
|
||||
if (hideAfterAWhile) {
|
||||
// hide after some seconds
|
||||
Timer t = new Timer() {
|
||||
|
||||
|
@ -155,20 +342,42 @@ public class GeonaDataEntryMainForm extends Composite {
|
|||
t.schedule(10000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enable button save.
|
||||
*
|
||||
* @param enabled the enabled
|
||||
*/
|
||||
public void enableButtonDuplicateSection(boolean enabled) {
|
||||
duplicateSelected.setEnabled(enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable button remove section.
|
||||
*
|
||||
* @param enabled the enabled
|
||||
*/
|
||||
public void enableButtonRemoveSection(boolean enabled) {
|
||||
removeSelected.setEnabled(enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable button save.
|
||||
*
|
||||
* @param enabled the enabled
|
||||
*/
|
||||
public void enableButtonSave(boolean enabled) {
|
||||
buttonSave.setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the ative after.
|
||||
*
|
||||
* @param index the index
|
||||
* @param bool the bool
|
||||
* @param bool the bool
|
||||
*/
|
||||
public void setAtiveAfter(int index, boolean bool){
|
||||
|
||||
public void setAtiveAfter(int index, boolean bool) {
|
||||
|
||||
// if(listTabs.size()<index) {
|
||||
// for (int i = index; i < listTabs.size(); i++) {
|
||||
// listTabs.get(i).setEnabled(bool);
|
||||
|
@ -176,4 +385,13 @@ public class GeonaDataEntryMainForm extends Composite {
|
|||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visible form actions.
|
||||
*
|
||||
* @param bool the new visible form actions
|
||||
*/
|
||||
public void setVisibleFormActions(boolean bool) {
|
||||
formActions.setVisible(bool);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,14 +6,55 @@
|
|||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.w20 {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.w80 {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.section-toolbar {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
.section-toolbar a {
|
||||
margin-left: 5px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel ui:field="mainHTMLPanel">
|
||||
<b:TabPanel ui:field="mainTabPanel" tabPosition="left">
|
||||
</b:TabPanel>
|
||||
<b:AlertBlock type="DEFAULT" visible="false" close="false" ui:field="alertFormAction"></b:AlertBlock>
|
||||
<b:FormActions>
|
||||
<g:HTMLPanel addStyleNames="{style.wrapper}">
|
||||
<g:HTMLPanel addStyleNames="tree-panel">
|
||||
<b:NavList visible=" false " ui:field="navbarTree">
|
||||
<b:NavHeader>Sections</b:NavHeader>
|
||||
<g:HTMLPanel addStyleNames="{style.section-toolbar}">
|
||||
<b:Button text="Duplicate" ui:field="duplicateSelected"
|
||||
icon="COPY">
|
||||
</b:Button>
|
||||
<b:Button text="Delete" ui:field="removeSelected"
|
||||
icon="TRASH">
|
||||
Delete</b:Button>
|
||||
</g:HTMLPanel>
|
||||
</b:NavList>
|
||||
<g:ScrollPanel ui:field="treePanel">
|
||||
</g:ScrollPanel>
|
||||
</g:HTMLPanel>
|
||||
<g:ScrollPanel ui:field="inputPanel"
|
||||
addStyleNames="{style.w80}"></g:ScrollPanel>
|
||||
</g:HTMLPanel>
|
||||
<!-- <b:TabPanel ui:field="mainTabPanel" tabPosition="left"> </b:TabPanel> -->
|
||||
<b:AlertBlock type="DEFAULT" visible="false"
|
||||
close="false" ui:field="alertFormAction"></b:AlertBlock>
|
||||
<b:FormActions ui:field="formActions" visible="false">
|
||||
<b:Button type="PRIMARY" icon="SAVE" ui:field="buttonSave">Save</b:Button>
|
||||
</b:FormActions>
|
||||
<!-- </b:AlertBlock> -->
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,475 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.projects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||
import org.gcube.application.geoportalcommon.shared.WhereClause;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalClientCaches.CacheSearchingFilterParametersFromConfig;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Dropdown;
|
||||
import com.github.gwtbootstrap.client.ui.Hero;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* The Class ListOfProjectTablePanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 21, 2022
|
||||
*/
|
||||
public class ListOfProjectTablePanel extends Composite {
|
||||
|
||||
@UiField
|
||||
Dropdown dropdownSortBy;
|
||||
|
||||
@UiField
|
||||
Dropdown dropdownSearchFor;
|
||||
|
||||
@UiField
|
||||
Alert alertSortBy;
|
||||
|
||||
@UiField
|
||||
Alert alertProjectType;
|
||||
|
||||
@UiField
|
||||
Alert alertSearchFor;
|
||||
|
||||
@UiField
|
||||
NavLink buttonReloadProjects;
|
||||
|
||||
@UiField
|
||||
HTMLPanel geonaListOfRecordsPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel contTabGetListOfProjects;
|
||||
|
||||
@UiField
|
||||
TextBox searchField;
|
||||
|
||||
@UiField
|
||||
Button resetSearch;
|
||||
|
||||
@UiField
|
||||
Dropdown ddProjectType;
|
||||
|
||||
@UiField
|
||||
Hero noProjectSelectionMessage;
|
||||
|
||||
private CacheSearchingFilterParametersFromConfig cacheSearchingFilterParameters;
|
||||
|
||||
private SearchingFilter currentSearchingFilter;
|
||||
|
||||
private List<UseCaseDescriptorDV> ucdProjectTypesForListingDataView;
|
||||
|
||||
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
||||
|
||||
private static final String LABEL_FILTER_SEPARATOR = " - ";
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private GeonaRecordsPaginatedView grpw;
|
||||
|
||||
private static ListOfProjectTablePanelUiBinder uiBinder = GWT.create(ListOfProjectTablePanelUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface ListOfProjectTablePanelUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 21, 2022
|
||||
*/
|
||||
interface ListOfProjectTablePanelUiBinder extends UiBinder<Widget, ListOfProjectTablePanel> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new list of project table panel.
|
||||
*
|
||||
* @param appManagerBus the app manager bus
|
||||
*/
|
||||
public ListOfProjectTablePanel(HandlerManager appManagerBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
|
||||
alertSortBy.setType(AlertType.INFO);
|
||||
alertSortBy.setClose(false);
|
||||
|
||||
alertSearchFor.setType(AlertType.INFO);
|
||||
alertSearchFor.setClose(false);
|
||||
|
||||
alertProjectType.setType(AlertType.INFO);
|
||||
alertProjectType.setClose(false);
|
||||
|
||||
resetSearch.setIconSize(IconSize.TWO_TIMES);
|
||||
resetSearch.setType(ButtonType.LINK);
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
buttonReloadProjects.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||
if (singleUCD != null) {
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
|
||||
getCurrentSearchingFilter(), true));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
searchField.addKeyPressHandler(new KeyPressHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
GWT.log("CHAR CODE: " + event.getCharCode());
|
||||
if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
|
||||
GWT.log(searchField.getText());
|
||||
doSearchEvent();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
resetSearch.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
searchField.setText("");
|
||||
|
||||
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||
if (singleUCD != null) {
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
|
||||
getCurrentSearchingFilter(), false));
|
||||
}
|
||||
|
||||
resetSearch.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the filtering parameters.
|
||||
*
|
||||
* @param sfp the sfp
|
||||
*/
|
||||
public void setFilteringParameters(CacheSearchingFilterParametersFromConfig sfp) {
|
||||
GWT.log("ListOfProjectTablePanel setFilteringParameters called");
|
||||
this.cacheSearchingFilterParameters = sfp;
|
||||
List<ItemFieldDV> sortByFields = sfp.getOrderByFields();
|
||||
List<ItemFieldDV> searchForFields = sfp.getSearchByFields();
|
||||
// currentSearchingFilter = new SearchingFilter(sortByFields, null);
|
||||
|
||||
alertSearchFor.clear();
|
||||
dropdownSearchFor.clear();
|
||||
|
||||
alertSearchFor.setText(searchForFields.get(0).getDisplayName());
|
||||
alertSortBy.setText(toLabelFilter((sortByFields.get(0)), SearchingFilter.ORDER.ASC));
|
||||
|
||||
for (final ItemFieldDV record_FIELD : searchForFields) {
|
||||
|
||||
final NavLink navSearch = new NavLink(record_FIELD.getDisplayName());
|
||||
dropdownSearchFor.add(navSearch);
|
||||
|
||||
navSearch.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Search for: " + record_FIELD.getDisplayName());
|
||||
alertSearchFor.setText(record_FIELD.getDisplayName());
|
||||
|
||||
if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
||||
doSearchEvent();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
dropdownSortBy.clear();
|
||||
|
||||
for (ItemFieldDV record_FIELD : sortByFields) {
|
||||
|
||||
// if (record_FIELD.equals(RECORD_FIELD.RECORD_STATUS))
|
||||
// continue;
|
||||
|
||||
// ASC
|
||||
final String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||
final NavLink nav = new NavLink(labelASC);
|
||||
dropdownSortBy.add(nav);
|
||||
|
||||
nav.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Sort by: " + labelASC);
|
||||
alertSortBy.setText(labelASC);
|
||||
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||
if (singleUCD != null) {
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
|
||||
getCurrentSearchingFilter(), false));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// //DESC
|
||||
final String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||
final NavLink nav2 = new NavLink(labelDESC);
|
||||
dropdownSortBy.add(nav2);
|
||||
|
||||
nav2.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GWT.log("Sort by: " + labelDESC);
|
||||
alertSortBy.setText(labelDESC);
|
||||
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||
if (singleUCD != null) {
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(false, singleUCD.getProfileID(),
|
||||
getCurrentSearchingFilter(), false));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To sort filter.
|
||||
*
|
||||
* @param labelFilter the label filter
|
||||
* @return the searching filter
|
||||
*/
|
||||
private SearchingFilter toSortFilter(String labelFilter) {
|
||||
GWT.log("ListOfProjectTablePanel toSortFilter for label " + labelFilter);
|
||||
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||
|
||||
GWT.log("label filter: " + array[0]);
|
||||
SearchingFilter sortFilter = null;
|
||||
try {
|
||||
ItemFieldDV recordField = null;
|
||||
GWT.log("cacheSearchingFilterParameters.getOrderByFields() is: "
|
||||
+ cacheSearchingFilterParameters.getOrderByFields());
|
||||
for (ItemFieldDV value : cacheSearchingFilterParameters.getOrderByFields()) {
|
||||
if (array[0].trim().compareTo(value.getDisplayName()) == 0) {
|
||||
recordField = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ORDER orderField = ORDER.valueOf(array[1].trim());
|
||||
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
GWT.log("toSortFilter got " + sortFilter);
|
||||
return sortFilter;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Dirty solution. I created this one because I had problem on firing click
|
||||
* event for Tab element
|
||||
*
|
||||
* @param ucdProjectTypesForListingDataView the ucd project types for listing
|
||||
* data view
|
||||
*/
|
||||
public void instanceAndShowListOfProjects(List<UseCaseDescriptorDV> ucdProjectTypesForListingDataView) {
|
||||
GWT.log("ListOfProjectTablePanel instanceAndShowListOfProjects called");
|
||||
this.ucdProjectTypesForListingDataView = ucdProjectTypesForListingDataView;
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
// noProjectSelectionMessage.setVisible(true);
|
||||
// Selecting directly the unique UCD type.
|
||||
if (ucdProjectTypesForListingDataView.size() == 1) {
|
||||
// noProjectSelectionMessage.setVisible(false);
|
||||
UseCaseDescriptorDV singleUCD = ucdProjectTypesForListingDataView.get(0);
|
||||
alertProjectType.setText(singleUCD.getName());
|
||||
// setFilteringParameters(displayFields, sortByFields, searchForFields,
|
||||
// currentSearchingFilter);
|
||||
appManagerBus.fireEvent(new GetListOfRecordsEvent(true, singleUCD.getProfileID(),
|
||||
getCurrentSearchingFilter(), true));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Built searching filter.
|
||||
*
|
||||
* @return the searching filter
|
||||
*/
|
||||
public SearchingFilter builtSearchingFilter() {
|
||||
SearchingFilter searchingFilter = toSortFilter(alertSortBy.getText());
|
||||
String searchText = searchField.getText();
|
||||
if (searchText != null && !searchText.isEmpty()) {
|
||||
Map<String, Object> searchInto = new HashMap<String, Object>();
|
||||
|
||||
List<String> listOfSeachingFields = new ArrayList<String>();
|
||||
|
||||
for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) {
|
||||
if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
|
||||
listOfSeachingFields = recordField.getJsonFields();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (String fieldname : listOfSeachingFields) {
|
||||
searchInto.put(fieldname, searchText);
|
||||
}
|
||||
|
||||
WhereClause where = new WhereClause();
|
||||
where.setSearchInto(searchInto);
|
||||
where.setOperator(LOGICAL_OP.OR);
|
||||
|
||||
searchingFilter.setConditions(Arrays.asList(where));
|
||||
}
|
||||
return searchingFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the internal height.
|
||||
*
|
||||
* @param height the new internal height
|
||||
*/
|
||||
public void setInternalHeight(int height) {
|
||||
contTabGetListOfProjects.asWidget().setHeight(height + "px");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current sort filter.
|
||||
*
|
||||
* @return the current sort filter
|
||||
*/
|
||||
public SearchingFilter getCurrentSearchingFilter() {
|
||||
currentSearchingFilter = builtSearchingFilter();
|
||||
GWT.log("ListOfProjectTablePanel getCurrentSearchingFilter: " + currentSearchingFilter);
|
||||
return currentSearchingFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the select project type.
|
||||
*
|
||||
* @return the select project type
|
||||
*/
|
||||
public UseCaseDescriptorDV getSelectProjectType() {
|
||||
String projectName = alertProjectType.getText();
|
||||
for (UseCaseDescriptorDV usdDV : ucdProjectTypesForListingDataView) {
|
||||
if (usdDV.getName().compareTo(projectName) == 0) {
|
||||
GWT.log("Selected project type is: " + usdDV);
|
||||
return usdDV;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do search event.
|
||||
*/
|
||||
private void doSearchEvent() {
|
||||
String searchText = searchField.getText();
|
||||
if (searchText.length() < MIN_LENGHT_SERCHING_STRING) {
|
||||
Window.alert("Please enter at least " + MIN_LENGHT_SERCHING_STRING + " characters");
|
||||
return;
|
||||
}
|
||||
|
||||
resetSearch.setVisible(true);
|
||||
|
||||
UseCaseDescriptorDV singleUCD = getSelectProjectType();
|
||||
if (singleUCD != null) {
|
||||
appManagerBus.fireEvent(
|
||||
new GetListOfRecordsEvent(false, singleUCD.getProfileID(), getCurrentSearchingFilter(), false));
|
||||
}
|
||||
}
|
||||
|
||||
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
|
||||
GWT.log("showListOfProjectsView for: " + grpw);
|
||||
this.grpw = grpw;
|
||||
geonaListOfRecordsPanel.clear();
|
||||
VerticalPanel verticalPanel = new VerticalPanel();
|
||||
verticalPanel.add(this.grpw.getCellPanel());
|
||||
verticalPanel.add(this.grpw.getPagerPanel());
|
||||
geonaListOfRecordsPanel.add(verticalPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* To label filter.
|
||||
*
|
||||
* @param itemField the item field
|
||||
* @param direction the direction
|
||||
* @return the string
|
||||
*/
|
||||
private String toLabelFilter(ItemFieldDV itemField, ORDER direction) {
|
||||
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
|
||||
return labelFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Project type reset.
|
||||
*/
|
||||
public void projectTypeReset() {
|
||||
ddProjectType.clear();
|
||||
|
||||
}
|
||||
|
||||
public void addProjectType(final UseCaseDescriptorDV ucd) {
|
||||
|
||||
NavLink link = new NavLink(ucd.getName());
|
||||
link.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
alertProjectType.setText(ucd.getName());
|
||||
appManagerBus
|
||||
.fireEvent(new GetListOfRecordsEvent(false, ucd.getProfileID(), builtSearchingFilter(), true));
|
||||
}
|
||||
});
|
||||
|
||||
ddProjectType.add(link);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<!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"
|
||||
xmlns:m="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui"
|
||||
xmlns:r="urn:import:org.gcube.portlets.user.geoportaldataentry.client.ui.utils">
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.float-right {
|
||||
display: block;
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.display-right {
|
||||
float: right;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.max-height-300 {
|
||||
max-height: auto;
|
||||
}
|
||||
|
||||
.search-field {
|
||||
padding-top: 6px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:ScrollPanel>
|
||||
<g:HTMLPanel ui:field="contTabGetListOfProjects">
|
||||
<b:Navbar addStyleNames="nav-toolbar-style">
|
||||
<b:Brand>List of Projects</b:Brand>
|
||||
<b:Nav>
|
||||
<b:Dropdown text="Project Type" ui:field="ddProjectType"
|
||||
icon="BUILDING">
|
||||
</b:Dropdown>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:Alert ui:field="alertProjectType"
|
||||
addStyleNames="alert_box_nav"></b:Alert>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
|
||||
</b:Dropdown>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:Alert ui:field="alertSortBy"
|
||||
addStyleNames="alert_box_nav"></b:Alert>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:NavLink ui:field="buttonReloadProjects"
|
||||
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
|
||||
</b:Nav>
|
||||
|
||||
<g:HTMLPanel addStyleNames="{style.display-right}">
|
||||
<b:Nav>
|
||||
<b:Dropdown text="Search for"
|
||||
ui:field="dropdownSearchFor">
|
||||
</b:Dropdown>
|
||||
</b:Nav>
|
||||
<b:Nav>
|
||||
<b:Alert ui:field="alertSearchFor"
|
||||
addStyleNames="alert_box_nav"></b:Alert>
|
||||
</b:Nav>
|
||||
|
||||
<b:TextBox ui:field="searchField"
|
||||
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>
|
||||
<b:Button icon="REMOVE_CIRCLE" ui:field="resetSearch"
|
||||
title="Reset the search" visible="false"></b:Button>
|
||||
</g:HTMLPanel>
|
||||
</b:Navbar>
|
||||
|
||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||
<div id="topPage2"></div>
|
||||
<a href="#bottomPage2">Go to bottom</a>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="geonaListOfRecordsPanel">
|
||||
<b:Hero ui:field="noProjectSelectionMessage">
|
||||
<b:Paragraph>select "Project Type"</b:Paragraph>
|
||||
</b:Hero>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.float-right}">
|
||||
<div id="bottomPage2"></div>
|
||||
<a href="#topPage2">Go to top</a>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</g:ScrollPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,117 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.projects;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.config.GcubeUserRole;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.action.ActionListPanel;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.UCD_Util;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* The Class ListOfProjectWorkflowActionsPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 21, 2022
|
||||
*/
|
||||
public class ListOfProjectWorkflowActionsPanel extends Composite {
|
||||
|
||||
@UiField
|
||||
FlowPanel actionListMainPanel;
|
||||
|
||||
private ActionListPanel actionListPanel;
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private static ListOfProjectWorkflowActionsPanelUiBinder uiBinder = GWT
|
||||
.create(ListOfProjectWorkflowActionsPanelUiBinder.class);
|
||||
|
||||
/**
|
||||
* The Interface ListOfProjectWorkflowActionsPanelUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 21, 2022
|
||||
*/
|
||||
interface ListOfProjectWorkflowActionsPanelUiBinder extends UiBinder<Widget, ListOfProjectWorkflowActionsPanel> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new list of project workflow actions panel.
|
||||
*
|
||||
* @param appManagerBus the app manager bus
|
||||
*/
|
||||
public ListOfProjectWorkflowActionsPanel(HandlerManager appManagerBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the action list panel.
|
||||
*
|
||||
* @param ucd the ucd
|
||||
*/
|
||||
public void initActionListPanel(UseCaseDescriptorDV ucd) {
|
||||
GWT.log("Init ActionListPanel for UCD: " + ucd);
|
||||
|
||||
// Setting Project type having HANDLER WORKFLOW ACTION
|
||||
HandlerDeclarationDV dataListHandler = UCD_Util.getHandlerDeclarationFor(ucd,
|
||||
GEOPORTAL_DATA_HANDLER.geoportal_workflow_action_list);
|
||||
|
||||
if (dataListHandler != null) {
|
||||
actionListMainPanel.setVisible(true);
|
||||
actionListMainPanel.clear();
|
||||
ConfigurationDV<?> config = dataListHandler.getConfiguration();
|
||||
List<ActionDefinitionDV> listActionDef = toListActionDefinition(config);
|
||||
actionListPanel = new ActionListPanel(appManagerBus, ucd.getName(), ucd.getProfileID(), listActionDef);
|
||||
actionListMainPanel.add(actionListPanel);
|
||||
|
||||
} else {
|
||||
actionListMainPanel.clear();
|
||||
actionListMainPanel.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To list action definition.
|
||||
*
|
||||
* @param config the config
|
||||
* @return the list
|
||||
*/
|
||||
private List<ActionDefinitionDV> toListActionDefinition(ConfigurationDV<?> config) {
|
||||
|
||||
try {
|
||||
return (List<ActionDefinitionDV>) config.getConfiguration();
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error on casting " + ConfigurationDV.class.getName() + " to List of "
|
||||
+ ActionDefinitionDV.class.getName());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show actions on selected.
|
||||
*
|
||||
* @param <T> the generic type
|
||||
* @param selectItems the select items
|
||||
* @param userRole the user role
|
||||
*/
|
||||
public <T> void showActionsOnSelected(List<T> selectItems, GcubeUserRole userRole) {
|
||||
actionListPanel.showActionsOnSelected(selectItems, userRole);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<!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>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
</ui:style>
|
||||
<g:FlowPanel>
|
||||
<g:FlowPanel ui:field="actionListMainPanel"
|
||||
addStyleNames="action-list-main-panel"></g:FlowPanel>
|
||||
</g:FlowPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,284 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandlerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.ComplexPanel;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class CreateRelationProjectsPanel extends Composite {
|
||||
|
||||
private static CreateRelationProjectsPanelUiBinder uiBinder = GWT.create(CreateRelationProjectsPanelUiBinder.class);
|
||||
|
||||
interface CreateRelationProjectsPanelUiBinder extends UiBinder<Widget, CreateRelationProjectsPanel> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
HTMLPanel firstPanelContainer;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelTitle;
|
||||
|
||||
@UiField
|
||||
HTMLPanel secondPanelContainer;
|
||||
|
||||
@UiField
|
||||
Alert firstItemAlert;
|
||||
|
||||
@UiField
|
||||
Alert secondItemAlert;
|
||||
|
||||
@UiField
|
||||
Button buttFirtProjectReset;
|
||||
|
||||
@UiField
|
||||
Button buttSecondProjectReset;
|
||||
|
||||
@UiField
|
||||
FlowPanel firstProjectPanelContainer;
|
||||
|
||||
@UiField
|
||||
FlowPanel secondProjectPanelContainer;
|
||||
|
||||
@UiField
|
||||
ListBox listBoxRelationNames;
|
||||
|
||||
@UiField
|
||||
Button closeButton;
|
||||
|
||||
@UiField
|
||||
Button buttCreateRelation;
|
||||
|
||||
@UiField
|
||||
Alert alertMessage;
|
||||
|
||||
private Map<String, RelationshipDefinitionDV> mapRelationsDefiniton = new HashMap<String, RelationshipDefinitionDV>();
|
||||
|
||||
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
public CreateRelationProjectsPanel(HandlerManager appManagerBus, ResultDocumentDV project) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
|
||||
closeButton.setType(ButtonType.LINK);
|
||||
closeButton.setIcon(IconType.REMOVE);
|
||||
closeButton.setIconSize(IconSize.LARGE);
|
||||
|
||||
closeButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
appManagerBus.fireEvent(new CloseCreateRelationGUIEvent());
|
||||
}
|
||||
});
|
||||
|
||||
listBoxRelationNames.setWidth("90%");
|
||||
|
||||
GeoPortalDataEntryApp.geoportalDataEntryService.getRelationshipsDefinition(project.getProfileID(),
|
||||
new AsyncCallback<List<RelationshipDefinitionDV>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<RelationshipDefinitionDV> relationshipNames) {
|
||||
|
||||
if (relationshipNames == null || relationshipNames.size() == 0) {
|
||||
buttCreateRelation.setEnabled(false);
|
||||
alertMessage
|
||||
.setText("You cannot create a relationship. No configuration found in the UCD for: "
|
||||
+ project.getProfileID());
|
||||
alertMessage.setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (RelationshipDefinitionDV relDef : relationshipNames) {
|
||||
listBoxRelationNames.addItem(relDef.getLabel(), relDef.getId());
|
||||
mapRelationsDefiniton.put(relDef.getId(), relDef);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
alertMessage.setText("Error on reading the relationship names. Error: " + caught.getMessage());
|
||||
return;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
firstItemAlert.add(new Image(Images.ICONS.oneFingerIcon()));
|
||||
firstItemAlert.setClose(false);
|
||||
secondItemAlert.add(new Image(Images.ICONS.oneFingerIcon()));
|
||||
secondItemAlert.setClose(false);
|
||||
|
||||
buttFirtProjectReset.setType(ButtonType.LINK);
|
||||
buttFirtProjectReset.setIcon(IconType.REMOVE_SIGN);
|
||||
buttFirtProjectReset.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
selectedProjects.put(0, null);
|
||||
firstItemAlert.setVisible(true);
|
||||
firstProjectPanelContainer.clear();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
buttSecondProjectReset.setType(ButtonType.LINK);
|
||||
buttSecondProjectReset.setIcon(IconType.REMOVE_SIGN);
|
||||
|
||||
buttSecondProjectReset.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
selectedProjects.put(1, null);
|
||||
secondItemAlert.setVisible(true);
|
||||
secondProjectPanelContainer.clear();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
buttCreateRelation.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
boolean isValidForm = checkFormPassed();
|
||||
if (isValidForm) {
|
||||
buttCreateRelation.setEnabled(false);
|
||||
|
||||
RelationshipDefinitionDV relationSelected = mapRelationsDefiniton
|
||||
.get(listBoxRelationNames.getSelectedValue());
|
||||
|
||||
appManagerBus.fireEvent(new RelationActionHandlerEvent(selectedProjects.get(0), relationSelected,
|
||||
selectedProjects.get(1)));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
selectedProject(project);
|
||||
|
||||
}
|
||||
|
||||
public boolean checkFormPassed() {
|
||||
|
||||
alertMessage.setVisible(false);
|
||||
|
||||
ResultDocumentDV first = selectedProjects.get(0);
|
||||
if (first == null) {
|
||||
alertMessage.setVisible(true);
|
||||
alertMessage.setText("You must select the first project from the 'List of Project' Table");
|
||||
return false;
|
||||
}
|
||||
|
||||
ResultDocumentDV second = selectedProjects.get(1);
|
||||
if (second == null) {
|
||||
alertMessage.setVisible(true);
|
||||
alertMessage.setText("You must select the second project from the 'List of Project' Table");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (first.getId().compareTo(second.getId()) == 0) {
|
||||
alertMessage.setVisible(true);
|
||||
alertMessage.setText("First and Second project cannot be the same project");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public void selectedProject(ResultDocumentDV project) {
|
||||
|
||||
ResultDocumentDV first = selectedProjects.get(0);
|
||||
|
||||
String htmlMsg = "Selected: <b>" + project.getFirstEntryOfMap().getValue() + "</b> (id: " + project.getId()
|
||||
+ ")";
|
||||
|
||||
if (first == null) {
|
||||
firstItemAlert.setVisible(false);
|
||||
selectedProjects.put(0, project);
|
||||
FlexTable flex = new FlexTable();
|
||||
flex.setWidget(0, 0, new HTML(htmlMsg));
|
||||
FlowPanel temporalContainer = new FlowPanel();
|
||||
flex.setWidget(1, 0, temporalContainer);
|
||||
firstProjectPanelContainer.add(flex);
|
||||
addTemportalReferenceToPanel(temporalContainer, project.getProfileID(), project.getProjectID());
|
||||
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
|
||||
rtth.showAsJSON(false);
|
||||
firstProjectPanelContainer.add(rtth);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ResultDocumentDV second = selectedProjects.get(1);
|
||||
|
||||
if (second == null) {
|
||||
secondItemAlert.setVisible(false);
|
||||
selectedProjects.put(1, project);
|
||||
FlexTable flex = new FlexTable();
|
||||
flex.setWidget(0, 0, new HTML(htmlMsg));
|
||||
FlowPanel temporalContainer = new FlowPanel();
|
||||
flex.setWidget(1, 0, temporalContainer);
|
||||
addTemportalReferenceToPanel(temporalContainer, project.getProfileID(), project.getProjectID());
|
||||
secondProjectPanelContainer.add(flex);
|
||||
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
|
||||
rtth.showAsJSON(false);
|
||||
secondProjectPanelContainer.add(rtth);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addTemportalReferenceToPanel(final ComplexPanel panelContainer, String profileID, String projectID) {
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().temporalReferenceForProject(profileID, projectID,
|
||||
new AsyncCallback<TemporalReferenceDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TemporalReferenceDV result) {
|
||||
if (result != null) {
|
||||
panelContainer.add(new HTML(HTMLUtil.toHTMLCode(result)));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
<!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>
|
||||
.creation-rel-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
padding: 18px;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.list-box-delimiter {
|
||||
/*border-top: 1px solid #cdcdcd;*/
|
||||
/*border-bottom: 1px solid #cdcdcd;*/
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.butt-create {
|
||||
float: right;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.to-align-right {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.panel-style {
|
||||
margin-top: 10px;
|
||||
border: 1px solid #96a5b5;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.panel-style table {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.panel-container-style {
|
||||
padding-left: 10px;
|
||||
}
|
||||
</ui:style>
|
||||
|
||||
<g:HTMLPanel>
|
||||
<b:Button ui:field="closeButton"
|
||||
addStyleNames="{style.to-align-right}"></b:Button>
|
||||
<g:HTMLPanel ui:field="panelTitle"
|
||||
addStyleNames="{style.creation-rel-title}">Create Relationship</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="firstPanelContainer"
|
||||
addStyleNames="{style.panel-style}">
|
||||
<g:FlowPanel>
|
||||
<b:Label>First Project</b:Label>
|
||||
<b:Button ui:field="buttFirtProjectReset">Reset</b:Button>
|
||||
</g:FlowPanel>
|
||||
<b:Alert ui:field="firstItemAlert">Select project from the "List of
|
||||
Projects"
|
||||
Table</b:Alert>
|
||||
<g:FlowPanel ui:field="firstProjectPanelContainer" addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.list-box-delimiter}">
|
||||
<b:ListBox ui:field="listBoxRelationNames">
|
||||
</b:ListBox>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="secondPanelContainer"
|
||||
addStyleNames="{style.panel-style}">
|
||||
<g:FlowPanel>
|
||||
<b:Label>Second Project</b:Label>
|
||||
<b:Button ui:field="buttSecondProjectReset">Reset</b:Button>
|
||||
</g:FlowPanel>
|
||||
<b:Alert ui:field="secondItemAlert">Select project from the "List of
|
||||
Projects"
|
||||
Table</b:Alert>
|
||||
<g:FlowPanel ui:field="secondProjectPanelContainer" addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
<b:Alert type="ERROR" ui:field="alertMessage" visible="false"></b:Alert>
|
||||
<b:Button type="PRIMARY" ui:field="buttCreateRelation"
|
||||
addStyleNames="{style.butt-create}">Create</b:Button>
|
||||
</g:HTMLPanel>
|
||||
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,280 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.relation;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.config.OPERATION_ON_ITEM;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.WORKFLOW_PHASE;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.CloseCreateRelationGUIEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.RelationActionHandlerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.ModalWindow;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconSize;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.ComplexPanel;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class ViewRelationshipPanel extends Composite {
|
||||
|
||||
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
|
||||
|
||||
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, ViewRelationshipPanel> {
|
||||
}
|
||||
|
||||
private String profileID;
|
||||
|
||||
@UiField
|
||||
HTMLPanel firstPanelContainer;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelTitle;
|
||||
|
||||
@UiField
|
||||
HTMLPanel secondPanelContainer;
|
||||
|
||||
@UiField
|
||||
FlowPanel firstProjectPanelContainer;
|
||||
|
||||
@UiField
|
||||
FlowPanel secondProjectPanelContainer;
|
||||
|
||||
@UiField
|
||||
Button closeButton;
|
||||
|
||||
@UiField
|
||||
Button buttonExpand;
|
||||
|
||||
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private Map<String, ResultDocumentDV> mapOfTargetProjectForId = new HashMap<String, ResultDocumentDV>();
|
||||
|
||||
private ResultDocumentDV fromTheProject;
|
||||
|
||||
public ViewRelationshipPanel(HandlerManager appManagerBus, final ResultDocumentDV fromProject, boolean showExpand) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
this.fromTheProject = fromProject;
|
||||
closeButton.setType(ButtonType.LINK);
|
||||
closeButton.setIcon(IconType.REMOVE);
|
||||
closeButton.setIconSize(IconSize.LARGE);
|
||||
|
||||
closeButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
appManagerBus.fireEvent(new CloseCreateRelationGUIEvent());
|
||||
}
|
||||
});
|
||||
|
||||
buttonExpand.setType(ButtonType.LINK);
|
||||
buttonExpand.setIcon(IconType.EXPAND);
|
||||
buttonExpand.setTitle("Show this view in new Window");
|
||||
buttonExpand.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
Modal mw = new Modal(true, true);
|
||||
mw.setTitle("Relationships");
|
||||
mw.getElement().addClassName("no_modal_body_max_height");
|
||||
|
||||
int width = 0;
|
||||
int heigth = 0;
|
||||
try {
|
||||
width = Window.getClientWidth() * 75 / 100;
|
||||
heigth = Window.getClientHeight() * 75 / 100;
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
if (width > 800) {
|
||||
mw.setWidth(width);
|
||||
}
|
||||
|
||||
if(heigth > 600) {
|
||||
mw.setHeight(heigth+"px");
|
||||
}
|
||||
|
||||
mw.add(new ViewRelationshipPanel(appManagerBus, fromTheProject, false));
|
||||
mw.show();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (!showExpand) {
|
||||
buttonExpand.setVisible(false);
|
||||
panelTitle.setVisible(false);
|
||||
closeButton.setVisible(false);
|
||||
}
|
||||
|
||||
showRelationsOf(fromProject);
|
||||
}
|
||||
|
||||
public void showRelationsOf(ResultDocumentDV project) {
|
||||
firstProjectPanelContainer.clear();
|
||||
secondProjectPanelContainer.clear();
|
||||
this.fromTheProject = project;
|
||||
|
||||
Entry<String, Object> firstEntrySet = project.getFirstEntryOfMap();
|
||||
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
|
||||
+ ")";
|
||||
|
||||
FlexTable flex = new FlexTable();
|
||||
flex.setWidget(0, 0, new HTML(htmlMsg));
|
||||
FlowPanel fromTemporalContainer = new FlowPanel();
|
||||
flex.setWidget(1, 0, fromTemporalContainer);
|
||||
firstProjectPanelContainer.add(flex);
|
||||
addTemportalReferenceToPanel(fromTemporalContainer, project.getProfileID(), project.getProjectID());
|
||||
|
||||
//firstProjectPanelContainer.add(new HTML(htmlMsg));
|
||||
ReportTemplateToHTML rtth = new ReportTemplateToHTML("", project.getDocumentAsJSON(), false, false);
|
||||
rtth.showAsJSON(false);
|
||||
firstProjectPanelContainer.add(rtth);
|
||||
|
||||
HTML labelNoRelations = new HTML("No relationship/s found");
|
||||
secondProjectPanelContainer.add(labelNoRelations);
|
||||
|
||||
if (project.getListRelationshipDV() != null && project.getListRelationshipDV().size() > 0) {
|
||||
|
||||
secondProjectPanelContainer.clear();
|
||||
|
||||
for (RelationshipDV relationDV : project.getListRelationshipDV()) {
|
||||
|
||||
final FlexTable flexTable = new FlexTable();
|
||||
flexTable.getElement().addClassName("box-table-diplay-project");
|
||||
Label label = new Label();
|
||||
label.setType(LabelType.INFO);
|
||||
label.setText(relationDV.getRelationshipName());
|
||||
|
||||
FlowPanel panelContainer = new FlowPanel();
|
||||
Button deleteRelation = new Button("", IconType.TRASH);
|
||||
deleteRelation.setTitle("Delete this relation");
|
||||
deleteRelation.setType(ButtonType.LINK);
|
||||
deleteRelation.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
// #24571
|
||||
boolean isNotInDRAFT = false;
|
||||
|
||||
if (fromTheProject.getLifecycleInfo() != null) {
|
||||
String phase = fromTheProject.getLifecycleInfo().getPhase();
|
||||
// IF the project is not in DRAFT, showing an alert and the no Update Mode will
|
||||
// be activated
|
||||
if (phase != null && phase.compareToIgnoreCase(WORKFLOW_PHASE.DRAFT.getLabel()) != 0) {
|
||||
|
||||
String msg = ConstantsGeoPortalDataEntryApp.ALERT_MESSAGE_DELETE_RELATION_FORBIDDEN;
|
||||
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()),
|
||||
"Forbidden: " + OPERATION_ON_ITEM.DELETE_RELATION, msg, AlertType.WARNING);
|
||||
modalW.show();
|
||||
|
||||
isNotInDRAFT = true;
|
||||
}
|
||||
}
|
||||
|
||||
//If the project is in DRAFT, going to delete the releation after confirm
|
||||
if(!isNotInDRAFT) {
|
||||
ResultDocumentDV toProject = mapOfTargetProjectForId.get(relationDV.getTargetUCD());
|
||||
appManagerBus.fireEvent(
|
||||
new RelationActionHandlerEvent(project, relationDV.getRelationshipName(), toProject));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
panelContainer.add(label);
|
||||
panelContainer.add(deleteRelation);
|
||||
flexTable.setWidget(0, 0, panelContainer);
|
||||
|
||||
flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(
|
||||
relationDV.getTargetUCD(), relationDV.getTargetID(), new AsyncCallback<ResultDocumentDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
flexTable.setWidget(1, 0, new HTML(caught.getMessage()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResultDocumentDV result) {
|
||||
mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
|
||||
Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
|
||||
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
|
||||
+ "</b> (id: " + result.getId() + ")";
|
||||
|
||||
flexTable.setWidget(1, 0, new HTML(htmlMsg));
|
||||
FlowPanel toTemporalContainer = new FlowPanel();
|
||||
flexTable.setWidget(2, 0, toTemporalContainer);
|
||||
addTemportalReferenceToPanel(toTemporalContainer, result.getProfileID(), result.getProjectID());
|
||||
|
||||
ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("", result.getDocumentAsJSON(),
|
||||
false, false);
|
||||
rtth2.showAsJSON(false);
|
||||
|
||||
flexTable.setWidget(3, 0, rtth2);
|
||||
}
|
||||
});
|
||||
|
||||
secondProjectPanelContainer.add(flexTable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addTemportalReferenceToPanel(final ComplexPanel panelContainer, String profileID, String projectID) {
|
||||
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().temporalReferenceForProject(profileID, projectID,
|
||||
new AsyncCallback<TemporalReferenceDV>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TemporalReferenceDV result) {
|
||||
if (result != null) {
|
||||
panelContainer.add(new HTML(HTMLUtil.toHTMLCode(result)));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
<!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>
|
||||
.view-rel-title {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
padding: 18px;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.butt-create {
|
||||
float: right;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.to-align-right {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
}
|
||||
|
||||
.panel-style {
|
||||
margin-top: 10px;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.panel-style table {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.panel-container-style {
|
||||
padding-left: 10px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.float-right {
|
||||
float: right;
|
||||
}
|
||||
</ui:style>
|
||||
|
||||
<g:HTMLPanel>
|
||||
<b:Button ui:field="closeButton"
|
||||
addStyleNames="{style.to-align-right}"></b:Button>
|
||||
<g:HTMLPanel ui:field="panelTitle"
|
||||
addStyleNames="{style.view-rel-title}">View Relations</g:HTMLPanel>
|
||||
<b:Button ui:field="buttonExpand"
|
||||
addStyleNames="{style.float-right}">Expand</b:Button>
|
||||
<g:HTMLPanel ui:field="firstPanelContainer"
|
||||
addStyleNames="{style.panel-style}">
|
||||
<g:FlowPanel>
|
||||
<b:Label>From Project</b:Label>
|
||||
</g:FlowPanel>
|
||||
<g:FlowPanel ui:field="firstProjectPanelContainer"
|
||||
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="secondPanelContainer"
|
||||
addStyleNames="{style.panel-style}">
|
||||
<g:FlowPanel>
|
||||
<b:Label>To Project/s</b:Label>
|
||||
</g:FlowPanel>
|
||||
<g:FlowPanel ui:field="secondProjectPanelContainer"
|
||||
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
|
||||
</ui:UiBinder>
|
|
@ -1,57 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.report;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil.HTML_TAG;
|
||||
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
|
||||
/**
|
||||
* The Class BuildValidationReport.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 14, 2021
|
||||
*/
|
||||
public class BuildValidationReport extends FlowPanel {
|
||||
private HTML recordPublished = new HTML();
|
||||
private ReportTemplateToHTML rTToHTML;
|
||||
|
||||
/**
|
||||
* Instantiates a new builds the validation report.
|
||||
*
|
||||
* @param validationReport the validation report
|
||||
*/
|
||||
public BuildValidationReport(ValidationReportDV validationReport) {
|
||||
|
||||
if(validationReport==null)
|
||||
return;
|
||||
|
||||
ValidationStatus status = validationReport.getStatus();
|
||||
switch (status) {
|
||||
case PASSED:
|
||||
String success = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null, "SUCCESS");
|
||||
recordPublished.setHTML("Record Published with " + success);
|
||||
break;
|
||||
case WARNING:
|
||||
String warning = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null, "WARNING");
|
||||
recordPublished.setHTML("Record Published with " + warning);
|
||||
|
||||
break;
|
||||
case ERROR:
|
||||
String error = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold", "ERROR");
|
||||
recordPublished.setHTML(error + " on publishing the Record");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
rTToHTML = new ReportTemplateToHTML(validationReport.getAsJSONString(), true);
|
||||
|
||||
add(recordPublished);
|
||||
add(rTToHTML);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.report;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil.HTML_TAG;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
|
||||
/**
|
||||
* The Class LifecycleInformationPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 1, 2022
|
||||
*/
|
||||
public class LifecycleInformationPanel extends FlowPanel {
|
||||
|
||||
/**
|
||||
* Instantiates a new lifecycle information panel.
|
||||
*
|
||||
* @param projectID the project ID
|
||||
* @param profileID the profile ID
|
||||
* @param projectAsJSON the project as JSON
|
||||
* @param lcDV the lc DV
|
||||
* @param showGoToProject the show go to project
|
||||
*/
|
||||
public LifecycleInformationPanel(String projectID, String profileID, String projectAsJSON,
|
||||
LifecycleInformationDV lcDV, boolean showGoToProject) {
|
||||
|
||||
add(new HTML("Project id: " + (projectID)));
|
||||
|
||||
HTML htmlPhase = new HTML();
|
||||
htmlPhase.setHTML("Current phase: <b>" + lcDV.getPhase() + "</b>");
|
||||
|
||||
HTML htmlStep = new HTML();
|
||||
htmlStep.setHTML("Last invoked step: <b>" + lcDV.getLastInvokedStep() + "</b>");
|
||||
|
||||
HTML lastOperationStatus = new HTML();
|
||||
String lastOperationMsg = "Last operation status: ";
|
||||
switch (lcDV.getLastOperationStatus()) {
|
||||
case OK: {
|
||||
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null,
|
||||
lcDV.getLastOperationStatus().toString());
|
||||
break;
|
||||
}
|
||||
case WARNING: {
|
||||
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null,
|
||||
lcDV.getLastOperationStatus().toString());
|
||||
break;
|
||||
}
|
||||
case ERROR: {
|
||||
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold",
|
||||
lcDV.getLastOperationStatus().toString());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
lastOperationMsg += HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold",
|
||||
lcDV.getLastOperationStatus().toString());
|
||||
break;
|
||||
}
|
||||
lastOperationStatus.setHTML(lastOperationMsg);
|
||||
|
||||
add(htmlPhase);
|
||||
add(htmlStep);
|
||||
add(lastOperationStatus);
|
||||
|
||||
HTML htmlEvent = new HTML();
|
||||
htmlEvent.setHTML("Last event step: <b>" + lcDV.getLastEvent() + "</b>");
|
||||
|
||||
if (showGoToProject) {
|
||||
final HorizontalPanel hpGetLink = new HorizontalPanel();
|
||||
final LoaderIcon lc = new LoaderIcon("Get link...");
|
||||
hpGetLink.add(lc);
|
||||
add(hpGetLink);
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(projectID, profileID,
|
||||
new AsyncCallback<GeoportalItemReferences>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
hpGetLink.clear();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoportalItemReferences result) {
|
||||
hpGetLink.clear();
|
||||
String theURL = result.getRestrictedLink().getShortURL() != null
|
||||
? result.getRestrictedLink().getShortURL()
|
||||
: result.getRestrictedLink().getCompleteURL();
|
||||
String htmlLink = "<div>Go to project on Map: <a href=" + theURL + " target=\"_blank\">"
|
||||
+ theURL + "</a></div>";
|
||||
HTML html = new HTML(htmlLink);
|
||||
hpGetLink.add(html);
|
||||
// modal.add(html);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (projectAsJSON != null)
|
||||
add(new ReportTemplateToHTML("Project", projectAsJSON, false));
|
||||
if (lcDV.getAsJSONString() != null)
|
||||
add(new ReportTemplateToHTML("Lifecycle Report", lcDV.getAsJSONString(), false));
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.report;
|
|||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.ExternalLib;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AccordionGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.github.gwtbootstrap.client.ui.event.HiddenEvent;
|
||||
|
@ -10,8 +11,6 @@ import com.github.gwtbootstrap.client.ui.event.HiddenHandler;
|
|||
import com.github.gwtbootstrap.client.ui.event.ShowEvent;
|
||||
import com.github.gwtbootstrap.client.ui.event.ShowHandler;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
import com.google.gwt.json.client.JSONParser;
|
||||
import com.google.gwt.json.client.JSONValue;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
|
@ -47,89 +46,196 @@ public class ReportTemplateToHTML extends Composite {
|
|||
|
||||
@UiField
|
||||
VerticalPanel htmlContainer;
|
||||
|
||||
|
||||
@UiField
|
||||
AccordionGroup showReportAsJSON;
|
||||
|
||||
@UiField
|
||||
AccordionGroup showReportAsTable;
|
||||
|
||||
@UiField
|
||||
Paragraph reportJSON;
|
||||
|
||||
@UiField
|
||||
Paragraph reportTable;
|
||||
|
||||
@UiField
|
||||
Label labelToReport;
|
||||
|
||||
boolean toJSONERROR = false;
|
||||
|
||||
/**
|
||||
* Instantiates a new report template to HTML.
|
||||
*
|
||||
* @param reportAsJSON the report as JSON
|
||||
* @param documentLabel the document label
|
||||
* @param theJSONDocument the the JSON document
|
||||
* @param openTableReport the open table report
|
||||
* @param openJSONReport the open JSON report
|
||||
*/
|
||||
public ReportTemplateToHTML(String reportAsJSON, boolean openJSONReport) {
|
||||
public ReportTemplateToHTML(String documentLabel, String theJSONDocument, boolean openTableReport,
|
||||
boolean openJSONReport) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
vpContainer.setVisible(false);
|
||||
|
||||
showReportAsJSON.setDefaultOpen(openJSONReport);
|
||||
//showReportAsJSON.setIconPosition(IconPosition.RIGHT);
|
||||
|
||||
if(openJSONReport) {
|
||||
showReportAsTable.setDefaultOpen(openTableReport);
|
||||
|
||||
documentLabel = documentLabel == null ? "Document" : documentLabel;
|
||||
labelToReport.setText(documentLabel);
|
||||
// showReportAsJSON.setIconPosition(IconPosition.RIGHT);
|
||||
|
||||
if (openTableReport) {
|
||||
showReportAsTable.setIcon(IconType.ARROW_DOWN);
|
||||
} else {
|
||||
showReportAsTable.setIcon(IconType.ARROW_RIGHT);
|
||||
}
|
||||
|
||||
if (openJSONReport) {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
|
||||
}else {
|
||||
} else {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
|
||||
}
|
||||
|
||||
|
||||
showReportAsTable.addShowHandler(new ShowHandler() {
|
||||
|
||||
@Override
|
||||
public void onShow(ShowEvent showEvent) {
|
||||
showReportAsTable.setIcon(IconType.ARROW_DOWN);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
showReportAsTable.addHiddenHandler(new HiddenHandler() {
|
||||
|
||||
@Override
|
||||
public void onHidden(HiddenEvent hiddenEvent) {
|
||||
showReportAsTable.setIcon(IconType.ARROW_RIGHT);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
showReportAsJSON.addShowHandler(new ShowHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onShow(ShowEvent showEvent) {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
showReportAsJSON.addHiddenHandler(new HiddenHandler() {
|
||||
|
||||
|
||||
@Override
|
||||
public void onHidden(HiddenEvent hiddenEvent) {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (reportAsJSON != null) {
|
||||
GWT.log("report is: " + reportAsJSON);
|
||||
|
||||
if (theJSONDocument != null) {
|
||||
GWT.log("report is: " + theJSONDocument);
|
||||
vpContainer.setVisible(true);
|
||||
|
||||
try {
|
||||
JSONValue jsonObj = JSONParser.parse(reportAsJSON);
|
||||
JSONObject json = (JSONObject) jsonObj;
|
||||
JSONValue valueChildren = json.get("children");
|
||||
JSONArray jsonChildren = (JSONArray) valueChildren;
|
||||
|
||||
String toTableHTML = null;
|
||||
for (int i = 0; i < jsonChildren.size(); i++) {
|
||||
JSONObject jsO = (JSONObject) jsonChildren.get(i);
|
||||
JSONValue jsonObj = JSONParser.parse(theJSONDocument);
|
||||
String toTableHTML = jsonToHTML(jsonObj.toString());
|
||||
GWT.log("HTML table: " + toTableHTML);
|
||||
|
||||
if (jsO.containsKey("children")) {
|
||||
toTableHTML = jsonToHTML(jsO.get("children").toString());
|
||||
} else {
|
||||
toTableHTML = jsonToHTML(jsO.toString());
|
||||
}
|
||||
|
||||
htmlContainer.add(new HTML(toTableHTML));
|
||||
}
|
||||
reportTable.add(new HTML(toTableHTML));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
GWT.log("error: " + e.getMessage());
|
||||
showReportAsTable.setVisible(false);
|
||||
}
|
||||
reportJSON.add(new HTML("<pre>" + ExternalLib.toPrettyPrintJSON(reportAsJSON) + "</pre>"));
|
||||
|
||||
reportJSON.add(new HTML("<pre>" + ExternalLib.toPrettyPrintJSON(theJSONDocument) + "</pre>"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new report template to HTML. Shows the JSON Document as Table
|
||||
* HTML by default
|
||||
*
|
||||
* @param documentLabel the document label
|
||||
* @param theJSONDocument the the JSON document
|
||||
* @param openJSONReport the open JSON report
|
||||
*/
|
||||
public ReportTemplateToHTML(String documentLabel, String theJSONDocument, boolean openJSONReport) {
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
vpContainer.setVisible(false);
|
||||
|
||||
showReportAsTable.setVisible(false);
|
||||
|
||||
showReportAsJSON.setDefaultOpen(openJSONReport);
|
||||
|
||||
documentLabel = documentLabel == null ? "Document" : documentLabel;
|
||||
labelToReport.setText(documentLabel);
|
||||
// showReportAsJSON.setIconPosition(IconPosition.RIGHT);
|
||||
|
||||
if (openJSONReport) {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
|
||||
} else {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
|
||||
}
|
||||
|
||||
showReportAsJSON.addShowHandler(new ShowHandler() {
|
||||
|
||||
@Override
|
||||
public void onShow(ShowEvent showEvent) {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_DOWN);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
showReportAsJSON.addHiddenHandler(new HiddenHandler() {
|
||||
|
||||
@Override
|
||||
public void onHidden(HiddenEvent hiddenEvent) {
|
||||
showReportAsJSON.setIcon(IconType.ARROW_RIGHT);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (theJSONDocument != null) {
|
||||
GWT.log("report is: " + theJSONDocument);
|
||||
vpContainer.setVisible(true);
|
||||
|
||||
try {
|
||||
|
||||
JSONValue jsonObj = JSONParser.parse(theJSONDocument);
|
||||
String toTableHTML = jsonToHTML(jsonObj.toString());
|
||||
GWT.log("HTML table: " + toTableHTML);
|
||||
htmlContainer.add(new HTML(toTableHTML));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
GWT.log("error: " + e.getMessage());
|
||||
showReportAsTable.setVisible(false);
|
||||
}
|
||||
|
||||
reportJSON.add(new HTML("<pre>" + ExternalLib.toPrettyPrintJSON(theJSONDocument) + "</pre>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showAsHTMLTable(boolean bool) {
|
||||
showReportAsTable.setVisible(bool);
|
||||
}
|
||||
|
||||
public void showAsJSON(boolean bool) {
|
||||
showReportAsJSON.setVisible(bool);
|
||||
}
|
||||
|
||||
/**
|
||||
* Json to HTML.
|
||||
*
|
||||
* @param jsonTxt the json txt
|
||||
* @return the string
|
||||
*/
|
||||
public static native String jsonToHTML(String jsonTxt)/*-{
|
||||
private static native String jsonToHTML(String jsonTxt)/*-{
|
||||
try {
|
||||
var jsonObj = JSON.parse(jsonTxt);
|
||||
|
||||
|
|
|
@ -14,10 +14,15 @@
|
|||
<g:HTMLPanel>
|
||||
<g:VerticalPanel ui:field="vpContainer"
|
||||
addStyleNames="{style.margin-top-10}">
|
||||
<b:Label>Publication Report: </b:Label>
|
||||
<b:Label ui:field="labelToReport">Report: </b:Label>
|
||||
<g:VerticalPanel ui:field="htmlContainer"
|
||||
addStyleNames="{style.margin-top-10}"></g:VerticalPanel>
|
||||
<b:AccordionGroup heading="Show Report as JSON" ui:field="showReportAsJSON">
|
||||
<b:AccordionGroup heading="Show as Table"
|
||||
ui:field="showReportAsTable">
|
||||
<b:Paragraph ui:field="reportTable"></b:Paragraph>
|
||||
</b:AccordionGroup>
|
||||
<b:AccordionGroup heading="Show as JSON"
|
||||
ui:field="showReportAsJSON">
|
||||
<b:Paragraph ui:field="reportJSON"></b:Paragraph>
|
||||
</b:AccordionGroup>
|
||||
|
||||
|
|
|
@ -5,26 +5,29 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV.Status;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.PublicationInfoDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.StringUtil;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.ButtonCell;
|
||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||
import com.google.gwt.cell.client.Cell.Context;
|
||||
import com.google.gwt.cell.client.DateCell;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
|
||||
import com.google.gwt.safehtml.shared.SafeHtml;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
||||
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
||||
|
@ -49,26 +52,35 @@ import com.google.gwt.view.client.SingleSelectionModel;
|
|||
* Jun 15, 2021
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<T> {
|
||||
public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T> {
|
||||
|
||||
private static final String CSS_CLASS_BACK_SYSTEM_CELL_B = "back-system-cell-b";
|
||||
private static final String CSS_CLASS_BACK_SYSTEM_CELL_O = "back-system-cell-o";
|
||||
private static final String CSS_CLASS_BACK_SYSTEM_CELL_Y = "back-system-cell-y";
|
||||
private static final int MAX_TEXT_DIMENSION = 350;
|
||||
private static final int ITEMS_PER_PAGE = 10;
|
||||
private static final String NO_DATA = "No data";
|
||||
private TextColumn<T> name;
|
||||
private TextColumn<T> introduction;
|
||||
private TextColumn<T> author;
|
||||
public static DateTimeFormat dtformat = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
|
||||
|
||||
private AbstractDataProvider<T> dataProvider;
|
||||
|
||||
private List<RECORD_FIELD> displayFields;
|
||||
private TextColumn<T> startEndProjectColumn;
|
||||
private TextColumn<T> statusColumn;
|
||||
// private Column<T, Date> startProjectDateColumn;
|
||||
// private Column<T, Date> endProjectDateColumn;
|
||||
private List<ItemFieldDV> displayFields;
|
||||
private boolean isAsyncronusTable;
|
||||
private TextColumn<T> insertedBy;
|
||||
private Column<T, Date> createdColumn;
|
||||
private SortFilter currentSortFilter;
|
||||
|
||||
private Map<DEFAULT_DISPLAYING_COLUMN_NAME, Column> mapColumns = new HashMap<DEFAULT_DISPLAYING_COLUMN_NAME, Column>();
|
||||
|
||||
public enum DEFAULT_DISPLAYING_COLUMN_NAME {
|
||||
CREATED("Created"), CREATED_BY("Created by"), PHASE("Phase"), STATUS("Status"), RELATIONSHIPS("Relationships");
|
||||
|
||||
String title;
|
||||
|
||||
DEFAULT_DISPLAYING_COLUMN_NAME(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new items table.
|
||||
|
@ -77,10 +89,9 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
* @param displayFields the display fields
|
||||
* @param startSortByColumn the start sort by column
|
||||
*/
|
||||
public ItemsTable(HandlerManager eventBus, RECORD_FIELD[] displayFields, SortFilter currentSortFilter) {
|
||||
public ItemsTable(HandlerManager eventBus, List<ItemFieldDV> displayFields) {
|
||||
this.eventBus = eventBus;
|
||||
this.currentSortFilter = currentSortFilter;
|
||||
setDisplayFields(displayFields);
|
||||
this.displayFields = displayFields;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -92,6 +103,127 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
super.addItems(items);
|
||||
}
|
||||
|
||||
class CellRender {
|
||||
|
||||
String tooltip;
|
||||
String value;
|
||||
|
||||
public CellRender() {
|
||||
}
|
||||
|
||||
public String getTooltip() {
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setTooltip(String tooltip) {
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CellRender toCellRender(ItemFieldDV itemField, DocumentDV documentDV) {
|
||||
|
||||
StringBuilder tooltipBuilder = new StringBuilder();
|
||||
StringBuilder valueBuilder = new StringBuilder();
|
||||
String newLine = "<br>";
|
||||
String newLineTxt = "\n";
|
||||
String bullet = "• "; // it is the dot. As <li> rendered in the <ul> tag
|
||||
|
||||
String newBullet = newLine + bullet;
|
||||
|
||||
List<String> listJsonFields = itemField.getJsonFields();
|
||||
|
||||
int numberOfFields = listJsonFields.size();
|
||||
|
||||
if (numberOfFields > 1) {
|
||||
valueBuilder.append(bullet);
|
||||
}
|
||||
|
||||
for (String jsonKey : listJsonFields) {
|
||||
|
||||
try {
|
||||
String objectToRender = "";
|
||||
// removing the '_theDocument.' prefix for searching in the Document Map
|
||||
String key = jsonKey.replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
|
||||
Object value = documentDV.getDocumentAsMap().get(key);
|
||||
// GWT.log("key: "+key+" is instance of: "+value.getClass());
|
||||
|
||||
if (value == null)
|
||||
continue;
|
||||
|
||||
GWT.log("value instance: " + value.getClass());
|
||||
|
||||
if (value instanceof ArrayList) {
|
||||
ArrayList<Object> arrayValues = (ArrayList<Object>) value;
|
||||
String toReturn = "<ul>";
|
||||
for (Object arrayValue : arrayValues) {
|
||||
toReturn += "<li>" + arrayValue + "</li>";
|
||||
}
|
||||
toReturn += "</ul>";
|
||||
GWT.log("Array returning: " + key + " is instance of: " + value.getClass() + " to return: "
|
||||
+ toReturn);
|
||||
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
|
||||
} else {
|
||||
objectToRender = StringUtil.ellipsize(value.toString(), MAX_TEXT_DIMENSION);
|
||||
}
|
||||
|
||||
valueBuilder.append(objectToRender);
|
||||
valueBuilder.append(newBullet);
|
||||
|
||||
if (numberOfFields > 1) {
|
||||
tooltipBuilder.append("* " + key + newLineTxt);
|
||||
}else {
|
||||
tooltipBuilder.append(key);
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error e: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
CellRender cellRender = new CellRender();
|
||||
|
||||
String toRender = valueBuilder.toString();
|
||||
cellRender.setValue(toRender.substring(0, toRender.length() - newBullet.length()));
|
||||
|
||||
String toTooltip = tooltipBuilder.toString();
|
||||
toTooltip = numberOfFields > 1 ? toTooltip.substring(0, toTooltip.length() - newLineTxt.length())
|
||||
: toTooltip;
|
||||
cellRender.setTooltip(toTooltip);
|
||||
|
||||
return cellRender;
|
||||
|
||||
}
|
||||
|
||||
interface Templates extends SafeHtmlTemplates {
|
||||
|
||||
/**
|
||||
* Start tool tip.
|
||||
*
|
||||
* @param toolTipText the tool tip text
|
||||
* @return the safe html
|
||||
*/
|
||||
@Template("<span title=\"{0}\">")
|
||||
SafeHtml startToolTip(String toolTipText);
|
||||
|
||||
/**
|
||||
* End tool tip.
|
||||
*
|
||||
* @return the safe html
|
||||
*/
|
||||
@Template("</span>")
|
||||
SafeHtml endToolTip();
|
||||
}
|
||||
|
||||
/**
|
||||
* Inits the table.
|
||||
*
|
||||
|
@ -109,320 +241,254 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
|
||||
setEmptyTableMessage(NO_DATA);
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.NAME)) {
|
||||
int i = 1;
|
||||
|
||||
// NAME
|
||||
name = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null)
|
||||
return "";
|
||||
return ((ConcessioneDV) object).getNome();
|
||||
}
|
||||
for (ItemFieldDV itemField : displayFields) {
|
||||
|
||||
// ADDING TOOLTIP
|
||||
@Override
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||
if (object == null)
|
||||
return;
|
||||
sb.appendHtmlConstant("<div introduction=\"" + ((ConcessioneDV) object).getNome() + "\">");
|
||||
super.render(context, object, sb);
|
||||
sb.appendHtmlConstant("</div>");
|
||||
};
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(name, RECORD_FIELD.NAME.getDisplayName(), true);
|
||||
|
||||
if (!isAsyncronusTable) {
|
||||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
return ((ConcessioneDV) o1).getNome().compareTo(((ConcessioneDV) o2).getNome());
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.setComparator(name, c);
|
||||
if (i > ConstantsGeoPortalDataEntryApp.MAX_COLUMN_DISPLAYED_IN_THE_TABLE) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
String displayName = itemField.getDisplayName();
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.INTRODUCTION)) {
|
||||
TextColumn<T> col = new TextColumn<T>() {
|
||||
|
||||
introduction = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null)
|
||||
return "";
|
||||
return ((ConcessioneDV) object).getIntroduzione() != null
|
||||
? ((ConcessioneDV) object).getIntroduzione()
|
||||
: "";
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(introduction, RECORD_FIELD.INTRODUCTION.getDisplayName(), true);
|
||||
|
||||
if (!isAsyncronusTable) {
|
||||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
return ((ConcessioneDV) o1).getIntroduzione().compareTo(((ConcessioneDV) o2).getIntroduzione());
|
||||
}
|
||||
};
|
||||
sortedCellTable.setComparator(introduction, c);
|
||||
}
|
||||
|
||||
// sortedCellTable.setColumnWidth(introduction, 100, Unit.PCT);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.AUTHOR)) {
|
||||
|
||||
author = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
String toDisplay = toDisplayAuthors(((ConcessioneDV) object).getAuthors());
|
||||
return toDisplay;
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(author, RECORD_FIELD.AUTHOR.getDisplayName(), true);
|
||||
|
||||
if (!isAsyncronusTable) {
|
||||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
String toDisplay1 = toDisplayAuthors(((ConcessioneDV) o1).getAuthors());
|
||||
String toDisplay2 = toDisplayAuthors(((ConcessioneDV) o2).getAuthors());
|
||||
return toDisplay1.compareTo(toDisplay2);
|
||||
}
|
||||
};
|
||||
sortedCellTable.setComparator(author, c);
|
||||
}
|
||||
|
||||
sortedCellTable.setColumnWidth(author, 220, Unit.PX);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.PROJECT_START_END_DATE)) {
|
||||
|
||||
startEndProjectColumn = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
Date dS = (((ConcessioneDV) object).getDataInizioProgetto());
|
||||
Date dE = (((ConcessioneDV) object).getDataFineProgetto());
|
||||
return dtformat.format(dS) + " / " + dtformat.format(dE);
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(startEndProjectColumn, RECORD_FIELD.PROJECT_START_END_DATE.getDisplayName(),
|
||||
false);
|
||||
sortedCellTable.setColumnWidth(startEndProjectColumn, 180, Unit.PX);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.CREATED)) {
|
||||
|
||||
DateCell date = new DateCell(DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT+" "+ConvertToDataViewModel.TIME_FORMAT));
|
||||
createdColumn = new Column<T, Date>(date) {
|
||||
|
||||
@Override
|
||||
public Date getValue(T object) {
|
||||
if (object == null)
|
||||
return null;
|
||||
|
||||
return (((ConcessioneDV) object).getCreationTime());
|
||||
}
|
||||
};
|
||||
sortedCellTable.addColumn(createdColumn, RECORD_FIELD.CREATED.getDisplayName(), true);
|
||||
|
||||
if (!isAsyncronusTable) {
|
||||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
if (o1 == null)
|
||||
return -1;
|
||||
|
||||
if (o2 == null)
|
||||
return 1;
|
||||
|
||||
Date d1 = (((ConcessioneDV) o1).getCreationTime());
|
||||
Date d2 = (((ConcessioneDV) o2).getCreationTime());
|
||||
|
||||
// GWT.log(d1.toString() + "is after "+d2.toString() +" ? "+d2.after(d1));
|
||||
|
||||
if (d1.after(d2))
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
GWT.log("date colum sortable");
|
||||
sortedCellTable.setComparator(createdColumn, c);
|
||||
}
|
||||
|
||||
sortedCellTable.setColumnWidth(createdColumn, 150, Unit.PX);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.CREATED_BY)) {
|
||||
|
||||
// NAME
|
||||
insertedBy = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null)
|
||||
return "";
|
||||
return ((ConcessioneDV) object).getCreationUser();
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(insertedBy, RECORD_FIELD.CREATED_BY.getDisplayName(), true);
|
||||
|
||||
if (!isAsyncronusTable) {
|
||||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
return ((ConcessioneDV) o1).getCreationUser().compareTo(((ConcessioneDV) o2).getCreationUser());
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.setComparator(insertedBy, c);
|
||||
}
|
||||
sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX);
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.RECORD_STATUS)) {
|
||||
|
||||
statusColumn = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
ValidationReportDV vr = ((ConcessioneDV) object).getValidationReport();
|
||||
if (vr != null && vr.getStatus() != null)
|
||||
return vr.getStatus().getLabel();
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Context context, T object, SafeHtmlBuilder sb) {
|
||||
// TODO Auto-generated method stub
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||
if (object == null)
|
||||
return;
|
||||
Templates TEMPLATES = GWT.create(Templates.class);
|
||||
|
||||
String value = getValue(object);
|
||||
String color = "#000";
|
||||
if (value.compareTo(ValidationStatus.PASSED.getLabel()) == 0) {
|
||||
color = "#32CD32";
|
||||
} else if (value.compareTo(ValidationStatus.WARNING.getLabel()) == 0) {
|
||||
color = "#FF8000";
|
||||
} else if (value.compareTo(ValidationStatus.ERROR.getLabel()) == 0) {
|
||||
color = "red";
|
||||
}
|
||||
sb.appendHtmlConstant("<span style=\"color:" + color + "\";>");
|
||||
super.render(context, object, sb);
|
||||
sb.appendHtmlConstant("</span>");
|
||||
CellRender cellRender = toCellRender(itemField, object);
|
||||
sb.append(TEMPLATES.startToolTip(cellRender.getTooltip()));
|
||||
sb.appendHtmlConstant(cellRender.getValue());
|
||||
sb.append(TEMPLATES.endToolTip());
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(statusColumn, RECORD_FIELD.RECORD_STATUS.getDisplayName(), false);
|
||||
sortedCellTable.setColumnWidth(statusColumn, 120, Unit.PX);
|
||||
|
||||
sortedCellTable.addColumn(col, displayName, true);
|
||||
i++;
|
||||
}
|
||||
|
||||
// ButtonCell showOnMapButton = new ButtonCell();
|
||||
// showOnMapButton.setIcon(IconType.MAP_MARKER);
|
||||
//
|
||||
// MyToolTipColumn<T, String> showOnMapColumn = new MyToolTipColumn<T, String>(showOnMapButton, "Show on Map") {
|
||||
//
|
||||
// @Override
|
||||
// public String getValue(T object) {
|
||||
// return "";
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// showOnMapColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
||||
// @Override
|
||||
// public void update(int index, T object, String value) {
|
||||
// GWT.log("clicked show");
|
||||
// eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_ON_MAP));
|
||||
// }
|
||||
// });
|
||||
// sortedCellTable.addColumn(showOnMapColumn);
|
||||
// sortedCellTable.setColumnWidth(showOnMapColumn, 50, Unit.PX);
|
||||
//
|
||||
// ButtonCell showReportRecordButton = new ButtonCell();
|
||||
// showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT);
|
||||
// MyToolTipColumn<T, String> showReportRecordColumn = new MyToolTipColumn<T, String>(showReportRecordButton,
|
||||
// "Show Publication Report") {
|
||||
// public String getValue(T object) {
|
||||
// return "";
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// showReportRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
||||
// @Override
|
||||
// public void update(int index, T object, String value) {
|
||||
//
|
||||
// eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT));
|
||||
// }
|
||||
// });
|
||||
// sortedCellTable.addColumn(showReportRecordColumn);
|
||||
// sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX);
|
||||
//
|
||||
// ButtonCell deleteRecordButton = new ButtonCell();
|
||||
// deleteRecordButton.setIcon(IconType.TRASH);
|
||||
// MyToolTipColumn<T, String> deleteRecordColumn = new MyToolTipColumn<T, String>(deleteRecordButton,
|
||||
// "Delete Project") {
|
||||
// public String getValue(T object) {
|
||||
// return "";
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// deleteRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
||||
// @Override
|
||||
// public void update(int index, T object, String value) {
|
||||
//
|
||||
// eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.DELETE_RECORD));
|
||||
// }
|
||||
// });
|
||||
// sortedCellTable.addColumn(deleteRecordColumn);
|
||||
// sortedCellTable.setColumnWidth(deleteRecordColumn, 50, Unit.PX);
|
||||
// COL RELATIONS
|
||||
TextColumn<T> colRelationship = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
|
||||
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
if (currentSortFilter != null)
|
||||
switch (currentSortFilter.getOrderByField()) {
|
||||
case NAME:
|
||||
if (this.displayFields.contains(RECORD_FIELD.NAME)) {
|
||||
sortedCellTable.setInitialSortColumn(name);
|
||||
}
|
||||
break;
|
||||
case INTRODUCTION:
|
||||
if (this.displayFields.contains(RECORD_FIELD.INTRODUCTION)) {
|
||||
sortedCellTable.setInitialSortColumn(introduction);
|
||||
}
|
||||
break;
|
||||
case AUTHOR:
|
||||
if (this.displayFields.contains(RECORD_FIELD.AUTHOR)) {
|
||||
sortedCellTable.setInitialSortColumn(author);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||
String htmlValue = toDisplayClusterOfRelationships(documentDV.getListRelationshipDV());
|
||||
return htmlValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||
if (object == null)
|
||||
return;
|
||||
|
||||
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||
List<RelationshipDV> relations = documentDV.getListRelationshipDV();
|
||||
String color = "#333";
|
||||
if (relations == null || relations.isEmpty()) {
|
||||
color = "#555";
|
||||
}
|
||||
|
||||
sb.appendHtmlConstant("<span style='color:" + color + "; font-style: italic;'>");
|
||||
super.render(context, object, sb);
|
||||
sb.appendHtmlConstant("</span>");
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
colRelationship.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_B);
|
||||
sortedCellTable.addColumn(colRelationship, DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS.getTitle(), true);
|
||||
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS, colRelationship);
|
||||
|
||||
// COL CREATED
|
||||
TextColumn<T> colCreated = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||
|
||||
PublicationInfoDV publicationInfoDV = documentDV.getPublicationInfoDV();
|
||||
String created = "N.A.";
|
||||
try {
|
||||
created = publicationInfoDV.getCreationInfo().getLocalDate();
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return created;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
colCreated.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O);
|
||||
sortedCellTable.addColumn(colCreated, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED.getTitle(), true);
|
||||
sortedCellTable.setColumnWidth(colCreated, 130, Unit.PX);
|
||||
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED, colCreated);
|
||||
|
||||
// COL PUBLISHER
|
||||
TextColumn<T> colPublisher = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||
|
||||
PublicationInfoDV publicationInfoDV = documentDV.getPublicationInfoDV();
|
||||
String username = "N.A.";
|
||||
try {
|
||||
username = publicationInfoDV.getCreationInfo().getUsername();
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
return username;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
colPublisher.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O);
|
||||
sortedCellTable.addColumn(colPublisher, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY.getTitle(), true);
|
||||
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY, colPublisher);
|
||||
|
||||
// COL PUBLICATION PHASE
|
||||
TextColumn<T> colPublicationPhase = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||
String phase = "N.A.";
|
||||
try {
|
||||
phase = documentDV.getLifecycleInfo().getPhase();
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
return phase;
|
||||
}
|
||||
};
|
||||
|
||||
colPublicationPhase.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y);
|
||||
sortedCellTable.addColumn(colPublicationPhase, DEFAULT_DISPLAYING_COLUMN_NAME.PHASE.getTitle(), true);
|
||||
sortedCellTable.setColumnWidth(colPublicationPhase, 120, Unit.PX);
|
||||
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.PHASE, colPublicationPhase);
|
||||
|
||||
// COL OPERTION STATUS
|
||||
TextColumn<T> colOperationStatus = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
|
||||
if (object == null)
|
||||
return "";
|
||||
|
||||
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||
String status = "N.A.";
|
||||
try {
|
||||
status = documentDV.getLifecycleInfo().getLastOperationStatus().toString();
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
|
||||
if (object == null)
|
||||
return;
|
||||
|
||||
ResultDocumentDV documentDV = (ResultDocumentDV) object;
|
||||
Status status = null;
|
||||
try {
|
||||
status = documentDV.getLifecycleInfo().getLastOperationStatus();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
String color = "#000";
|
||||
if (status.equals(Status.OK)) {
|
||||
color = "#32CD32";
|
||||
} else if (status.equals(Status.WARNING)) {
|
||||
color = "#FF8000";
|
||||
} else if (status.equals(Status.ERROR)) {
|
||||
color = "red";
|
||||
}
|
||||
sb.appendHtmlConstant("<span style='color:" + color + ";'>");
|
||||
super.render(context, object, sb);
|
||||
sb.appendHtmlConstant("</span>");
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
colOperationStatus.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y);
|
||||
sortedCellTable.addColumn(colOperationStatus, DEFAULT_DISPLAYING_COLUMN_NAME.STATUS.getTitle(), true);
|
||||
sortedCellTable.setColumnWidth(colOperationStatus, 120, Unit.PX);
|
||||
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.STATUS, colOperationStatus);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void enableWriteOperations() {
|
||||
|
||||
|
||||
public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) {
|
||||
try {
|
||||
|
||||
Column theColumn = mapColumns.get(columnName);
|
||||
if (theColumn != null) {
|
||||
sortedCellTable.removeColumn(theColumn);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private String toDisplayClusterOfRelationships(List<RelationshipDV> listRelations) {
|
||||
|
||||
if (listRelations == null || listRelations.isEmpty()) {
|
||||
return "None";
|
||||
}
|
||||
|
||||
LinkedHashMap<String, Integer> mapclusterOfRelationships = new LinkedHashMap<String, Integer>(
|
||||
listRelations.size());
|
||||
|
||||
for (RelationshipDV relationshipDV : listRelations) {
|
||||
|
||||
Integer count = mapclusterOfRelationships.get(relationshipDV.getRelationshipName());
|
||||
if (count == null)
|
||||
count = 0;
|
||||
|
||||
count++;
|
||||
|
||||
mapclusterOfRelationships.put(relationshipDV.getRelationshipName(), count);
|
||||
}
|
||||
|
||||
String html = "";
|
||||
|
||||
for (String relationName : mapclusterOfRelationships.keySet()) {
|
||||
|
||||
html += mapclusterOfRelationships.get(relationName) + " - " + relationName + "; ";
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -465,15 +531,15 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the display fields.
|
||||
*
|
||||
* @param fields the new display fields
|
||||
*/
|
||||
public void setDisplayFields(RECORD_FIELD[] fields) {
|
||||
this.displayFields = fields != null && fields.length > 0 ? Arrays.asList(fields)
|
||||
: Arrays.asList(RECORD_FIELD.values());
|
||||
}
|
||||
// /**
|
||||
// * Sets the display fields.
|
||||
// *
|
||||
// * @param fields the new display fields
|
||||
// */
|
||||
// public void setDisplayFields(List<ItemField> fields) {
|
||||
// this.displayFields = fields != null && fields.size() > 0 ? Arrays.asList(fields)
|
||||
// : Arrays.asList(RECORD_FIELD.values());
|
||||
// }
|
||||
|
||||
/**
|
||||
* Reset columns table.
|
||||
|
@ -491,7 +557,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
*
|
||||
* @return the displayFields
|
||||
*/
|
||||
public List<RECORD_FIELD> getDisplayFields() {
|
||||
public List<ItemFieldDV> getDisplayFields() {
|
||||
return displayFields;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,278 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.tree;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.TreeItem;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class NodeItem extends Composite {
|
||||
|
||||
private static NodeItemUiBinder uiBinder = GWT.create(NodeItemUiBinder.class);
|
||||
|
||||
interface NodeItemUiBinder extends UiBinder<Widget, NodeItem> {
|
||||
}
|
||||
|
||||
@UiField
|
||||
Icon iconField;
|
||||
|
||||
@UiField
|
||||
HTML htmlNode;
|
||||
|
||||
@UiField
|
||||
Button buttonAdd;
|
||||
|
||||
@UiField
|
||||
Button buttonRemove;
|
||||
|
||||
private GeoNaFormCardModel geoNaFormCardModel;
|
||||
|
||||
private TreeItem parentTreeItem;
|
||||
|
||||
private String jsonSectionFullPath;
|
||||
|
||||
private boolean canBeDuplicated;
|
||||
|
||||
private boolean canBeDeleted;
|
||||
|
||||
private boolean isRoot = false;
|
||||
|
||||
private MetadataFormCardEventHandler formCardEventHandler = new MetadataFormCardEventHandler();
|
||||
|
||||
private String nodeHTMLLabel;
|
||||
|
||||
public NodeItem(TreeItem parent, String nodeHTMLLabel, GeoNaFormCardModel geoNaFormCardModel,
|
||||
boolean canBeDuplicated, boolean canBeDeleted, String jsonSectionFullPath) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.geoNaFormCardModel = geoNaFormCardModel;
|
||||
this.parentTreeItem = parent;
|
||||
this.jsonSectionFullPath = jsonSectionFullPath;
|
||||
this.canBeDuplicated = canBeDuplicated;
|
||||
this.canBeDeleted = canBeDeleted;
|
||||
this.nodeHTMLLabel = nodeHTMLLabel;
|
||||
htmlNode.setHTML(this.nodeHTMLLabel);
|
||||
buttonAdd.setVisible(false);
|
||||
buttonRemove.setVisible(false);
|
||||
|
||||
if (canBeDuplicated) {
|
||||
buttonAdd.setIcon(IconType.COPY);
|
||||
// buttonAdd.getElement().getStyle().setProperty("pointerEvents", "none");
|
||||
buttonAdd.getElement().getStyle().setProperty("textDecoration", "none");
|
||||
buttonAdd.getElement().getStyle().setColor("#555");
|
||||
buttonAdd.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
if (canBeDeleted) {
|
||||
buttonRemove.setIcon(IconType.TRASH);
|
||||
// buttonRemove.getElement().getStyle().setProperty("pointerEvents", "none");
|
||||
buttonRemove.getElement().getStyle().setProperty("textDecoration", "none");
|
||||
buttonRemove.getElement().getStyle().setColor("#555");
|
||||
buttonRemove.setVisible(true);
|
||||
}
|
||||
|
||||
htmlNode.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Is not the root node
|
||||
if (geoNaFormCardModel != null) {
|
||||
geoNaFormCardModel.getMetadataForm().addListener(formCardEventHandler);
|
||||
resetNodeStatus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class MetadataFormCardEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 12, 2020
|
||||
*/
|
||||
private class MetadataFormCardEventHandler implements GenericFormEventsListener {
|
||||
|
||||
/**
|
||||
* On form data valid.
|
||||
*
|
||||
* @param genericDatasetBean the generic dataset bean
|
||||
*/
|
||||
@Override
|
||||
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
|
||||
setNodeStatus();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On form data edit.
|
||||
*/
|
||||
@Override
|
||||
public void onFormDataEdit() {
|
||||
resetNodeStatus();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On form aborted.
|
||||
*/
|
||||
@Override
|
||||
public void onFormAborted() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* On validation error.
|
||||
*
|
||||
* @param throwable the throwable
|
||||
* @param errorMsg the error msg
|
||||
*/
|
||||
@Override
|
||||
public void onValidationError(Throwable throwable, String errorMsg) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate form.
|
||||
*
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean validateForm() {
|
||||
|
||||
if (isRoot) {
|
||||
return true;
|
||||
}
|
||||
|
||||
CreateMetadataForm createMetadataForm = geoNaFormCardModel.getMetadataForm();
|
||||
boolean isFormDataValid = createMetadataForm.isFormDataValid();
|
||||
GWT.log("Is form data valid: " + isFormDataValid);
|
||||
if (!isFormDataValid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the valid card.
|
||||
*
|
||||
* @param bool the new valid card
|
||||
*/
|
||||
public void setValidCard(boolean bool) {
|
||||
if (bool) {
|
||||
iconField.setIcon(IconType.OK_SIGN);
|
||||
iconField.getElement().removeClassName("red-text");
|
||||
iconField.getElement().addClassName("green-text");
|
||||
htmlNode.getElement().removeClassName("red-text");
|
||||
htmlNode.getElement().addClassName("green-text");
|
||||
} else {
|
||||
iconField.setIcon(IconType.MINUS_SIGN);
|
||||
iconField.getElement().removeClassName("green-text");
|
||||
iconField.getElement().addClassName("red-text");
|
||||
htmlNode.getElement().removeClassName("green-text");
|
||||
htmlNode.getElement().addClassName("red-text");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the tab status.
|
||||
*/
|
||||
private void setNodeStatus() {
|
||||
boolean isValid = validateForm();
|
||||
if (isValid) {
|
||||
iconField.setIcon(IconType.OK_SIGN);
|
||||
iconField.getElement().removeClassName("red-text");
|
||||
iconField.getElement().addClassName("green-text");
|
||||
htmlNode.getElement().removeClassName("red-text");
|
||||
htmlNode.getElement().addClassName("green-text");
|
||||
} else {
|
||||
iconField.setIcon(IconType.MINUS_SIGN);
|
||||
iconField.getElement().removeClassName("green-text");
|
||||
iconField.getElement().addClassName("red-text");
|
||||
htmlNode.getElement().removeClassName("green-text");
|
||||
htmlNode.getElement().addClassName("red-text");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isRoot() {
|
||||
return isRoot;
|
||||
}
|
||||
|
||||
public void setRoot(boolean isRoot) {
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
private void resetNodeStatus() {
|
||||
iconField.setIcon(null);
|
||||
}
|
||||
|
||||
public TreeItem getParentTreeItem() {
|
||||
return parentTreeItem;
|
||||
}
|
||||
|
||||
public GeoNaFormCardModel getGeoNaFormCardModel() {
|
||||
return geoNaFormCardModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the json section full path.
|
||||
*
|
||||
* @return the json section full path
|
||||
*/
|
||||
public String getJsonSectionFullPath() {
|
||||
return jsonSectionFullPath;
|
||||
}
|
||||
|
||||
public boolean isCanBeDeleted() {
|
||||
return canBeDeleted;
|
||||
}
|
||||
|
||||
public boolean isCanBeDuplicated() {
|
||||
return canBeDuplicated;
|
||||
}
|
||||
|
||||
public HTML getHtmlNode() {
|
||||
return htmlNode;
|
||||
}
|
||||
|
||||
public String getNodeHTMLLabel() {
|
||||
return nodeHTMLLabel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("NodeItem [jsonSectionFullPath=");
|
||||
builder.append(jsonSectionFullPath);
|
||||
builder.append(", canBeDuplicated=");
|
||||
builder.append(canBeDuplicated);
|
||||
builder.append(", canBeDeleted=");
|
||||
builder.append(canBeDeleted);
|
||||
builder.append(", isRoot=");
|
||||
builder.append(isRoot);
|
||||
builder.append(", nodeHTMLLabel=");
|
||||
builder.append(nodeHTMLLabel);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<!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>
|
||||
.margin-left-20 {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.margin-left-10 {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.padding-right-5 {
|
||||
padding-right: 5px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HorizontalPanel>
|
||||
<g:HTMLPanel addStyleNames="{style.padding-right-5}">
|
||||
<b:Icon type="OK_SIGN" ui:field="iconField"></b:Icon>
|
||||
</g:HTMLPanel>
|
||||
<g:HTML ui:field="htmlNode">Node</g:HTML>
|
||||
<b:Button title="This section can be duplicated"
|
||||
styleName="{style.margin-left-10}" ui:field="buttonAdd"></b:Button>
|
||||
<b:Button title="This section can be removed"
|
||||
styleName="{style.margin-left-10}" ui:field="buttonRemove"></b:Button>
|
||||
</g:HorizontalPanel>
|
||||
</ui:UiBinder>
|
|
@ -0,0 +1,304 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.tree;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.TreeItemEvent.ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.ui.Tree;
|
||||
import com.google.gwt.user.client.ui.TreeItem;
|
||||
|
||||
/**
|
||||
* The Class TreeItemPanel.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jul 8, 2022
|
||||
*/
|
||||
public class TreeItemPanel {
|
||||
|
||||
private static final String JSON_ROOT_PATH = "$.";
|
||||
private Tree tree = new Tree();
|
||||
private final TreeItem root;
|
||||
private HandlerManager appManagerBus;
|
||||
private HashMap<String, List<TreeItem>> treeItemParents = new HashMap<String, List<TreeItem>>();
|
||||
private String itemTypeTitle;
|
||||
private String profileID;
|
||||
|
||||
/**
|
||||
* Instantiates a new tree item panel.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param itemTypeTitle the item type title
|
||||
* @param gnaCardsModels the gna cards models
|
||||
* @param appManagerBus the app manager bus
|
||||
*/
|
||||
// Create a tree
|
||||
public TreeItemPanel(String profileID, String itemTypeTitle, Collection<GeoNaFormCardModel> gnaCardsModels,
|
||||
HandlerManager appManagerBus) {
|
||||
this.appManagerBus = appManagerBus;
|
||||
this.itemTypeTitle = itemTypeTitle;
|
||||
this.profileID = profileID;
|
||||
tree.setAnimationEnabled(true);
|
||||
|
||||
NodeItem rootNode = new NodeItem(null, itemTypeTitle, null, false, false, null);
|
||||
rootNode.setRoot(true);
|
||||
root = new TreeItem(rootNode);
|
||||
|
||||
treeItemParents.put(JSON_ROOT_PATH, Arrays.asList(root));
|
||||
|
||||
for (GeoNaFormCardModel geoNaFormCardModel : gnaCardsModels) {
|
||||
|
||||
GcubeProfileDV profile = geoNaFormCardModel.getGcubeProfile();
|
||||
String parentName = profile.getParentName();
|
||||
String jsonSectionFullPath = getJSONFullPathFromProfile(profile);
|
||||
|
||||
if (parentName == null || parentName.isEmpty()) {
|
||||
parentName = JSON_ROOT_PATH;
|
||||
}
|
||||
|
||||
GWT.log("tree getting jsonSectionFullPath: " + jsonSectionFullPath + " in " + treeItemParents.keySet());
|
||||
List<TreeItem> listParent = treeItemParents.get(parentName);
|
||||
GWT.log("tree jsonSection: " + jsonSectionFullPath + " parent " + parentName + " name: "
|
||||
+ profile.getSectionName() + " title: " + profile.getSectionTitle());
|
||||
|
||||
boolean canBeDuplicated = geoNaFormCardModel.getFormCard().isInternalRepeatibleForm();
|
||||
TreeItem child = createAndAddChild(listParent.get(0), profile.getSectionTitle(), geoNaFormCardModel, canBeDuplicated, false,
|
||||
jsonSectionFullPath);
|
||||
|
||||
}
|
||||
|
||||
tree.addItem(root);
|
||||
|
||||
tree.addSelectionHandler(new SelectionHandler<TreeItem>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<TreeItem> event) {
|
||||
TreeItem treeItem = event.getSelectedItem();
|
||||
|
||||
NodeItem nodeItem = (NodeItem) treeItem.getWidget();
|
||||
|
||||
GWT.log("TreeItem selected: " + nodeItem);
|
||||
appManagerBus.fireEvent(new TreeItemEvent(treeItem, ACTION.SELECTED));
|
||||
}
|
||||
});
|
||||
|
||||
// expand the element
|
||||
root.setState(true);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the JSON full path from profile.
|
||||
*
|
||||
* @param profile the profile
|
||||
* @return the JSON full path from profile
|
||||
*/
|
||||
private String getJSONFullPathFromProfile(GcubeProfileDV profile) {
|
||||
|
||||
String parentName = profile.getParentName();
|
||||
GWT.log("finding parentName: " + parentName + " in " + treeItemParents.keySet());
|
||||
|
||||
String jsonSectionFullPath = null;
|
||||
|
||||
if (parentName == null || parentName.isEmpty()) {
|
||||
GWT.log("tree parentName is null: " + parentName + " in " + treeItemParents.keySet());
|
||||
parentName = JSON_ROOT_PATH;
|
||||
jsonSectionFullPath = profile.getSectionName();
|
||||
} else {
|
||||
jsonSectionFullPath = parentName.endsWith(".") ? parentName + profile.getSectionName()
|
||||
: parentName + "." + profile.getSectionName();
|
||||
}
|
||||
|
||||
return jsonSectionFullPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the and add child.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param nodeHTML the node HTML
|
||||
* @param geoNaFormCardModel the geo na form card model
|
||||
* @param canBeDuplicated the can be duplicated
|
||||
* @param canBeDeleted the can be deleted
|
||||
* @param jsonSectionFullPath the json section full path
|
||||
* @return the tree item
|
||||
*/
|
||||
public TreeItem createAndAddChild(TreeItem parent, String nodeHTML, GeoNaFormCardModel geoNaFormCardModel, boolean canBeDuplicated,
|
||||
boolean canBeDeleted, String jsonSectionFullPath) {
|
||||
GWT.log("Creating and adding child to parent: " + parent.getText() +", card is"+geoNaFormCardModel);
|
||||
TreeItem newChild = new TreeItem(new NodeItem(parent, nodeHTML, geoNaFormCardModel, canBeDuplicated, canBeDeleted, jsonSectionFullPath));
|
||||
parent.addItem(newChild);
|
||||
|
||||
fillItemParents(jsonSectionFullPath, newChild);
|
||||
return newChild;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the child.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param nextSiblingIndex the index where the item will be inserted
|
||||
* @param item the item
|
||||
* @return the tree item
|
||||
*/
|
||||
public TreeItem addChild(TreeItem parent, int nextSiblingIndex, TreeItem item) {
|
||||
GWT.log("Adding child "+item.getText()+" to parent: " + parent.getText());
|
||||
|
||||
if(nextSiblingIndex>=0) {
|
||||
parent.insertItem(nextSiblingIndex, item);
|
||||
}
|
||||
else {
|
||||
parent.addItem(item);
|
||||
}
|
||||
|
||||
NodeItem nodeItem = (NodeItem) item.getWidget();
|
||||
String jsonSectionFullPath = nodeItem.getJsonSectionFullPath();
|
||||
|
||||
fillItemParents(jsonSectionFullPath, item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill item parents.
|
||||
*
|
||||
* @param jsonSectionFullPath the json section full path
|
||||
* @param newChild the new child
|
||||
*/
|
||||
private void fillItemParents(String jsonSectionFullPath, TreeItem newChild) {
|
||||
// if the path section is not the root
|
||||
if (jsonSectionFullPath.compareTo(JSON_ROOT_PATH) != 0) {
|
||||
|
||||
List<TreeItem> listNodeParents = treeItemParents.get(jsonSectionFullPath);
|
||||
|
||||
if (listNodeParents == null) {
|
||||
listNodeParents = new ArrayList<TreeItem>();
|
||||
}
|
||||
|
||||
listNodeParents.add(newChild);
|
||||
|
||||
treeItemParents.put(jsonSectionFullPath, listNodeParents);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the child.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param item the item
|
||||
* @param jsonSectionFullPath the json section full path
|
||||
*/
|
||||
public void removeChild(TreeItem parent, TreeItem item, String jsonSectionFullPath) {
|
||||
GWT.log("Removing child to parent: " + parent.getText());
|
||||
List<TreeItem> nodes = treeItemParents.get(jsonSectionFullPath);
|
||||
|
||||
if (nodes != null) {
|
||||
nodes.remove(item);
|
||||
treeItemParents.put(jsonSectionFullPath, nodes);
|
||||
}
|
||||
|
||||
parent.removeItem(item);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Count node for full path.
|
||||
*
|
||||
* @param jsonSectionFullPath the json section full path
|
||||
* @return the int
|
||||
*/
|
||||
public int countNodeForFullPath(String jsonSectionFullPath) {
|
||||
List<TreeItem> nodes = treeItemParents.get(jsonSectionFullPath);
|
||||
|
||||
if (nodes != null)
|
||||
return nodes.size();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tree.
|
||||
*
|
||||
* @return the tree
|
||||
*/
|
||||
public Tree getTree() {
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the root.
|
||||
*
|
||||
* @return the root
|
||||
*/
|
||||
public TreeItem getRoot() {
|
||||
return root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the select item.
|
||||
*
|
||||
* @return the select item
|
||||
*/
|
||||
public TreeItem getSelectItem() {
|
||||
return tree.getSelectedItem();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the node index.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param item the item
|
||||
* @return the node index
|
||||
*/
|
||||
public int getNodeIndex(TreeItem parent, TreeItem item) {
|
||||
return parent.getChildIndex(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item type title.
|
||||
*
|
||||
* @return the item type title
|
||||
*/
|
||||
public String getItemTypeTitle() {
|
||||
return itemTypeTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile ID.
|
||||
*
|
||||
* @return the profile ID
|
||||
*/
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the tree item parents.
|
||||
*
|
||||
* @return the tree item parents
|
||||
*/
|
||||
public HashMap<String, List<TreeItem>> getTreeItemParents() {
|
||||
return treeItemParents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select item.
|
||||
*
|
||||
* @param item the item
|
||||
*/
|
||||
public void selectItem(TreeItem item){
|
||||
item.setSelected(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
|
||||
/**
|
||||
* The Class AlertClosable.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 4, 2022
|
||||
*/
|
||||
public class AlertClosable extends Alert {
|
||||
|
||||
private AlertClosable instance = this;
|
||||
|
||||
/**
|
||||
* Instantiates a new alert closable.
|
||||
*/
|
||||
public AlertClosable() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Close after.
|
||||
*
|
||||
* @param depayMillis the depay millis
|
||||
*/
|
||||
public void closeAfter(int depayMillis) {
|
||||
Timer timer = new Timer() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
instance.close();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
timer.schedule(depayMillis);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,8 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
|
||||
|
||||
/**
|
||||
* The Class HTMLUtil.
|
||||
*
|
||||
|
@ -78,4 +81,90 @@ public class HTMLUtil {
|
|||
return "</" + tag.name() + ">";
|
||||
}
|
||||
|
||||
/**
|
||||
* Json to HTML.
|
||||
*
|
||||
* @param jsonTxt the json txt
|
||||
* @param cssClassToTable the css class to table
|
||||
* @return the element
|
||||
*/
|
||||
public static native String jsonToHTML(String jsonTxt, String cssClassToTable)/*-{
|
||||
try {
|
||||
|
||||
var jsonObj = JSON.parse(jsonTxt);
|
||||
//console.log(jsonObj.length)
|
||||
|
||||
if (jsonObj.length == undefined)
|
||||
jsonObj = [ jsonObj ]
|
||||
//console.log(jsonObj.length)
|
||||
|
||||
// EXTRACT VALUE FOR HTML HEADER.
|
||||
var col = [];
|
||||
for (var i = 0; i < jsonObj.length; i++) {
|
||||
for ( var key in jsonObj[i]) {
|
||||
//console.log('key json' +key)
|
||||
if (col.indexOf(key) === -1) {
|
||||
col.push(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// CREATE DYNAMIC TABLE.
|
||||
var table = document.createElement("table");
|
||||
var addDefaultCss = "json-to-html-table-column";
|
||||
if (cssClassToTable) {
|
||||
addDefaultCss = cssClassToTable;
|
||||
}
|
||||
try {
|
||||
table.classList.add(addDefaultCss);
|
||||
} catch (e) {
|
||||
console.log('invalid css add', e);
|
||||
}
|
||||
|
||||
// ADD JSON DATA TO THE TABLE AS ROWS.
|
||||
for (var i = 0; i < col.length; i++) {
|
||||
|
||||
tr = table.insertRow(-1);
|
||||
var firstCell = tr.insertCell(-1);
|
||||
//firstCell.style.cssText="font-weight: bold; text-align: center; vertical-align: middle;";
|
||||
firstCell.innerHTML = col[i];
|
||||
for (var j = 0; j < jsonObj.length; j++) {
|
||||
var tabCell = tr.insertCell(-1);
|
||||
var theValue = jsonObj[j][col[i]];
|
||||
tabCell.innerHTML = theValue;
|
||||
}
|
||||
}
|
||||
|
||||
return table.outerHTML;
|
||||
|
||||
} catch (e) {
|
||||
console.log('invalid json', e);
|
||||
}
|
||||
|
||||
}-*/;
|
||||
|
||||
public static String toHTMLCode(TemporalReferenceDV tempRef) {
|
||||
|
||||
String htmlCode = "<span class='display-date'>";
|
||||
|
||||
if (tempRef != null) {
|
||||
|
||||
String dateToString = "";
|
||||
if (tempRef.getStart() != null) {
|
||||
dateToString += ConstantsGeoPortalDataEntryApp.DATE_TIME_FORMAT.format(tempRef.getStart());
|
||||
|
||||
}
|
||||
dateToString += " / ";
|
||||
if (tempRef.getStart() != null) {
|
||||
dateToString += ConstantsGeoPortalDataEntryApp.DATE_TIME_FORMAT.format(tempRef.getEnd());
|
||||
|
||||
}
|
||||
|
||||
htmlCode += dateToString;
|
||||
}
|
||||
htmlCode += "</span>";
|
||||
|
||||
return htmlCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,26 +5,29 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
|||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Modal;
|
||||
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.resources.client.ImageResource;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* The Class DialogConfirm.
|
||||
* The Class ModalConfirm.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 19, 2015
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 1, 2022
|
||||
*/
|
||||
public class DialogConfirm extends DialogBox implements ClickHandler {
|
||||
public class ModalConfirm extends Modal implements ClickHandler {
|
||||
|
||||
private DockPanel dock = new DockPanel();
|
||||
private Button yesButton;
|
||||
|
@ -40,11 +43,13 @@ public class DialogConfirm extends DialogBox implements ClickHandler {
|
|||
* @param caption the caption
|
||||
* @param text the text
|
||||
*/
|
||||
public DialogConfirm(Image img, String caption, String text) {
|
||||
public ModalConfirm(Image img, String caption, String text) {
|
||||
setWidth(800);
|
||||
setAnimation(true);
|
||||
// getElement().setClassName("gwt-DialogBoxNew");
|
||||
dock.setSpacing(4);
|
||||
dock.setWidth("100%");
|
||||
setText(caption);
|
||||
setTitle(caption);
|
||||
// setHeading(caption);
|
||||
|
||||
yesButton = new Button("Yes");
|
||||
|
@ -75,10 +80,17 @@ public class DialogConfirm extends DialogBox implements ClickHandler {
|
|||
if (img != null)
|
||||
dock.add(img, DockPanel.WEST);
|
||||
|
||||
dock.add(vpContainer, DockPanel.CENTER);
|
||||
setWidget(dock);
|
||||
ScrollPanel scrollPanel = new ScrollPanel(vpContainer);
|
||||
scrollPanel.getElement().getStyle().setProperty("maxHeight", "500px");
|
||||
dock.add(new ScrollPanel(vpContainer), DockPanel.CENTER);
|
||||
add(dock);
|
||||
}
|
||||
|
||||
/**
|
||||
* On click.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
|
@ -0,0 +1,34 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||
|
||||
/**
|
||||
* The Class StringUtil.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Oct 12, 2021
|
||||
*/
|
||||
public class StringUtil {
|
||||
|
||||
/**
|
||||
* Ellipsize.
|
||||
*
|
||||
* @param input the input string that may be subjected to shortening
|
||||
* @param maxCharacters the maximum characters that must be returned for the
|
||||
* input string
|
||||
* @return the string
|
||||
*/
|
||||
public static String ellipsize(String input, int maxCharacters) {
|
||||
|
||||
if (input == null)
|
||||
return "";
|
||||
|
||||
if (input.length() < maxCharacters)
|
||||
return input;
|
||||
|
||||
return input.substring(0, maxCharacters) + "...";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.ui.TreeItem;
|
||||
|
||||
public class TreeVisitUtil {
|
||||
|
||||
public static <T> void preOrderVisit(Tree_Node<T> node) {
|
||||
GWT.log("preOrderVisit called");
|
||||
|
||||
if (node == null)
|
||||
return;
|
||||
|
||||
Tree_Node<T> parent = node.getParent();
|
||||
String parentName = null;
|
||||
if (parent != null) {
|
||||
parentName = parent.getName();
|
||||
}
|
||||
|
||||
GWT.log("preOrderVisit Node name: " + node + ", parent: " + parentName);
|
||||
|
||||
for (Tree_Node<T> child : node.getChildren()) {
|
||||
preOrderVisit(child);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Function to print the postorder traversal
|
||||
// of the n-ary tree
|
||||
public static void postOrderVisit(TreeItem root) {
|
||||
// GWT.log("postOrderVisit called");
|
||||
|
||||
if (root == null) {
|
||||
// GWT.log("postOrderVisit returns, node is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// GWT.log("postOrderVisit called on: " + root.getText());
|
||||
|
||||
// Total children count
|
||||
int total = root.getChildCount();
|
||||
for (int i = 0; i < total; i++) {
|
||||
postOrderVisit(root.getChild(i));
|
||||
}
|
||||
|
||||
String parentText = root.getParentItem() != null ? root.getParentItem().getText() : null;
|
||||
GWT.log("PostOrderVisit: " + root.getText() + " with parent: " + parentText);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
|
||||
public class UCD_Util {
|
||||
|
||||
public static HandlerDeclarationDV getHandlerDeclarationFor(List<UseCaseDescriptorDV> listUCDescriptors,
|
||||
String profileID, GEOPORTAL_DATA_HANDLER dataHandler) {
|
||||
|
||||
for (UseCaseDescriptorDV useCaseDescriptor : listUCDescriptors) {
|
||||
|
||||
if (useCaseDescriptor.getProfileID().compareTo(profileID) == 0) {
|
||||
|
||||
for (HandlerDeclarationDV handler : useCaseDescriptor.getHandlers()) {
|
||||
GEOPORTAL_DATA_HANDLER dataHandlerType = handler.getDataHandlerType();
|
||||
|
||||
if (dataHandlerType != null && dataHandlerType.equals(dataHandler)) {
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static HandlerDeclarationDV getHandlerDeclarationFor(UseCaseDescriptorDV useCaseDescriptor,
|
||||
GEOPORTAL_DATA_HANDLER dataHandler) {
|
||||
|
||||
if (useCaseDescriptor == null)
|
||||
return null;
|
||||
|
||||
for (HandlerDeclarationDV handler : useCaseDescriptor.getHandlers()) {
|
||||
GEOPORTAL_DATA_HANDLER dataHandlerType = handler.getDataHandlerType();
|
||||
|
||||
if (dataHandlerType != null && dataHandlerType.equals(dataHandler)) {
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -211,9 +211,11 @@ public class ConvertToServiceModel {
|
|||
}
|
||||
|
||||
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
|
||||
LOG.debug("Relazione di Scavo: Politica di accesso lst: "+politicaDiAccessoLst);
|
||||
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
|
||||
try {
|
||||
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
|
||||
LOG.debug("Relazione di Scavo: AccessPolicy: "+ap);
|
||||
relazioneScavo.setPolicy(ap);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e);
|
||||
|
@ -222,7 +224,9 @@ public class ConvertToServiceModel {
|
|||
|
||||
List<String> licenzaIdList = mapFields.get("ID Licenza");
|
||||
if (licenzaIdList != null && licenzaIdList.size() > 0) {
|
||||
LOG.debug("Relazione di Scavo: ID Licenza lst: "+licenzaIdList);
|
||||
relazioneScavo.setLicenseID(licenzaIdList.get(0));
|
||||
LOG.debug("Relazione di Scavo: ID Licenza: "+relazioneScavo.getLicenseID());
|
||||
}
|
||||
|
||||
// TODO
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.server;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
||||
|
||||
public class FileSetDataObject {
|
||||
|
||||
private FilePathDV filePathDV;
|
||||
private List<File> files = new ArrayList<File>();
|
||||
|
||||
public FileSetDataObject() {
|
||||
}
|
||||
|
||||
public void setFilePathDV(FilePathDV filePath) {
|
||||
this.filePathDV = filePath;
|
||||
|
||||
}
|
||||
|
||||
public void addFile(File file) {
|
||||
files.add(file);
|
||||
}
|
||||
|
||||
public File[] getFileset() {
|
||||
File[] arr = new File[files.size()];
|
||||
arr = files.toArray(arr);
|
||||
return arr;
|
||||
}
|
||||
|
||||
public FilePathDV getFilePathDV() {
|
||||
return filePathDV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("FileSetDataObject [filePathDV.getFieldName()=");
|
||||
builder.append(filePathDV.getFieldName());
|
||||
builder.append(", files size=");
|
||||
builder.append(files.size());
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,298 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.server;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
|
||||
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.jayway.jsonpath.Configuration;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||
|
||||
/**
|
||||
* The Class FormDataObjectToJSON.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 10, 2022
|
||||
*/
|
||||
public class FormDataObjectToJSON {
|
||||
|
||||
public static final String JSON_$_POINTER = "$";
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FormDataObjectToJSON.class);
|
||||
|
||||
/**
|
||||
* Convert.
|
||||
*
|
||||
* @param tree_Node the tree node
|
||||
* @param theRootDocument the the root document
|
||||
* @return the JSON object
|
||||
* @throws JSONException the JSON exception
|
||||
*/
|
||||
public JSONObject convert(Tree_Node<GeoNaFormDataObject> tree_Node, JSONObject theRootDocument)
|
||||
throws JSONException {
|
||||
|
||||
if (tree_Node == null)
|
||||
return theRootDocument;
|
||||
|
||||
// the root, instancing new json document
|
||||
if (tree_Node.isRoot()) {
|
||||
theRootDocument = JSONObjectOrdered.instance();
|
||||
}
|
||||
|
||||
Configuration configuration = Configuration.builder().jsonProvider(new JsonOrgJsonProvider()).build();
|
||||
|
||||
for (Tree_Node<GeoNaFormDataObject> treeNodeChild : tree_Node.getChildren()) {
|
||||
|
||||
GeoNaFormDataObject gnaFO = treeNodeChild.getData();
|
||||
|
||||
// Reading data and profile
|
||||
List<GenericDatasetBean> listGDB = gnaFO.getListGDB();
|
||||
GcubeProfileDV profile = gnaFO.getGcubeProfileDV();
|
||||
LOG.debug("The profile is: " + profile);
|
||||
|
||||
// Building JSON/section full PATH and section name
|
||||
String sectionJSONPath = "";
|
||||
String parentPathFromProfile = profile.getParentName() == null ? "" : profile.getParentName();
|
||||
String theSectionName = profile.getSectionName();
|
||||
|
||||
if (theSectionName.compareTo(JSON_$_POINTER) == 0 || theSectionName.compareTo(JSON_$_POINTER + ".") == 0) {
|
||||
sectionJSONPath = JSON_$_POINTER;
|
||||
theSectionName = "";
|
||||
} else {
|
||||
sectionJSONPath = String.format("%s%s",
|
||||
parentPathFromProfile.endsWith(".") ? parentPathFromProfile : parentPathFromProfile + ".", theSectionName);
|
||||
}
|
||||
LOG.debug("The sectionJSONPath is: " + sectionJSONPath);
|
||||
LOG.info("Current document is: " + theRootDocument);
|
||||
|
||||
// Building Parent PATH
|
||||
String parentPath = sectionJSONPath.compareTo(JSON_$_POINTER) == 0 ? JSON_$_POINTER
|
||||
: sectionJSONPath.substring(0, sectionJSONPath.lastIndexOf("."));
|
||||
JsonPath parentJSONPath = JsonPath.compile(parentPath);
|
||||
LOG.info("Putting into parentJSONPath: " + parentJSONPath);
|
||||
|
||||
List<JSONObject> listJSONObject = toListJonObject(listGDB);
|
||||
JSONObject jsonObject = listJSONObject.get(0);
|
||||
|
||||
// If the maxOccurs is not 1
|
||||
if (profile.getMaxOccurs() == 0 || profile.getMaxOccurs() > 1) {
|
||||
LOG.debug("maxOccurs is NOT 1");
|
||||
// Must be an array
|
||||
boolean pathExists = pathExists(theRootDocument, sectionJSONPath + "[*]");
|
||||
LOG.debug(sectionJSONPath+ "exists? "+pathExists);
|
||||
if (pathExists) {
|
||||
theRootDocument = JsonPath.parse(theRootDocument, configuration).add(sectionJSONPath, jsonObject)
|
||||
.json();
|
||||
} else {
|
||||
// Adding as array of object
|
||||
JSONArray targetArray = JSONArrayOrdered.instance();
|
||||
targetArray.put(jsonObject);
|
||||
LOG.debug("JSON array created: " + targetArray);
|
||||
theRootDocument = JsonPath.parse(theRootDocument, configuration)
|
||||
.put(parentJSONPath, theSectionName, targetArray).json();
|
||||
}
|
||||
|
||||
LOG.debug("theRootDocument as array is: " + theRootDocument);
|
||||
|
||||
} else {
|
||||
LOG.debug("maxOccurs is 1");
|
||||
// Merging as direct properties of the JSON root document
|
||||
if (theSectionName == null || theSectionName.isEmpty()) {
|
||||
deepMerge(jsonObject, theRootDocument);
|
||||
} else {
|
||||
// Putting as child of the JSON document
|
||||
// theRootDocument.put(profile.getSectionName(), jsonObject);
|
||||
theRootDocument = JsonPath.parse(theRootDocument, configuration)
|
||||
.put(parentJSONPath, theSectionName, jsonObject).json();
|
||||
}
|
||||
|
||||
LOG.debug("theRootDocument as single object is: " + theRootDocument);
|
||||
}
|
||||
// recursive call...
|
||||
theRootDocument = convert(treeNodeChild, theRootDocument);
|
||||
}
|
||||
|
||||
LOG.debug("Partial Root Document is: " + theRootDocument);
|
||||
return theRootDocument;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Path exists.
|
||||
*
|
||||
* @param document the document
|
||||
* @param pathExp the path exp
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean pathExists(JSONObject document, String pathExp) {
|
||||
LOG.debug("pathExists called");
|
||||
|
||||
try {
|
||||
LOG.debug("pathExists finding: " + pathExp + " into node: " + document);
|
||||
Object object = JsonPath.read(document.toString(), pathExp);
|
||||
if (object != null) {
|
||||
LOG.debug("pathExists returning true");
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.error("pathExists error", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG.debug("pathExists returning false");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic dataset bean to JSON.
|
||||
*
|
||||
* @param gdb the gdb
|
||||
* @return the JSON object
|
||||
* @throws JSONException the JSON exception
|
||||
*/
|
||||
protected JSONObject genericDatasetBeanToJSON(GenericDatasetBean gdb) throws JSONException {
|
||||
|
||||
JSONObject sectJSONObject = JSONObjectOrdered.instance();
|
||||
|
||||
LinkedHashMap<String, List<String>> mapFields = gdb.getFormDataEntryFields();
|
||||
LOG.debug("Map ordered: " + mapFields);
|
||||
for (String key : mapFields.keySet()) {
|
||||
List<String> listValues = mapFields.get(key);
|
||||
if (listValues == null || listValues.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
// key/value as string
|
||||
if (listValues.size() == 1) {
|
||||
sectJSONObject.put(key, listValues.get(0));
|
||||
continue;
|
||||
}
|
||||
// value is a list
|
||||
JSONArray array = new JSONArray();
|
||||
for (String value : listValues) {
|
||||
if(value!=null && !value.isEmpty()) {
|
||||
array.put(value);
|
||||
}
|
||||
}
|
||||
|
||||
sectJSONObject.put(key, array);
|
||||
}
|
||||
|
||||
return sectJSONObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* To list jon object.
|
||||
*
|
||||
* @param listGDB the list GDB
|
||||
* @return the list
|
||||
* @throws JSONException the JSON exception
|
||||
*/
|
||||
private List<JSONObject> toListJonObject(List<GenericDatasetBean> listGDB) throws JSONException {
|
||||
|
||||
List<JSONObject> listJSONObject = new ArrayList<JSONObject>();
|
||||
|
||||
for (GenericDatasetBean gdb : listGDB) {
|
||||
JSONObject jsonObject = genericDatasetBeanToJSON(gdb);
|
||||
listJSONObject.add(jsonObject);
|
||||
}
|
||||
|
||||
LOG.info("returning : " + listJSONObject);
|
||||
return listJSONObject;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge "source" into "target". If fields have equal name, merge them
|
||||
* recursively.
|
||||
*
|
||||
* @param source the source
|
||||
* @param target the target
|
||||
* @return the merged object (target).
|
||||
* @throws JSONException the JSON exception
|
||||
*/
|
||||
public static JSONObject deepMerge(JSONObject source, JSONObject target) throws JSONException {
|
||||
for (String key : JSONObject.getNames(source)) {
|
||||
Object value = source.get(key);
|
||||
if (!target.has(key)) {
|
||||
// new value for "key":
|
||||
target.put(key, value);
|
||||
} else {
|
||||
// existing value for "key" - recursively deep merge:
|
||||
if (value instanceof JSONObject) {
|
||||
JSONObject valueJson = (JSONObject) value;
|
||||
deepMerge(valueJson, target.getJSONObject(key));
|
||||
} else {
|
||||
target.put(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The Class JSONObjecOrdered.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 10, 2022
|
||||
*/
|
||||
public static class JSONObjectOrdered {
|
||||
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @return the JSON object
|
||||
*/
|
||||
public static JSONObject instance() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
Field changeMap = jsonObject.getClass().getDeclaredField("map");
|
||||
changeMap.setAccessible(true);
|
||||
changeMap.set(jsonObject, new LinkedHashMap<>());
|
||||
changeMap.setAccessible(false);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class JSONObjecOrdered.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Mar 10, 2022
|
||||
*/
|
||||
public static class JSONArrayOrdered {
|
||||
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @return the JSON object
|
||||
*/
|
||||
public static JSONArray instance() {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
try {
|
||||
Field changeMap = jsonArray.getClass().getDeclaredField("map");
|
||||
changeMap.setAccessible(true);
|
||||
changeMap.set(jsonArray, new LinkedHashMap<>());
|
||||
changeMap.setAccessible(false);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,29 +1,40 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.server;
|
||||
|
||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.mongoConcessioni;
|
||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
|
||||
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.rmi.RemoteException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
|
||||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
import org.gcube.application.geoportal.common.model.document.access.Access;
|
||||
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
|
||||
import org.gcube.application.geoportal.common.model.rest.TempFile;
|
||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||
import org.gcube.application.geoportal.common.rest.TempFile;
|
||||
import org.gcube.application.geoportal.common.rest.Projects;
|
||||
import org.gcube.application.geoportal.common.rest.UseCaseDescriptorsI;
|
||||
import org.gcube.application.geoportal.common.utils.FileSets;
|
||||
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||
import org.gcube.contentmanagement.blobstorage.transport.backend.RemoteBackendException;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploaded;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.upload.FileUploadedRemote;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
/**
|
||||
* The Class MongoServiceUtil.
|
||||
* The Class MongoServiceCommon.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
|
@ -33,13 +44,93 @@ public class MongoServiceUtil {
|
|||
|
||||
private static Logger LOG = LoggerFactory.getLogger(MongoServiceUtil.class);
|
||||
|
||||
UseCaseDescriptorsI client = null;
|
||||
|
||||
/**
|
||||
* Use case descriptors client.
|
||||
*
|
||||
* @return the use case descriptors I
|
||||
*/
|
||||
public UseCaseDescriptorsI useCaseDescriptorsClient() {
|
||||
LOG.debug("useCaseDescriptorsClient called");
|
||||
return useCaseDescriptors().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projects client.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @return the projects client
|
||||
*/
|
||||
public Projects<Project> getProjectsClient(String profileID) {
|
||||
LOG.debug("getProjectsClient called for profileID: " + profileID);
|
||||
return projects(profileID).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the new.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param jsonDocument the json document
|
||||
* @return the project
|
||||
* @throws RemoteException the remote exception
|
||||
*/
|
||||
public Project createNew(String profileID, String jsonDocument) throws RemoteException {
|
||||
LOG.debug("createNew called for profileID: " + profileID);
|
||||
Document myDocument = Document.parse(jsonDocument);
|
||||
Projects<Project> client = getProjectsClient(profileID);
|
||||
// Create project
|
||||
Project project = client.createNew(myDocument);
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register file set.
|
||||
*
|
||||
* @param profileID the profile ID
|
||||
* @param project the project
|
||||
* @param parentPath the parent path
|
||||
* @param fieldName the field name
|
||||
* @param fieldDefinition the field definition
|
||||
* @param access the access
|
||||
* @param files the files
|
||||
* @throws RemoteException the remote exception
|
||||
* @throws FileNotFoundException the file not found exception
|
||||
* @throws JsonProcessingException the json processing exception
|
||||
* @throws InvalidRequestException the invalid request exception
|
||||
*/
|
||||
public void registerFileSet(String profileID, Project project, String parentPath, String fieldName,
|
||||
String fieldDefinition, Access access, File... files)
|
||||
throws RemoteException, FileNotFoundException, JsonProcessingException, InvalidRequestException {
|
||||
LOG.info("registerFileSet called for profileID: " + profileID);
|
||||
LOG.info("and for parentPath: " + parentPath);
|
||||
LOG.info("and for fieldName: " + fieldName);
|
||||
LOG.info("and for fieldDefinition: " + fieldDefinition);
|
||||
LOG.info("and for access: " + access);
|
||||
|
||||
Projects<Project> client = getProjectsClient(profileID);
|
||||
// Prepare request
|
||||
RegisterFileSetRequest fsRequest = FileSets.prepareRequest(new StorageUtils(), parentPath, fieldName,
|
||||
fieldDefinition, files);
|
||||
fsRequest.setToSetAccess(access);
|
||||
|
||||
project = client.registerFileSet(project.getId(), fsRequest);
|
||||
|
||||
LOG.trace("Resulting Project : " + project);
|
||||
LOG.debug("Resulting Project as JSON: " + Serialization.write(project));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the instance mongo concessioni.
|
||||
*
|
||||
* @return the instance mongo concessioni
|
||||
*/
|
||||
public MongoConcessioni getInstanceMongoConcessioni() {
|
||||
return mongoConcessioni().build();
|
||||
// return mongoConcessioni().build();
|
||||
LOG.warn("\n\n\nMUST BE PORTED TO NEW MONGO CLIENT");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,33 +180,32 @@ public class MongoServiceUtil {
|
|||
return files;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To tem files from WSC.
|
||||
* To temp file from remote.
|
||||
*
|
||||
* @param listFiles the list files
|
||||
* @return the list
|
||||
* @param file the file
|
||||
* @return the temp file
|
||||
*/
|
||||
public List<TempFile> toTemFilesFromWSC(List<WorkspaceContentDV> listFiles) {
|
||||
LOG.debug("toTemFilesFromWSC called");
|
||||
if (listFiles == null || listFiles.isEmpty())
|
||||
public TempFile toTempFileFromRemote(FileUploadedRemote file) {
|
||||
LOG.debug("toTemFilesFromRemote called");
|
||||
if (file == null)
|
||||
return null;
|
||||
|
||||
// Building TempFile
|
||||
List<TempFile> files = new ArrayList<TempFile>(listFiles.size());
|
||||
for (WorkspaceContentDV fileUploaded : listFiles) {
|
||||
InputStream is;
|
||||
try {
|
||||
is = new URL(fileUploaded.getLink()).openStream();
|
||||
// Creating TempFile
|
||||
TempFile storageTempFile = createTempFileOnStorage(is, fileUploaded.getName());
|
||||
files.add(storageTempFile);
|
||||
} catch (IOException e) {
|
||||
LOG.error("Error on creating temp file from URL: " + fileUploaded.getLink(), e);
|
||||
}
|
||||
TempFile storageTempFile = null;
|
||||
try {
|
||||
InputStream is = new URL(file.getUrl()).openStream();
|
||||
// Creating TempFile
|
||||
storageTempFile = createTempFileOnStorage(is, file.getFileName());
|
||||
} catch (IOException e) {
|
||||
LOG.error("Error on creating temp file from URL: " + file.getUrl(), e);
|
||||
}
|
||||
return files;
|
||||
|
||||
return storageTempFile;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To JSON.
|
||||
*
|
||||
|
@ -137,60 +227,4 @@ public class MongoServiceUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class ConcessioneValidationReportStatusComparator.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 14, 2021
|
||||
*/
|
||||
public static class ConcessioneValidationReportStatusComparator implements Comparator<Concessione> {
|
||||
|
||||
/**
|
||||
* Compare.
|
||||
*
|
||||
* @param o1 the o 1
|
||||
* @param o2 the o 2
|
||||
* @return the int
|
||||
*/
|
||||
@Override
|
||||
public int compare(Concessione o1, Concessione o2) {
|
||||
if (o1 == null || o1.getReport() == null || o1.getReport().getStatus() == null)
|
||||
return 1;
|
||||
if (o2 == null || o2.getReport() == null || o2.getReport().getStatus() == null)
|
||||
return -1;
|
||||
|
||||
return o1.getReport().getStatus().name().compareTo(o2.getReport().getStatus().name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class ConcessioneDVValidationReportStatusComparator.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 16, 2021
|
||||
*/
|
||||
public static class ConcessioneDVValidationReportStatusComparator implements Comparator<ConcessioneDV> {
|
||||
|
||||
/**
|
||||
* Compare.
|
||||
*
|
||||
* @param o1 the o 1
|
||||
* @param o2 the o 2
|
||||
* @return the int
|
||||
*/
|
||||
@Override
|
||||
public int compare(ConcessioneDV o1, ConcessioneDV o2) {
|
||||
if (o1.getValidationStatus() == null)
|
||||
return 1;
|
||||
if (o2.getValidationStatus() == null)
|
||||
return -1;
|
||||
|
||||
return o1.getValidationStatus().name().compareTo(o2.getValidationStatus().name());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,9 @@ import javax.servlet.http.HttpSession;
|
|||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
@ -38,8 +39,16 @@ import com.liferay.portal.service.UserLocalServiceUtil;
|
|||
*/
|
||||
public class SessionUtil {
|
||||
|
||||
private static final String GEONA_DATAVIEWER_PROFILE = "GEONA_DATAVIEWER_PROFILE";
|
||||
private static final String GNA_DATAENTRY_CONFIG_PROFILE = "GNA_DATAENTRY_CONFIG_PROFILE";
|
||||
private static final String LATEST_RESULT_SET_SORTED = "LATEST_RESULT_SET_SORTED";
|
||||
//private static final String GEONA_DATAVIEWER_PROFILE = "GEONA_DATAVIEWER_PROFILE";
|
||||
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI";
|
||||
|
||||
private static final String LIST_OF_RELATIONSHIP_DEFINITION = "LIST_OF_RELATIONSHIP_DEFINITION";
|
||||
|
||||
private static final String LIST_OF_PROJECTS = "LIST_OF_PROJECTS";
|
||||
private static final String COUNT_DOCS_FOR_PROFILE_ID = "COUNT_DOCS_FOR_PROFILE_ID";
|
||||
private static final String TIMELINE_JSON_TEMPLATE = "DATA_ENTRY_TIMELINE_JSON_TEMPLATE";
|
||||
/** The log. */
|
||||
private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
|
||||
|
||||
|
@ -124,6 +133,61 @@ public class SessionUtil {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of projects for profile ID.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param profileID the profile ID
|
||||
* @return the list of projects for profile ID
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static List<ProjectDV> getListOfProjectsForProfileID(HttpServletRequest httpServletRequest, String profileID)
|
||||
throws Exception {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (List<ProjectDV>) session.getAttribute(LIST_OF_PROJECTS + profileID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total document for profile ID.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param theProfileID the the profile ID
|
||||
* @return the total document for profile ID
|
||||
*/
|
||||
public static Integer getTotalDocumentForProfileID(HttpServletRequest httpServletRequest, String theProfileID) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (Integer) session.getAttribute(COUNT_DOCS_FOR_PROFILE_ID + theProfileID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the total document for profile ID.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param theProfileID the the profile ID
|
||||
* @param countForProfileId the count for profile id
|
||||
*/
|
||||
public static void setTotalDocumentForProfileID(HttpServletRequest httpServletRequest, String theProfileID,
|
||||
Integer countForProfileId) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(COUNT_DOCS_FOR_PROFILE_ID + theProfileID, countForProfileId);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of projects for profile ID.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param profileID the profile ID
|
||||
* @param listOfProjects the list of projects
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static void setListOfProjectsForProfileID(HttpServletRequest httpServletRequest, String profileID,
|
||||
List<ProjectDV> listOfProjects) throws Exception {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(LIST_OF_PROJECTS + profileID, listOfProjects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of concessioni.
|
||||
*
|
||||
|
@ -166,28 +230,28 @@ public class SessionUtil {
|
|||
return listOfConcessioni;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the geportal viewer resource profile.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @return the geportal viewer resource profile
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static GeoNaDataViewerProfile getGeportalViewerResourceProfile(HttpServletRequest httpServletRequest)
|
||||
throws Exception {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
GeoNaDataViewerProfile geoNaDataViewerProfile = (GeoNaDataViewerProfile) session
|
||||
.getAttribute(GEONA_DATAVIEWER_PROFILE);
|
||||
|
||||
if (geoNaDataViewerProfile == null) {
|
||||
GeoportalCommon gc = new GeoportalCommon();
|
||||
geoNaDataViewerProfile = gc.getGeoNaDataViewProfile(null);
|
||||
session.setAttribute(GEONA_DATAVIEWER_PROFILE, geoNaDataViewerProfile);
|
||||
}
|
||||
|
||||
return geoNaDataViewerProfile;
|
||||
|
||||
}
|
||||
// /**
|
||||
// * Gets the geportal viewer resource profile.
|
||||
// *
|
||||
// * @param httpServletRequest the http servlet request
|
||||
// * @return the geportal viewer resource profile
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public static GNADataViewerConfigProfile getGeportalViewerResourceProfile(HttpServletRequest httpServletRequest)
|
||||
// throws Exception {
|
||||
// HttpSession session = httpServletRequest.getSession();
|
||||
// GNADataViewerConfigProfile geoNaDataViewerProfile = (GNADataViewerConfigProfile) session
|
||||
// .getAttribute(GEONA_DATAVIEWER_PROFILE);
|
||||
//
|
||||
// if (geoNaDataViewerProfile == null) {
|
||||
// GeoportalCommon gc = new GeoportalCommon();
|
||||
// geoNaDataViewerProfile = gc.readGNADataViewerConfig(null);
|
||||
// session.setAttribute(GEONA_DATAVIEWER_PROFILE, geoNaDataViewerProfile);
|
||||
// }
|
||||
//
|
||||
// return geoNaDataViewerProfile;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the latest result set sorted.
|
||||
|
@ -197,18 +261,95 @@ public class SessionUtil {
|
|||
*/
|
||||
public static ResultSetSorted getLatestResultSetSorted(HttpServletRequest httpServletRequest) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (ResultSetSorted) session.getAttribute("LATEST_RESULT_SET_SORTED");
|
||||
return (ResultSetSorted) session.getAttribute(LATEST_RESULT_SET_SORTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the latest sort filter.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param rsSorted the rs sorted
|
||||
* @return the latest sort filter
|
||||
*/
|
||||
public static void setLatestResultSetSorted(HttpServletRequest httpServletRequest, ResultSetSorted rsSorted) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute("LATEST_RESULT_SET_SORTED", rsSorted);
|
||||
session.setAttribute(LATEST_RESULT_SET_SORTED, rsSorted);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the GNA data entry config profile.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @return the GNA data entry config profile
|
||||
*/
|
||||
public static GNADataEntryConfigProfile getGNADataEntryConfigProfile(HttpServletRequest httpServletRequest) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (GNADataEntryConfigProfile) session.getAttribute(GNA_DATAENTRY_CONFIG_PROFILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the GNA data entry config profile.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param gNADEConfigProfile the g NADE config profile
|
||||
*/
|
||||
public static void setGNADataEntryConfigProfile(HttpServletRequest httpServletRequest,
|
||||
GNADataEntryConfigProfile gNADEConfigProfile) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(GNA_DATAENTRY_CONFIG_PROFILE, gNADEConfigProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relationships definition.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param profileID the profile ID
|
||||
* @return the relationships definition
|
||||
*/
|
||||
public static List<RelationshipDefinitionDV> getRelationshipsDefinition(HttpServletRequest httpServletRequest,
|
||||
String profileID) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (List<RelationshipDefinitionDV>) session.getAttribute(LIST_OF_RELATIONSHIP_DEFINITION + profileID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the relationship definition.
|
||||
*
|
||||
* @param threadLocalRequest the thread local request
|
||||
* @param profileID the profile ID
|
||||
* @param listRelationshipNames the list relationship names
|
||||
*/
|
||||
public static void setRelationshipDefinition(HttpServletRequest threadLocalRequest, String profileID,
|
||||
List<RelationshipDefinitionDV> listRelationshipNames) {
|
||||
HttpSession session = threadLocalRequest.getSession();
|
||||
session.setAttribute(LIST_OF_RELATIONSHIP_DEFINITION + profileID, listRelationshipNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the JSON timeline template.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param profileID the profile ID
|
||||
* @return the JSON timeline template
|
||||
*/
|
||||
public static String getJSONTimelineTemplate(HttpServletRequest httpServletRequest, String profileID) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (String) session.getAttribute(TIMELINE_JSON_TEMPLATE + profileID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the JSON timeline template.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param profileID the profile ID
|
||||
* @param jsonTimelineTemplate the json timeline template
|
||||
*/
|
||||
public static void setJSONTimelineTemplate(HttpServletRequest httpServletRequest, String profileID,
|
||||
String jsonTimelineTemplate) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(TIMELINE_JSON_TEMPLATE + profileID, jsonTimelineTemplate);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,328 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.server.json;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
|
||||
/**
|
||||
* This class provides methods to merge two json of any nested level into a
|
||||
* single json.
|
||||
*
|
||||
* copied from: https://github.com/hemantsonu20/json-merge
|
||||
*
|
||||
* @maintainer updated by Francesco Mangiacrapa at ISTI-CNR
|
||||
* francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Apr 21, 2023
|
||||
*/
|
||||
public class JsonMerge {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* The Enum MERGE_OPTION.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Apr 21, 2023
|
||||
*/
|
||||
public static enum MERGE_OPTION {
|
||||
MERGE, REPLACE
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to merge two json objects into single json object.
|
||||
*
|
||||
* <p>
|
||||
* It merges two json of any nested level into a single json following below
|
||||
* logic.
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>When keys are different, both keys with there values will be copied at
|
||||
* same level.</li>
|
||||
* <li>
|
||||
* <p>
|
||||
* When keys are same at some level, following table denotes what value will be
|
||||
* used.
|
||||
* </p>
|
||||
* <table border="1" summary="">
|
||||
* <thead>
|
||||
* <tr>
|
||||
* <th align="left">Src / Target</th>
|
||||
* <th align="left">JSON Value</th>
|
||||
* <th align="left">JSON Array</th>
|
||||
* <th align="left">JSON Object</th>
|
||||
* </tr>
|
||||
* </thead> <tbody>
|
||||
* <tr>
|
||||
* <td align="left">JSON Value<sup>1</sup></td>
|
||||
* <td align="left">Src</td>
|
||||
* <td align="left">Src</td>
|
||||
* <td align="left">Src</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="left">JSON Array</td>
|
||||
* <td align="left">Src<sup>2</sup></td>
|
||||
* <td align="left">Merge</td>
|
||||
* <td align="left">Src</td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td align="left">JSON Object</td>
|
||||
* <td align="left">Src</td>
|
||||
* <td align="left">Src</td>
|
||||
* <td align="left">Merge<sup>3</sup></td>
|
||||
* </tr>
|
||||
* </tbody>
|
||||
* </table>
|
||||
* <ul>
|
||||
* <li><sup><strong>1</strong></sup> Json Value denotes boolean, number or
|
||||
* string value in json.</li>
|
||||
* <li><sup><strong>2</strong></sup> Src denotes <code>Src</code> value will be
|
||||
* copied.</li>
|
||||
* <li><sup><strong>3</strong></sup> Merge denotes both <code>Src</code> and
|
||||
* <code>Target</code> values will be merged.</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* <h2>Examples</h2>
|
||||
* <h3>Example 1</h3>
|
||||
* <p>
|
||||
* <strong>Source Json</strong>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* {
|
||||
* "name": "json-merge-src"
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* <strong>Target Json</strong>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* {
|
||||
* "name": "json-merge-target"
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* <strong>Output</strong>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* {
|
||||
* "name": "json-merge-src"
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* <h3>Example 2</h3>
|
||||
* <p>
|
||||
* <strong>Source Json</strong>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* {
|
||||
* "level1": {
|
||||
* "key1": "SrcValue1"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* <strong>Target Json</strong>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* {
|
||||
* "level1": {
|
||||
* "key1": "targetValue1",
|
||||
* "level2": {
|
||||
* "key2": "value2"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* <strong>Output</strong>
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* {@code
|
||||
* {
|
||||
* "level1": {
|
||||
* "key1": "SrcValue1",
|
||||
* "level2": {
|
||||
* "key2": "value2"
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @param srcJsonStr source json string
|
||||
* @param targetJsonStr target json string
|
||||
* @param option the option
|
||||
* @return merged json as a string
|
||||
*/
|
||||
public static String merge(String srcJsonStr, String targetJsonStr, MERGE_OPTION option) {
|
||||
|
||||
try {
|
||||
if (option == null)
|
||||
option = MERGE_OPTION.MERGE;
|
||||
|
||||
JsonNode srcNode = OBJECT_MAPPER.readTree(srcJsonStr);
|
||||
JsonNode targetNode = OBJECT_MAPPER.readTree(targetJsonStr);
|
||||
JsonNode result = merge(srcNode, targetNode, option);
|
||||
return OBJECT_MAPPER.writeValueAsString(result);
|
||||
} catch (IOException e) {
|
||||
throw new JsonMergeException("Unable to merge json", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge.
|
||||
*
|
||||
* @param srcNode the src node
|
||||
* @param targetNode the target node
|
||||
* @param option the option
|
||||
* @return the json node
|
||||
*/
|
||||
public static JsonNode merge(JsonNode srcNode, JsonNode targetNode, MERGE_OPTION option) {
|
||||
|
||||
if (option == null)
|
||||
option = MERGE_OPTION.MERGE;
|
||||
|
||||
// if both nodes are object node, merged object node is returned
|
||||
if (srcNode.isObject() && targetNode.isObject()) {
|
||||
return merge((ObjectNode) srcNode, (ObjectNode) targetNode, option);
|
||||
}
|
||||
|
||||
// if both nodes are array node, merged array node is returned
|
||||
if (srcNode.isArray() && targetNode.isArray()) {
|
||||
return mergeArray((ArrayNode) srcNode, (ArrayNode) targetNode, option);
|
||||
}
|
||||
|
||||
// special case when src node is null
|
||||
if (srcNode.isNull()) {
|
||||
return targetNode;
|
||||
}
|
||||
|
||||
return srcNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge.
|
||||
*
|
||||
* @param srcNode the src node
|
||||
* @param targetNode the target node
|
||||
* @param option the option
|
||||
* @return the object node
|
||||
*/
|
||||
public static ObjectNode merge(ObjectNode srcNode, ObjectNode targetNode, MERGE_OPTION option) {
|
||||
|
||||
ObjectNode result = OBJECT_MAPPER.createObjectNode();
|
||||
|
||||
Iterator<Map.Entry<String, JsonNode>> srcItr = srcNode.fields();
|
||||
while (srcItr.hasNext()) {
|
||||
|
||||
Map.Entry<String, JsonNode> entry = srcItr.next();
|
||||
|
||||
// check key in src json exists in target json or not at same level
|
||||
if (targetNode.has(entry.getKey())) {
|
||||
result.set(entry.getKey(), merge(entry.getValue(), targetNode.get(entry.getKey()), option));
|
||||
} else {
|
||||
// if key in src json doesn't exist in target json, just copy the same in result
|
||||
result.set(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// copy fields from target json into result which were missing in src json
|
||||
Iterator<Map.Entry<String, JsonNode>> targetItr = targetNode.fields();
|
||||
while (targetItr.hasNext()) {
|
||||
Map.Entry<String, JsonNode> entry = targetItr.next();
|
||||
if (!result.has(entry.getKey())) {
|
||||
result.set(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge.
|
||||
*
|
||||
* @param srcNode the src node
|
||||
* @param targetNode the target node
|
||||
* @param option the option
|
||||
* @return the array node
|
||||
*/
|
||||
public static ArrayNode mergeArray(ArrayNode srcNode, ArrayNode targetNode, MERGE_OPTION option) {
|
||||
ArrayNode result = OBJECT_MAPPER.createArrayNode();
|
||||
|
||||
switch (option) {
|
||||
case REPLACE:
|
||||
//Replacing source json value as result
|
||||
return result.addAll(srcNode);
|
||||
//return result.addAll(srcNode).addAll(targetNode);
|
||||
default:
|
||||
return mergeSet(srcNode, targetNode);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Added by Francesco Mangiacrapa Merge set.
|
||||
*
|
||||
* @param srcNode the src node
|
||||
* @param targetNode the target node
|
||||
* @return the array node
|
||||
*/
|
||||
public static ArrayNode mergeSet(ArrayNode srcNode, ArrayNode targetNode) {
|
||||
ArrayNode result = OBJECT_MAPPER.createArrayNode();
|
||||
|
||||
HashSet<JsonNode> set = new HashSet<>();
|
||||
|
||||
set = toHashSet(set, srcNode);
|
||||
set = toHashSet(set, targetNode);
|
||||
|
||||
Iterator<JsonNode> itr = set.iterator();
|
||||
while (itr != null && itr.hasNext()) {
|
||||
JsonNode arrayValue = itr.next();
|
||||
result.add(arrayValue);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* To hash set.
|
||||
*
|
||||
* @param set the set
|
||||
* @param srcNode the src node
|
||||
* @return the hash set
|
||||
*/
|
||||
public static HashSet<JsonNode> toHashSet(HashSet<JsonNode> set, ArrayNode srcNode) {
|
||||
if (srcNode != null) {
|
||||
Iterator<JsonNode> itr = srcNode.elements();
|
||||
while (itr != null && itr.hasNext()) {
|
||||
JsonNode arrayValue = itr.next();
|
||||
set.add(arrayValue);
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.server.json;
|
||||
|
||||
/**
|
||||
* Exception to be thrown in case of any error occured while merging two json.
|
||||
*
|
||||
*/
|
||||
public class JsonMergeException extends RuntimeException {
|
||||
|
||||
public JsonMergeException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public JsonMergeException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public JsonMergeException(String msg, Throwable th) {
|
||||
super(msg, th);
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
|
||||
|
||||
/**
|
||||
* The Class CommitReport.
|
||||
|
@ -16,11 +16,11 @@ public class CommitReport implements Serializable {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -9519707669761939L;
|
||||
|
||||
public Long recordId;
|
||||
public String mongoId;
|
||||
public ValidationReportDV validationReportDV;
|
||||
private static final long serialVersionUID = -3606902201347318287L;
|
||||
public String projectID;
|
||||
private LifecycleInformationDV lifecycleInformation;
|
||||
private String profileID;
|
||||
private String projectAsJSON;
|
||||
|
||||
/**
|
||||
* Instantiates a new commit report.
|
||||
|
@ -29,46 +29,57 @@ public class CommitReport implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
public CommitReport(Long recordId, String mongoId, ValidationReportDV validationReportDV) {
|
||||
super();
|
||||
this.recordId = recordId;
|
||||
this.mongoId = mongoId;
|
||||
this.validationReportDV = validationReportDV;
|
||||
public CommitReport(String projectID, String profileID, String projectAsJSON,
|
||||
LifecycleInformationDV lifecycleInfo) {
|
||||
this.projectID = projectID;
|
||||
this.profileID = profileID;
|
||||
this.projectAsJSON = projectAsJSON;
|
||||
this.lifecycleInformation = lifecycleInfo;
|
||||
}
|
||||
|
||||
public Long getRecordId() {
|
||||
return recordId;
|
||||
public String getProjectID() {
|
||||
return projectID;
|
||||
}
|
||||
|
||||
public String getMongoId() {
|
||||
return mongoId;
|
||||
public LifecycleInformationDV getLifecycleInformation() {
|
||||
return lifecycleInformation;
|
||||
}
|
||||
|
||||
public ValidationReportDV getValidationReportDV() {
|
||||
return validationReportDV;
|
||||
public void setProjectID(String projectID) {
|
||||
this.projectID = projectID;
|
||||
}
|
||||
|
||||
public void setRecordId(Long recordId) {
|
||||
this.recordId = recordId;
|
||||
public void setLifecycleInformation(LifecycleInformationDV lifecycleInformation) {
|
||||
this.lifecycleInformation = lifecycleInformation;
|
||||
}
|
||||
|
||||
public void setMongoId(String mongoId) {
|
||||
this.mongoId = mongoId;
|
||||
public String getProfileID() {
|
||||
return profileID;
|
||||
}
|
||||
|
||||
public void setValidationReportDV(ValidationReportDV validationReportDV) {
|
||||
this.validationReportDV = validationReportDV;
|
||||
public void setProfileID(String profileID) {
|
||||
this.profileID = profileID;
|
||||
}
|
||||
|
||||
public String getProjectAsJSON() {
|
||||
return projectAsJSON;
|
||||
}
|
||||
|
||||
public void setProjectAsJSON(String projectAsJSON) {
|
||||
this.projectAsJSON = projectAsJSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("CommitReport [recordId=");
|
||||
builder.append(recordId);
|
||||
builder.append(", mongoId=");
|
||||
builder.append(mongoId);
|
||||
builder.append(", validationReportDV=");
|
||||
builder.append(validationReportDV);
|
||||
builder.append("CommitReport [projectID=");
|
||||
builder.append(projectID);
|
||||
builder.append(", lifecycleInformation=");
|
||||
builder.append(lifecycleInformation);
|
||||
builder.append(", profileID=");
|
||||
builder.append(profileID);
|
||||
builder.append(", projectAsJSON=");
|
||||
builder.append(projectAsJSON);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
|
||||
public class ConfigHandlerDV implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 372838411789432170L;
|
||||
|
||||
private String id;
|
||||
private String type; // is case in the JSON
|
||||
|
||||
private List<GcubeProfileDV> gcubeProfiles;
|
||||
|
||||
public ConfigHandlerDV() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public List<GcubeProfileDV> getGcubeProfiles() {
|
||||
return gcubeProfiles;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setGcubeProfiles(List<GcubeProfileDV> gcubeProfiles) {
|
||||
this.gcubeProfiles = gcubeProfiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ConfigHandlerDV [id=");
|
||||
builder.append(id);
|
||||
builder.append(", type=");
|
||||
builder.append(type);
|
||||
builder.append(", gcubeProfiles=");
|
||||
builder.append(gcubeProfiles);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class DocumentConfigDV implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7538079431272352662L;
|
||||
private String id;
|
||||
private String type;
|
||||
private String itemType;
|
||||
private ConfigHandlerDV configuration;
|
||||
|
||||
public DocumentConfigDV() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ConfigHandlerDV getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
public void setItemType(String itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setConfiguration(ConfigHandlerDV configuration) {
|
||||
this.configuration = configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("DocumentConfigDV [id=");
|
||||
builder.append(id);
|
||||
builder.append(", type=");
|
||||
builder.append(type);
|
||||
builder.append(", itemType=");
|
||||
builder.append(itemType);
|
||||
builder.append(", configuration=");
|
||||
builder.append(configuration);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataEntryConfigProfile;
|
||||
|
||||
|
||||
/**
|
||||
* The Class GNADataEntryExtendedConfigProfile.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 26, 2022
|
||||
*/
|
||||
public class GNADataEntryExtendedConfigProfile extends GNADataEntryConfigProfile implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3185317083819447952L;
|
||||
private UserRights userRights = null;
|
||||
|
||||
/**
|
||||
* Instantiates a new GNA data entry config profile.
|
||||
*/
|
||||
public GNADataEntryExtendedConfigProfile() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the user rights.
|
||||
*
|
||||
* @return the user rights
|
||||
*/
|
||||
public UserRights getUserRights() {
|
||||
return userRights;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user rights.
|
||||
*
|
||||
* @param userRights the new user rights
|
||||
*/
|
||||
public void setUserRights(UserRights userRights) {
|
||||
this.userRights = userRights;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GNADataEntryExtendedConfigProfile [userRights=");
|
||||
builder.append(userRights);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -3,27 +3,26 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
|
|||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
|
||||
|
||||
public class GeoNaFormDataObject implements Serializable{
|
||||
|
||||
public class GeoNaFormDataObject implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3620244260086172039L;
|
||||
|
||||
private static final long serialVersionUID = 1084036362952974474L;
|
||||
private List<GenericDatasetBean> listGDB;
|
||||
private ConcessioniFormCardTitle theType;
|
||||
|
||||
public GeoNaFormDataObject(){
|
||||
|
||||
private GcubeProfileDV gcubeProfileDV;
|
||||
|
||||
public GeoNaFormDataObject() {
|
||||
|
||||
}
|
||||
|
||||
public GeoNaFormDataObject(List<GenericDatasetBean> listGDB, ConcessioniFormCardTitle theType) {
|
||||
public GeoNaFormDataObject(List<GenericDatasetBean> listGDB, GcubeProfileDV gcubeProfileDV) {
|
||||
super();
|
||||
this.listGDB = listGDB;
|
||||
this.theType = theType;
|
||||
this.gcubeProfileDV = gcubeProfileDV;
|
||||
}
|
||||
|
||||
public List<GenericDatasetBean> getListGDB() {
|
||||
|
@ -33,17 +32,24 @@ public class GeoNaFormDataObject implements Serializable{
|
|||
public void setListGDB(List<GenericDatasetBean> listGDB) {
|
||||
this.listGDB = listGDB;
|
||||
}
|
||||
public ConcessioniFormCardTitle getTheType() {
|
||||
return theType;
|
||||
|
||||
public GcubeProfileDV getGcubeProfileDV() {
|
||||
return gcubeProfileDV;
|
||||
}
|
||||
public void setTheType(ConcessioniFormCardTitle theType) {
|
||||
this.theType = theType;
|
||||
|
||||
public void setGcubeProfileDV(GcubeProfileDV gcubeProfileDV) {
|
||||
this.gcubeProfileDV = gcubeProfileDV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GeoNaFormDataObject [listGDB=" + listGDB + ", theType=" + theType + "]";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoNaFormDataObject [listGDB=");
|
||||
builder.append(listGDB);
|
||||
builder.append(", gcubeProfileDV=");
|
||||
builder.append(gcubeProfileDV);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class GeonaISConfig implements Serializable{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6700506811708315617L;
|
||||
|
||||
String gRSecondaryType;
|
||||
String scope;
|
||||
|
||||
public GeonaISConfig() {
|
||||
}
|
||||
|
||||
public GeonaISConfig(String gRSecondaryType, String scope) {
|
||||
super();
|
||||
this.gRSecondaryType = gRSecondaryType;
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
|
||||
public String getgRSecondaryType() {
|
||||
return gRSecondaryType;
|
||||
}
|
||||
|
||||
public void setgRSecondaryType(String gRSecondaryType) {
|
||||
this.gRSecondaryType = gRSecondaryType;
|
||||
}
|
||||
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeonaISConfig [gRSecondaryType=");
|
||||
builder.append(gRSecondaryType);
|
||||
builder.append(", scope=");
|
||||
builder.append(scope);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* The Class GeoportalISConfig.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Sep 26, 2022
|
||||
*/
|
||||
public class GeoportalISConfig implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 4187839053354198268L;
|
||||
private String genericResSecondaryType;
|
||||
private String scope;
|
||||
|
||||
/**
|
||||
* Instantiates a new geona IS config.
|
||||
*/
|
||||
public GeoportalISConfig() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new geona IS config.
|
||||
*
|
||||
* @param gRSecondaryType the g R secondary type
|
||||
* @param scope the scope
|
||||
*/
|
||||
public GeoportalISConfig(String gRSecondaryType, String scope) {
|
||||
super();
|
||||
this.genericResSecondaryType = gRSecondaryType;
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the generic resource secondary type.
|
||||
*
|
||||
* @return the generic resource secondary type
|
||||
*/
|
||||
public String getGenericResourceSecondaryType() {
|
||||
return genericResSecondaryType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the generic resource secondary type.
|
||||
*
|
||||
* @param gRSecondaryType the new generic resource secondary type
|
||||
*/
|
||||
public void setGenericResourceSecondaryType(String gRSecondaryType) {
|
||||
this.genericResSecondaryType = gRSecondaryType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the scope.
|
||||
*
|
||||
* @return the scope
|
||||
*/
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the scope.
|
||||
*
|
||||
* @param scope the new scope
|
||||
*/
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("GeoportalISConfig [genericResSecondaryType=");
|
||||
builder.append(genericResSecondaryType);
|
||||
builder.append(", scope=");
|
||||
builder.append(scope);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,189 +0,0 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
|
||||
|
||||
/**
|
||||
* The Class ResultSetPaginatedData.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 6, 2021
|
||||
*/
|
||||
public class ResultSetPaginatedData implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6800997954077785719L;
|
||||
private List<ConcessioneDV> data;
|
||||
private int clientStartIndex = 0;
|
||||
private int limit;
|
||||
private int serverEndIndex = 0;
|
||||
private boolean isServerSearchFinished = false;
|
||||
private long totalItems;
|
||||
|
||||
/**
|
||||
* Instantiates a new searched folder.
|
||||
*/
|
||||
public ResultSetPaginatedData() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new result set paginated data.
|
||||
*
|
||||
* @param clientStartIndex the client start index
|
||||
* @param limit the limit
|
||||
* @param serverEndIndex the server end index
|
||||
* @param isServerSearchFinished the is server search finished
|
||||
*/
|
||||
public ResultSetPaginatedData(int clientStartIndex, int limit, int serverEndIndex, boolean isServerSearchFinished) {
|
||||
|
||||
this.clientStartIndex = clientStartIndex;
|
||||
this.limit = limit;
|
||||
this.serverEndIndex = serverEndIndex;
|
||||
this.isServerSearchFinished = isServerSearchFinished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data.
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
public List<ConcessioneDV> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the client start index.
|
||||
*
|
||||
* @return the client start index
|
||||
*/
|
||||
public int getClientStartIndex() {
|
||||
return clientStartIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the limit.
|
||||
*
|
||||
* @return the limit
|
||||
*/
|
||||
public int getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the server end index.
|
||||
*
|
||||
* @return the server end index
|
||||
*/
|
||||
public int getServerEndIndex() {
|
||||
return serverEndIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is server search finished.
|
||||
*
|
||||
* @return true, if is server search finished
|
||||
*/
|
||||
public boolean isServerSearchFinished() {
|
||||
return isServerSearchFinished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data.
|
||||
*
|
||||
* @param data the new data
|
||||
*/
|
||||
public void setData(List<ConcessioneDV> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the client start index.
|
||||
*
|
||||
* @param clientStartIndex the new client start index
|
||||
*/
|
||||
public void setClientStartIndex(int clientStartIndex) {
|
||||
this.clientStartIndex = clientStartIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the limit.
|
||||
*
|
||||
* @param limit the new limit
|
||||
*/
|
||||
public void setLimit(int limit) {
|
||||
this.limit = limit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the server end index.
|
||||
*
|
||||
* @param serverEndIndex the new server end index
|
||||
*/
|
||||
public void setServerEndIndex(int serverEndIndex) {
|
||||
this.serverEndIndex = serverEndIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the server search finished.
|
||||
*
|
||||
* @param isServerSearchFinished the new server search finished
|
||||
*/
|
||||
public void setServerSearchFinished(boolean isServerSearchFinished) {
|
||||
this.isServerSearchFinished = isServerSearchFinished;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total items.
|
||||
*
|
||||
* @return the total items
|
||||
*/
|
||||
public long getTotalItems() {
|
||||
return totalItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the total items.
|
||||
*
|
||||
* @param totalItems the new total items
|
||||
*/
|
||||
public void setTotalItems(long totalItems) {
|
||||
this.totalItems = totalItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("ResultSetPaginatedData [data=");
|
||||
builder.append(data);
|
||||
builder.append(", clientStartIndex=");
|
||||
builder.append(clientStartIndex);
|
||||
builder.append(", limit=");
|
||||
builder.append(limit);
|
||||
builder.append(", serverEndIndex=");
|
||||
builder.append(serverEndIndex);
|
||||
builder.append(", isServerSearchFinished=");
|
||||
builder.append(isServerSearchFinished);
|
||||
builder.append(", totalItems=");
|
||||
builder.append(totalItems);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ import java.io.Serializable;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
|
||||
public class ResultSetSorted implements Serializable {
|
||||
|
||||
|
@ -12,7 +13,7 @@ public class ResultSetSorted implements Serializable {
|
|||
*/
|
||||
private static final long serialVersionUID = 889420364685643758L;
|
||||
|
||||
private SortFilter searchFilter;
|
||||
private SearchingFilter searchFilter;
|
||||
|
||||
private List<Concessione> data;
|
||||
|
||||
|
@ -20,13 +21,13 @@ public class ResultSetSorted implements Serializable {
|
|||
|
||||
}
|
||||
|
||||
public ResultSetSorted(SortFilter searchFilter, List<Concessione> data) {
|
||||
public ResultSetSorted(SearchingFilter searchFilter, List<Concessione> data) {
|
||||
super();
|
||||
this.searchFilter = searchFilter;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public SortFilter getSearchFilter() {
|
||||
public SearchingFilter getSearchFilter() {
|
||||
return searchFilter;
|
||||
}
|
||||
|
||||
|
@ -34,7 +35,7 @@ public class ResultSetSorted implements Serializable {
|
|||
return data;
|
||||
}
|
||||
|
||||
public void setSearchFilter(SortFilter searchFilter) {
|
||||
public void setSearchFilter(SearchingFilter searchFilter) {
|
||||
this.searchFilter = searchFilter;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
|
||||
|
||||
/**
|
||||
* The Class SortFilter.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 6, 2021
|
||||
*/
|
||||
public class SortFilter implements Serializable {
|
||||
|
||||
/**
|
||||
* The Enum ORDER.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 6, 2021
|
||||
*/
|
||||
public static enum ORDER {
|
||||
ASC("ASCENDING"), DESC("DESCENDING");
|
||||
|
||||
String label;
|
||||
|
||||
ORDER(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4004094263090373626L;
|
||||
|
||||
private RECORD_FIELD orderByField;
|
||||
|
||||
private ORDER order;
|
||||
|
||||
/**
|
||||
* Instantiates a new sort filter.
|
||||
*/
|
||||
public SortFilter() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new sort filter.
|
||||
*
|
||||
* @param orderByField the order by field
|
||||
* @param order the order
|
||||
*/
|
||||
public SortFilter(RECORD_FIELD orderByField, ORDER order) {
|
||||
this.orderByField = orderByField;
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order by field.
|
||||
*
|
||||
* @return the order by field
|
||||
*/
|
||||
public RECORD_FIELD getOrderByField() {
|
||||
return orderByField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the order.
|
||||
*
|
||||
* @return the order
|
||||
*/
|
||||
public ORDER getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the order by field.
|
||||
*
|
||||
* @param orderByField the new order by field
|
||||
*/
|
||||
public void setOrderByField(RECORD_FIELD orderByField) {
|
||||
this.orderByField = orderByField;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the order.
|
||||
*
|
||||
* @param order the new order
|
||||
*/
|
||||
public void setOrder(ORDER order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("SortFilter [orderByField=");
|
||||
builder.append(orderByField);
|
||||
builder.append(", order=");
|
||||
builder.append(order);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The Class Tree_Node.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jul 7, 2022
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public class Tree_Node<T> implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7319055031988865761L;
|
||||
private String name;
|
||||
private T data;
|
||||
private List<Tree_Node<T>> children = new ArrayList<Tree_Node<T>>();
|
||||
private Tree_Node<T> parent;
|
||||
private boolean isRoot;
|
||||
|
||||
/**
|
||||
* Instantiates a new tree node.
|
||||
*/
|
||||
public Tree_Node() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new tree node.
|
||||
*
|
||||
* @param name the name
|
||||
* @param data the data
|
||||
*/
|
||||
public Tree_Node(String name, T data) {
|
||||
this.name = name;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is root.
|
||||
*
|
||||
* @return true, if is root
|
||||
*/
|
||||
public boolean isRoot() {
|
||||
return isRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the root.
|
||||
*
|
||||
* @param isRoot the new root
|
||||
*/
|
||||
public void setRoot(boolean isRoot) {
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the child.
|
||||
*
|
||||
* @param child the child
|
||||
*/
|
||||
public void addChild(Tree_Node<T> child) {
|
||||
child.setParent(this);
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the name.
|
||||
*
|
||||
* @param name the new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data.
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
public T getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the data.
|
||||
*
|
||||
* @param data the new data
|
||||
*/
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the parent.
|
||||
*
|
||||
* @return the parent
|
||||
*/
|
||||
public Tree_Node<T> getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the parent.
|
||||
*
|
||||
* @param parent the new parent
|
||||
*/
|
||||
public void setParent(Tree_Node<T> parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the children.
|
||||
*
|
||||
* @return the children
|
||||
*/
|
||||
public List<Tree_Node<T>> getChildren() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Tree_Node [name=");
|
||||
builder.append(name);
|
||||
builder.append(", data=");
|
||||
builder.append(data);
|
||||
builder.append(", isRoot=");
|
||||
builder.append(isRoot);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
package org.gcube.portlets.user.geoportaldataentry.shared;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.config.RoleRights;
|
||||
|
||||
/**
|
||||
* The Class UserRights.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Nov 24, 2021
|
||||
*/
|
||||
public class UserRights implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -304157165851633221L;
|
||||
|
||||
private String myUsername;
|
||||
|
||||
private RoleRights roleRights;
|
||||
|
||||
/**
|
||||
* Instantiates a new user rights.
|
||||
*/
|
||||
public UserRights() {
|
||||
super();
|
||||
}
|
||||
|
||||
public UserRights(String myUsername, RoleRights roleRights) {
|
||||
super();
|
||||
this.myUsername = myUsername;
|
||||
this.roleRights = roleRights;
|
||||
}
|
||||
|
||||
public String getMyUsername() {
|
||||
return myUsername;
|
||||
}
|
||||
|
||||
public RoleRights getRoleRights() {
|
||||
return roleRights;
|
||||
}
|
||||
|
||||
public void setMyUsername(String myUsername) {
|
||||
this.myUsername = myUsername;
|
||||
}
|
||||
|
||||
public void setRoleRights(RoleRights roleRights) {
|
||||
this.roleRights = roleRights;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("UserRights [myUsername=");
|
||||
builder.append(myUsername);
|
||||
builder.append(", roleRights=");
|
||||
builder.append(roleRights);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -12,32 +12,31 @@
|
|||
|
||||
<inherits name="com.google.gwt.json.JSON" />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.application.geoportaldatamapper.GeoportalDataMapper' />
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.gdvw.geoportal_data_viewer_widget' />
|
||||
|
||||
|
||||
<inherits
|
||||
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
||||
|
||||
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
|
||||
|
||||
<!-- Inherit the default GWT style sheet. You can change -->
|
||||
<!-- the theme of your GWT application by uncommenting -->
|
||||
<!-- any one of the following lines. -->
|
||||
<!--<inherits name='com.google.gwt.user.theme.standard.Standard' /> -->
|
||||
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
|
||||
<inherits name="com.google.gwt.json.JSON" />
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
|
||||
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||
<!-- Other module inherits -->
|
||||
|
||||
<!-- Other module inherits -->
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point
|
||||
class='org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp' />
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<entry-point class='org.gcube.portlets.user.geoportaldataentry.client.GeoPortalDataEntryApp' />
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
|
||||
</module>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/** Add css rules here for your application. */
|
||||
/** Example rules used by the template application (remove for your app) */
|
||||
|
||||
/** JUST to override the gwt-boostrap body */
|
||||
body {
|
||||
padding: 0px !important;
|
||||
|
@ -37,30 +36,31 @@ h1 {
|
|||
margin: 15px 6px 6px;
|
||||
}
|
||||
|
||||
.red-text a {
|
||||
.red-text {
|
||||
color: red !important;
|
||||
}
|
||||
|
||||
.green-text a {
|
||||
.green-text {
|
||||
color: green !important;
|
||||
}
|
||||
|
||||
.my-html-table {
|
||||
padding: 5px;
|
||||
margin-left:10px;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 10px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.my-html-table td {
|
||||
padding: 5px;
|
||||
border: 1px solid gray;
|
||||
border-bottom: 1px solid gray;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.my-html-table td:first-child {
|
||||
color: gray;
|
||||
color: gray;
|
||||
}
|
||||
|
||||
|
||||
/*** TABLE GET LIST OF RECORDS***/
|
||||
.table-glor {
|
||||
word-wrap: break-word;
|
||||
|
@ -70,29 +70,41 @@ h1 {
|
|||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.table-glor td:nth-last-child(-n+3) {
|
||||
.back-system-cell-b {
|
||||
background-color: #d9edf7 !important;
|
||||
}
|
||||
|
||||
.back-system-cell-o {
|
||||
background-color: #FFE1BE !important;
|
||||
}
|
||||
|
||||
.back-system-cell-y {
|
||||
background-color: #FFEDBE !important;
|
||||
}
|
||||
|
||||
|
||||
.table-glor-vertical-middle td, th {
|
||||
height: 50%;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
||||
.move-sticky {
|
||||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 20px;
|
||||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background-color: #f8f8f8;
|
||||
border-radius: 20px;
|
||||
}
|
||||
|
||||
.modal-body-custom {
|
||||
max-height: 700px !important;
|
||||
}
|
||||
|
||||
.modal-body-edit {
|
||||
max-height: none !important;
|
||||
}
|
||||
.disable-div {
|
||||
pointer-events: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.form-fieldset-edit {
|
||||
|
@ -101,6 +113,16 @@ h1 {
|
|||
padding: 10px !important;
|
||||
}
|
||||
|
||||
.form-fieldset-edit .control-group {
|
||||
margin-bottom: 15px !important;
|
||||
}
|
||||
|
||||
.form-fieldset-edit .control-group > span {
|
||||
padding-top: 3px !important;
|
||||
padding-bottom: 3px !important;
|
||||
font-size: 14px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.table-current-content {
|
||||
width: 100%;
|
||||
background-color: #efefef !important;
|
||||
|
@ -119,3 +141,178 @@ h1 {
|
|||
margin-left: 10px;
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
.search-textbox {
|
||||
padding: 4px 14px !important;
|
||||
margin-bottom: 0 !important;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
|
||||
font-size: 13px !important;
|
||||
font-weight: normal !important;
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px !important;
|
||||
width: 250px !important;
|
||||
margin-top: 8px !important;
|
||||
}
|
||||
|
||||
.alert_box_nav {
|
||||
padding: 4px 10px !important;
|
||||
margin-top: 8px !important;
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
|
||||
.tree-panel {
|
||||
padding: 5px;
|
||||
border: 1px solid #e7e7e7;
|
||||
min-width: 280px;
|
||||
}
|
||||
|
||||
.tree-panel .gwt-TreeItem {
|
||||
padding: 5px !important;
|
||||
border: 1px solid #dee2e6 !important;
|
||||
min-width: 270px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.tree-panel .gwt-TreeItem div {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.tree-panel ul {
|
||||
background: #e7e7e7;
|
||||
}
|
||||
|
||||
.nav-toolbar-style {
|
||||
margin-bottom: 5px !important;
|
||||
}
|
||||
|
||||
.nav-toolbar-style .navbar-inner {
|
||||
background-image: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.nav-toolbar-style .container {
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.actions-button-group {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.actions-button-group a {
|
||||
margin-left: 10px !important;
|
||||
}
|
||||
|
||||
.action-list-main-panel {
|
||||
height: 100%;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.move-sticky-no-back {
|
||||
position: -webkit-sticky;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.move-sticky-no-back .gwt-Label {
|
||||
top: 0;
|
||||
margin: auto 0;
|
||||
}
|
||||
|
||||
.geoportal-loaders-center {
|
||||
position: absolute;
|
||||
left:40%;
|
||||
padding: 200px 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.geoportal-loaders-center table {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@keyframes fadeInOutAnimation {
|
||||
0% {
|
||||
opacity: 0.2;
|
||||
}
|
||||
100% {
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
.animate-fadeInOut {
|
||||
animation: fadeInOutAnimation 1s infinite;
|
||||
animation-direction: alternate;
|
||||
animation-timing-function: linear;
|
||||
}
|
||||
|
||||
.theDetailsPanel {
|
||||
margin-left: 5px;
|
||||
margin-right: 5px;
|
||||
border-left: 1px solid #cdcdcd;
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.theDetailsPanel .accordion-group {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
.box-table-diplay-project {
|
||||
border: 1px solid #96a5b5;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 5px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.box-table-diplay-project td {
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.display-date {
|
||||
color: red;
|
||||
background-color: #f7f7f9;
|
||||
padding: 2px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.no_modal_body_max_height .modal-body {
|
||||
max-height: 90% !important;
|
||||
}
|
||||
|
||||
|
||||
/** OVERRDING legend-style into 'metadata-profile-form-builder-widget' */
|
||||
|
||||
.legend-style {
|
||||
width: auto !important;
|
||||
padding-left: 10px !important;
|
||||
padding-top: 0px !important;
|
||||
padding-right: 10px !important;
|
||||
margin-bottom: 0px !important;
|
||||
border-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.legend-style small {
|
||||
display: block;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
/** END OVERRDING legend-style into 'metadata-profile-form-builder-widget' */
|
||||
|
||||
|
||||
/** OVERRDING legend-style into 'metadata-profile-form-builder-widget' */
|
||||
|
||||
.legend-style {
|
||||
width: auto !important;
|
||||
padding-left: 10px !important;
|
||||
padding-top: 0px !important;
|
||||
padding-right: 10px !important;
|
||||
margin-bottom: 0px !important;
|
||||
border-bottom: 0px !important;
|
||||
}
|
||||
|
||||
.legend-style small {
|
||||
display: block;
|
||||
font-size: 12px !important;
|
||||
}
|
||||
|
||||
/** END OVERRDING legend-style into 'metadata-profile-form-builder-widget' */
|
|
@ -64,6 +64,7 @@
|
|||
Your web browser must have JavaScript enabled in order for this
|
||||
application to display correctly.</div>
|
||||
</noscript>
|
||||
<div id="geoportal-loaders"></div>
|
||||
<div id="geoportal-data-entry"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -45,5 +45,5 @@
|
|||
<!-- <script type="text/javascript"
|
||||
src='<%=request.getContextPath()%>/js/jquery.autosize.js'></script> -->
|
||||
|
||||
|
||||
<div id="geoportal-loaders"></div>
|
||||
<div id="geoportal-data-entry"></div>
|
|
@ -1,5 +1,5 @@
|
|||
<display>
|
||||
<category name="gCube Applications">
|
||||
<portlet id="GeoPortalDataEntryAppPortlet" />
|
||||
<portlet id="GeoPortalDataEntryApplication" />
|
||||
</category>
|
||||
</display>
|
|
@ -1,4 +1,4 @@
|
|||
name=GeoPortalDataEntryAppPortlet
|
||||
name=GeoPortalDataEntryApplication
|
||||
module-group-id=liferay
|
||||
module-incremental-version=2
|
||||
tags=
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<liferay-portlet-app>
|
||||
<portlet>
|
||||
<portlet-name>GeoPortalDataEntryAppPortlet</portlet-name>
|
||||
<portlet-name>GeoPortalDataEntryApplication</portlet-name>
|
||||
<layout-cacheable>false</layout-cacheable>
|
||||
<instanceable>false</instanceable>
|
||||
<ajaxable>false</ajaxable>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<portlet-app>
|
||||
<portlet>
|
||||
<description>GeoPortalDataEntryApp Portlet</description>
|
||||
<portlet-name>GeoPortalDataEntryAppPortlet</portlet-name>
|
||||
<display-name>GeoPortal-DataEntry-Portlet</display-name>
|
||||
<description>GeoPortalDataEntry Application</description>
|
||||
<portlet-name>GeoPortalDataEntryApplication</portlet-name>
|
||||
<display-name>GeoPortal-DataEntry-App</display-name>
|
||||
<portlet-class>org.gcube.portlets.user.geoportaldataentry.portlet.GeoPortalDataEntryAppPortlet
|
||||
</portlet-class>
|
||||
<expiration-cache>0</expiration-cache>
|
||||
|
@ -12,8 +12,8 @@
|
|||
<portlet-mode>VIEW</portlet-mode>
|
||||
</supports>
|
||||
<portlet-info>
|
||||
<title>GeoPortal Data Entry Portlet</title>
|
||||
<short-title>GeoPortal Data Entry Portlet</short-title>
|
||||
<title>GeoPortal DataEntry Application</title>
|
||||
<short-title>GeoPortal DataEntry Application</short-title>
|
||||
</portlet-info>
|
||||
<portlet-preferences>
|
||||
<preference>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue