Compare commits

..

5 Commits

121 changed files with 1553 additions and 17718 deletions

View File

@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/geoportal-data-entry-app-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
@ -31,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes"/>
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.2.0
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-1.1.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,11 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.source=1.7

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="jst.web" version="3.0"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.jaxrs" version="1.1"/>
<installed facet="java" version="1.8"/>
</faceted-project>

View File

@ -4,132 +4,35 @@
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).
## [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
## [v1.2.0-SNAPSHOT] - 2020-12-18
#### 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
- [#20435] Client integration with MongoConcessioni
- Moved to maven-portal-bom 3.6.3
- [#21856] Implemented new user feedback
- [#21890] Passed to mongoID
- [#20599] Get List of Records
- [#22002] Integrated with ValidationReport and status
- [#21990] Provide the (first version of) edit mode
- [#22040] Revisited the "Abstract Relazione di Scavo"
## [v1.2.0] - 2020-12-18
#### Enhancements
- [#20357] new requirements
[#20357] new requirements
## [v1.1.0] - 2020-12-1
#### Enhancements
- [#20210] Updating required for data entry facility after the first feedback by domain experts
[#20210] Updating required for data entry facility after the first feedback by domain experts
## [v1.0.2] - 2020-11-09
## [v1.0.2-SNAPSHOT] - 2020-11-09
#### Bug fixes
- [#20092] Repeatible form: validate the card after the create event is fired
[#20092] Repeatible form: validate the card after the create event is fired
## [v1.0.1] - 2020-11-04
#### Bug fixes
- [#20063] Fixes for data-entry components
[#20063] Fixes for data-entry components
## [v1.0.0] - 2020-10-07
- [#19916] First release
[#19916] First release

View File

@ -1,58 +1,15 @@
# GeoPortal Data Entry App
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).
The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project
## Built With
* [OpenJDK](https://openjdk.java.net/) - The JDK used
* [Maven](https://maven.apache.org/) - Dependency Management
**Uses**
* 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 lArcheologia (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
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" />
N/A
## Change log

123
pom.xml
View File

@ -7,16 +7,16 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.2.0</version>
<version>1.1.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging>
<version>3.2.2</version>
<version>1.2.0-SNAPSHOT</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 create projects/documents (based on UCD) in the D4Science Geoportal service</description>
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to GeoNa project</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,12 +25,12 @@
<properties>
<!-- Convenience property to set the GWT version -->
<gwt.version>2.9.0</gwt.version>
<gwtVersion>2.7.0</gwtVersion>
<!-- GWT needs at least java 1.6 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
@ -51,7 +51,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.7.0</version>
<version>3.6.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -59,31 +59,16 @@
</dependencyManagement>
<dependencies>
<!-- needed to compile with gwt > 2.7 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<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>${gwt.version}</version>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -91,42 +76,17 @@
<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>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<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>
<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>
@ -157,29 +117,19 @@
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<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>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<artifactId>geoportal-logic</artifactId>
<version>[1.0.8, 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>
@ -224,27 +174,12 @@
<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>
@ -252,29 +187,13 @@
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>${gwt.version}</version>
<version>${gwtVersion}</version>
<executions>
<execution>
<goals>
@ -308,10 +227,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>

View File

@ -12,19 +12,11 @@
<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' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

View File

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

View File

@ -1,96 +1,15 @@
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.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 6, 2021
*/
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 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 ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!";
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 ACTION_PERFORMED_ON_ITEM.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 25, 2021
*/
public enum ACTION_PERFORMED_ON_ITEM {
UPDATED_PROJECT
}
public static final List<String> HANDLERS_IDS = Arrays.asList(GEOPORTAL_DATA_HANDLER.geoportal_data_list.getId(),
GEOPORTAL_DATA_HANDLER.geoportal_data_entry.getId());
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());
}
}
}
}

View File

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

View File

@ -2,239 +2,31 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List;
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.application.geoportalcommon.shared.GeoNaItemRef;
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.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/**
* The client side stub for the RPC service.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
*/
@RemoteServiceRelativePath("geoportaldataentryservice")
public interface GeoportalDataEntryService extends RemoteService {
/**
* Save geona data forms.
*
* @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(String profileID, Tree_Node<GeoNaFormDataObject> tree_Node,
List<String> stepsOnPostCreation) throws Exception;
CommitReport saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects) throws Exception;
/**
* Gets the geona init config.
*
* @return the geona init config
*/
GeoportalISConfig getGeonaInitConfig();
GeonaISConfig getGeonaInitConfig();
/**
* Gets the links for.
*
* @param itemId the item id
* @param profileID the profile ID
* @param itemId the item id
* @param recordType the record type
* @return the links for
* @throws Exception the exception
*/
GeoportalItemReferences getLinksFor(String itemId, String profileID) throws Exception;
/**
* 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 projects
* @throws Exception the exception
*/
public ResultSetPaginatedData getListProjects(String theProfileID, Integer start, Integer limit,
SearchingFilter filter, boolean reloadFromService) throws Exception;
/**
* Gets the JSON record.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the JSON record
* @throws Exception the exception
*/
String getJSONDocumentInTheProject(String profileID, String projectID) throws Exception;
/**
* Update record.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param jsonUpdate the json update
* @return the project DV
* @throws Exception the exception
*/
ProjectDV updateRecord(String profileID, String projectID, String jsonUpdate) throws Exception;
/**
* Read data viewer config.
*
* @return the GNA data entry ext config profile
* @throws Exception the exception
*/
GNADataEntryExtendedConfigProfile readDataViewerConfig() throws Exception;
/**
* Gets the list use case descriptors.
*
* @param handlersIds the handlers ids
* @return the list use case descriptors
* @throws Exception the exception
*/
List<UseCaseDescriptorDV> getListUseCaseDescriptors(List<String> handlersIds) throws Exception;
/**
* Gets the lifecycle info for project id.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the lifecycle info for project id
* @throws Exception the 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;
GeoNaItemRef getLinksFor(Long itemId, String recordType) throws Exception;
}

View File

@ -2,100 +2,45 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List;
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.application.geoportalcommon.shared.GeoNaItemRef;
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.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* The Interface GeoportalDataEntryServiceAsync.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 1, 2022
*/
public interface GeoportalDataEntryServiceAsync {
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 getGeonaInitConfig(AsyncCallback<GeoportalISConfig> callback);
void saveGeonaDataForms(List<GeoNaFormDataObject> listGeonaFormObjects, AsyncCallback<CommitReport> callback);
void getLinksFor(String itemId, String profileID, AsyncCallback<GeoportalItemReferences> callback);
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
void deleteProject(String profileID, String projectID, AsyncCallback<Boolean> callback);
void getJSONDocumentInTheProject(String profileID, String projectID, AsyncCallback<String> callback);
void updateRecord(String profileID, String projectID, String jsonUpdate, AsyncCallback<ProjectDV> callback);
void readDataViewerConfig(AsyncCallback<GNADataEntryExtendedConfigProfile> asyncCallback);
void getListUseCaseDescriptors(List<String> handlersIds, AsyncCallback<List<UseCaseDescriptorDV>> callback);
void getLifecycleInfoForProjectId(String profileID, String projectID,
AsyncCallback<LifecycleInformationDV> callback);
void performActionSteps(String profileID, String projectID, ActionDefinitionDV action,
AsyncCallback<ProjectDV> 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 getProjectByID(String profileID, String projectID, AsyncCallback<ProjectDV> callback);
void getResultDocumentFoProjectByID(String profileID, String projectID, AsyncCallback<ResultDocumentDV> 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 getProjectEdit(String profileID, String projectID, AsyncCallback<ProjectEdit> callback);
void getProjectView(String profileID, String projectID, AsyncCallback<ProjectView> callback);
void getLinksFor(Long itemId, String recordType, AsyncCallback<GeoNaItemRef> callback);
}

View File

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

View File

@ -1,68 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ClickItemEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 22, 2021
* @param <T> the generic type
*/
public class ClickItemEvent<T> extends GwtEvent<ClickItemEventHandler> {
public static Type<ClickItemEventHandler> TYPE = new Type<ClickItemEventHandler>();
private List<T> selectItems;
/**
* Instantiates a new click item event.
*
* @param selectItems the select items
*/
public ClickItemEvent(List<T> selectItems) {
this.selectItems = selectItems;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<ClickItemEventHandler> 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(ClickItemEventHandler handler) {
handler.onClick(this);
}
/**
* Gets the select items.
*
* @return the select items
*/
public List<T> getSelectItems() {
return selectItems;
}
}

View File

@ -1,21 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ClickItemEventHandler.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jul 6, 2015
*/
public interface ClickItemEventHandler extends EventHandler {
/**
* On click.
*
* @param <T> the generic type
* @param moreInfoShowEvent the more info show event
*/
<T> void onClick(ClickItemEvent<T> moreInfoShowEvent);
}

View File

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

View File

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

View File

@ -1,40 +1,25 @@
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)
*
* Mar 17, 2022
* Oct 13, 2020
*/
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 creates the new project event.
*
* @param handler the handler
* @param listGcubeProfiles the list gcube profiles
* Instantiates a new cancel upload event.
*/
// (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;
public CreateNewProjectEvent() {
}
/**
@ -42,9 +27,7 @@ public class CreateNewProjectEvent extends GwtEvent<CreateNewProjectEventHandler
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
@ -57,33 +40,12 @@ 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;
}
}

View File

@ -1,128 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class CreateNewProjectEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler> {
/** The type. */
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
private SearchingFilter searchingFilter;
private String profileID;
private String projectName;
private Boolean reloadFilteringParameters = false;
private boolean onApplicationInit = false;
/**
* 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(boolean onApplicationInit, String profileID, SearchingFilter searchingFilter,
Boolean reloadFilteringParameters) {
this.onApplicationInit = onApplicationInit;
this.searchingFilter = searchingFilter;
this.profileID = profileID;
this.reloadFilteringParameters = reloadFilteringParameters;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<GetListOfRecordsEventHandler> 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(GetListOfRecordsEventHandler handler) {
handler.onGetList(this);
}
/**
* Gets the searching filter.
*
* @return the searching filter
*/
public SearchingFilter getSearchingFilter() {
return searchingFilter;
}
/**
* 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();
}
}

View File

@ -1,22 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface GetListOfRecordsEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
*/
public interface GetListOfRecordsEventHandler extends EventHandler {
/**
* On get list.
*
* @param getListOfRecordsEvent the get list of records event
*/
void onGetList(GetListOfRecordsEvent getListOfRecordsEvent);
}

View File

@ -1,106 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List;
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 OperationOnItemEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 15, 2021
* @param <T> the generic type
*/
public class OperationOnItemEvent<T extends DocumentDV> extends GwtEvent<OperationOnItemEventHandler> {
public static Type<OperationOnItemEventHandler> TYPE = new Type<OperationOnItemEventHandler>();
private List<T> selectItems;
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 OperationOnItemEvent(List<T> selectItems, OPERATION_ON_ITEM doAction) {
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<OperationOnItemEventHandler> 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(OperationOnItemEventHandler handler) {
handler.onDoActionFired(this);
}
/**
* Gets the select items.
*
* @return the select items
*/
public List<T> getSelectItems() {
return selectItems;
}
/**
* Gets the action.
*
* @return the action
*/
public OPERATION_ON_ITEM getAction() {
return action;
}
public void setSourceElement(Element element) {
this.sourceElement = element;
}
public Element getSourceElement() {
return sourceElement;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("OperationOnItemEvent [selectItems=");
builder.append(selectItems);
builder.append(", action=");
builder.append(action);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,23 +0,0 @@
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 OperationOnItemEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 5, 2021
*/
public interface OperationOnItemEventHandler extends EventHandler {
/**
* On do action fired.
*
* @param <T> the generic type
* @param showItemEvent the show item event
*/
<T extends DocumentDV> void onDoActionFired(OperationOnItemEvent<T> showItemEvent);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,8 @@
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;
@ -11,24 +12,22 @@ 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 Tree_Node<GeoNaFormDataObject> treeNode;
private String profileID;
private List<GeoNaFormDataObject> listGeonaDataForms;
/**
* Instantiates a new save geona data forms event.
*
* @param profileID the profile ID
* @param treeNode the tree node
* @param listGeonaDataForms the list geona data forms
*/
public SaveGeonaDataFormsEvent(String profileID, Tree_Node<GeoNaFormDataObject> treeNode) {
this.treeNode = treeNode;
this.profileID = profileID;
public SaveGeonaDataFormsEvent(List<GeoNaFormDataObject> listGeonaDataForms) {
this.listGeonaDataForms = listGeonaDataForms;
}
/**
@ -36,9 +35,7 @@ public class SaveGeonaDataFormsEvent extends GwtEvent<SaveGeonaDataFormsHandler>
*
* @return the associated type
*/
/*
* (non-Javadoc)
*
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
@ -51,29 +48,16 @@ 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 Tree_Node<GeoNaFormDataObject> getTreeNode() {
return treeNode;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
public List<GeoNaFormDataObject> getListGeonaDataForms() {
return listGeonaDataForms;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -1,110 +0,0 @@
@def selectionBorderWidth 1px ; .cellTableWidget {
}
.cellTableFirstColumn {
}
.cellTableLastColumn {
}
.cellTableFooter {
}
.cellTableHeader {
}
.cellTableCell {
}
.cellTableFirstColumnFooter {
}
.cellTableFirstColumnHeader {
}
.cellTableLastColumnFooter {
}
.cellTableLastColumnHeader {
}
.cellTableSortableHeader {
}
.cellTableSortableHeader:hover {
}
.cellTableSortedHeaderAscending {
}
.cellTableSortedHeaderDescending {
}
.cellTableEvenRow {
}
.cellTableEvenRowCell {
}
.cellTableOddRow {
}
.cellTableOddRowCell {
}
.cellTableHoveredRow {
background: #D9EDF7 !important;
cursor: pointer;
}
.cellTableHoveredRowCell {
background: #D9EDF7 !important;
cursor: pointer;
}
.cellTableKeyboardSelectedRow, .cellTableKeyboardSelectedRow td, .cellTableKeyboardSelectedRow th {
background: #3A87AD !important;
}
.cellTableSelectedRow, .cellTableSelectedRow td, .cellTableSelectedRow th
{
/* background: #D9EDF7 !important; */
/* color: white !important; */
/* height: auto; */
/* overflow: auto; */
}
.cellTableSelectedRowCell, .cellTableSelectedRow td.cellTableSelectedRowCell {
background: #3A87AD !important;
}
.cellTableKeyboardSelectedRowCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedRowCell{
background: #3A87AD !important;
}
.cellTableKeyboardSelectedCell, .cellTableKeyboardSelectedRow td.cellTableKeyboardSelectedCell{
background: #3A87AD !important;
color: white !important;
}
.cellTableLoading {
margin: 30px;
}

View File

@ -1,23 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.resource;
import com.github.gwtbootstrap.client.ui.CellTable;
import com.github.gwtbootstrap.client.ui.CellTable.Resources;
import com.google.gwt.core.shared.GWT;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Jun 23, 2015
*/
public interface CellTableResources extends Resources {
public CellTableResources INSTANCE = GWT.create(CellTableResources.class);
// The styles used in this widget.
@Override
@Source("CellTable.css")
CellTable.Style cellTableStyle();
}

View File

@ -10,10 +10,4 @@ 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.

Before

Width:  |  Height:  |  Size: 962 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

View File

@ -0,0 +1,179 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.portlets.user.geoportaldataentry.client.events.SaveGeonaDataFormsEvent;
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.shared.GeoNaFormDataObject;
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.constants.AlertType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
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.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.Widget;
public class GeonaDataEntryMainForm extends Composite {
private static GeonaDataEntryMainFormUiBinder uiBinder = GWT.create(GeonaDataEntryMainFormUiBinder.class);
interface GeonaDataEntryMainFormUiBinder extends UiBinder<Widget, GeonaDataEntryMainForm> {
}
private List<GeoNaFormCardModel> listCards = new ArrayList<GeoNaFormCardModel>();
@UiField
HTMLPanel mainHTMLPanel;
@UiField
TabPanel mainTabPanel;
@UiField
AlertBlock alertFormAction;
@UiField
Button buttonSave;
private LinkedHashMap<String,MetadataFormCard> mapForms = new LinkedHashMap<String,MetadataFormCard>();
private List<Tab> listTabs = new ArrayList<Tab>();
private HandlerManager appManagerBus;
public GeonaDataEntryMainForm(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
}
public void addForm(String tabHeading, GeoNaFormCardModel geonFormModel){
listCards.add(geonFormModel);
createNewCard(tabHeading, geonFormModel);
}
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);
}
mapForms.put(tabHeading, mfc);
}
public void reset() {
mapForms.clear();
mainTabPanel.clear();
listTabs.clear();
}
public void selectTab(int index){
GWT.log("Selecting tab index: "+ index +" of "+listTabs.size());
if(listTabs.size()<index) {
mainTabPanel.selectTab(index);
}
}
@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 {
showAlertOnSaveAction("Detected errors, please fix it/them", AlertType.ERROR, true);
}
//Window.alert("I can save: "+listGeonaFormObjects);
}
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);
if(hideAfterAWhile){
// hide after some seconds
Timer t = new Timer() {
@Override
public void run() {
alertFormAction.setVisible(false);
}
};
t.schedule(10000);
}
}
public void enableButtonSave(boolean enabled) {
buttonSave.setEnabled(enabled);
}
/**
* Sets the ative after.
*
* @param index the index
* @param bool the 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);
// }
// }
}
}

View File

@ -0,0 +1,19 @@
<!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: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>
<b:Button type="PRIMARY" icon="SAVE" ui:field="buttonSave">Save</b:Button>
</b:FormActions>
<!-- </b:AlertBlock> -->
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,80 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.LoaderIcon;
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.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
// TODO: Auto-generated Javadoc
/**
* The Class GeonaMainPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
public class GeonaMainPanel extends Composite {
/** The geona main form panel. */
@UiField
HTMLPanel geonaMainFormPanel;
/** The loader. */
@UiField
LoaderIcon loader;
@UiField
GeonaNavigationBar geonaNavigationBar;
private HandlerManager appManagerBus;
/** The ui binder. */
private static GeonaMainPanelUiBinder uiBinder = GWT.create(GeonaMainPanelUiBinder.class);
/**
* The Interface GeonaMainPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 13, 2020
*/
interface GeonaMainPanelUiBinder extends UiBinder<Widget, GeonaMainPanel> {
}
/**
* Instantiates a new geona main panel.
* @param appManagerBus
*/
public GeonaMainPanel(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
geonaNavigationBar.setAppManagerBus(appManagerBus);
}
/**
* Adds the form panel.
*
* @param formPanel the form panel
*/
public void addFormPanel(GeonaDataEntryMainForm formPanel) {
geonaMainFormPanel.add(formPanel);
}
/**
* Sets the loader visible.
*
* @param txtHTML the txt HTML
* @param visible the visible
*/
public void setLoaderVisible(String txtHTML, boolean visible){
loader.setText(txtHTML);
loader.setVisible(visible);
}
}

View File

@ -0,0 +1,27 @@
<!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;
}
.custom-page-header {
padding: 10px;
background-color: #f5f5f5;
margin-bottom: 10px;
border: 1px solid #eee;
}
</ui:style>
<g:HTMLPanel ui:field="geonaMainPanel">
<b:PageHeader subtext="data entry facility"
styleName="{style.custom-page-header}">GeoNa</b:PageHeader>
<m:GeonaNavigationBar ui:field="geonaNavigationBar"></m:GeonaNavigationBar>
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
<g:HTMLPanel ui:field="geonaMainFormPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,698 +0,0 @@
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.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.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.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.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.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class GeonaMainTabPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
public class GeonaMainTabPanel extends Composite {
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
/**
* The Interface GeonaMainTabPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 21, 2022
*/
interface GeonaMainTabPanelUiBinder extends UiBinder<Widget, GeonaMainTabPanel> {
}
/** The geona main form panel. */
@UiField
HTMLPanel geonaMainFormPanel;
/** The geona main form panel. */
@UiField
HTMLPanel contTabNewProject;
/** The loader. */
@UiField
LoaderIcon loader;
@UiField
TabPanel tabPanel;
@UiField
Tab tabNewProject;
@UiField
Tab tabGetListOfProjects;
@UiField
NavLink navViewAsDocument;
@UiField
NavLink navViewAsJSON;
@UiField
NavLink navShowOnMap;
@UiField
NavLink navShowReport;
@UiField
NavLink navEditMode;
@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 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 app manager bus
*/
public GeonaMainTabPanel(HandlerManager appManagerBus) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
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");
theDockLayoutPanel.setHeight((height - 40) + "px");
detailsPanel.setHeight((height - 90) + "px");
}
/**
* Bind events.
*/
private void bindEvents() {
tabGetListOfProjects.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// instanceAndShowListOfProjects(false);
}
});
navShowOnMap.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_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));
}
});
navShowReport.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_REPORT));
}
});
navEditMode.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.EDIT_PROJECT));
}
});
navDelete.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.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);
}
/**
* Adds the form panel.
*
* @param formPanel the form panel
*/
public void addFormPanel(GeonaDataEntryMainForm formPanel) {
geonaMainFormPanel.add(formPanel);
}
/**
* Show list of projects view.
*
* @param grpw the grpw
*/
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
this.grpw = grpw;
listOfProjectTablePanel.showListOfProjectsView(grpw);
}
/**
* Sets the loader visible.
*
* @param txtHTML the txt HTML
* @param visible the visible
*/
public void setLoaderVisible(String txtHTML, boolean visible) {
loader.setText(txtHTML);
loader.setVisible(visible);
}
/**
* Gets the current projects searching filter.
*
* @return the current projects searching filter
*/
public SearchingFilter getCurrentProjectsSearchingFilter() {
return listOfProjectTablePanel.builtSearchingFilter();
}
/**
* Removes the tab.
*
* @param index the index
*/
public void removeTab(int index) {
tabPanel.remove(index);
}
/**
* Sets the tab active.
*
* @param index the new tab active
*/
public void setTabActive(int index) {
tabPanel.selectTab(index);
}
/**
* 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);
}
}
}

View File

@ -1,132 +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"
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;
}
.custom-page-header {
background-color: #f5f5f5;
margin-bottom: 10px;
border: 1px solid #eee;
}
.custom-page-header h1 {
font-size: 32px;
}
.margin-top-5 {
margin-top: 5px !important;
}
.float-right {
display: block;
width: 100%;
font-size: 12px;
text-align: right;
}
.display-right {
float: right;
margin-right: 20px;
}
.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}" 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="nav-toolbar-style">
<b:Brand addStyleNames="{style.margin-top-5}">New Project</b:Brand>
<b:Nav>
<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 addStyleNames="{style.float-right}">
<div id="bottomPage"></div>
<a href="#topPage">Go to top</a>
</g:HTMLPanel>
</g:HTMLPanel>
</g:ScrollPanel>
</b:Tab>
<b:Tab icon="TABLE" heading="List of Projects"
ui:field="tabGetListOfProjects">
<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">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:DockLayoutPanel ui:field="theDockLayoutPanel">
</g:DockLayoutPanel>
</g:FlowPanel>
</b:Tab>
</b:TabPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,58 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.shared.EventBus;
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.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
public class GeonaNavigationBar extends Composite {
private static GeonaNavigationBarUiBinder uiBinder = GWT.create(GeonaNavigationBarUiBinder.class);
interface GeonaNavigationBarUiBinder extends UiBinder<Widget, GeonaNavigationBar> {
}
private EventBus eventBus;
public GeonaNavigationBar() {
initWidget(uiBinder.createAndBindUi(this));
}
private void bindEvents() {
// TODO Auto-generated method stub
}
@UiField
NavLink linkCreateNewProject;
private HandlerManager appManagerBus;
public GeonaNavigationBar(String firstName) {
initWidget(uiBinder.createAndBindUi(this));
}
@UiHandler("linkCreateNewProject")
void onClick(ClickEvent e) {
appManagerBus.fireEvent(new CreateNewProjectEvent());
}
/**
* Sets the app manager bus.
*
* @param appManagerBus the new app manager bus
*/
public void setAppManagerBus(HandlerManager appManagerBus) {
this.appManagerBus = appManagerBus;
}
}

View File

@ -2,14 +2,17 @@
<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>
<g:HTMLPanel>
<b:Navbar>
<b:Nav>
<b:NavLink ui:field="linkCreateNewProject"
title="Create a new Project">Create new Project</b:NavLink>
</b:Nav>
</b:Navbar>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,366 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui;
import java.util.ArrayList;
import java.util.List;
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 com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.AsyncDataProvider;
import com.google.gwt.view.client.HasData;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.Range;
import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
/**
* The Class GeonaRecordsPaginatedView.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Aug 4, 2021
*/
public class GeonaRecordsPaginatedView {
private static final int ITEM_START_INDEX = 0;
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<DocumentDV> itemsTable;
private MyCustomDataProvider<DocumentDV> dataProvider = new MyCustomDataProvider<DocumentDV>();
protected Widget orginalLoadingIndicator = null;
private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
private HandlerManager eventBus;
private SearchingFilter currentSearchingFilter;
private String profileID;
/**
* Instantiates a new geona records paginated view.
*
* @param eventBus the eventbus
* @param profileID the profile ID
* @param displayFields the display fields
* @param currentSearchingFilter the current searching filter
*/
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<DocumentDV>(eventBus, displayFields);
itemsTable.initTable(null, null, dataProvider);
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
initPagination(ITEMS_PER_PAGE);
loadItemsForType(profileID);
}
/**
* Gets the table data provider.
*
* @return the table data provider
*/
public AsyncDataProvider<DocumentDV> getTableDataProvider() {
return (AsyncDataProvider<DocumentDV>) getCellTable().getDataProvider();
}
/**
* Gets the cell tale.
*
* @return the cell tale
*/
private SortedCellTable<DocumentDV> getCellTable() {
return itemsTable.getCellTable();
}
/**
* Inits the pagination.
*
* @param itemsPerPage the items per page
*/
public void initPagination(int itemsPerPage) {
SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);
SimplePager pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0, true);
pager.setDisplay(getCellTable());
pager.setPageSize(itemsPerPage);
pager.getElement().getStyle().setProperty("margin", "auto");
vPanel.add(loadingPanel);
vPanel.add(getCellTable());
vPanel.getElement().addClassName("vPanel");
pagerPanel.add(pager);
}
/**
* Load new page.
*
* @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(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 + "]");
int newStartIndex = startIdx;
if (resetStore) {
GWT.log("Cleaning all data...");
newStartIndex = 0;
GWT.log("Store reset performed start index is: " + newStartIndex);
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
}
loadProjects(profileID, newStartIndex, limit, currentSearchFilter, invalidCache);
}
/**
* Load items for type.
*
* @param profileID the profile ID
*/
private void loadItemsForType(String profileID) {
this.profileID = profileID;
getCellTable().setVisibleRangeAndClearData(new Range(ITEM_START_INDEX, ITEMS_PER_PAGE), false);
loadNewPage(profileID, ITEM_START_INDEX, ITEMS_PER_PAGE, true, currentSearchingFilter, true);
}
/**
* Sets the new page result.
*
* @param result the new new page result
*/
private void setNewPageResult(ResultSetPaginatedData result) {
GWT.log("setNewPageResult: " + result);
// serverStartIndex = result.getServerEndIndex();
SelectionModel<? super DocumentDV> sm = getCellTable().getSelectionModel();
if (sm instanceof SingleSelectionModel) {
SingleSelectionModel<? super DocumentDV> ssm = (SingleSelectionModel<DocumentDV>) sm;
ssm.clear();
} else if (sm instanceof MultiSelectionModel) {
MultiSelectionModel<? super DocumentDV> msm = (MultiSelectionModel<DocumentDV>) sm;
msm.clear();
}
getTableDataProvider().updateRowCount((int) result.getTotalItems(), true);
// TODO MUST USE PROJECT
getTableDataProvider().updateRowData(result.getClientStartIndex(), (List<DocumentDV>) result.getData());
if (result.getData().size() == 0) {
getCellTable().setLoadingIndicator(new Label("No data"));
} else {
getCellTable().setLoadingIndicator(orginalLoadingIndicator);
}
GWT.log("Updating row data startIndex: " + result.getClientStartIndex() + " children size: "
+ result.getData().size());
GWT.log("getAsycnDataProvider().getDataDisplays().size(): " + getCellTable().getRowCount());
if (result.isServerSearchFinished()) {
GWT.log("Search finished!!!");
getTableDataProvider().updateRowCount(getCellTable().getRowCount(), true);
}
// 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());
}
}
/**
* 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 searchFilter the search filter
* @param invalidCache the invalid cache
*/
private <T> void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter searchFilter,
boolean invalidCache) {
showLoading(true);
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) {
showLoading(false);
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(ResultSetPaginatedData result) {
showLoading(false);
setNewPageResult(result);
}
});
}
/**
* Select items.
*
* @param select the select
* @param limitToPage the limit to page
*/
public void selectItems(boolean select, boolean limitToPage) {
SortedCellTable<DocumentDV> table = getCellTable();
int rowSize = table.getVisibleItemCount();
for (int i = 0; i < rowSize; 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<DocumentDV> getSelectItems() {
return itemsTable.getSelectedItems();
}
/**
* A custom {@link AsyncDataProvider}.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 5, 2017
* @param <T> the generic type
*/
public class MyCustomDataProvider<T> extends AsyncDataProvider<T> {
/**
* {@link #onRangeChanged(HasData)} is called when the table requests a new
* range of data. You can push data back to the displays using
* {@link #updateRowData(int, List)}.
*
* @param display the display
*/
@Override
public void onRangeChanged(HasData<T> display) {
// Get the new range.
final Range range = display.getVisibleRange();
int start = range.getStart();
int length = range.getLength();
if (initClassFirstRangeChanged) {
GWT.log("initClassFirstRangeChanged is true.. returning");
initClassFirstRangeChanged = false;
return;
}
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
loadNewPage(profileID, start, length, false, currentSearchingFilter, false);
}
}
/**
* Gets the pager panel.
*
* @return the pager panel
*/
public VerticalPanel getCellPanel() {
return vPanel;
}
/**
* Set the panel in loading mode.
*
* @param show the show
*/
protected void showLoading(boolean show) {
loadingPanel.setVisible(show);
}
/**
* Gets the pager panel.
*
* @return the pager panel
*/
public FlowPanel getPagerPanel() {
return pagerPanel;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
}

View File

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

View File

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

View File

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

View File

@ -1,26 +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;
}
.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>

View File

@ -1,35 +1,32 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.card;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.portlets.user.geoportaldataentry.client.ProjectFormCard;
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
public class GeoNaFormCardModel<T extends MetaDataProfileBean> {
public class GeoNaFormCardModel {
private T metadataProfileBean;
private MetaDataProfileBean metadataProfileBean;
private CreateMetadataForm metadataForm;
private ProjectFormCard formCard; // matching with metadata profile
private GcubeProfileDV gcubeProfile;
private ConcessioniFormCardTitle formCardTitle; //matching with metadata profile type
public GeoNaFormCardModel() {
}
public GeoNaFormCardModel(T metadataProfileBean, CreateMetadataForm metadataForm, ProjectFormCard formCard,
GcubeProfileDV gcubeProfile) {
public GeoNaFormCardModel(MetaDataProfileBean metadataProfileBean, CreateMetadataForm metadataForm,
ConcessioniFormCardTitle formCardTitle) {
super();
this.metadataProfileBean = metadataProfileBean;
this.metadataForm = metadataForm;
this.formCard = formCard;
this.gcubeProfile = gcubeProfile;
this.formCardTitle = formCardTitle;
}
public T getMetadataProfileBean() {
public MetaDataProfileBean getMetadataProfileBean() {
return metadataProfileBean;
}
public void setMetadataProfileBean(T metadataProfileBean) {
public void setMetadataProfileBean(MetaDataProfileBean metadataProfileBean) {
this.metadataProfileBean = metadataProfileBean;
}
@ -41,35 +38,18 @@ public class GeoNaFormCardModel<T extends MetaDataProfileBean> {
this.metadataForm = metadataForm;
}
public ProjectFormCard getFormCard() {
return formCard;
public ConcessioniFormCardTitle getFormCardTitle() {
return formCardTitle;
}
public void setFormCard(ProjectFormCard formCard) {
this.formCard = formCard;
}
public GcubeProfileDV getGcubeProfile() {
return gcubeProfile;
}
public void setGcubeProfile(GcubeProfileDV gcubeProfile) {
this.gcubeProfile = gcubeProfile;
public void setFormCardTitle(ConcessioniFormCardTitle formCardTitle) {
this.formCardTitle = formCardTitle;
}
@Override
public String toString() {
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();
return "GeoNaForm [metadataProfileBean=" + metadataProfileBean + ", metadataForm=" + metadataForm
+ ", formCardTitle=" + formCardTitle + "]";
}
}

View File

@ -3,70 +3,63 @@ 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.
*
@ -75,7 +68,7 @@ public class MetadataFormCard {
@Override
public void onFormDataValid(GenericDatasetBean genericDatasetBean) {
setTabStatus();
}
/**
@ -84,7 +77,7 @@ public class MetadataFormCard {
@Override
public void onFormDataEdit() {
resetTabStatus();
}
/**
@ -93,58 +86,38 @@ 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;
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);
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);
}
/**
@ -152,74 +125,62 @@ public class MetadataFormCard {
*
* @param createMetadataForm the create metadata form
*/
private void buildCard(final CreateMetadataForm createMetadataForm, boolean repeatibleFormIsRemovable) {
if (repeatible) {
private void buildCard(final CreateMetadataForm createMetadataForm) {
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, 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();
}
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);
}
});
}
tab.add(tabContainer);
addNewForm(createMetadataForm, repeatibleFormIsRemovable);
addNewForm(createMetadataForm);
}
/**
* Adds the new form.
*
* @param newForm the new form
*/
private void addNewForm(final CreateMetadataForm newForm, boolean repeatibleFormIsRemovable) {
tabContainer.insert(newForm, 0);
private void addNewForm(final CreateMetadataForm newForm) {
tabContainer.insert(newForm,0);
listForms.add(newForm);
if (listForms.size() > 1 && repeatibleFormIsRemovable) {
if(listForms.size()>1) {
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.
*
@ -228,7 +189,7 @@ public class MetadataFormCard {
public List<CreateMetadataForm> getListForms() {
return listForms;
}
/**
* Gets the heading.
*
@ -238,6 +199,7 @@ public class MetadataFormCard {
return heading;
}
/**
* Validate form.
*
@ -246,8 +208,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;
}
}
@ -260,41 +222,43 @@ 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;
}

View File

@ -1,257 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit;
import java.util.Arrays;
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.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.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;
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.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;
/**
* The Class EditModeRecord.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 17, 2021
*/
public class EditModeRecord extends Composite {
private static EditModeRecordUiBinder uiBinder = GWT.create(EditModeRecordUiBinder.class);
@UiField
Tab tabRawUpdate;
@UiField
Tab tabUploadFiles;
@UiField
FlowPanel rawUpdatePanel;
@UiField
HTMLPanel filesUpdatePanel;
@UiField
Button buttonJSONUpdate;
private ResultDocumentDV selectedProject;
private JSONEditorWrapper jsEditor;
private HandlerManager appManagerBus;
private final HandlerManager editorManagerBus = new HandlerManager(null);
private int modalHeight;
/**
* The Interface EditModeRecordUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 17, 2021
*/
interface EditModeRecordUiBinder extends UiBinder<Widget, EditModeRecord> {
}
public EditModeRecord(HandlerManager appManagerBus, ResultDocumentDV selectedProject, int modalHeight) {
initWidget(uiBinder.createAndBindUi(this));
this.modalHeight = modalHeight;
this.selectedProject = selectedProject;
this.appManagerBus = appManagerBus;
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();
bindEvents();
}
private void instanceUpdateFilesetEditor() {
// 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); } });
*/
}
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((modalHeight - 160) + "px");
rawUpdatePanel.add(fp);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
GeoPortalDataEntryApp.geoportalDataEntryService.getJSONDocumentInTheProject(
selectedProject.getProfileID(), selectedProject.getId(), new AsyncCallback<String>() {
@Override
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);
}
@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);
}
});
};
});
}
/**
* Bind events.
*/
private void bindEvents() {
buttonJSONUpdate.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
rawUpdatePanel.getElement().addClassName("disable-div");
buttonJSONUpdate.setEnabled(false);
final LoaderIcon loader = new LoaderIcon("Updating the project...");
tabRawUpdate.add(loader);
GeoPortalDataEntryApp.geoportalDataEntryService.updateRecord(selectedProject.getProfileID(),
selectedProject.getId(), jsEditor.getText(), new AsyncCallback<ProjectDV>() {
@Override
public void onFailure(Throwable caught) {
buttonJSONUpdate.setEnabled(true);
try {
rawUpdatePanel.getElement().removeClassName("disable-div");
tabRawUpdate.remove(loader);
} catch (Exception e) {
// TODO: handle exception
}
editorManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
selectedProject.getProfileID(), Arrays.asList(selectedProject),
ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
}
@Override
public void onSuccess(ProjectDV result) {
buttonJSONUpdate.setEnabled(true);
try {
rawUpdatePanel.getElement().removeClassName("disable-div");
tabRawUpdate.remove(loader);
} catch (Exception e) {
// TODO: handle exception
}
DialogInform di = new DialogInform(null, "Project updated!",
"Project ID '" + result.getId() + "' updated correctly");
di.setZIndex(100000);
di.center();
editorManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
selectedProject.getProfileID(), Arrays.asList(selectedProject),
ACTION_PERFORMED_ON_ITEM.UPDATED_PROJECT));
}
});
}
});
editorManagerBus.addHandler(OperationPerformedOnItemEvent.TYPE, new OperationPerformedOnItemEventHandler() {
@Override
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();
appManagerBus.fireEvent(new OperationPerformedOnItemEvent<ResultDocumentDV>(
selectedProject.getProfileID(), (List<ResultDocumentDV>) items, action));
}
}
});
}
}

View File

@ -1,74 +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;
}
.info-panel {
width: 100%;
word-break: break-word;
}
</ui:style>
<g:HTMLPanel>
<b:TabPanel tabPosition="left" ui:field="tabPanel">
<b:Tab icon="CODE" active="true" heading="Project"
ui:field="tabRawUpdate">
<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,
licenzaID and so
on..) reported in
<span style='color: black'>black.</span>
Update only their values
(e.g. "il nome
del
progetto",
"introduzione
del progetto") reported in
<span style='color: green'>green</span>
by the
Editor
<br />
<span>At the end of the changes press the "Update" button to make
them persistent on the service</span>
</p>
</g:HTML>
<g:FlowPanel ui:field="rawUpdatePanel">
</g:FlowPanel>
<b:Button icon="SAVE" type="INFO"
addStyleNames="{style.button-save-style}"
ui:field="buttonJSONUpdate" visible="false">UPDATE</b:Button>
</b:Tab>
<b:Tab icon="UPLOAD_ALT" heading="Manage File/s"
ui:field="tabUploadFiles">
<b:Heading size="3">Manage the file/s</b:Heading>
<b:Label type="INFO">You can choose a section (e.g. "piante") and
manage the existing file/s (by removing it/them) and uploading new one/s</b:Label>
<g:HTML addStyleNames="{style.info-panel}">
<p style='color: #585858'>
At the end of the changes press the "Update" button to
make
them persistent on the service
</p>
</g:HTML>
<g:HTMLPanel ui:field="filesUpdatePanel">
</g:HTMLPanel>
</b:Tab>
</b:TabPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,383 +0,0 @@
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) {
}
}
}

View File

@ -1,70 +0,0 @@
<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>

View File

@ -1,89 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.edit.jseditor;
import com.google.gwt.core.client.JavaScriptObject;
/**
* The Class JSONEditorWrapper.
*
* Wrapper for https://github.com/josdejong/jsoneditor
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 27, 2021
*/
public class JSONEditorWrapper extends JavaScriptObject {
/**
* Instantiates a new JSON editor wrapper.
*/
protected JSONEditorWrapper() {
}
/**
* Inits the.
*
* @param divID the div ID
* @return the JSON editor wrapper
*/
public static native JSONEditorWrapper init(String divID) /*-{
var container = $doc.getElementById(divID);
var options = {
modes : ['code','tree'],
search: true,
onError : function(error) {
console.log("JSONEditorWrapper error: " + error)
}
};
//console.log("container is: " + container);
return new $wnd.JSONEditor(container, options);
}-*/;
/**
* Sets the.
*
* @param json the json
*/
public final native void set(String json) /*-{
var toJSONObject = JSON.parse(json);
// set json
//console.log("displayng JSON: " + toJSONObject);
this.set(toJSONObject);
this.refresh();
}-*/;
/**
* Gets the text.
*
* @return the text
*/
public final native String getText() /*-{
//console.log("this.get(): " +this.getText());
return this.getText();
}-*/;
/**
* On error.
*/
public final native void onError() /*-{
this.onError(error);
}-*/;
/**
* Sets the mode.
*
* @param mode the new mode
*/
public final native void setMode(String mode) /*-{
this.setMode(mode);
}-*/;
/**
* Sets the name.
*
* @param rootName the new name
*/
public final native void setName(String rootName) /*-{
this.setName(rootName);
}-*/;
}

View File

@ -1,397 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.form;
import java.util.Arrays;
import java.util.LinkedHashMap;
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 com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
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;
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 Tree_Node<GeoNaFormCardModel> nodes = new Tree_Node<GeoNaFormCardModel>();
@UiField
HTMLPanel mainHTMLPanel;
@UiField
ScrollPanel treePanel;
@UiField
NavList navbarTree;
@UiField
ScrollPanel inputPanel;
@UiField
AlertBlock alertFormAction;
@UiField
Button duplicateSelected;
@UiField
Button removeSelected;
@UiField
Button buttonSave;
@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));
}
});
}
/**
* Adds the tree.
*
* @param treeItemPanel the tree item panel
*/
public void addTree(TreeItemPanel treeItemPanel) {
this.treeItemPanel = treeItemPanel;
navbarTree.setVisible(true);
treePanel.add(treeItemPanel.getTree());
}
public void removeTree(TreeItemPanel treeItemPanel) {
try {
treePanel.remove(treeItemPanel.getTree());
} catch (Exception e) {
GWT.log("error: "+e.getMessage());
}
}
/**
* 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();
// mainHTMLPanel.clear();
inputPanel.clear();
//inputPanel = new ScrollPanel();
//removeTree(treeItemPanel);
treePanel.clear();
alertFormAction.clear();
alertFormAction.setVisible(false);
//treePanel = new ScrollPanel();
// treePanel = new ScrollPanel();
// listTabs.clear();
}
/**
* 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) {
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);
}
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);
if (hideAfterAWhile) {
// hide after some seconds
Timer t = new Timer() {
@Override
public void run() {
alertFormAction.setVisible(false);
}
};
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
*/
public void setAtiveAfter(int index, boolean bool) {
// if(listTabs.size()<index) {
// for (int i = index; i < listTabs.size(); i++) {
// listTabs.get(i).setEnabled(bool);
// }
// }
}
/**
* Sets the visible form actions.
*
* @param bool the new visible form actions
*/
public void setVisibleFormActions(boolean bool) {
formActions.setVisible(bool);
}
}

View File

@ -1,60 +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;
}
.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">
<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>
</g:HTMLPanel>
</ui:UiBinder>

View File

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

View File

@ -1,92 +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"
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>

View File

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

View File

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

View File

@ -1,86 +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>
.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>

View File

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

View File

@ -1,68 +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>
.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>

View File

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

View File

@ -1,297 +0,0 @@
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;
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.JSONParser;
import com.google.gwt.json.client.JSONValue;
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.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class ReportTemplateToHTML.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jan 25, 2021
*/
public class ReportTemplateToHTML extends Composite {
private static ReportTemplateToHTMLUiBinder uiBinder = GWT.create(ReportTemplateToHTMLUiBinder.class);
/**
* The Interface ReportTemplateToHTMLUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jan 25, 2021
*/
interface ReportTemplateToHTMLUiBinder extends UiBinder<Widget, ReportTemplateToHTML> {
}
@UiField
VerticalPanel vpContainer;
@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 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 documentLabel, String theJSONDocument, boolean openTableReport,
boolean openJSONReport) {
initWidget(uiBinder.createAndBindUi(this));
vpContainer.setVisible(false);
showReportAsJSON.setDefaultOpen(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 {
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 (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);
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(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
*/
private static native String jsonToHTML(String jsonTxt)/*-{
try {
var jsonObj = JSON.parse(jsonTxt);
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");
try {
table.classList.add("my-html-table");
} 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]];
//console.log("the value: "+theValue);
if (Object.prototype.toString.call(theValue) === '[object Array]') {
var formattedValueArray = "";
for (var k = 0; k < theValue.length; k++) {
var theValueArray = theValue[k];
//console.log(theValueArray);
formattedValueArray += theValueArray + "<br>";
}
tabCell.innerHTML = formattedValueArray;
} else {
tabCell.innerHTML = theValue;
}
}
}
return table.outerHTML;
} catch (e) {
console.log('invalid json', e);
return jsonTxt;
}
}-*/;
}

View File

@ -1,31 +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;
}
.margin-top-10 {
margin-top: 10px;
}
</ui:style>
<g:HTMLPanel>
<g:VerticalPanel ui:field="vpContainer"
addStyleNames="{style.margin-top-10}">
<b:Label ui:field="labelToReport">Report: </b:Label>
<g:VerticalPanel ui:field="htmlContainer"
addStyleNames="{style.margin-top-10}"></g:VerticalPanel>
<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>
</g:VerticalPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,208 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import org.gcube.portlets.user.geoportaldataentry.client.events.ClickItemEvent;
import com.github.gwtbootstrap.client.ui.Pagination;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Style.BorderStyle;
import com.google.gwt.event.dom.client.ContextMenuEvent;
import com.google.gwt.event.dom.client.ContextMenuHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.AsyncDataProvider;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.SelectionChangeEvent.Handler;
import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
/**
* The Class AbstractItemsCellTable.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jul 11, 2017
* @param <T> the generic type
*/
public abstract class AbstractItemsCellTable<T> {
protected SortedCellTable<T> sortedCellTable;
protected T itemContextMenu = null;
protected boolean fireEventOnClick = true;
protected SelectionModel<T> theSelectionModel;
protected HandlerManager eventBus;
/**
* Inits the table.
*
* @param pager the pager
* @param pagination the pagination
* @param dataProvider the data provider
*/
public abstract void initTable(final SimplePager pager, final Pagination pagination,
AbstractDataProvider<T> dataProvider);
/**
* Inits the abstract table.
*
* @param eventBus the event bus
* @param fireOnClick the fire on click
* @param dataProvider the data provider
* @param selectionModel the selection model
* @param pageSize the page size
*/
protected void initAbstractTable(HandlerManager eventBus, boolean fireOnClick, AbstractDataProvider<T> dataProvider,
SelectionModel<T> selectionModel, int pageSize) {
this.eventBus = eventBus;
this.fireEventOnClick = fireOnClick;
this.theSelectionModel = selectionModel;
sortedCellTable = new SortedCellTable<T>(pageSize, dataProvider);
sortedCellTable.addStyleName("table-glor");
sortedCellTable.addStyleName("table-glor-vertical-middle");
//sortedCellTable.setStriped(true);
sortedCellTable.setCondensed(true);
sortedCellTable.setWidth("100%", true);
sortedCellTable.setAutoHeaderRefreshDisabled(true);
sortedCellTable.setAutoFooterRefreshDisabled(true);
// dataProvider.addDataDisplay(sortedCellTable);
// initTable(cellTable, null, null);
//sortedCellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
// DefaultSelectionEventManager<T> checkBoxManager = DefaultSelectionEventManager.<T> createCheckboxManager();
// sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager);
sortedCellTable.setSelectionModel(theSelectionModel);
theSelectionModel.addSelectionChangeHandler(new Handler() {
@Override
public void onSelectionChange(final SelectionChangeEvent event) {
if (theSelectionModel instanceof SingleSelectionModel) {
SingleSelectionModel<T> ssm = (SingleSelectionModel<T>) theSelectionModel;
final T selectedObject = ssm.getSelectedObject();
if (selectedObject != null) {
GWT.log("Clicked: " + selectedObject);
// selectedItem(selectedObject);
if (fireEventOnClick)
AbstractItemsCellTable.this.eventBus.fireEvent(new ClickItemEvent<T>(Arrays.asList(selectedObject)));
}
}else if (theSelectionModel instanceof MultiSelectionModel) {
Set<T> selected = ((MultiSelectionModel<T>) theSelectionModel).getSelectedSet();
GWT.log("Selected are:" +selected);
if (fireEventOnClick)
AbstractItemsCellTable.this.eventBus.fireEvent(new ClickItemEvent<T>(new ArrayList<T>(selected)));
}
}
});
sortedCellTable.addDomHandler(new DoubleClickHandler() {
@Override
public void onDoubleClick(final DoubleClickEvent event) {
if (theSelectionModel instanceof SingleSelectionModel) {
SingleSelectionModel<T> ssm = (SingleSelectionModel<T>) theSelectionModel;
T selected = ssm.getSelectedObject();
if (selected != null) {
GWT.log("Double Click: " + selected);
// AbstractItemsCellTable.this.eventBus.fireEvent(new
// org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent<T>(selected));
}
}
}
}, DoubleClickEvent.getType());
MenuBar options = new MenuBar(true);
ScheduledCommand openCommand = new ScheduledCommand() {
@Override
public void execute() {
GWT.log("Context menu shown: " + itemContextMenu);
// AbstractItemsCellTable.this.eventBus.fireEvent(new
// org.gcube.portlets.widgets.wsexplorer.client.event.LoadFolderEvent<T>(itemContextMenu));
}
};
MenuItem openItem = new MenuItem("Open", openCommand);
options.addItem(openItem);
final DialogBox menuWrapper = new DialogBox(true);
menuWrapper.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
menuWrapper.getElement().getStyle().setZIndex(10000);
menuWrapper.add(options);
sortedCellTable.sinkEvents(Event.ONCONTEXTMENU);
sortedCellTable.addHandler(new ContextMenuHandler() {
@Override
public void onContextMenu(ContextMenuEvent event) {
}
}, ContextMenuEvent.getType());
}
/**
* Gets the cell tables.
*
* @return the cell tables
*/
public SortedCellTable<T> getCellTable() {
return sortedCellTable;
}
/**
* Checks if is fire event on click.
*
* @return the fireEventOnClick
*/
public boolean isFireEventOnClick() {
return fireEventOnClick;
}
/**
* Sets the fire event on click.
*
* @param fireEventOnClick the fireEventOnClick to set
*/
public void setFireEventOnClick(boolean fireEventOnClick) {
this.fireEventOnClick = fireEventOnClick;
}
/**
* Adds the items.
*
* @param items the items
*/
public void addItems(List<T> items) {
AbstractDataProvider<T> dataProvider = sortedCellTable.getDataProvider();
if (dataProvider instanceof ListDataProvider) {
List<T> ldp = ((ListDataProvider<T>) dataProvider).getList();
for (int i = 0; i < items.size(); i++) {
ldp.add(i, items.get(i));
}
sortedCellTable.setPageSize(items.size() + 1);
sortedCellTable.redraw();
} else if (dataProvider instanceof AsyncDataProvider) {
// TODO ???
}
}
}

View File

@ -1,635 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import java.util.ArrayList;
import java.util.Arrays;
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.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.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;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.cellview.client.TextColumn;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionModel;
import com.google.gwt.view.client.SingleSelectionModel;
/**
* The Class ItemsTable.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
* @param <T> the generic type
*/
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";
public static DateTimeFormat dtformat = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
private AbstractDataProvider<T> dataProvider;
private List<ItemFieldDV> displayFields;
private boolean isAsyncronusTable;
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.
*
* @param eventBus the event bus
* @param displayFields the display fields
* @param startSortByColumn the start sort by column
*/
public ItemsTable(HandlerManager eventBus, List<ItemFieldDV> displayFields) {
this.eventBus = eventBus;
this.displayFields = displayFields;
}
/**
* Adds the items.
*
* @param items the items
*/
public void addItems(List<T> items) {
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 = "&#8226; "; // 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.
*
* @param pager the pager
* @param pagination the pagination
* @param dataProvider the data provider
*/
@Override
public void initTable(final SimplePager pager, final Pagination pagination, AbstractDataProvider<T> dataProvider) {
this.dataProvider = dataProvider;
this.theSelectionModel = new SingleSelectionModel<T>();
initAbstractTable(eventBus, fireEventOnClick, dataProvider, theSelectionModel, ITEMS_PER_PAGE);
this.dataProvider.addDataDisplay(sortedCellTable);
this.isAsyncronusTable = dataProvider instanceof ListDataProvider ? false : true;
setEmptyTableMessage(NO_DATA);
int i = 1;
for (ItemFieldDV itemField : displayFields) {
if (i > ConstantsGeoPortalDataEntryApp.MAX_COLUMN_DISPLAYED_IN_THE_TABLE) {
break;
}
String displayName = itemField.getDisplayName();
TextColumn<T> col = new TextColumn<T>() {
@Override
public String getValue(T object) {
return "";
}
@Override
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);
CellRender cellRender = toCellRender(itemField, object);
sb.append(TEMPLATES.startToolTip(cellRender.getTooltip()));
sb.appendHtmlConstant(cellRender.getValue());
sb.append(TEMPLATES.endToolTip());
};
};
sortedCellTable.addColumn(col, displayName, true);
i++;
}
// COL RELATIONS
TextColumn<T> colRelationship = new TextColumn<T>() {
@Override
public String getValue(T object) {
if (object == null)
return "";
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 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;
}
/**
* To display authors.
*
* @param authors the authors
* @return the string
*/
private String toDisplayAuthors(List<String> authors) {
String toDisplay = "";
if (authors == null)
return toDisplay;
for (String author : authors) {
toDisplay += author + "; ";
}
return toDisplay;
}
/**
* Displays the appropriate sorted icon in the header of the column for the
* given index.
*
* @param columnIndex of the column to mark as sorted
* @param ascending <code>true</code> for ascending icon, <code>false</code>
* for descending icon
*/
public void setSortedColumn(int columnIndex, boolean ascending) {
GWT.log("Column index: " + columnIndex);
GWT.log("ascending: " + ascending);
Column<T, ?> column = sortedCellTable.getColumn(columnIndex);
if (column != null && column.isSortable()) {
ColumnSortInfo info = sortedCellTable.getColumnSortList().push(column);
// ColumnSortEvent.fire(cellTable, cellTable.getColumnSortList());
GWT.log("info.isAscending(): " + info.isAscending());
if (info.isAscending() != ascending) {
sortedCellTable.getColumnSortList().push(column);
ColumnSortEvent.fire(sortedCellTable, sortedCellTable.getColumnSortList());
}
}
}
// /**
// * 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.
*/
public void reInitColumnsTable() {
int count = sortedCellTable.getColumnCount();
for (int i = 0; i < count; i++) {
sortedCellTable.removeColumn(0);
}
initTable(null, null, dataProvider);
}
/**
* Gets the display fields.
*
* @return the displayFields
*/
public List<ItemFieldDV> getDisplayFields() {
return displayFields;
}
/**
* The Class ButtonImageCell.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 1, 2016
*/
public class ButtonImageCell extends ButtonCell {
/**
* Render.
*
* @param context the context
* @param value the value
* @param sb the sb
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.cell.client.AbstractSafeHtmlCell#render(com.google.gwt.cell.
* client.Cell.Context, java.lang.Object,
* com.google.gwt.safehtml.shared.SafeHtmlBuilder)
*/
@Override
public void render(com.google.gwt.cell.client.Cell.Context context, String value, SafeHtmlBuilder sb) {
SafeHtml html = SafeHtmlUtils.fromTrustedString(new Image(value).toString());
sb.append(html);
}
}
/**
* Gets the selected item.
*
* @return the selected item
*/
public List<T> getSelectedItems() {
if (theSelectionModel instanceof SingleSelectionModel) {
T selected = ((SingleSelectionModel<T>) theSelectionModel).getSelectedObject();
if (selected != null) {
return Arrays.asList(selected);
}
} else if (theSelectionModel instanceof MultiSelectionModel) {
Set<T> selected = ((MultiSelectionModel<T>) theSelectionModel).getSelectedSet();
if (selected != null) {
return new ArrayList<T>(selected);
}
}
return null;
}
/**
* Sets the empty table message.
*
* @param msg the new empty table message
*/
public void setEmptyTableMessage(String msg) {
msg = msg != null ? msg : NO_DATA;
if (sortedCellTable != null)
sortedCellTable.setEmptyTableWidget(new Label(msg));
}
/**
* Gets the selection model.
*
* @return the selection model
*/
public SelectionModel<T> getSelectionModel() {
return theSelectionModel;
}
}

View File

@ -1,82 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import com.google.gwt.cell.client.Cell;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.core.client.GWT;
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.user.cellview.client.Column;
/**
* The Class MyToolTipColumn.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
* @param <T> the generic type
* @param <C> the generic type
*/
public abstract class MyToolTipColumn<T, C> extends Column<T, C> {
/**
* The Interface Templates.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
*/
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();
}
private static final Templates TEMPLATES = GWT.create(Templates.class);
private final String toolTipText;
/**
* Instantiates a new my tool tip column.
*
* @param cell the cell
* @param toolTipText the tool tip text
*/
public MyToolTipColumn(final Cell<C> cell, final String toolTipText) {
super(cell);
this.toolTipText = toolTipText;
}
/**
* Render.
*
* @param context the context
* @param object the object
* @param sb the sb
*/
@Override
public void render(final Context context, final T object, final SafeHtmlBuilder sb) {
sb.append(TEMPLATES.startToolTip(toolTipText));
super.render(context, object, sb);
sb.append(TEMPLATES.endToolTip());
}
}

View File

@ -1,304 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.table;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.portlets.user.geoportaldataentry.client.resource.CellTableResources;
import com.github.gwtbootstrap.client.ui.CellTable;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent;
import com.google.gwt.user.cellview.client.ColumnSortEvent.AsyncHandler;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo;
import com.google.gwt.user.cellview.client.Header;
import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.AsyncDataProvider;
import com.google.gwt.view.client.ListDataProvider;
/**
* The Class SortedCellTable.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2021
* @param <T> the generic type
*/
public class SortedCellTable<T> extends CellTable<T> {
/**
* To keep track of the currently sorted column
*/
private Column<T, ?> currentlySortedColumn;
/**
* Tells us which way to sort a column initially
*/
private Map<Column<T, ?>, Boolean> defaultSortOrderMap = new HashMap<Column<T, ?>, Boolean>();
/**
* Comparators associated with their columns
*/
private Map<Column<T, ?>, Comparator<T>> comparators = new HashMap<Column<T, ?>, Comparator<T>>();
/**
* Column to sort when the data provider's list is refreshed using
* {@link SortedCellTable#setList(List)}
*/
private Column<T, ?> initialSortColumn;
/**
* Data provider we will attach to this table
*/
private AbstractDataProvider<T> dataProvider;
/**
* Special column sorting handler that will allow us to do more controlled
* sorting
*/
private ColumnSortEvent.Handler columnSortHandler;
/**
* Instantiates a new sorted cell table.
*
* @param pageSize the page size
* @param dataProv the data prov
*/
public SortedCellTable(int pageSize, AbstractDataProvider<T> dataProv) {
super(pageSize, CellTableResources.INSTANCE);
this.dataProvider = dataProv;
if (this.dataProvider instanceof ListDataProvider) {
ListDataProvider<T> listDataProvider = (ListDataProvider<T>) this.dataProvider;
ListHandler<T> listSortHandler = new ListHandler<T>((listDataProvider).getList()) {
@Override
public void onColumnSort(ColumnSortEvent event) {
@SuppressWarnings("unchecked")
Column<T, ?> column = (Column<T, ?>) event.getColumn();
if (column == null) {
return;
}
if (column.equals(currentlySortedColumn)) {
// Default behavior
super.onColumnSort(event);
} else {
// Initial sort; look up which direction we need
final Comparator<T> comparator = comparators.get(column);
if (comparator == null) {
return;
}
Boolean ascending = defaultSortOrderMap.get(column);
if (ascending == null || ascending) {
// Default behavior
super.onColumnSort(event);
} else {
// Sort the column descending
Collections.sort(getList(), new Comparator<T>() {
public int compare(T o1, T o2) {
return -comparator.compare(o1, o2);
}
});
// Set the proper arrow in the header
getColumnSortList().push(new ColumnSortInfo(column, false));
}
currentlySortedColumn = column;
}
}
@Override
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
comparators.put(column, comparator);
super.setComparator(column, comparator);
}
};
addColumnSortHandler(listSortHandler);
columnSortHandler = listSortHandler;
} else if (this.dataProvider instanceof AsyncDataProvider) {
// AsyncDataProvider asyncDataProvider = ((AsyncDataProvider)
// this.dataProvider);
// asyncDataProvider.get
AsyncHandler asyncSortHandler = new AsyncHandler(this) {
@Override
public void onColumnSort(ColumnSortEvent event) {
@SuppressWarnings("unchecked")
Column<T, ?> column = (Column<T, ?>) event.getColumn();
if (column == null) {
return;
}
if (column.equals(currentlySortedColumn)) {
// Default behavior
super.onColumnSort(event);
} else {
// Initial sort; look up which direction we need
final Comparator<T> comparator = comparators.get(column);
if (comparator == null) {
return;
}
Boolean ascending = defaultSortOrderMap.get(column);
if (ascending == null || ascending) {
// Default behavior
super.onColumnSort(event);
} else {
// Sort the column descending
Collections.sort(getVisibleItems(), new Comparator<T>() {
public int compare(T o1, T o2) {
return -comparator.compare(o1, o2);
}
});
// Set the proper arrow in the header
getColumnSortList().push(new ColumnSortInfo(column, false));
}
currentlySortedColumn = column;
}
}
};
// addColumnSortHandler(asyncSortHandler);
// columnSortHandler = asyncSortHandler;
}
}
/**
* Adds a column to the table and sets its sortable state.
*
* @param column the column
* @param headerName the header name
* @param sortable the sortable
*/
public void addColumn(Column<T, ?> column, String headerName, boolean sortable) {
addColumn(column, headerName);
column.setSortable(sortable);
if (sortable) {
defaultSortOrderMap.put(column, true);
}
}
/**
* Adds the column.
*
* @param column the column
* @param headerName the header name
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.user.cellview.client.AbstractCellTable#addColumn(com.google.
* gwt.user.cellview.client.Column, java.lang.String)
*/
public void addColumn(Column<T, ?> column, String headerName) {
super.addColumn(column, headerName);
}
/**
* Adds a column to the table and sets its sortable state.
*
* @param column the column
* @param header the header
* @param sortable the sortable
*/
public void addColumn(Column<T, ?> column, Header<?> header, boolean sortable) {
addColumn(column, header);
column.setSortable(sortable);
if (sortable) {
defaultSortOrderMap.put(column, true);
}
}
/**
* Sets the column to sort when the data list is reset using
* {@link SortedCellTable#setList(List)}.
*
* @param column the column
*/
public void setInitialSortColumn(Column<T, ?> column) {
initialSortColumn = column;
}
/**
* Set the comparator used to sort the specified column in ascending order.
*
* @param column the {@link Column}
* @param comparator the {@link Comparator} to use for the {@link Column}
*/
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
comparators.put(column, comparator);
}
/**
* Sets the sort order to use when this column is clicked and it was not
* previously sorted.
*
* @param column the column
* @param ascending the ascending
*/
public void setDefaultSortOrder(Column<T, ?> column, boolean ascending) {
defaultSortOrderMap.put(column, ascending);
}
/**
* Sets the table's data provider list and sorts the table based on the column
* given in {@link SortedCellTable#setInitialSortColumn(Column)}.
*
* @param list the new list
*/
public void setList(List<T> list) {
if (dataProvider instanceof ListDataProvider) {
List<T> myData = ((ListDataProvider) dataProvider).getList();
myData.clear();
if (list != null) {
/*
* for (T t : list) { dataProvider.getList().add(t); }
*/
myData.addAll(list);
}
// Do a first-time sort based on which column was set in
// setInitialSortColumn()
if (initialSortColumn != null) {
Collections.sort(myData, new Comparator<T>() {
@Override
public int compare(T o1, T o2) {
return (defaultSortOrderMap.get(initialSortColumn) ? 1 : -1)
* comparators.get(initialSortColumn).compare(o1, o2);
}
});
// Might as well get the little arrow on the header to make it
// official
getColumnSortList()
.push(new ColumnSortInfo(initialSortColumn, defaultSortOrderMap.get(initialSortColumn)));
currentlySortedColumn = initialSortColumn;
}
}
}
/**
* Gets the data provider.
*
* @return the data provider
*/
public AbstractDataProvider<T> getDataProvider() {
return dataProvider;
}
}

View File

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

View File

@ -1,29 +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>
.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>

View File

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

View File

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

View File

@ -1,172 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
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.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class DialogInform.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 5, 2021
*/
public class DialogInform extends DialogBox implements ClickHandler {
private DockPanel dock = new DockPanel();
private Button okButton;
private VerticalPanel vpContainer = new VerticalPanel();
private ImageResource loading = Images.ICONS.loading();
private HorizontalPanel hpButtons = new HorizontalPanel();
private HorizontalPanel hpMask = new HorizontalPanel();
private DialogInform instance = this;
/**
* Instantiates a new dialog inform.
*
* @param img the img
* @param caption the caption
* @param msg the msg
*/
public DialogInform(Image img, String caption, String msg) {
// getElement().setClassName("gwt-DialogBoxNew");
dock.setSpacing(4);
dock.setWidth("100%");
setText(caption);
// setHeading(caption);
okButton = new Button("OK");
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
vpContainer.add(new HTML(msg));
hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
hpButtons.setSpacing(3);
okButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
hpButtons.add(okButton);
okButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
instance.hide();
}
});
dock.add(hpButtons, DockPanel.SOUTH);
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
if (img != null)
dock.add(img, DockPanel.WEST);
vpContainer.add(hpMask);
dock.add(vpContainer, DockPanel.CENTER);
setWidget(dock);
}
/**
* Sets the msg.
*
* @param msg the new msg
*/
public void setMsg(String msg) {
vpContainer.clear();
vpContainer.add(new HTML(msg));
hpButtons.setVisible(true);
}
/**
* On click.
*
* @param event the event
*/
/*
* (non-Javadoc)
*
* @see
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
// hide();
}
/**
* Hide loader.
*/
public void hideLoader() {
hpMask.clear();
hpButtons.setVisible(true);
}
/**
* Loader.
*
* @param message the message
*/
public void showLoader(String message) {
try {
hpButtons.setVisible(false);
} catch (Exception e) {
}
hpMask.clear();
hpMask.add(new Image(loading));
HTML html = new HTML(message);
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
hpMask.add(html);
}
/**
* Adds the to center panel.
*
* @param w the w
*/
public void addToCenterPanel(Widget w) {
vpContainer.add(w);
}
/**
* Gets the dock.
*
* @return the dock
*/
public DockPanel getDock() {
return dock;
}
/**
* Gets the yes button.
*
* @return the yes button
*/
public Button getOKButton() {
return okButton;
}
/**
* Sets the z index.
*
* @param value the new z index
*/
public void setZIndex(int value) {
this.getElement().getStyle().setZIndex(value);
}
}

View File

@ -1,23 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
/**
* The Class ExternalLib.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 17, 2021
*/
public class ExternalLib {
/**
* To pretty print JSON. calls the externa js lib 'pretty-print-json'
*
* @param jsonData the json data
* @return the string
*/
public static native String toPrettyPrintJSON(String jsonData)/*-{
//console.log(jsonData);
var objJSON = JSON.parse(jsonData);
return $wnd.prettyPrintJson.toHtml(objJSON);
}-*/;
}

View File

@ -1,170 +0,0 @@
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.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jan 26, 2021
*/
public class HTMLUtil {
/**
* The Enum HTML_TAG.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jan 26, 2021
*/
public static enum HTML_TAG {
p, div, span
}
/**
* Gets the HTML element.
*
* @param tag the tag
* @param textSize the text size
* @param rgb the rgb
* @param fontWeight the font weight
* @param text the text
* @return the HTML element
*/
public static String getHTMLElement(HTML_TAG tag, Integer textSize, String rgb, String fontWeight, String text) {
StringBuilder htmlEl = new StringBuilder();
if (textSize != null || rgb != null || fontWeight != null) {
String style = "";
if (textSize != null) {
style += "font-size:" + textSize + ";";
}
if (rgb != null) {
style += "color:#" + rgb + ";";
}
if (fontWeight != null) {
style += "font-weight:" + fontWeight + ";";
}
htmlEl.append("<" + tag.name() + " style='" + style + "'>");
} else {
htmlEl.append(tagOPEN(tag));
}
if (text != null) {
htmlEl.append(text);
}
htmlEl.append(tagCLosed(tag));
return htmlEl.toString();
}
/**
* Tag OPEN.
*
* @param tag the tag
* @return the string
*/
public static String tagOPEN(HTML_TAG tag) {
return "<" + tag.name() + ">";
}
/**
* Tag C losed.
*
* @param tag the tag
* @return the string
*/
public static String tagCLosed(HTML_TAG tag) {
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;
}
}

View File

@ -1,160 +0,0 @@
/**
*
*/
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.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 ModalConfirm.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 1, 2022
*/
public class ModalConfirm extends Modal implements ClickHandler {
private DockPanel dock = new DockPanel();
private Button yesButton;
private VerticalPanel vpContainer;
private ImageResource loading = Images.ICONS.loading();
private HorizontalPanel hpButtons = new HorizontalPanel();
private Button noButton;
/**
* Instantiates a new dialog confirm.
*
* @param img the img
* @param caption the caption
* @param text the text
*/
public ModalConfirm(Image img, String caption, String text) {
setWidth(800);
setAnimation(true);
// getElement().setClassName("gwt-DialogBoxNew");
dock.setSpacing(4);
dock.setWidth("100%");
setTitle(caption);
// setHeading(caption);
yesButton = new Button("Yes");
noButton = new Button("No", this);
noButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
}
});
vpContainer = new VerticalPanel();
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
vpContainer.add(new HTML(text));
hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);
hpButtons.setSpacing(3);
yesButton.getElement().getStyle().setMarginRight(20.0, Unit.PX);
hpButtons.add(yesButton);
hpButtons.add(noButton);
dock.add(hpButtons, DockPanel.SOUTH);
dock.setCellHorizontalAlignment(hpButtons, DockPanel.ALIGN_CENTER);
if (img != null)
dock.add(img, DockPanel.WEST);
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)
*
* @see
* com.google.gwt.event.dom.client.ClickHandler#onClick(com.google.gwt.event
* .dom.client.ClickEvent)
*/
@Override
public void onClick(ClickEvent event) {
// hide();
}
/**
* Loader.
*
* @param message the message
*/
public void loader(String message) {
try {
dock.remove(hpButtons);
} catch (Exception e) {
}
vpContainer.clear();
HorizontalPanel hpMask = new HorizontalPanel();
hpMask.add(new Image(loading));
HTML html = new HTML(message);
html.getElement().getStyle().setMarginLeft(5, Unit.PX);
hpMask.add(html);
vpContainer.add(hpMask);
}
/**
* Adds the to center panel.
*
* @param w the w
*/
public void addToCenterPanel(Widget w) {
vpContainer.add(w);
}
/**
* Gets the dock.
*
* @return the dock
*/
public DockPanel getDock() {
return dock;
}
/**
* Gets the yes button.
*
* @return the yes button
*/
public Button getYesButton() {
return yesButton;
}
/**
* Gets the no button.
*
* @return the no button
*/
public Button getNoButton() {
return noButton;
}
}

View File

@ -1,29 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.utils;
import com.google.gwt.core.client.JavaScriptObject;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Sep 4, 2013
*
*/
public final class NewBrowserWindow extends JavaScriptObject {
// All types that extend JavaScriptObject must have a protected,
// no-args constructor.
protected NewBrowserWindow() {
}
public static native NewBrowserWindow open(String url, String target, String options) /*-{
return $wnd.open(url, target, options)
}-*/;
public native void close() /*-{
this.close();
}-*/;
public native void setUrl(String url) /*-{
if (this.location) {
this.location = url;
}
}-*/;
}

View File

@ -1,34 +0,0 @@
/**
*
*/
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) + "...";
}
}

View File

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

View File

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

View File

@ -8,399 +8,366 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.model.AccessPolicy;
import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.application.geoportal.model.concessioni.LayerConcessione;
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class ConvertToServiceModel.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 21, 2020
* Oct 21, 2020
*/
public class ConvertToServiceModel {
/** The Constant LOG. */
private static final Logger LOG = LoggerFactory.getLogger(ConvertToServiceModel.class);
public static final String HOURS_MINUTES_SEPARATOR = ConstantsGeoPortalDataEntryApp.HOURS_MINUTES_SEPARATOR;
public static final String DATE_FORMAT = ConstantsGeoPortalDataEntryApp.DATE_FORMAT;
public static final String TIME_FORMAT = ConstantsGeoPortalDataEntryApp.TIME_FORMAT;
/**
* To concessione.
*
* @param gdb the gdb
* @param gdb the gdb
* @param user the user
* @return the concessione
* @throws Exception the exception
* @throws Exception
*/
public static Concessione toConcessione(GenericDatasetBean gdb, GCubeUser user) throws Exception {
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
Concessione concessione = new Concessione();
// List<String> authors = mapFields.get("Autore");
// if(authors!=null) {
// concessione.setAuthors(authors);
// }
List<String> authors = mapFields.get("Nome Autore, Email, Ruolo");
if (authors != null) {
List<String> authors = mapFields.get("Autore");
if(authors!=null) {
concessione.setAuthors(authors);
}
List<String> contributors = mapFields.get("Contributore");
if (contributors != null) {
if(contributors!=null) {
for (String contributor : contributors) {
concessione.setContributore(contributor);
}
}
// concessione.setCreationTime(Instant.now());
//concessione.setCreationTime(Instant.now());
concessione.setCreationUser(user.getUsername());
List<String> dataInizProgettoList = mapFields.get("Data inizio Progetto");
if (dataInizProgettoList != null && dataInizProgettoList.size() > 0) {
if(dataInizProgettoList!=null && dataInizProgettoList.size()>0) {
String inizioProgetto = dataInizProgettoList.get(0);
LocalDateTime theLDT = toLocalDateTime(inizioProgetto);
concessione.setDataInizioProgetto(theLDT);
}
List<String> dataFineProgettoList = mapFields.get("Data fine Progetto");
if (dataFineProgettoList != null && dataFineProgettoList.size() > 0) {
if(dataFineProgettoList!=null && dataFineProgettoList.size()>0) {
String fineProgetto = dataFineProgettoList.get(0);
LocalDateTime theLDT = toLocalDateTime(fineProgetto);
concessione.setDataFineProgetto(theLDT);
}
List<String> descrizioneLst = mapFields.get("Descrizione del contenuto");
if (descrizioneLst != null && descrizioneLst.size() > 0) {
if(descrizioneLst!=null && descrizioneLst.size()>0) {
concessione.setDescrizioneContenuto(descrizioneLst.get(0));
}
List<String> editors = mapFields.get("Editore");
if (editors != null && editors.size() > 0) {
if(editors!=null && editors.size()>0) {
concessione.setEditore(editors.get(0));
}
List<String> fontiFinanziamento = mapFields.get("Fonte del finanziamento");
if (fontiFinanziamento != null) {
if(fontiFinanziamento!=null) {
concessione.setFontiFinanziamento(fontiFinanziamento);
}
List<String> licenzaLst = mapFields.get("ID Licenza");
if (licenzaLst != null && licenzaLst.size() > 0) {
if(licenzaLst!=null && licenzaLst.size()>0) {
concessione.setLicenzaID(licenzaLst.get(0));
}
List<String> introduzioneLst = mapFields.get("Introduzione");
if (introduzioneLst != null && introduzioneLst.size() > 0) {
if(introduzioneLst!=null && introduzioneLst.size()>0) {
concessione.setIntroduzione(introduzioneLst.get(0));
}
List<String> nomeLst = mapFields.get("Nome del progetto");
if (nomeLst != null && nomeLst.size() > 0) {
if(nomeLst!=null && nomeLst.size()>0) {
concessione.setNome(nomeLst.get(0));
}
List<String> paroleChiaveLibereLst = mapFields.get("Parola chiave a scelta libera");
// LOG.debug("Parola chiave a scelta libera: "+paroleChiaveLibereLst);
if (paroleChiaveLibereLst != null) {
//LOG.debug("Parola chiave a scelta libera: "+paroleChiaveLibereLst);
if(paroleChiaveLibereLst!=null){
concessione.setParoleChiaveLibere(paroleChiaveLibereLst);
}
List<String> paroleChiaveICCDLst = mapFields.get("Parola chiave relativa alla cronologia");
// LOG.debug("Parola chiave relativa alla cronologia: "+paroleChiaveICCDLst);
if (paroleChiaveICCDLst != null) {
//LOG.debug("Parola chiave relativa alla cronologia: "+paroleChiaveICCDLst);
if(paroleChiaveICCDLst!=null){
concessione.setParoleChiaveICCD(paroleChiaveICCDLst);
}
List<String> risorsaCorrelataLst = mapFields.get("Risorsa correlata");
if (risorsaCorrelataLst != null) {
if(risorsaCorrelataLst!=null){
concessione.setRisorseCorrelate(risorsaCorrelataLst);
}
List<String> responsabileLst = mapFields.get("Responsabile");
if (responsabileLst != null && responsabileLst.size() > 0) {
if(responsabileLst!=null && responsabileLst.size()>0){
concessione.setResponsabile(responsabileLst.get(0));
}
List<String> soggettoLst = mapFields.get("Soggetto");
if (soggettoLst != null) {
if(soggettoLst!=null){
concessione.setSoggetto(soggettoLst);
}
List<String> titolareCopyrightLst = mapFields.get("Titolare Copyright");
if (titolareCopyrightLst != null) {
if(titolareCopyrightLst!=null){
concessione.setTitolareCopyright(titolareCopyrightLst);
}
List<String> titolareLicenzaLst = mapFields.get("Titolare Licenza");
if (titolareLicenzaLst != null) {
if(titolareLicenzaLst!=null){
concessione.setTitolareLicenza(titolareLicenzaLst);
}
List<String> titolareDatiLst = mapFields.get("Titolare dei dati");
if (titolareDatiLst != null) {
if(titolareDatiLst!=null){
concessione.setTitolari(titolareDatiLst);
}
List<String> latList = mapFields.get("Latitudine Centroide");
if (latList != null && latList.size() > 0) {
if(latList!=null && latList.size()>0){
try {
String theLat = latList.get(0);
if (theLat != null && !theLat.isEmpty()) {
if(theLat!=null && !theLat.isEmpty()) {
Double centroidLat = Double.parseDouble(theLat);
concessione.setCentroidLat(centroidLat);
}
} catch (Exception e) {
throw new Exception("Unable to parse " + latList.get(0) + " as valid latitude");
}catch (Exception e) {
throw new Exception("Unable to parse "+latList.get(0)+" as valid latitude");
}
}
List<String> longList = mapFields.get("Longitudine Centroide");
if (longList != null && longList.size() > 0) {
if(longList!=null && longList.size()>0){
try {
String theLong = longList.get(0);
if (theLong != null && !theLong.isEmpty()) {
if(theLong!=null && !theLong.isEmpty()) {
Double centroidLong = Double.parseDouble(theLong);
concessione.setCentroidLong(centroidLong);
}
} catch (Exception e) {
throw new Exception("Unable to parse " + longList.get(0) + " as valid longitude");
}catch (Exception e) {
throw new Exception("Unable to parse "+longList.get(0)+" as valid longitude");
}
}
return concessione;
}
/**
* To relazione scavo.
*
* @param abstractRelazioneScavo the abstract relazione scavo
* @param gdb the gdb
* @return the relazione scavo
*/
public static RelazioneScavo toRelazioneScavo(GenericDatasetBean gdb) {
public static RelazioneScavo toRelazioneScavo(RelazioneScavo abstractRelazioneScavo, GenericDatasetBean gdb){
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
RelazioneScavo relazioneScavo = new RelazioneScavo();
RelazioneScavo relazioneScavo = abstractRelazioneScavo == null?new RelazioneScavo():abstractRelazioneScavo;
List<String> responsabiliLst = mapFields.get("Responsabile del documento");
if (responsabiliLst != null) {
if(responsabiliLst!=null) {
relazioneScavo.setResponsabili(responsabiliLst);
}
List<String> autoreList = mapFields.get("Autore del documento");
if (autoreList != null) {
// TODO
if(autoreList!=null) {
//TODO
}
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
LOG.debug("Relazione di Scavo: Politica di accesso lst: "+politicaDiAccessoLst);
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
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);
}catch (Exception e) {
LOG.warn("I cannot cast "+politicaDiAccessoLst.get(0) +" to "+AccessPolicy.values(),e);
}
}
List<String> licenzaIdList = mapFields.get("ID Licenza");
if (licenzaIdList != null && licenzaIdList.size() > 0) {
LOG.debug("Relazione di Scavo: ID Licenza lst: "+licenzaIdList);
if(licenzaIdList!=null && licenzaIdList.size()>0) {
relazioneScavo.setLicenseID(licenzaIdList.get(0));
LOG.debug("Relazione di Scavo: ID Licenza: "+relazioneScavo.getLicenseID());
}
// TODO
List<String> periodoDiEmbargo = mapFields.get("Periodo di embargo");
if (periodoDiEmbargo != null && periodoDiEmbargo.size() > 0) {
String dateFromTo = periodoDiEmbargo.get(0);
String[] dates = dateFromTo.split(",");
String dateFrom = dates[0];
String dateTo = dates[0];
// TODO MUST BE INTENGRATED IN THE SERVICE
}
return relazioneScavo;
}
/**
* To abstract relazione scavo.
*
* @param gdb the gdb
* @return the abstract relazione
*/
public static AbstractRelazione toAbstractRelazioneScavo(GenericDatasetBean gdb) {
public static RelazioneScavo toAbstractRelazioneScavo(GenericDatasetBean gdb) {
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
AbstractRelazione abstractrelazione = new AbstractRelazione();
RelazioneScavo relazioneScavo = new RelazioneScavo();
List<String> abstractLstIta = mapFields.get("Abstract in Italiano");
if (abstractLstIta != null && abstractLstIta.size() > 0) {
abstractrelazione.setAbstractIta(abstractLstIta.get(0));
if(abstractLstIta!=null && abstractLstIta.size()>0) {
relazioneScavo.setAbstractIta(abstractLstIta.get(0));
}
List<String> abstractLstEng = mapFields.get("Abstract in Inglese");
if (abstractLstEng != null && abstractLstEng.size() > 0) {
abstractrelazione.setAbstractEng(abstractLstEng.get(0));
if(abstractLstEng!=null && abstractLstEng.size()>0) {
relazioneScavo.setAbstractEng(abstractLstIta.get(0));
}
// THIS SHOULD BE ALWAYS "OPEN"
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
//TODO IN FUTURE WHEN THE MODEL WILL BE UPDATED
/*List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
if(politicaDiAccessoLst!=null && politicaDiAccessoLst.size()>0) {
try {
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
abstractrelazione.setPolicy(ap);
} catch (Exception e) {
LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e);
relazioneScavo.setPolicy(ap);
}catch (Exception e) {
LOG.warn("I cannot cast "+politicaDiAccessoLst.get(0) +" to "+AccessPolicy.values(),e);
}
}
// THIS SHOULD BE ALWAYS "CC-BY-4.0"
List<String> licenzaIdList = mapFields.get("ID Licenza");
if (licenzaIdList != null && licenzaIdList.size() > 0) {
abstractrelazione.setLicenseID(licenzaIdList.get(0));
}
return abstractrelazione;
if(licenzaIdList!=null && licenzaIdList.size()>0) {
relazioneScavo.setLicenseID(licenzaIdList.get(0));
}*/
return relazioneScavo;
}
/**
* To immagini rappresentative.
*
* @param gdb the gdb
* @return the uploaded image
*/
public static UploadedImage toImmaginiRappresentative(GenericDatasetBean gdb) {
public static UploadedImage toImmaginiRappresentative(GenericDatasetBean gdb){
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
UploadedImage uplaodedImage = new UploadedImage();
// List<String> titoloLst = mapFields.get("Titolo");
// if(titoloLst!=null && titoloLst.size()>0) {
// uplaodedImage.setTitolo(titoloLst.get(0));
// }
//
List<String> didascaliaLst = mapFields.get("Didascalia");
if (didascaliaLst != null && didascaliaLst.size() > 0) {
if(didascaliaLst!=null && didascaliaLst.size()>0) {
uplaodedImage.setDidascalia(didascaliaLst.get(0));
}
// NB here is setResponsabili but should be setAuthor
//NB here is setResponsabili but should be setAuthor
List<String> responsabileLst = mapFields.get("Autore");
if (responsabileLst != null) {
if(responsabileLst!=null) {
uplaodedImage.setResponsabili(responsabileLst);
// uplaodedImage.setAuthor is missing!!!
//uplaodedImage.setAuthor is missing!!!
}
// List<String> autoreList = mapFields.get("Autore");
// if(autoreList!=null) {
// //TODO
// }
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
if(politicaDiAccessoLst!=null && politicaDiAccessoLst.size()>0) {
try {
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
uplaodedImage.setPolicy(ap);
} catch (Exception e) {
LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e);
}catch (Exception e) {
LOG.warn("I cannot cast "+politicaDiAccessoLst.get(0) +" to "+AccessPolicy.values(),e);
}
}
List<String> licenzaIdList = mapFields.get("ID Licenza");
if (licenzaIdList != null && licenzaIdList.size() > 0) {
if(licenzaIdList!=null && licenzaIdList.size()>0) {
uplaodedImage.setLicenseID(licenzaIdList.get(0));
}
return uplaodedImage;
}
/**
* To layer concessione.
*
* @param gdb the gdb
* @return the layer concessione
*/
public static LayerConcessione toLayerConcessione(GenericDatasetBean gdb) {
public static LayerConcessione toLayerConcessione(GenericDatasetBean gdb){
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
LayerConcessione layerConcessione = new LayerConcessione();
List<String> titoloLst = mapFields.get("Titolo");
if (titoloLst != null && titoloLst.size() > 0) {
if(titoloLst!=null && titoloLst.size()>0) {
layerConcessione.setTitolo(titoloLst.get(0));
}
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
if(politicaDiAccessoLst!=null && politicaDiAccessoLst.size()>0) {
try {
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
layerConcessione.setPolicy(ap);
} catch (Exception e) {
LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e);
}catch (Exception e) {
LOG.warn("I cannot cast "+politicaDiAccessoLst.get(0) +" to "+AccessPolicy.values(),e);
}
}
List<String> valutazioneQualitaLst = mapFields.get("Valutazione della qualità");
if (valutazioneQualitaLst != null && valutazioneQualitaLst.size() > 0) {
if(valutazioneQualitaLst!=null && valutazioneQualitaLst.size()>0) {
layerConcessione.setValutazioneQualita(valutazioneQualitaLst.get(0));
}
List<String> metodoRaccoltaDatiLst = mapFields.get("Metodo di raccolta dei dati");
if (metodoRaccoltaDatiLst != null && metodoRaccoltaDatiLst.size() > 0) {
if(metodoRaccoltaDatiLst!=null && metodoRaccoltaDatiLst.size()>0) {
layerConcessione.setMetodoRaccoltaDati(metodoRaccoltaDatiLst.get(0));
}
List<String> scalaAcquisizioneLst = mapFields.get("Scala di acquisizione dei dati");
if (scalaAcquisizioneLst != null && scalaAcquisizioneLst.size() > 0) {
if(scalaAcquisizioneLst!=null && scalaAcquisizioneLst.size()>0) {
layerConcessione.setScalaAcquisizione(scalaAcquisizioneLst.get(0));
}
// TODO
List<String> periodoDiEmbargo = mapFields.get("Periodo di embargo");
if (periodoDiEmbargo != null && periodoDiEmbargo.size() > 0) {
String dateFromTo = periodoDiEmbargo.get(0);
String[] dates = dateFromTo.split(",");
String dateFrom = dates[0];
String dateTo = dates[0];
// TODO MUST BE INTENGRATED IN THE SERVICE
}
List<String> licenzaIdList = mapFields.get("ID Licenza");
if (licenzaIdList != null && licenzaIdList.size() > 0) {
if(licenzaIdList!=null && licenzaIdList.size()>0) {
layerConcessione.setLicenseID(licenzaIdList.get(0));
}
List<String> autoreLst = mapFields.get("Autore");
if (autoreLst != null) {
if(autoreLst!=null) {
layerConcessione.setAuthors(autoreLst);
}
return layerConcessione;
}
/**
* To local date time.
*
@ -412,19 +379,20 @@ public class ConvertToServiceModel {
try {
date = date.trim();
SimpleDateFormat dateFormat = null;
if (date.contains(HOURS_MINUTES_SEPARATOR)) {
dateFormat = new SimpleDateFormat(DATE_FORMAT + " " + TIME_FORMAT);
} else
if(date.contains(HOURS_MINUTES_SEPARATOR)) {
dateFormat = new SimpleDateFormat(DATE_FORMAT+" "+TIME_FORMAT);
}else
dateFormat = new SimpleDateFormat(DATE_FORMAT);
Date theDate = dateFormat.parse(date);
theLocalDT = convertToLocalDateTimeViaInstant(theDate);
} catch (ParseException e) {
LOG.error("No able to parse: " + date, e);
LOG.error("No able to parse: "+date, e);
}
return theLocalDT;
}
/**
* Convert to local date time via instant.
*
@ -432,7 +400,9 @@ public class ConvertToServiceModel {
* @return the local date time
*/
public static LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert) {
return dateToConvert.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
return dateToConvert.toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
}
}

View File

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

View File

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

View File

@ -1,230 +0,0 @@
package org.gcube.portlets.user.geoportaldataentry.server;
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.List;
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.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.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 MongoServiceCommon.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Sep 16, 2021
*/
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();
LOG.warn("\n\n\nMUST BE PORTED TO NEW MONGO CLIENT");
return null;
}
/**
* Creates the temp file on storage.
*
* @param is the is
* @param fileName the file name
* @return the temp file
*/
public TempFile createTempFileOnStorage(InputStream is, String fileName) {
LOG.debug("createTempFileOnStorage called");
StorageUtils storage = new StorageUtils();
TempFile toUpload = null;
try {
LOG.info("calling putOntoStorage the stream with the fileName: " + fileName);
toUpload = storage.putOntoStorage(is, fileName);
} catch (RemoteBackendException | FileNotFoundException e) {
LOG.error("Error when uploading stream on Storage: ", e);
}
return toUpload;
}
/**
* To tem files.
*
* @param listFileUploaded the list file uploaded
* @return the list
*/
public List<TempFile> toTemFiles(List<FileUploaded> listFileUploaded) {
LOG.debug("toTemFiles called");
if (listFileUploaded == null || listFileUploaded.isEmpty())
return null;
// Building TempFile
List<TempFile> files = new ArrayList<TempFile>(listFileUploaded.size());
for (FileUploaded fileUploaded : listFileUploaded) {
FileInputStream fis;
try {
fis = new FileInputStream(fileUploaded.getTempSystemPath());
// Creating TempFile
TempFile storageTempFile = createTempFileOnStorage(fis, fileUploaded.getFileName());
files.add(storageTempFile);
} catch (FileNotFoundException e) {
LOG.error("Error on loading temp file with path: " + fileUploaded.getTempSystemPath(), e);
}
}
return files;
}
/**
* To temp file from remote.
*
* @param file the file
* @return the temp file
*/
public TempFile toTempFileFromRemote(FileUploadedRemote file) {
LOG.debug("toTemFilesFromRemote called");
if (file == null)
return null;
// Building TempFile
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 storageTempFile;
}
/**
* To JSON.
*
* @param theObj the the obj
* @return the string
*/
public String toJSON(Object theObj) {
LOG.debug("toJSON called");
try {
// if (theObj instanceof Serializable) {
return org.gcube.application.geoportal.client.utils.Serialization.write(theObj);
// }
// throw new Exception("The input object is not serializable");
} catch (Exception e) {
LOG.warn("Error on deserializing: ", e);
return null;
}
}
}

View File

@ -3,22 +3,10 @@
*/
package org.gcube.portlets.user.geoportaldataentry.server;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
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.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;
import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetSorted;
import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
@ -30,25 +18,16 @@ import org.slf4j.LoggerFactory;
import com.liferay.portal.service.UserLocalServiceUtil;
/**
* The Class SessionUtil.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 20, 2020
* Oct 20, 2020
*/
public class SessionUtil {
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);
@ -61,7 +40,7 @@ public class SessionUtil {
try {
UserLocalServiceUtil.getService();
return true;
} catch (Exception ex) {
}catch (Exception ex) {
LOG.debug("Development Mode ON");
return false;
}
@ -73,9 +52,9 @@ public class SessionUtil {
* @param request the request
* @return a GcubeUser object
*/
public static GCubeUser getCurrentUser(HttpServletRequest request) {
public static GCubeUser getCurrentUser(HttpServletRequest request){
if (request == null)
if(request == null)
throw new IllegalArgumentException("HttpServletRequest is null!");
PortalContext pContext = PortalContext.getConfiguration();
@ -87,29 +66,21 @@ public class SessionUtil {
/**
* Retrieve the current scope by using the portal manager.
*
* @param request the request
* @param setContextsInThread set the scope and the security token into current
* thread
* @param request the request
* @param setInThread the set in thread
* @return a GcubeUser object
*/
public static String getCurrentContext(HttpServletRequest request, boolean setContextsInThread) {
public static String getCurrentContext(HttpServletRequest request, boolean setInThread){
if (request == null)
if(request == null)
throw new IllegalArgumentException("HttpServletRequest is null!");
PortalContext pContext = PortalContext.getConfiguration();
String context = pContext.getCurrentScope(request);
LOG.debug("Returning context " + context);
if (setContextsInThread) {
GCubeUser user = getCurrentUser(request);
String token = pContext.getCurrentUserToken(context, user.getUsername());
if (context != null)
ScopeProvider.instance.set(context);
if (token != null)
SecurityTokenProvider.instance.set(token);
}
if(context != null && setInThread)
ScopeProvider.instance.set(context);
return context;
}
@ -120,11 +91,11 @@ public class SessionUtil {
* @param scope the scope
* @return the group from scope
* @throws UserManagementSystemException the user management system exception
* @throws GroupRetrievalFault the group retrieval fault
* @throws GroupRetrievalFault the group retrieval fault
*/
public static GCubeGroup getGroupFromScope(String scope) throws UserManagementSystemException, GroupRetrievalFault {
public static GCubeGroup getGroupFromScope(String scope) throws UserManagementSystemException, GroupRetrievalFault{
if (scope == null || scope.isEmpty())
if(scope == null || scope.isEmpty())
throw new IllegalArgumentException("Scope is missing here!!");
GroupManager gm = new LiferayGroupManager();
@ -132,224 +103,4 @@ public class SessionUtil {
return gm.getGroup(groupId);
}
/**
* 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.
*
* @param httpServletRequest the http servlet request
* @param reloadFromService the reload from service
* @return the list of concessioni
* @throws Exception the exception
*/
public static List<Concessione> getListOfConcessioni(HttpServletRequest httpServletRequest,
boolean reloadFromService) throws Exception {
HttpSession session = httpServletRequest.getSession();
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
// setting null to force reloading from service
if (reloadFromService)
listOfConcessioni = null;
if (listOfConcessioni == null) {
listOfConcessioni = new ArrayList<Concessione>();
LOG.info("Loading list of concessione from client mongo");
SessionUtil.getCurrentContext(httpServletRequest, true);
MongoServiceUtil serviceUtil = new MongoServiceUtil();
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
Iterator<Concessione> concessioni = clientMongo.getList();
if (concessioni != null) {
while (concessioni.hasNext()) {
Concessione concessione = (Concessione) concessioni.next();
listOfConcessioni.add(concessione);
}
}
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
} else
LOG.info("list of concessioni presents in session, using it");
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
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 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.
*
* @param httpServletRequest the http servlet request
* @return the latest result set sorted
*/
public static ResultSetSorted getLatestResultSetSorted(HttpServletRequest httpServletRequest) {
HttpSession session = httpServletRequest.getSession();
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);
}
/**
* 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);
}
}

View File

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

View File

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

View File

@ -2,25 +2,36 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
/**
* The Class CommitReport.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Jul 30, 2021
* Nov 30, 2020
*/
public class CommitReport implements Serializable {
/**
*
*/
private static final long serialVersionUID = -3606902201347318287L;
public String projectID;
private LifecycleInformationDV lifecycleInformation;
private String profileID;
private String projectAsJSON;
private static final long serialVersionUID = -9519707669761939L;
/**
* The Enum STATE.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 21, 2020
*/
public enum STATE {
ERROR, WARN, OK, UNKNOWN
}
public STATE state = STATE.UNKNOWN;
public Long recordId;
public String msg;
public String report;
/**
* Instantiates a new commit report.
@ -29,59 +40,113 @@ public class CommitReport implements Serializable {
}
public CommitReport(String projectID, String profileID, String projectAsJSON,
LifecycleInformationDV lifecycleInfo) {
this.projectID = projectID;
this.profileID = profileID;
this.projectAsJSON = projectAsJSON;
this.lifecycleInformation = lifecycleInfo;
/**
* Instantiates a new commit report.
*
* @param state the state
* @param recordId the record id
* @param msg the msg
* @param report the report
*/
public CommitReport(STATE state, long recordId, String msg, String report) {
super();
this.state = state;
this.recordId = recordId;
this.msg = msg;
this.report = report;
}
public String getProjectID() {
return projectID;
/**
* Gets the state.
*
* @return the state
*/
public STATE getState() {
return state;
}
public LifecycleInformationDV getLifecycleInformation() {
return lifecycleInformation;
/**
* Sets the state.
*
* @param state the new state
*/
public void setState(STATE state) {
this.state = state;
}
public void setProjectID(String projectID) {
this.projectID = projectID;
/**
* Gets the record id.
*
* @return the record id
*/
public Long getRecordId() {
return recordId;
}
public void setLifecycleInformation(LifecycleInformationDV lifecycleInformation) {
this.lifecycleInformation = lifecycleInformation;
/**
* Gets the report.
*
* @return the report
*/
public String getReport() {
return report;
}
public String getProfileID() {
return profileID;
/**
* Sets the report.
*
* @param report the new report
*/
public void setReport(String report) {
this.report = report;
}
public void setProfileID(String profileID) {
this.profileID = profileID;
/**
* Sets the record id.
*
* @param recordId the new record id
*/
public void setRecordId(long recordId) {
this.recordId = recordId;
}
public String getProjectAsJSON() {
return projectAsJSON;
/**
* Gets the msg.
*
* @return the msg
*/
public String getMsg() {
return msg;
}
public void setProjectAsJSON(String projectAsJSON) {
this.projectAsJSON = projectAsJSON;
/**
* Sets the msg.
*
* @param msg the new msg
*/
public void setMsg(String msg) {
this.msg = msg;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
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("CommitReport [state=");
builder.append(state);
builder.append(", recordId=");
builder.append(recordId);
builder.append(", msg=");
builder.append(msg);
builder.append(", report=");
builder.append(report);
builder.append("]");
return builder.toString();
}
}

View File

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

View File

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

View File

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

View File

@ -3,26 +3,27 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
import java.io.Serializable;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
public class GeoNaFormDataObject implements Serializable {
public class GeoNaFormDataObject implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1084036362952974474L;
private static final long serialVersionUID = 3620244260086172039L;
private List<GenericDatasetBean> listGDB;
private GcubeProfileDV gcubeProfileDV;
public GeoNaFormDataObject() {
private ConcessioniFormCardTitle theType;
public GeoNaFormDataObject(){
}
public GeoNaFormDataObject(List<GenericDatasetBean> listGDB, GcubeProfileDV gcubeProfileDV) {
public GeoNaFormDataObject(List<GenericDatasetBean> listGDB, ConcessioniFormCardTitle theType) {
super();
this.listGDB = listGDB;
this.gcubeProfileDV = gcubeProfileDV;
this.theType = theType;
}
public List<GenericDatasetBean> getListGDB() {
@ -32,24 +33,17 @@ public class GeoNaFormDataObject implements Serializable {
public void setListGDB(List<GenericDatasetBean> listGDB) {
this.listGDB = listGDB;
}
public GcubeProfileDV getGcubeProfileDV() {
return gcubeProfileDV;
public ConcessioniFormCardTitle getTheType() {
return theType;
}
public void setGcubeProfileDV(GcubeProfileDV gcubeProfileDV) {
this.gcubeProfileDV = gcubeProfileDV;
public void setTheType(ConcessioniFormCardTitle theType) {
this.theType = theType;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoNaFormDataObject [listGDB=");
builder.append(listGDB);
builder.append(", gcubeProfileDV=");
builder.append(gcubeProfileDV);
builder.append("]");
return builder.toString();
return "GeoNaFormDataObject [listGDB=" + listGDB + ", theType=" + theType + "]";
}
}

Some files were not shown because too many files have changed in this diff Show More