Compare commits
8 Commits
master
...
cms-projec
Author | SHA1 | Date |
---|---|---|
Fabio Sinibaldi | b15dbf8a81 | |
Fabio Sinibaldi | 529ff44dc1 | |
Fabio Sinibaldi | 0933ed0d46 | |
Fabio Sinibaldi | a07befcc1d | |
Fabio Sinibaldi | 1e84ca40a7 | |
Fabio Sinibaldi | 43ddf88ba8 | |
Fabio Sinibaldi | 8d664f6ba1 | |
Fabio Sinibaldi | f29a8c3ef0 |
39
.classpath
39
.classpath
|
@ -1,39 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.3.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"/>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.3.0-SNAPSHOT/WEB-INF/classes"/>
|
|
||||||
</classpath>
|
|
|
@ -1,2 +0,0 @@
|
||||||
/bin/
|
|
||||||
/target/
|
|
47
.project
47
.project
|
@ -1,47 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>geoportal-data-viewer-app-ws</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.gwtplugins.gdt.eclipse.core.webAppProjectValidator</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>com.gwtplugins.gwt.eclipse.core.gwtProjectValidator</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
|
||||||
<nature>com.gwtplugins.gwt.eclipse.core.gwtNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,4 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.3.0-SNAPSHOT
|
|
||||||
warSrcDir=src/main/webapp
|
|
||||||
warSrcDirIsOutput=false
|
|
|
@ -1,2 +0,0 @@
|
||||||
eclipse.preferences.version=1
|
|
||||||
gwtSyncCodeServer=true
|
|
|
@ -1,11 +0,0 @@
|
||||||
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.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=warning
|
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
|
@ -1,171 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-viewer-app-2.3.0-SNAPSHOT">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project-modules>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<faceted-project>
|
|
||||||
<installed facet="jst.web" version="3.0"/>
|
|
||||||
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
|
|
||||||
<installed facet="jst.jaxrs" version="2.0"/>
|
|
||||||
<installed facet="java" version="1.8"/>
|
|
||||||
</faceted-project>
|
|
|
@ -4,6 +4,11 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
|
||||||
|
## [v3.0.0-SNAPSHOT] - 2022-08-09
|
||||||
|
|
||||||
|
- Support for Use Case Descriptors
|
||||||
|
|
||||||
## [v2.3.0] - 2022-07-26
|
## [v2.3.0] - 2022-07-26
|
||||||
|
|
||||||
#### Bug fixed
|
#### Bug fixed
|
||||||
|
|
134
pom.xml
134
pom.xml
|
@ -14,13 +14,13 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.3.0</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
<name>GeoPortal Data Viewer App</name>
|
<name>GeoPortal Data Viewer App</name>
|
||||||
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface</description>
|
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface</description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Convenience property to set the GWT version -->
|
<!-- Convenience property to set the GWT version -->
|
||||||
<gwt.version>2.9.0</gwt.version>
|
<gwt.version>2.8.2</gwt.version>
|
||||||
<gwt.compiler.style>PRETTY</gwt.compiler.style>
|
<gwt.compiler.style>PRETTY</gwt.compiler.style>
|
||||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
<!-- GWT 2.9 support 8, 9 and 11 -->
|
<!-- GWT 2.9 support 8, 9 and 11 -->
|
||||||
|
@ -63,11 +63,74 @@
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
|
<!-- FORCING THESE DEPENDENCIES IN ORDER TO USE THE "OLD" CONCESSIONI CLIENT/MODEL -->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>metadata-profile-discovery</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 1.1.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.application</groupId>
|
||||||
|
<artifactId>geoportal-data-common</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- END FORCING -->
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>org.gcube.application</groupId>
|
||||||
|
<artifactId>geoportal-client</artifactId>
|
||||||
|
|
||||||
|
</dependency> -->
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.gwtbootstrap</groupId>
|
||||||
|
<artifactId>gwt-bootstrap</artifactId>
|
||||||
|
<version>2.3.2.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.tdesjardins</groupId>
|
||||||
|
<artifactId>gwt-ol3</artifactId>
|
||||||
|
<!-- <version>8.1.0-gwt2_9</version> -->
|
||||||
|
<version>8.2.0-gwt2_8</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.spatial.data</groupId>
|
||||||
|
<artifactId>geo-utility</artifactId>
|
||||||
|
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>gcube-url-shortener</artifactId>
|
||||||
|
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.common</groupId>
|
||||||
|
<artifactId>keycloak-client</artifactId>
|
||||||
|
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <dependency> -->
|
||||||
|
<!-- <groupId>org.projectlombok</groupId> -->
|
||||||
|
<!-- <artifactId>lombok</artifactId> -->
|
||||||
|
<!-- <version>1.14.8</version> -->
|
||||||
|
<!-- </dependency> -->
|
||||||
|
|
||||||
|
<!-- PROVIDED in GATEWAY -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
<version>3.1.0</version>
|
<version>3.1.0</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
|
<!-- <scope>system</scope> -->
|
||||||
|
<!-- <systemPath>/Users/fabioisti/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar</systemPath> -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -105,22 +168,7 @@
|
||||||
<artifactId>oidc-library</artifactId>
|
<artifactId>oidc-library</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.tdesjardins</groupId>
|
|
||||||
<artifactId>gwt-ol3</artifactId>
|
|
||||||
<version>8.1.0-gwt2_9</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.gwtbootstrap</groupId>
|
|
||||||
<artifactId>gwt-bootstrap</artifactId>
|
|
||||||
<version>2.3.2.0</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.spatial.data</groupId>
|
|
||||||
<artifactId>geo-utility</artifactId>
|
|
||||||
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
<groupId>org.gcube.resources.discovery</groupId>
|
||||||
<artifactId>ic-client</artifactId>
|
<artifactId>ic-client</artifactId>
|
||||||
|
@ -141,73 +189,33 @@
|
||||||
<artifactId>usermanagement-core</artifactId>
|
<artifactId>usermanagement-core</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
|
||||||
<artifactId>gcube-url-shortener</artifactId>
|
|
||||||
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- FORCING THESE DEPENDENCIES IN ORDER TO USE THE "OLD" CONCESSIONI CLIENT/MODEL -->
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.common</groupId>
|
|
||||||
<artifactId>metadata-profile-discovery</artifactId>
|
|
||||||
<version>[1.0.0-SNAPSHOT, 1.1.0-SNAPSHOT)</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.application</groupId>
|
|
||||||
<artifactId>geoportal-data-common</artifactId>
|
|
||||||
<version>[1.0.0-SNAPSHOT, 1.5.0-SNAPSHOT)</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.application</groupId>
|
|
||||||
<artifactId>geoportal-client</artifactId>
|
|
||||||
<version>[1.0.0, 1.1.0-SNAPSHOT)</version>
|
|
||||||
<scope>compile</scope>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
|
||||||
<artifactId>ic-client</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.ow2.asm</groupId>
|
|
||||||
<artifactId>asm</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<!-- END FORCING -->
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.common</groupId>
|
|
||||||
<artifactId>keycloak-client</artifactId>
|
|
||||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.liferay.portal</groupId>
|
<groupId>com.liferay.portal</groupId>
|
||||||
<artifactId>portal-service</artifactId>
|
<artifactId>portal-service</artifactId>
|
||||||
<!-- <version>6.2.5</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.portlet</groupId>
|
<groupId>javax.portlet</groupId>
|
||||||
<artifactId>portlet-api</artifactId>
|
<artifactId>portlet-api</artifactId>
|
||||||
<!-- <version>2.0</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<!-- <version>1.6.4</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<!-- <version>1.6.4</version> -->
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- TEST -->
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|
|
@ -1,51 +1,37 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ClosedViewDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.SearchPerformedEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowPopupOnCentroiEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.ChangeBaseMapLayerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent.LAYER_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEventHandler;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.OGCUtils;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -55,13 +41,11 @@ import com.google.gwt.core.client.ScriptInjector;
|
||||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.Timer;
|
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
|
||||||
import ol.Coordinate;
|
|
||||||
import ol.layer.Image;
|
import ol.layer.Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,40 +66,23 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
/** The main panel. */
|
/** The main panel. */
|
||||||
private GeonaDataViewMainPanel mainPanel;
|
private GeonaDataViewMainPanel mainPanel;
|
||||||
|
|
||||||
/** The param wms request. */
|
|
||||||
private String paramWmsRequest;
|
|
||||||
|
|
||||||
/** The param UUID. */
|
|
||||||
// private String paramUUID;
|
|
||||||
|
|
||||||
private String paramGeonaItemType;
|
|
||||||
|
|
||||||
/** The param layer title. */
|
|
||||||
private String paramLayerTitle;
|
|
||||||
|
|
||||||
private HandlerManager applicationBus = new HandlerManager("");
|
private HandlerManager applicationBus = new HandlerManager("");
|
||||||
|
|
||||||
/** The layer manager. */
|
/** The layer manager. */
|
||||||
private LayerManager layerManager = new LayerManager(applicationBus);
|
private LayerManager layerManager = new LayerManager(applicationBus);
|
||||||
|
|
||||||
private String paramGeonaItemID;
|
|
||||||
|
|
||||||
private GNADataViewerConfigProfile geonaDataViewerProfile;
|
|
||||||
|
|
||||||
private OLMapManager olMapMng = null;
|
private OLMapManager olMapMng = null;
|
||||||
|
|
||||||
|
|
||||||
int attempt = 0;
|
int attempt = 0;
|
||||||
|
|
||||||
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait");
|
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait");
|
||||||
|
|
||||||
private HTML attributionDiv = new HTML();
|
private HTML attributionDiv = new HTML();
|
||||||
|
|
||||||
private static List<BaseMapLayer> listBaseMapLayers = null;
|
|
||||||
|
|
||||||
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
private static ViewerStatus viewerStatus=new ViewerStatus();
|
||||||
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
|
||||||
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
*/
|
*/
|
||||||
|
@ -123,90 +90,45 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
loaderApp.getElement().addClassName("loader-gna-app");
|
loaderApp.getElement().addClassName("loader-gna-app");
|
||||||
RootPanel.get(APP_DIV).add(loaderApp);
|
RootPanel.get(APP_DIV).add(loaderApp);
|
||||||
|
|
||||||
paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
|
||||||
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
|
|
||||||
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
|
|
||||||
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID);
|
|
||||||
GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle);
|
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(loaderApp);
|
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().listOfFieldsForSearching(new AsyncCallback<List<ItemField>>() {
|
|
||||||
|
|
||||||
@Override
|
// Fields configurations are read on open collection event
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
Window.alert(caught.getMessage());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
|
||||||
public void onSuccess(List<ItemField> result) {
|
RootPanel.get(APP_DIV).add(mainPanel);
|
||||||
GWT.log("Loaded item fields: "+result);
|
|
||||||
|
initApplication();
|
||||||
for (ItemField itemField : result) {
|
|
||||||
if(itemField.isDisplayAsResult()) {
|
|
||||||
displayFields.add(itemField);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(itemField.isSearchable()) {
|
|
||||||
searchByFields.add(itemField);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(itemField.isSortable()) {
|
|
||||||
sortByFields.add(itemField);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GWT.log("List display fields: "+result);
|
|
||||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
|
||||||
initialSortFilter.setOrder(ORDER.ASC);
|
|
||||||
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
|
||||||
|
|
||||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),sortByFields,searchByFields,initialSortFilter);
|
|
||||||
RootPanel.get(APP_DIV).add(mainPanel);
|
|
||||||
|
|
||||||
initApplication();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initApplication() {
|
private void initApplication() {
|
||||||
|
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
//LOADING THE BASE MAP LAYERS
|
Map<String,List<String>> queryParameters = new HashMap<String,List<String>> ();
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListBaseLayers(new AsyncCallback<List<BaseMapLayer>>() {
|
queryParameters.putAll(Window.Location.getParameterMap());
|
||||||
|
|
||||||
|
GWT.log("Sending query params : "+ queryParameters);
|
||||||
|
// Load Initial Configuration
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getInitialConfiguration(queryParameters, new ControlledCallBack<ViewerConfiguration>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void after() {RootPanel.get(APP_DIV).remove(loaderApp);}
|
||||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
|
||||||
Window.alert("Sorry, an error occurred on instancing the GeoPortale Viewer. Please, contact the support");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
|
public void onSuccess(ViewerConfiguration result) {
|
||||||
try {
|
super.onSuccess(result);
|
||||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
|
||||||
}catch (Exception e) {
|
|
||||||
loaderApp.setVisible(false);
|
|
||||||
}
|
|
||||||
GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers;
|
|
||||||
//now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile
|
|
||||||
loadGeonaDataViewerProfile();
|
|
||||||
mainPanel.setBaseLayers(listBaseMapLayers);
|
|
||||||
|
|
||||||
BaseMapLayer firstBaseLayer = listBaseMapLayers.get(0);
|
GWT.log("Received init config : "+result);
|
||||||
|
GWT.log("Loading base layers, count : "+result.getBaseLayers().size());
|
||||||
|
|
||||||
|
GeoportalDataViewer.getStatus().setConfig(result);
|
||||||
|
|
||||||
|
mainPanel.setBaseLayers(result.getBaseLayers());
|
||||||
|
|
||||||
|
BaseMapLayer firstBaseLayer = result.getBaseLayers().get(0);
|
||||||
//Passing the first base map layer that will be applied as first base layer
|
//Passing the first base map layer that will be applied as first base layer
|
||||||
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
||||||
layerManager.getLayerManagerBus(), firstBaseLayer);
|
layerManager.getLayerManagerBus(), firstBaseLayer);
|
||||||
|
@ -215,14 +137,21 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
mainPanel.setMap(olMap);
|
mainPanel.setMap(olMap);
|
||||||
|
|
||||||
updateSize();
|
updateSize();
|
||||||
|
|
||||||
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||||
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||||
|
|
||||||
|
|
||||||
|
GWT.log("Loading collections, count "+result.getAvailableCollections().size());
|
||||||
|
|
||||||
|
mainPanel.setAvailableCollections(result.getAvailableCollections().values());
|
||||||
|
|
||||||
|
// TODO LOAD INITIAL LAYERS
|
||||||
|
|
||||||
|
GWT.log("DONE INIT LOAD");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -238,70 +167,72 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
public static ViewerStatus getStatus() {
|
||||||
return listBaseMapLayers;
|
return viewerStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadGeonaDataViewerProfile() {
|
|
||||||
|
// private void loadGeonaDataViewerProfile() {
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
//
|
||||||
|
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
@Override
|
//
|
||||||
public void execute() {
|
// @Override
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance()
|
// public void execute() {
|
||||||
.getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
// GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||||
|
// .getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
||||||
@Override
|
//
|
||||||
public void onFailure(Throwable caught) {
|
// @Override
|
||||||
Window.alert(caught.getMessage());
|
// public void onFailure(Throwable caught) {
|
||||||
|
// Window.alert(caught.getMessage());
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
@Override
|
//
|
||||||
public void onSuccess(GNADataViewerConfigProfile profile) {
|
// @Override
|
||||||
geonaDataViewerProfile = profile;
|
// public void onSuccess(GNADataViewerConfigProfile profile) {
|
||||||
GWT.log("Profile: " + geonaDataViewerProfile);
|
// geonaDataViewerProfile = profile;
|
||||||
Iterator<String> it;
|
// GWT.log("Profile: " + geonaDataViewerProfile);
|
||||||
String theItemType = paramGeonaItemType;
|
// Iterator<String> it;
|
||||||
if (theItemType == null) {
|
// String theItemType = paramGeonaItemType;
|
||||||
it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
// if (theItemType == null) {
|
||||||
it.hasNext();
|
// it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
||||||
theItemType = it.next();
|
// it.hasNext();
|
||||||
}
|
// theItemType = it.next();
|
||||||
|
// }
|
||||||
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
//
|
||||||
|
// LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
||||||
if (layerItem == null) {
|
//
|
||||||
Window.alert("Not detected any layer with type: " + theItemType);
|
// if (layerItem == null) {
|
||||||
return;
|
// Window.alert("Not detected any layer with type: " + theItemType);
|
||||||
}
|
// return;
|
||||||
|
// }
|
||||||
GWT.log("ON module load The layerItem is: " + layerItem);
|
//
|
||||||
String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink());
|
// GWT.log("ON module load The layerItem is: " + layerItem);
|
||||||
layerItem.setName(layerName);
|
// String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink());
|
||||||
layerManager.setBaseLayerFromIsProfile(layerItem);
|
// layerItem.setName(layerName);
|
||||||
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
// layerManager.setBaseLayerFromIsProfile(layerItem);
|
||||||
null, false, null, null, null);
|
// layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
||||||
|
// null, false, null, null, null);
|
||||||
if (paramGeonaItemID != null) {
|
//
|
||||||
if (paramGeonaItemType == null) {
|
// if (paramGeonaItemID != null) {
|
||||||
Window.alert(
|
// if (paramGeonaItemType == null) {
|
||||||
"Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
|
// Window.alert(
|
||||||
+ " (GeoNa Data Type) where to search the item id: "
|
// "Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
|
||||||
+ paramGeonaItemID);
|
// + " (GeoNa Data Type) where to search the item id: "
|
||||||
return;
|
// + paramGeonaItemID);
|
||||||
}
|
// return;
|
||||||
GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
|
// }
|
||||||
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
// GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
|
||||||
}
|
// applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||||
|
// }
|
||||||
}
|
//
|
||||||
});
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// }
|
||||||
|
// });
|
||||||
}
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update window size.
|
* Update window size.
|
||||||
|
@ -322,302 +253,278 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
return rootHeight;
|
return rootHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//************************************************************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
// ************************** COLLECTIONS
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
applicationBus.addHandler(OpenCollectionEvent.TYPE, openCollectionEvent ->{
|
||||||
GWT.log("Fired event: " + showDetailsEvent);
|
GWT.log("Fired event: " + openCollectionEvent);
|
||||||
|
// Check if ID is available
|
||||||
String geonaMongoId = showDetailsEvent.getGeonaMongoID();
|
String collId=openCollectionEvent.getCollectionId();
|
||||||
|
if(!GeoportalDataViewer.getStatus().getConfig().getAvailableCollections().containsKey(collId)) {
|
||||||
if (geonaMongoId == null) {
|
GWT.log("!! Collection "+collId+" is not available");
|
||||||
Window.alert("Item Id not found");
|
Window.alert("Collection "+collId+" is not found.");
|
||||||
return;
|
}else {
|
||||||
}
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
boolean found = false;
|
|
||||||
GWT.log("Product with id: " + geonaMongoId + " found? " + found);
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
|
|
||||||
if (showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
|
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(geonaMongoId,
|
|
||||||
new AsyncCallback<ConcessioneDV>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
Window.alert(caught.getMessage());
|
|
||||||
mainPanel.hidePanelDetails();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(ConcessioneDV concessioneDV) {
|
|
||||||
GWT.log("Showing: " + concessioneDV);
|
|
||||||
mainPanel.showAsDetails(concessioneDV, showDetailsEvent.getGeonaItemRef());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
applicationBus.addHandler(AddedLayerToMapEvent.TYPE, new AddedLayerToMapEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
|
||||||
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
attempt = 0;
|
|
||||||
|
|
||||||
if (paramGeonaItemID != null) {
|
|
||||||
// waiting for record retrieved by service before calling the WFS
|
|
||||||
final int MAX_RETRY = 15;
|
|
||||||
Timer timer = new com.google.gwt.user.client.Timer() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
attempt++;
|
|
||||||
GWT.log("waiting get record: " + attempt);
|
|
||||||
RecordDV record = mainPanel.getDisplayedRecord();
|
|
||||||
if (record != null) {
|
|
||||||
this.cancel();
|
|
||||||
GWT.log("cancelled timer");
|
|
||||||
performWFSQueryOnCentroid(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attempt > MAX_RETRY) {
|
|
||||||
GWT.log("MAX_RETRY reached, cancelled timer");
|
|
||||||
this.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
timer.scheduleRepeating(1000);
|
|
||||||
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
// TODO: handle exception
|
|
||||||
}
|
|
||||||
|
|
||||||
LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
|
|
||||||
|
|
||||||
if (layerType != null) {
|
|
||||||
|
|
||||||
switch (layerType) {
|
|
||||||
case BASE:
|
|
||||||
|
|
||||||
break;
|
|
||||||
case OVERLAY:
|
|
||||||
mainPanel.showOverlayLayers(layerManager.getOverlayLayerManager().getPanel());
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
applicationBus.addHandler(ZoomOutOverMinimumEvent.TYPE, new ZoomOutOverMinimumEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
|
|
||||||
|
|
||||||
if (mainPanel.getDisplayedRecord() == null && !olMapMng.isQueryPointActive()) {
|
|
||||||
olMapMng.hidePopInfo();
|
|
||||||
layerManager.removeAllDetailLayers();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
mainPanel.hideOverlayLayers();
|
|
||||||
// layerManager.getOverlayLayerManager().hide();
|
|
||||||
// hidePopupLayers();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
applicationBus.addHandler(ClosedViewDetailsEvent.TYPE, new ClosedViewDetailsEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClosed(ClosedViewDetailsEvent closedViewDetailsEvent) {
|
|
||||||
olMapMng.hidePopInfo();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
applicationBus.addHandler(MapExtentToEvent.TYPE, new MapExtentToEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onExtentEvent(MapExtentToEvent mapExtentToEvent) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, new DoActionOnDetailLayersEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doLayerActionEvent) {
|
|
||||||
|
|
||||||
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
|
||||||
GWT.log("event: "+doAction);
|
|
||||||
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
|
|
||||||
OpenLayerMap olMap = olMapMng.getOLMap();
|
|
||||||
|
|
||||||
switch (doAction) {
|
GCubeCollection toOpen = GeoportalDataViewer.getStatus().getConfig().getAvailableCollections().get(collId);
|
||||||
case OPACITY:
|
|
||||||
GWT.log("opacity: "+doLayerActionEvent.getOpacity());
|
// Check if indexes is empty
|
||||||
olMap.setWMSDetailLayerOpacity(doLayerActionEvent.getLayerItem(),
|
if(toOpen.getIndexes()==null || toOpen.getIndexes().isEmpty()) {
|
||||||
doLayerActionEvent.getOpacity());
|
GWT.log("Unexpected empty indexes in collection "+toOpen);
|
||||||
break;
|
Window.alert("Cannot open collection index layer for "+toOpen.getUcd().getName()+".");
|
||||||
|
}
|
||||||
|
// TODO Get Default Index Layer
|
||||||
|
// For now we just take the first - only 1 is expected
|
||||||
|
IndexLayer layer = toOpen.getIndexes().get(0);
|
||||||
|
// Open Index Layer
|
||||||
|
|
||||||
|
GWT.log("Opening index "+layer);
|
||||||
|
|
||||||
|
LayerObject toAdd = new LayerObject(toOpen.getUcd().getId(), layer, LayerItem.fromIndex(layer));
|
||||||
|
layerManager.addLayer(toAdd);
|
||||||
|
|
||||||
|
}catch(Throwable t) {
|
||||||
|
GWT.log("Unable to open collection.",t);
|
||||||
|
Window.alert("Unable to open collection. Please contact administrators.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ************************* LAYERS
|
||||||
|
|
||||||
|
applicationBus.addHandler(AddedLayerToMapEvent.TYPE, addedLayerToMapEvent -> {
|
||||||
|
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
|
||||||
|
|
||||||
case SWAP:
|
// ???
|
||||||
SwapLayer swLS = doLayerActionEvent.getSourceLayerSwap();
|
// Open details popup (if called on startup)
|
||||||
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
|
|
||||||
GWT.log("SWAPPING source "+swLS.getLayerItem().getName() +", target: "+swLT.getLayerItem().getName());
|
|
||||||
olMap.swapDetailsLayers(swLS, swLT);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VISIBILITY:
|
|
||||||
GWT.log("visibility: "+doLayerActionEvent.getVisibility());
|
|
||||||
olMap.setWMSDetailLayerVisible(doLayerActionEvent.getLayerItem(),
|
try {
|
||||||
doLayerActionEvent.getVisibility());
|
|
||||||
|
attempt = 0;
|
||||||
|
|
||||||
|
// if (paramGeonaItemID != null) {
|
||||||
|
// // waiting for record retrieved by service before calling the WFS
|
||||||
|
// final int MAX_RETRY = 15;
|
||||||
|
// Timer timer = new com.google.gwt.user.client.Timer() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// attempt++;
|
||||||
|
// GWT.log("waiting get record: " + attempt);
|
||||||
|
// RecordDV record = mainPanel.getDisplayedRecord();
|
||||||
|
// if (record != null) {
|
||||||
|
// this.cancel();
|
||||||
|
// GWT.log("cancelled timer");
|
||||||
|
// OGCUtils.performWFSQueryOnCentroid(record);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (attempt > MAX_RETRY) {
|
||||||
|
// GWT.log("MAX_RETRY reached, cancelled timer");
|
||||||
|
// this.cancel();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// timer.scheduleRepeating(1000);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
}
|
||||||
|
|
||||||
|
LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
|
||||||
|
|
||||||
|
if (layerType != null) {
|
||||||
|
|
||||||
|
switch (layerType) {
|
||||||
|
case BASE:
|
||||||
|
|
||||||
|
break;
|
||||||
|
case OVERLAY:
|
||||||
|
mainPanel.showOverlayLayers(layerManager.getOverlayLayerManager().getPanel());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
//**************************** User actions On MAP
|
||||||
public void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent) {
|
applicationBus.addHandler(ShowDetailsEvent.TYPE, showDetailsEvent -> {
|
||||||
|
GWT.log("Fired event: " + showDetailsEvent);
|
||||||
|
|
||||||
BaseMapLayer baseLayer = changeMapLayerEvent.getBaseMapLayer();
|
String geonaMongoId = showDetailsEvent.getGeonaMongoID();
|
||||||
|
|
||||||
if (baseLayer == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
String attributionHTML = "<div class='map-credits'><div class='map-credits-container'>"
|
|
||||||
+ baseLayer.getAttribution() + "</div></div>";
|
|
||||||
olMapMng.getOLMap().changeBaseMap(baseLayer);
|
|
||||||
|
|
||||||
// THE OSM Contributors are automatically added by gwt-ol, others ones not.
|
|
||||||
if (!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
|
|
||||||
attributionDiv.setHTML(attributionHTML);
|
|
||||||
} else
|
|
||||||
attributionDiv.setHTML("");
|
|
||||||
|
|
||||||
|
if (geonaMongoId == null) {
|
||||||
|
Window.alert("Item Id not found");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
|
||||||
|
|
||||||
if(showPopupOnCentroiEvent.getRecord()!=null)
|
|
||||||
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSearchDone(SearchPerformedEvent searchPerformedEvent) {
|
|
||||||
|
|
||||||
if(searchPerformedEvent!=null) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
|
|
||||||
String firstWMSKey = wmsMap.keySet().iterator().next();
|
|
||||||
List<ConcessioneDV> result = searchPerformedEvent.getData();
|
|
||||||
|
|
||||||
if(result!=null && result.size()>0) {
|
|
||||||
String cqlFilter = "product_id IN(";
|
|
||||||
for (ConcessioneDV concessioneDV : result) {
|
|
||||||
cqlFilter+="'"+concessioneDV.getItemId()+"',";
|
|
||||||
}
|
|
||||||
cqlFilter = cqlFilter.substring(0,cqlFilter.length()-1)+")";
|
|
||||||
|
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
|
|
||||||
}else {
|
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(searchPerformedEvent.isSearchReset()) {
|
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
// TODO
|
||||||
|
boolean found = false;
|
||||||
|
GWT.log("Product with id: " + geonaMongoId + " found? " + found);
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
if (!found) {
|
||||||
|
|
||||||
// /**
|
// if (showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
|
||||||
// * Handler popu closer.
|
|
||||||
// *
|
|
||||||
// * @param divId the div id
|
|
||||||
// * @param overlayId the overlay id
|
|
||||||
// */
|
|
||||||
// public static native void handlerPopuCloser(String divId, String overlayId) /*-{
|
|
||||||
// var closer = $doc.getElementById(divId);
|
|
||||||
// var overlay = $doc.getElementById(overlayId);
|
|
||||||
// closer.onclick = function() {
|
|
||||||
// overlay.setPosition(undefined);
|
|
||||||
// closer.blur();
|
|
||||||
// return false;
|
|
||||||
// };
|
|
||||||
//
|
//
|
||||||
// }-*/;
|
// GeoportalDataViewerServiceAsync.Util.getInstance().getConcessioneForId(geonaMongoId,
|
||||||
|
// new AsyncCallback<ConcessioneDV>() {
|
||||||
private void performWFSQueryOnCentroid(RecordDV record) {
|
//
|
||||||
if (record != null) {
|
// @Override
|
||||||
GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: "
|
// public void onFailure(Throwable caught) {
|
||||||
+ record.getItemId());
|
// Window.alert(caught.getMessage());
|
||||||
// GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: "
|
// mainPanel.hidePanelDetails();
|
||||||
// +(record instanceof ConcessioneDV));
|
//
|
||||||
if (record instanceof ConcessioneDV) {
|
// }
|
||||||
ConcessioneDV concessioneDV = (ConcessioneDV) record;
|
//
|
||||||
Double x = concessioneDV.getCentroidLong();
|
// @Override
|
||||||
Double y = concessioneDV.getCentroidLat();
|
// public void onSuccess(ConcessioneDV concessioneDV) {
|
||||||
GWT.log("X: " + x + ", Y:" + y);
|
// GWT.log("Showing: " + concessioneDV);
|
||||||
if (x != null && y != null) {
|
// mainPanel.showAsDetails(concessioneDV, showDetailsEvent.getGeonaItemRef());
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
|
// }
|
||||||
MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName());
|
// });
|
||||||
GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
|
// }
|
||||||
GWT.log("GeoQuery: " + select);
|
|
||||||
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
|
||||||
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
|
|
||||||
transfCoord.getY());
|
|
||||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(),
|
|
||||||
true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
|
|
||||||
} else {
|
|
||||||
GeoportalDataViewerConstants.printJs(
|
|
||||||
"I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
|
||||||
|
applicationBus.addHandler(ClosedViewDetailsEvent.TYPE, closedViewDetailsEvent -> olMapMng.hidePopInfo());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
applicationBus.addHandler(ZoomOutOverMinimumEvent.TYPE, zoomOutEvent -> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
if (mainPanel.getDisplayedRecord() == null && !olMapMng.isQueryPointActive()) {
|
||||||
|
olMapMng.hidePopInfo();
|
||||||
|
layerManager.removeAllDetailLayers();
|
||||||
|
|
||||||
|
}
|
||||||
|
mainPanel.hideOverlayLayers();
|
||||||
|
// layerManager.getOverlayLayerManager().hide();
|
||||||
|
// hidePopupLayers();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
applicationBus.addHandler(MapExtentToEvent.TYPE, mapExtentToEvent -> {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
applicationBus.addHandler(DoActionOnDetailLayersEvent.TYPE, doLayerActionEvent -> {
|
||||||
|
|
||||||
|
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
||||||
|
GWT.log("event: "+doAction);
|
||||||
|
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
|
||||||
|
OpenLayerMap olMap = olMapMng.getOLMap();
|
||||||
|
|
||||||
|
switch (doAction) {
|
||||||
|
case OPACITY:
|
||||||
|
GWT.log("opacity: "+doLayerActionEvent.getOpacity());
|
||||||
|
olMap.setWMSDetailLayerOpacity(doLayerActionEvent.getLayerItem(),
|
||||||
|
doLayerActionEvent.getOpacity());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SWAP:
|
||||||
|
SwapLayer swLS = doLayerActionEvent.getSourceLayerSwap();
|
||||||
|
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
|
||||||
|
GWT.log("SWAPPING source "+swLS.getLayerItem().getName() +", target: "+swLT.getLayerItem().getName());
|
||||||
|
olMap.swapDetailsLayers(swLS, swLT);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VISIBILITY:
|
||||||
|
GWT.log("visibility: "+doLayerActionEvent.getVisibility());
|
||||||
|
olMap.setWMSDetailLayerVisible(doLayerActionEvent.getLayerItem(),
|
||||||
|
doLayerActionEvent.getVisibility());
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
applicationBus.addHandler(ChangeBaseMapLayerEvent.TYPE, changeMapLayerEvent -> {
|
||||||
|
|
||||||
|
BaseMapLayer baseLayer = changeMapLayerEvent.getBaseMapLayer();
|
||||||
|
|
||||||
|
if (baseLayer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
String attributionHTML = "<div class='map-credits'><div class='map-credits-container'>"
|
||||||
|
+ baseLayer.getAttribution() + "</div></div>";
|
||||||
|
olMapMng.getOLMap().changeBaseMap(baseLayer);
|
||||||
|
|
||||||
|
// THE OSM Contributors are automatically added by gwt-ol, others ones not.
|
||||||
|
if (!baseLayer.getType().equals(BaseMapLayer.OL_BASE_MAP.OSM)) {
|
||||||
|
attributionDiv.setHTML(attributionHTML);
|
||||||
|
} else
|
||||||
|
attributionDiv.setHTML("");
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, showPopupOnCentroiEvent -> {
|
||||||
|
|
||||||
|
if(showPopupOnCentroiEvent.getRecord()!=null)
|
||||||
|
OGCUtils.performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ******************************* SEARCH
|
||||||
|
|
||||||
|
// applicationBus.addHandler(SearchPerformedEvent.TYPE, searchPerformedEvent -> {
|
||||||
|
//
|
||||||
|
// if(searchPerformedEvent!=null) {
|
||||||
|
//
|
||||||
|
// LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
|
||||||
|
// String firstWMSKey = wmsMap.keySet().iterator().next();
|
||||||
|
// List<ConcessioneDV> result = searchPerformedEvent.getData();
|
||||||
|
//
|
||||||
|
// if(result!=null && result.size()>0) {
|
||||||
|
// String cqlFilter = "product_id IN(";
|
||||||
|
// for (ConcessioneDV concessioneDV : result) {
|
||||||
|
// cqlFilter+="'"+concessioneDV.getItemId()+"',";
|
||||||
|
// }
|
||||||
|
// cqlFilter = cqlFilter.substring(0,cqlFilter.length()-1)+")";
|
||||||
|
//
|
||||||
|
// olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
|
||||||
|
// }else {
|
||||||
|
// olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if(searchPerformedEvent.isSearchReset()) {
|
||||||
|
// olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
@ -52,14 +49,14 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
|
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
|
||||||
int maxWFSFeature, double zoomLevel);
|
int maxWFSFeature, double zoomLevel);
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the concessione for id.
|
// * Gets the concessione for id.
|
||||||
*
|
// *
|
||||||
* @param mongoId the mongo id
|
// * @param mongoId the mongo id
|
||||||
* @return the concessione for id
|
// * @return the concessione for id
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
ConcessioneDV getConcessioneForId(String mongoId) throws Exception;
|
// ConcessioneDV getConcessioneForId(String mongoId) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the my login.
|
* Gets the my login.
|
||||||
|
@ -105,15 +102,15 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception;
|
GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception;
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the layers for id.
|
// * Gets the layers for id.
|
||||||
*
|
// *
|
||||||
* @param itemType the item type
|
// * @param itemType the item type
|
||||||
* @param itemId the item id
|
// * @param itemId the item id
|
||||||
* @return the layers for id
|
// * @return the layers for id
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
|
// List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the WFS features.
|
* Gets the WFS features.
|
||||||
|
@ -128,27 +125,9 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
|
||||||
|
|
||||||
List<BaseMapLayer> getListBaseLayers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of fields for searching.
|
|
||||||
*
|
|
||||||
* @return the list
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
List<ItemField> listOfFieldsForSearching() throws Exception;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the list concessioni.
|
|
||||||
*
|
|
||||||
* @param start the start
|
|
||||||
* @param limit the limit
|
|
||||||
* @param filter the filter
|
|
||||||
* @param reloadFromService the reload from service
|
|
||||||
* @return the list concessioni
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
|
||||||
boolean reloadFromService) throws Exception;
|
|
||||||
|
|
||||||
|
// Collections
|
||||||
|
|
||||||
|
ViewerConfiguration getInitialConfiguration(Map<String, List<String>> parameters) throws Exception, ControlledError;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
|
||||||
|
@ -43,8 +39,6 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
|
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
|
||||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||||
|
|
||||||
void getConcessioneForId(String mongoId, AsyncCallback<ConcessioneDV> callback);
|
|
||||||
|
|
||||||
void getMyLogin(AsyncCallback<String> callback);
|
void getMyLogin(AsyncCallback<String> callback);
|
||||||
|
|
||||||
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
|
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||||
|
@ -56,16 +50,13 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
|
|
||||||
void getPublicLinksFor(GeoNaItemRef item, AsyncCallback<GeoNaItemRef> asyncCallback);
|
void getPublicLinksFor(GeoNaItemRef item, AsyncCallback<GeoNaItemRef> asyncCallback);
|
||||||
|
|
||||||
void getLayersForId(String itemType, String itemId, AsyncCallback<List<LayerConcessioneDV>> asyncCallback);
|
|
||||||
|
|
||||||
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
||||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||||
|
|
||||||
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
|
||||||
|
// PROJECTS SUPPORT
|
||||||
void listOfFieldsForSearching(AsyncCallback<List<ItemField>> callback);
|
|
||||||
|
|
||||||
void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
|
||||||
AsyncCallback<ResultSetPaginatedData> callback);
|
|
||||||
|
|
||||||
|
void getInitialConfiguration(Map<String, List<String>> parameters, AsyncCallback<ViewerConfiguration> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
|
||||||
|
class StartParameters {
|
||||||
|
public StartParameters(Map<String, List<String>> parameters) {
|
||||||
|
if (parameters == null || parameters.isEmpty())
|
||||||
|
GWT.log("!!!! NB : NO QUERY PARAMETERS");
|
||||||
|
else {
|
||||||
|
paramWmsRequest = getFirst(parameters, GeoportalDataViewerConstants.GET_WMS_PARAMETER);
|
||||||
|
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
|
||||||
|
|
||||||
|
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
|
||||||
|
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// retro usage?
|
||||||
|
/** WMS Link -> Layer Name [optional]*/
|
||||||
|
public Map<String,String> toOpenLayers() {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> toOpenCollections(){
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<String> toOpenProjects(){
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getFirst(Map<String, List<String>> parameters, String key) {
|
||||||
|
List<String> values = parameters.get(key);
|
||||||
|
if (values != null && !values.isEmpty()) {
|
||||||
|
GWT.log("Param " + key + "Getting First value of : " + values);
|
||||||
|
return values.get(0);
|
||||||
|
} else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The param wms request.
|
||||||
|
*/
|
||||||
|
private String paramWmsRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The param UUID.
|
||||||
|
*/
|
||||||
|
// private String paramUUID;
|
||||||
|
|
||||||
|
private String paramGeonaItemType;
|
||||||
|
/**
|
||||||
|
* The param layer title.
|
||||||
|
*/
|
||||||
|
private String paramLayerTitle;
|
||||||
|
|
||||||
|
private String paramGeonaItemID;
|
||||||
|
|
||||||
|
public String getParamWmsRequest() {
|
||||||
|
return paramWmsRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamGeonaItemType() {
|
||||||
|
return paramGeonaItemType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamLayerTitle() {
|
||||||
|
return paramLayerTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParamGeonaItemID() {
|
||||||
|
return paramGeonaItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
|
||||||
|
public class ViewerStatus {
|
||||||
|
|
||||||
|
|
||||||
|
private GNADataViewerConfigProfile geonaDataViewerProfile;
|
||||||
|
|
||||||
|
private ViewerConfiguration config;
|
||||||
|
|
||||||
|
|
||||||
|
// ucid -> index layer
|
||||||
|
private Map<String,List<LayerObject>> openedIndexes;
|
||||||
|
|
||||||
|
// ucid -> projectId -> layers
|
||||||
|
private Map<String,Map<String,List<LayerObject>>> openedProjects;
|
||||||
|
|
||||||
|
public GNADataViewerConfigProfile getGeonaDataViewerProfile() {
|
||||||
|
return geonaDataViewerProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGeonaDataViewerProfile(GNADataViewerConfigProfile geonaDataViewerProfile) {
|
||||||
|
this.geonaDataViewerProfile = geonaDataViewerProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ViewerConfiguration getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfig(ViewerConfiguration config) {
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, List<LayerObject>> getOpenedIndexes() {
|
||||||
|
return openedIndexes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Map<String,List<LayerObject>>> getOpenedProjects() {
|
||||||
|
return openedProjects;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addOpenedIndex(String ucid, LayerObject indexId) {
|
||||||
|
if(openedIndexes==null) openedIndexes=new HashMap<String, List<LayerObject>>();
|
||||||
|
if(!openedIndexes.containsKey(ucid)) openedIndexes.put(ucid, new ArrayList<LayerObject>());
|
||||||
|
openedIndexes.get(ucid).add(indexId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOpenedProjectLayer(String ucid, String projectId, LayerObject projectLayer) {
|
||||||
|
if(openedProjects==null) openedProjects=new HashMap<String, Map<String,List<LayerObject>>>();
|
||||||
|
if(!openedProjects.containsKey(ucid)) openedProjects.put(ucid, new HashMap<String, List<LayerObject>>());
|
||||||
|
Map<String,List<LayerObject>> map=openedProjects.get(ucid);
|
||||||
|
if(!map.containsKey(projectId)) map.put(ucid, new ArrayList<LayerObject>());
|
||||||
|
map.get(projectId).add(projectLayer);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
@ -18,4 +18,5 @@ public interface ShowDetailsEventHandler extends EventHandler {
|
||||||
* @param showDetailsEvent the show details event
|
* @param showDetailsEvent the show details event
|
||||||
*/
|
*/
|
||||||
void onShowDetails(ShowDetailsEvent showDetailsEvent);
|
void onShowDetails(ShowDetailsEvent showDetailsEvent);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEventHandler;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.event.shared.GwtEvent.Type;
|
||||||
|
|
||||||
|
public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler> {
|
||||||
|
|
||||||
|
|
||||||
|
private String collectionId = null;
|
||||||
|
|
||||||
|
public static Type<CloseCollectionEventHandler> TYPE = new Type<CloseCollectionEventHandler>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<CloseCollectionEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(CloseCollectionEventHandler h) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public CloseCollectionEvent(String collectionId) {
|
||||||
|
this.collectionId=collectionId;
|
||||||
|
}
|
||||||
|
public String getCollectionId() {
|
||||||
|
return collectionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
public interface CloseCollectionEventHandler extends EventHandler{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
public class OpenCollectionEvent extends GwtEvent<OpenCollectionEventHandler> {
|
||||||
|
|
||||||
|
|
||||||
|
private String collectionId = null;
|
||||||
|
|
||||||
|
public static Type<OpenCollectionEventHandler> TYPE = new Type<OpenCollectionEventHandler>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<OpenCollectionEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(OpenCollectionEventHandler h) {
|
||||||
|
h.onOpenCollection(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenCollectionEvent(String collectionId) {
|
||||||
|
this.collectionId=collectionId;
|
||||||
|
}
|
||||||
|
public String getCollectionId() {
|
||||||
|
return collectionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
public interface OpenCollectionEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
|
||||||
|
void onOpenCollection(OpenCollectionEvent event);
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ChangeMapLayerEvent.
|
* The Class ChangeBaseMapLayerEvent.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Nov 12, 2021
|
* Nov 12, 2021
|
||||||
*/
|
*/
|
||||||
public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
public class ChangeBaseMapLayerEvent extends GwtEvent<ChangeBaseMapLayerEventHandler> {
|
||||||
public static Type<ChangeMapLayerEventHandler> TYPE = new Type<ChangeMapLayerEventHandler>();
|
public static Type<ChangeBaseMapLayerEventHandler> TYPE = new Type<ChangeBaseMapLayerEventHandler>();
|
||||||
private BaseMapLayer baseMapLayer;
|
private BaseMapLayer baseMapLayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,7 +20,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
||||||
*
|
*
|
||||||
* @param baseMapLayer the base map layer
|
* @param baseMapLayer the base map layer
|
||||||
*/
|
*/
|
||||||
public ChangeMapLayerEvent(BaseMapLayer baseMapLayer) {
|
public ChangeBaseMapLayerEvent(BaseMapLayer baseMapLayer) {
|
||||||
this.baseMapLayer = baseMapLayer;
|
this.baseMapLayer = baseMapLayer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
||||||
* @return the associated type
|
* @return the associated type
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Type<ChangeMapLayerEventHandler> getAssociatedType() {
|
public Type<ChangeBaseMapLayerEventHandler> getAssociatedType() {
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
||||||
* @param handler the handler
|
* @param handler the handler
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(ChangeMapLayerEventHandler handler) {
|
protected void dispatch(ChangeBaseMapLayerEventHandler handler) {
|
||||||
handler.onChangeBaseMapLayer(this);
|
handler.onChangeBaseMapLayer(this);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,20 +1,20 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface ChangeMapLayerEventHandler.
|
* The Interface ChangeBaseMapLayerEventHandler.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Nov 12, 2021
|
* Nov 12, 2021
|
||||||
*/
|
*/
|
||||||
public interface ChangeMapLayerEventHandler extends EventHandler {
|
public interface ChangeBaseMapLayerEventHandler extends EventHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On change base map layer.
|
* On change base map layer.
|
||||||
*
|
*
|
||||||
* @param changeMapLayerEvent the change map layer event
|
* @param changeMapLayerEvent the change map layer event
|
||||||
*/
|
*/
|
||||||
void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent);
|
void onChangeBaseMapLayer(ChangeBaseMapLayerEvent changeMapLayerEvent);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class LightOpenLayerMap {
|
||||||
map.addInteraction(new KeyboardPan());
|
map.addInteraction(new KeyboardPan());
|
||||||
map.addInteraction(new KeyboardZoom());
|
map.addInteraction(new KeyboardZoom());
|
||||||
|
|
||||||
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getListBaseMapLayers();
|
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getStatus().getConfig().getBaseLayers();
|
||||||
BaseMapLayer bml = null;
|
BaseMapLayer bml = null;
|
||||||
if(listBaseMapLayers!=null)
|
if(listBaseMapLayers!=null)
|
||||||
bml = listBaseMapLayers.get(0);
|
bml = listBaseMapLayers.get(0);
|
||||||
|
|
|
@ -5,9 +5,9 @@ import java.util.LinkedHashMap;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent.LAYER_TYPE;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ import ol.source.ImageWmsParams;
|
||||||
import ol.source.Osm;
|
import ol.source.Osm;
|
||||||
import ol.source.Source;
|
import ol.source.Source;
|
||||||
import ol.source.Vector;
|
import ol.source.Vector;
|
||||||
|
import ol.source.WmsServerType;
|
||||||
import ol.source.Xyz;
|
import ol.source.Xyz;
|
||||||
import ol.source.XyzOptions;
|
import ol.source.XyzOptions;
|
||||||
|
|
||||||
|
@ -433,33 +434,12 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
|
|
||||||
|
|
||||||
GWT.log("Getting key: "+key);
|
|
||||||
|
|
||||||
GWT.log("Setting CQL FILTER: "+cqlFilterExpression);
|
|
||||||
Image wmsLayer = wmsLayerMap.get(key);
|
|
||||||
|
|
||||||
GWT.log("WMS layer is: "+wmsLayer);
|
|
||||||
|
|
||||||
//map.removeLayer(wmsLayer);
|
|
||||||
|
|
||||||
ImageWms imageWMSSource = wmsLayer.getSource();
|
|
||||||
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
|
||||||
|
|
||||||
if (cqlFilterExpression == null) {
|
|
||||||
imageWMSParams.delete("CQL_FILTER");
|
|
||||||
} else {
|
|
||||||
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
|
|
||||||
}
|
|
||||||
|
|
||||||
imageWMSSource.updateParams(imageWMSParams);
|
|
||||||
wmsLayer.setSource(imageWMSSource);
|
|
||||||
|
|
||||||
//map.addLayer(wmsLayer);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the WMS detail layer.
|
* Adds the WMS detail layer.
|
||||||
*
|
*
|
||||||
|
@ -467,6 +447,8 @@ public abstract class OpenLayerMap {
|
||||||
*/
|
*/
|
||||||
public synchronized void addWMSDetailLayer(LayerItem layerItem) {
|
public synchronized void addWMSDetailLayer(LayerItem layerItem) {
|
||||||
|
|
||||||
|
GWT.log("Adding WMS Detail Layer on map "+layerItem);
|
||||||
|
|
||||||
if (wmsDetailsLayerMap == null)
|
if (wmsDetailsLayerMap == null)
|
||||||
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
|
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
|
||||||
|
|
||||||
|
@ -478,9 +460,14 @@ public abstract class OpenLayerMap {
|
||||||
GWT.log("The detail layer with key: " + key + " does not exist, creating and adding it to map");
|
GWT.log("The detail layer with key: " + key + " does not exist, creating and adding it to map");
|
||||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||||
imageWMSParams.setLayers(layerItem.getName());
|
imageWMSParams.setLayers(layerItem.getName());
|
||||||
|
|
||||||
|
|
||||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||||
|
|
||||||
|
imageWMSOptions.setServerType(WmsServerType.GEOSERVER);
|
||||||
|
imageWMSOptions.setUrl(layerItem.getWmsLink().substring(0, layerItem.getWmsLink().lastIndexOf("?")));
|
||||||
|
|
||||||
imageWMSOptions.setParams(imageWMSParams);
|
imageWMSOptions.setParams(imageWMSParams);
|
||||||
// imageWMSOptions.setRatio(1.5f);
|
// imageWMSOptions.setRatio(1.5f);
|
||||||
|
|
||||||
|
@ -510,26 +497,55 @@ public abstract class OpenLayerMap {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the all detail layers.
|
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
|
||||||
*/
|
|
||||||
public void removeAllDetailLayers() {
|
|
||||||
|
|
||||||
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
|
GWT.log("Getting key: "+key);
|
||||||
|
|
||||||
|
GWT.log("Setting CQL FILTER: "+cqlFilterExpression);
|
||||||
|
Image wmsLayer = wmsLayerMap.get(key);
|
||||||
|
|
||||||
|
GWT.log("WMS layer is: "+wmsLayer);
|
||||||
|
|
||||||
|
//map.removeLayer(wmsLayer);
|
||||||
|
|
||||||
|
ImageWms imageWMSSource = wmsLayer.getSource();
|
||||||
|
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
||||||
|
|
||||||
if (wmsDetailsLayerMap == null)
|
if (cqlFilterExpression == null) {
|
||||||
return;
|
imageWMSParams.delete("CQL_FILTER");
|
||||||
|
} else {
|
||||||
GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
|
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
|
||||||
|
|
||||||
for (String key : wmsDetailsLayerMap.keySet()) {
|
|
||||||
Image layer = wmsDetailsLayerMap.get(key);
|
|
||||||
map.removeLayer(layer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wmsDetailsLayerMap.clear();
|
imageWMSSource.updateParams(imageWMSParams);
|
||||||
|
wmsLayer.setSource(imageWMSSource);
|
||||||
|
|
||||||
|
//map.addLayer(wmsLayer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Removes the all detail layers.
|
||||||
|
// */
|
||||||
|
// public void removeAllDetailLayers() {
|
||||||
|
//
|
||||||
|
// // NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
|
||||||
|
//
|
||||||
|
// if (wmsDetailsLayerMap == null)
|
||||||
|
// return;
|
||||||
|
//
|
||||||
|
// GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
|
||||||
|
//
|
||||||
|
// for (String key : wmsDetailsLayerMap.keySet()) {
|
||||||
|
// Image layer = wmsDetailsLayerMap.get(key);
|
||||||
|
// map.removeLayer(layer);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// wmsDetailsLayerMap.clear();
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the vector.
|
* Adds the vector.
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ClosedViewDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
|
|
@ -1,30 +1,29 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.ChangeBaseMapLayerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
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.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
@ -92,14 +91,26 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Button linkLayers;
|
Button linkLayers;
|
||||||
|
|
||||||
|
|
||||||
|
//TODO Search By Collection, postponed
|
||||||
|
// @UiField
|
||||||
|
// DropdownButton searchFacilityButton;
|
||||||
|
//
|
||||||
|
// @UiField
|
||||||
|
// ScrollPanel searchFacilityPanel;
|
||||||
|
//
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
DropdownButton searchFacilityButton;
|
DropdownButton openCollectionDropDown;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel openCollectionPanel;
|
||||||
|
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel overlayLayersPanel;
|
ScrollPanel overlayLayersPanel;
|
||||||
|
|
||||||
@UiField
|
|
||||||
ScrollPanel searchFacilityPanel;
|
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel panelAttribution;
|
HTMLPanel panelAttribution;
|
||||||
|
@ -128,8 +139,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
* @param applicationBus the application bus
|
* @param applicationBus the application bus
|
||||||
* @param mapHeight the map height
|
* @param mapHeight the map height
|
||||||
*/
|
*/
|
||||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight, List<ItemField> sortByFields,
|
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
|
||||||
List<ItemField> searchForFields, SearchingFilter initialSortFilter) {
|
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
mapPanel = new MapPanel(mapHeight + "px");
|
mapPanel = new MapPanel(mapHeight + "px");
|
||||||
|
@ -155,23 +165,33 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
openCollectionDropDown.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||||
searchFacility.setSearchButton(searchFacilityButton);
|
|
||||||
searchFacilityButton.setIcon(IconType.SEARCH);
|
|
||||||
searchFacilityPanel.add(searchFacility);
|
// TODO
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
GWT.log("!!! NB TODO : Search facility is skipped ");
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
// searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
||||||
searchFacilityPanel.getElement().getParentElement().getStyle().setOpacity(0.9);
|
// searchFacility.setSearchButton(searchFacilityButton);
|
||||||
|
// searchFacilityButton.setIcon(IconType.SEARCH);
|
||||||
}
|
// searchFacilityPanel.add(searchFacility);
|
||||||
|
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
});
|
//
|
||||||
|
// @Override
|
||||||
|
// public void execute() {
|
||||||
|
// searchFacilityPanel.getElement().getParentElement().getStyle().setOpacity(0.9);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// layersDDB.setToggle(true);
|
// layersDDB.setToggle(true);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
GWT.log("Main Panel Created");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
@ -191,15 +211,17 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
searchFacilityButton.addDomHandler(new ClickHandler() {
|
|
||||||
|
// TODO Search
|
||||||
@Override
|
// searchFacilityButton.addDomHandler(new ClickHandler() {
|
||||||
public void onClick(ClickEvent event) {
|
//
|
||||||
//event.preventDefault();
|
// @Override
|
||||||
event.stopPropagation();
|
// public void onClick(ClickEvent event) {
|
||||||
|
// //event.preventDefault();
|
||||||
}
|
// event.stopPropagation();
|
||||||
}, ClickEvent.getType());
|
//
|
||||||
|
// }
|
||||||
|
// }, ClickEvent.getType());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,16 +330,19 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Show as details.
|
// TODO Generic Open Details
|
||||||
*
|
|
||||||
* @param concessioneDV the concessione DV
|
// /**
|
||||||
* @param geonaItemRef the geona item ref
|
// * Show as details.
|
||||||
*/
|
// *
|
||||||
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
|
// * @param concessioneDV the concessione DV
|
||||||
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
|
// * @param geonaItemRef the geona item ref
|
||||||
|
// */
|
||||||
}
|
// public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
|
||||||
|
// detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide panel details.
|
* Hide panel details.
|
||||||
|
@ -327,6 +352,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Check method
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the displyed record.
|
* Gets the displyed record.
|
||||||
*
|
*
|
||||||
|
@ -394,6 +422,48 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
panelAttribution.add(p);
|
panelAttribution.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setAvailableCollections(Collection<GCubeCollection> collection) {
|
||||||
|
GWT.log("Init Available collections menu");
|
||||||
|
if(collection == null || collection.isEmpty())
|
||||||
|
GWT.log("!!! No Available collections");
|
||||||
|
|
||||||
|
|
||||||
|
for(GCubeCollection coll : collection) {
|
||||||
|
GWT.log("Found available collection "+coll);
|
||||||
|
String label = coll.getUcd().getName();
|
||||||
|
String id=coll.getUcd().getId();
|
||||||
|
|
||||||
|
CheckBox checkbox = new CheckBox(label);
|
||||||
|
checkbox.setId("gcubeCollectionSelector_"+id);
|
||||||
|
|
||||||
|
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
|
GWT.log("Collection selector flag changed to value : "+event.toDebugString());
|
||||||
|
|
||||||
|
String collectionID = ((CheckBox)event.getSource()).getId().replace("gcubeCollectionSelector_", "");
|
||||||
|
|
||||||
|
GWT.log("Collection ID is : "+collectionID);
|
||||||
|
if(event.getValue()) {
|
||||||
|
// OPEN COLLECTION
|
||||||
|
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
||||||
|
}else {
|
||||||
|
// CLOSE COLLECTION
|
||||||
|
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
openCollectionPanel.add(checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
||||||
|
|
||||||
if(listBaseLayers==null)
|
if(listBaseLayers==null)
|
||||||
|
@ -413,7 +483,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
|
applicationBus.fireEvent(new ChangeBaseMapLayerEvent(baseMapLayer));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,16 +35,29 @@
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK" text="Search"
|
|
||||||
|
<!-- <b:DropdownButton type="LINK" text="Search"
|
||||||
ui:field="searchFacilityButton">
|
ui:field="searchFacilityButton">
|
||||||
<g:ScrollPanel ui:field="searchFacilityPanel"
|
<g:ScrollPanel ui:field="searchFacilityPanel"
|
||||||
addStyleNames="search-facility"></g:ScrollPanel>
|
addStyleNames="search-facility"></g:ScrollPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton> -->
|
||||||
|
|
||||||
|
|
||||||
|
<b:DropdownButton type="LINK" text="Open Collection"
|
||||||
|
ui:field="openCollectionDropDown">
|
||||||
|
<g:HTMLPanel ui:field="openCollectionPanel">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</b:DropdownButton>
|
||||||
|
|
||||||
|
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
title="Select the Map" text="Map" ui:field="linkMap">
|
title="Select the Map" text="Map" ui:field="linkMap">
|
||||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
title="Center Map to Location" text="Preset Location"
|
title="Center Map to Location" text="Preset Location"
|
||||||
ui:field="linkPresetLocation">
|
ui:field="linkPresetLocation">
|
||||||
|
|
|
@ -1,50 +1,22 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
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.products.ConcessioneDV;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Alert;
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
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.IconType;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
|
||||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
|
||||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
|
||||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Window;
|
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.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
@ -85,9 +57,9 @@ public class SearchFacilityUI extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
HorizontalPanel toogleSortBy;
|
HorizontalPanel toogleSortBy;
|
||||||
|
|
||||||
private List<ItemField> searchForFields;
|
// private List<ItemField> searchForFields;
|
||||||
|
//
|
||||||
private List<ItemField> sortByFields;
|
// private List<ItemField> sortByFields;
|
||||||
|
|
||||||
private SearchingFilter currentSortFilter;
|
private SearchingFilter currentSortFilter;
|
||||||
|
|
||||||
|
@ -109,122 +81,122 @@ public class SearchFacilityUI extends Composite {
|
||||||
interface SearchFacilityPanelUiBinder extends UiBinder<Widget, SearchFacilityUI> {
|
interface SearchFacilityPanelUiBinder extends UiBinder<Widget, SearchFacilityUI> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Instantiates a new search facility UI.
|
// * Instantiates a new search facility UI.
|
||||||
*
|
// *
|
||||||
* @param appManagerBus the app manager bus
|
// * @param appManagerBus the app manager bus
|
||||||
* @param sortByFields the sort by fields
|
// * @param sortByFields the sort by fields
|
||||||
* @param searchForFields the search for fields
|
// * @param searchForFields the search for fields
|
||||||
* @param initialSortFilter the initial sort filter
|
// * @param initialSortFilter the initial sort filter
|
||||||
*/
|
// */
|
||||||
public SearchFacilityUI(HandlerManager appManagerBus, List<ItemField> sortByFields, List<ItemField> searchForFields,
|
// public SearchFacilityUI(HandlerManager appManagerBus, List<ItemField> sortByFields, List<ItemField> searchForFields,
|
||||||
SearchingFilter initialSortFilter) {
|
// SearchingFilter initialSortFilter) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
// initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.searchForFields = searchForFields;
|
// this.searchForFields = searchForFields;
|
||||||
this.currentSortFilter = initialSortFilter;
|
// this.currentSortFilter = initialSortFilter;
|
||||||
this.sortByFields = sortByFields;
|
// this.sortByFields = sortByFields;
|
||||||
this.appManagerBus = appManagerBus;
|
// this.appManagerBus = appManagerBus;
|
||||||
|
//
|
||||||
|
// resetSearch.setType(ButtonType.LINK);
|
||||||
|
//
|
||||||
|
// listBoxSortBy.setWidth("180px");
|
||||||
|
// listBoxSearchFor.setWidth("140px");
|
||||||
|
//
|
||||||
|
// bindEvents();
|
||||||
|
// }
|
||||||
|
|
||||||
resetSearch.setType(ButtonType.LINK);
|
// /**
|
||||||
|
// * To label filter.
|
||||||
listBoxSortBy.setWidth("180px");
|
// *
|
||||||
listBoxSearchFor.setWidth("140px");
|
// * @param itemField the item field
|
||||||
|
// * @param direction the direction
|
||||||
bindEvents();
|
// * @return the string
|
||||||
}
|
// */
|
||||||
|
// private String toLabelFilter(ItemField itemField, ORDER direction) {
|
||||||
/**
|
// String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
|
||||||
* To label filter.
|
// return labelFilter;
|
||||||
*
|
// }
|
||||||
* @param itemField the item field
|
|
||||||
* @param direction the direction
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
private String toLabelFilter(ItemField itemField, ORDER direction) {
|
|
||||||
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
|
|
||||||
return labelFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind events.
|
* Bind events.
|
||||||
*/
|
*/
|
||||||
private void bindEvents() {
|
// private void bindEvents() {
|
||||||
|
//
|
||||||
for (ItemField record_FIELD : sortByFields) {
|
// for (ItemField record_FIELD : sortByFields) {
|
||||||
if(record_FIELD.isSortable()) {
|
// if(record_FIELD.isSortable()) {
|
||||||
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
// String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||||
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
// String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||||
listBoxSortBy.addItem(labelASC);
|
// listBoxSortBy.addItem(labelASC);
|
||||||
listBoxSortBy.addItem(labelDESC);
|
// listBoxSortBy.addItem(labelDESC);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
listBoxSortBy.addChangeHandler(new ChangeHandler() {
|
// listBoxSortBy.addChangeHandler(new ChangeHandler() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onChange(ChangeEvent event) {
|
// public void onChange(ChangeEvent event) {
|
||||||
if(latestResult!=null && latestResult.getData().size()>0) {
|
// if(latestResult!=null && latestResult.getData().size()>0) {
|
||||||
doSearchEvent();
|
// doSearchEvent();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
for (ItemField record_FIELD : searchForFields) {
|
// for (ItemField record_FIELD : searchForFields) {
|
||||||
GWT.log("search for: "+record_FIELD);
|
// GWT.log("search for: "+record_FIELD);
|
||||||
if(record_FIELD.isSearchable()) {
|
// if(record_FIELD.isSearchable()) {
|
||||||
listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
// listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
listBoxSearchFor.addChangeHandler(new ChangeHandler() {
|
// listBoxSearchFor.addChangeHandler(new ChangeHandler() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onChange(ChangeEvent event) {
|
// public void onChange(ChangeEvent event) {
|
||||||
if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
// if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
||||||
doSearchEvent();
|
// doSearchEvent();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
sortByToogle.addClickHandler(new ClickHandler() {
|
// sortByToogle.addClickHandler(new ClickHandler() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(ClickEvent event) {
|
// public void onClick(ClickEvent event) {
|
||||||
if (toogleSortBy.isVisible())
|
// if (toogleSortBy.isVisible())
|
||||||
toogleSortBy.setVisible(false);
|
// toogleSortBy.setVisible(false);
|
||||||
else
|
// else
|
||||||
toogleSortBy.setVisible(true);
|
// toogleSortBy.setVisible(true);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
searchField.addKeyPressHandler(new KeyPressHandler() {
|
// searchField.addKeyPressHandler(new KeyPressHandler() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onKeyPress(KeyPressEvent event) {
|
// public void onKeyPress(KeyPressEvent event) {
|
||||||
if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
|
// if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
|
||||||
GWT.log(searchField.getText());
|
// GWT.log(searchField.getText());
|
||||||
doSearchEvent();
|
// doSearchEvent();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
resetSearch.addClickHandler(new ClickHandler() {
|
// resetSearch.addClickHandler(new ClickHandler() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(ClickEvent event) {
|
// public void onClick(ClickEvent event) {
|
||||||
searchField.setText("");
|
// searchField.setText("");
|
||||||
resetSearch.setVisible(false);
|
// resetSearch.setVisible(false);
|
||||||
panelResults.clear();
|
// panelResults.clear();
|
||||||
latestResult = null;
|
// latestResult = null;
|
||||||
appManagerBus.fireEvent(new SearchPerformedEvent(null,true));
|
// appManagerBus.fireEvent(new SearchPerformedEvent(null,true));
|
||||||
setSearchEnabled(false);
|
// setSearchEnabled(false);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
private void setSearchEnabled(boolean bool) {
|
private void setSearchEnabled(boolean bool) {
|
||||||
if(bool) {
|
if(bool) {
|
||||||
|
@ -243,136 +215,138 @@ public class SearchFacilityUI extends Composite {
|
||||||
SearchingFilter filter = getCurrentSortFilter();
|
SearchingFilter filter = getCurrentSortFilter();
|
||||||
panelResults.clear();
|
panelResults.clear();
|
||||||
panelResults.add(new HTML("<hr>"));
|
panelResults.add(new HTML("<hr>"));
|
||||||
panelResults.add(new LoaderIcon("Searching..."));
|
panelResults.add(new LoaderIcon("TODO..."));
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListConcessioni(0, 30, filter, false,
|
//TODO
|
||||||
new AsyncCallback<ResultSetPaginatedData>() {
|
|
||||||
|
// GeoportalDataViewerServiceAsync.Util.getInstance().getListConcessioni(0, 30, filter, false,
|
||||||
|
// new AsyncCallback<ResultSetPaginatedData>() {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
// showLoading(false);
|
|
||||||
// Window.alert(caught.getMessage());
|
|
||||||
panelResults.clear();
|
|
||||||
panelResults.add(new HTML("<hr>"));
|
|
||||||
Alert alert = new Alert("Error on searching. Please, refresh or change the search");
|
|
||||||
alert.setType(AlertType.ERROR);
|
|
||||||
alert.setClose(false);
|
|
||||||
panelResults.add(alert);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(ResultSetPaginatedData result) {
|
|
||||||
|
|
||||||
appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(),false));
|
|
||||||
setSearchEnabled(true);
|
|
||||||
latestResult = result;
|
|
||||||
|
|
||||||
panelResults.clear();
|
|
||||||
panelResults.add(new HTML("<hr>"));
|
|
||||||
|
|
||||||
if (result.getData().size() == 0) {
|
|
||||||
panelResults.add(new HTML("No result found"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FlexTable ft = new FlexTable();
|
|
||||||
ft.getElement().setClassName("table-results");
|
|
||||||
int i = 1;
|
|
||||||
ft.setWidget(0, i, new HTML("Nome Progetto"));
|
|
||||||
|
|
||||||
String selValue = listBoxSearchFor.getSelectedValue().toLowerCase();
|
|
||||||
|
|
||||||
boolean addIntroduction = false;
|
|
||||||
if(selValue.startsWith("proj") || selValue.startsWith("any")) {
|
|
||||||
ft.setWidget(0, ++i, new HTML("Introduzione"));
|
|
||||||
addIntroduction = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean addStaff = false;
|
|
||||||
if(selValue.startsWith("director")) {
|
|
||||||
ft.setWidget(0, ++i, new HTML("Autori"));
|
|
||||||
ft.setWidget(0, ++i, new HTML("Responsabile"));
|
|
||||||
ft.setWidget(0, ++i, new HTML("Editore"));
|
|
||||||
ft.setWidget(0, ++i, new HTML("Titolari"));
|
|
||||||
ft.setWidget(0, ++i, new HTML("Contributore"));
|
|
||||||
addStaff = true;
|
|
||||||
}
|
|
||||||
boolean addParole = false;
|
|
||||||
if(selValue.startsWith("keyword")) {
|
|
||||||
ft.setWidget(0, ++i, new HTML("Parole Libere"));
|
|
||||||
ft.setWidget(0, ++i, new HTML("Parole Cronologia"));
|
|
||||||
addParole = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = 1;
|
|
||||||
for (ConcessioneDV concessione : result.getData()) {
|
|
||||||
int j = -1;
|
|
||||||
|
|
||||||
NavLink locateOnMap = new NavLink("Show");
|
|
||||||
locateOnMap.setTitle("Locate on the Map and show details");
|
|
||||||
locateOnMap.setIcon(IconType.MAP_MARKER);
|
|
||||||
|
|
||||||
locateOnMap.addClickHandler(new ClickHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(ClickEvent event) {
|
|
||||||
GeoNaItemRef gir = new GeoNaItemRef(concessione.getItemId(), GeoportalDataViewerConstants.RECORD_TYPE.CONCESSIONE.toString());
|
|
||||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
|
||||||
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(concessione));
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ft.setWidget(i, ++j, locateOnMap);
|
|
||||||
|
|
||||||
|
|
||||||
ft.setWidget(i, ++j, new HTML(concessione.getNome()));
|
|
||||||
if(addIntroduction)
|
|
||||||
ft.setWidget(i, ++j, new HTML(StringUtil.ellipsize(concessione.getIntroduzione(), 200)));
|
|
||||||
|
|
||||||
if(addStaff) {
|
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getAuthors())));
|
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getResponsabile()))));
|
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getEditore()))));
|
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getTitolari())));
|
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getContributore()))));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(addParole) {
|
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getParoleChiaveLibere())));
|
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getParoleChiaveICCD())));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// List<UploadedImageDV> listImg = concessione.getImmaginiRappresentative();
|
|
||||||
// GWT.log(listImg.toString());
|
|
||||||
// boolean imagePreviewFound = false;
|
|
||||||
// if (listImg != null && listImg.size() > 0) {
|
|
||||||
//
|
//
|
||||||
// UploadedImageDV uImg = listImg.get(0);
|
//
|
||||||
//
|
//
|
||||||
// if (uImg != null && uImg.getListWsContent() != null
|
// @Override
|
||||||
// && uImg.getListWsContent().size() > 0) {
|
// public void onFailure(Throwable caught) {
|
||||||
// WorkspaceContentDV wsc = uImg.getListWsContent().get(0);
|
//// showLoading(false);
|
||||||
// String image = "<img style=\"width:50px;height:50px;\" src='" + wsc.getLink()
|
//// Window.alert(caught.getMessage());
|
||||||
// + "' alt='" + wsc.getName() + "'>";
|
// panelResults.clear();
|
||||||
// ft.setWidget(i, 2, new HTML(image));
|
// panelResults.add(new HTML("<hr>"));
|
||||||
// imagePreviewFound = true;
|
// Alert alert = new Alert("Error on searching. Please, refresh or change the search");
|
||||||
|
// alert.setType(AlertType.ERROR);
|
||||||
|
// alert.setClose(false);
|
||||||
|
// panelResults.add(alert);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess(ResultSetPaginatedData result) {
|
||||||
|
//
|
||||||
|
// appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(),false));
|
||||||
|
// setSearchEnabled(true);
|
||||||
|
// latestResult = result;
|
||||||
|
//
|
||||||
|
// panelResults.clear();
|
||||||
|
// panelResults.add(new HTML("<hr>"));
|
||||||
|
//
|
||||||
|
// if (result.getData().size() == 0) {
|
||||||
|
// panelResults.add(new HTML("No result found"));
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// FlexTable ft = new FlexTable();
|
||||||
|
// ft.getElement().setClassName("table-results");
|
||||||
|
// int i = 1;
|
||||||
|
// ft.setWidget(0, i, new HTML("Nome Progetto"));
|
||||||
|
//
|
||||||
|
// String selValue = listBoxSearchFor.getSelectedValue().toLowerCase();
|
||||||
|
//
|
||||||
|
// boolean addIntroduction = false;
|
||||||
|
// if(selValue.startsWith("proj") || selValue.startsWith("any")) {
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Introduzione"));
|
||||||
|
// addIntroduction = true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// boolean addStaff = false;
|
||||||
|
// if(selValue.startsWith("director")) {
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Autori"));
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Responsabile"));
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Editore"));
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Titolari"));
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Contributore"));
|
||||||
|
// addStaff = true;
|
||||||
|
// }
|
||||||
|
// boolean addParole = false;
|
||||||
|
// if(selValue.startsWith("keyword")) {
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Parole Libere"));
|
||||||
|
// ft.setWidget(0, ++i, new HTML("Parole Cronologia"));
|
||||||
|
// addParole = true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// i = 1;
|
||||||
|
// for (ConcessioneDV concessione : result.getData()) {
|
||||||
|
// int j = -1;
|
||||||
|
//
|
||||||
|
// NavLink locateOnMap = new NavLink("Show");
|
||||||
|
// locateOnMap.setTitle("Locate on the Map and show details");
|
||||||
|
// locateOnMap.setIcon(IconType.MAP_MARKER);
|
||||||
|
//
|
||||||
|
// locateOnMap.addClickHandler(new ClickHandler() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onClick(ClickEvent event) {
|
||||||
|
// GeoNaItemRef gir = new GeoNaItemRef(concessione.getItemId(), GeoportalDataViewerConstants.RECORD_TYPE.CONCESSIONE.toString());
|
||||||
|
// appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||||
|
// appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(concessione));
|
||||||
|
//
|
||||||
// }
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// ft.setWidget(i, ++j, locateOnMap);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// ft.setWidget(i, ++j, new HTML(concessione.getNome()));
|
||||||
|
// if(addIntroduction)
|
||||||
|
// ft.setWidget(i, ++j, new HTML(StringUtil.ellipsize(concessione.getIntroduzione(), 200)));
|
||||||
|
//
|
||||||
|
// if(addStaff) {
|
||||||
|
// ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getAuthors())));
|
||||||
|
// ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getResponsabile()))));
|
||||||
|
// ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getEditore()))));
|
||||||
|
// ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getTitolari())));
|
||||||
|
// ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getContributore()))));
|
||||||
// }
|
// }
|
||||||
|
//
|
||||||
|
// if(addParole) {
|
||||||
|
// ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getParoleChiaveLibere())));
|
||||||
|
// ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getParoleChiaveICCD())));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// List<UploadedImageDV> listImg = concessione.getImmaginiRappresentative();
|
||||||
|
//// GWT.log(listImg.toString());
|
||||||
|
//// boolean imagePreviewFound = false;
|
||||||
|
//// if (listImg != null && listImg.size() > 0) {
|
||||||
|
////
|
||||||
|
//// UploadedImageDV uImg = listImg.get(0);
|
||||||
|
////
|
||||||
|
//// if (uImg != null && uImg.getListWsContent() != null
|
||||||
|
//// && uImg.getListWsContent().size() > 0) {
|
||||||
|
//// WorkspaceContentDV wsc = uImg.getListWsContent().get(0);
|
||||||
|
//// String image = "<img style=\"width:50px;height:50px;\" src='" + wsc.getLink()
|
||||||
|
//// + "' alt='" + wsc.getName() + "'>";
|
||||||
|
//// ft.setWidget(i, 2, new HTML(image));
|
||||||
|
//// imagePreviewFound = true;
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// if (!imagePreviewFound) {
|
||||||
|
//// ft.setWidget(i, 2, new Image(GNAImages.ICONS.italyIcon()));
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// i++;
|
||||||
|
// }
|
||||||
//
|
//
|
||||||
// if (!imagePreviewFound) {
|
// panelResults.add(ft);
|
||||||
// ft.setWidget(i, 2, new Image(GNAImages.ICONS.italyIcon()));
|
//
|
||||||
// }
|
// }
|
||||||
|
// });
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
panelResults.add(ft);
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -409,75 +383,77 @@ public class SearchFacilityUI extends Composite {
|
||||||
searchConcessioni();
|
searchConcessioni();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* To sort filter.
|
// * To sort filter.
|
||||||
*
|
// *
|
||||||
* @param labelFilter the label filter
|
// * @param labelFilter the label filter
|
||||||
* @return the searching filter
|
// * @return the searching filter
|
||||||
*/
|
// */
|
||||||
public SearchingFilter toSortFilter(String labelFilter) {
|
// public SearchingFilter toSortFilter(String labelFilter) {
|
||||||
GWT.log("toSortFilter for label " + labelFilter);
|
// GWT.log("toSortFilter for label " + labelFilter);
|
||||||
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
// String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||||
|
//
|
||||||
SearchingFilter sortFilter = null;
|
// SearchingFilter sortFilter = null;
|
||||||
try {
|
// try {
|
||||||
ItemField recordField = null;
|
// ItemField recordField = null;
|
||||||
for (ItemField value : sortByFields) {
|
// for (ItemField value : sortByFields) {
|
||||||
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
// if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
||||||
recordField = value;
|
// recordField = value;
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
ORDER orderField = ORDER.valueOf(array[1]);
|
// ORDER orderField = ORDER.valueOf(array[1]);
|
||||||
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
// sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
GWT.log("toSortFilter Got " + sortFilter);
|
// GWT.log("toSortFilter Got " + sortFilter);
|
||||||
return sortFilter;
|
// return sortFilter;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Built searching filter.
|
* Built searching filter.
|
||||||
*
|
*
|
||||||
* @return the searching filter
|
* @return the searching filter
|
||||||
*/
|
*/
|
||||||
private SearchingFilter builtSearchingFilter() {
|
//TODO
|
||||||
SearchingFilter searchingFilter = toSortFilter(listBoxSortBy.getSelectedValue());
|
|
||||||
String searchText = searchField.getText();
|
// private SearchingFilter builtSearchingFilter() {
|
||||||
if (searchText != null && !searchText.isEmpty()) {
|
// SearchingFilter searchingFilter = toSortFilter(listBoxSortBy.getSelectedValue());
|
||||||
Map<String, Object> searchInto = new HashMap<String, Object>();
|
// String searchText = searchField.getText();
|
||||||
|
// if (searchText != null && !searchText.isEmpty()) {
|
||||||
List<String> listOfSeachingFields = new ArrayList<String>();
|
// Map<String, Object> searchInto = new HashMap<String, Object>();
|
||||||
|
//
|
||||||
for (ItemField recordField : searchForFields) {
|
// List<String> listOfSeachingFields = new ArrayList<String>();
|
||||||
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
//
|
||||||
listOfSeachingFields = recordField.getJsonFields();
|
// for (ItemField recordField : searchForFields) {
|
||||||
continue;
|
// if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
||||||
}
|
// listOfSeachingFields = recordField.getJsonFields();
|
||||||
}
|
// continue;
|
||||||
|
// }
|
||||||
if(listOfSeachingFields.size()==0) {
|
// }
|
||||||
listOfSeachingFields.add("nome");
|
//
|
||||||
}
|
// if(listOfSeachingFields.size()==0) {
|
||||||
for (String fieldname : listOfSeachingFields) {
|
// listOfSeachingFields.add("nome");
|
||||||
searchInto.put(fieldname, searchText);
|
// }
|
||||||
}
|
// for (String fieldname : listOfSeachingFields) {
|
||||||
|
// searchInto.put(fieldname, searchText);
|
||||||
WhereClause where = new WhereClause();
|
// }
|
||||||
where.setSearchInto(searchInto);
|
//
|
||||||
where.setOperator(LOGICAL_OP.OR);
|
// WhereClause where = new WhereClause();
|
||||||
|
// where.setSearchInto(searchInto);
|
||||||
//THIS CLAUSE IS ADDED IN ORDER TO SEARCH ONLY PUBLISHED PRODUCT (WITH SUCCESS)
|
// where.setOperator(LOGICAL_OP.OR);
|
||||||
Map<String, Object> searchInto2 = new HashMap<String, Object>();
|
//
|
||||||
searchInto2.put("report.status", "PASSED");
|
// //THIS CLAUSE IS ADDED IN ORDER TO SEARCH ONLY PUBLISHED PRODUCT (WITH SUCCESS)
|
||||||
WhereClause where2 = new WhereClause(LOGICAL_OP.AND, searchInto2);
|
// Map<String, Object> searchInto2 = new HashMap<String, Object>();
|
||||||
|
// searchInto2.put("report.status", "PASSED");
|
||||||
searchingFilter.setConditions(Arrays.asList(where, where2));
|
// WhereClause where2 = new WhereClause(LOGICAL_OP.AND, searchInto2);
|
||||||
}
|
//
|
||||||
return searchingFilter;
|
// searchingFilter.setConditions(Arrays.asList(where, where2));
|
||||||
}
|
// }
|
||||||
|
// return searchingFilter;
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current sort filter.
|
* Gets the current sort filter.
|
||||||
|
@ -485,7 +461,9 @@ public class SearchFacilityUI extends Composite {
|
||||||
* @return the current sort filter
|
* @return the current sort filter
|
||||||
*/
|
*/
|
||||||
public SearchingFilter getCurrentSortFilter() {
|
public SearchingFilter getCurrentSortFilter() {
|
||||||
currentSortFilter = builtSearchingFilter();
|
|
||||||
|
//TODO
|
||||||
|
//currentSortFilter = builtSearchingFilter();
|
||||||
GWT.log("currentSortFilter: " + currentSortFilter);
|
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||||
return currentSortFilter;
|
return currentSortFilter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
@ -60,10 +60,12 @@ public class DragDropLayer extends FlowPanel {
|
||||||
this.labelLayerName.setTitle(layerItem.getName());
|
this.labelLayerName.setTitle(layerItem.getName());
|
||||||
this.labelLayerName.setType(LabelType.INFO);
|
this.labelLayerName.setType(LabelType.INFO);
|
||||||
|
|
||||||
BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
|
// TODO Manage Collection
|
||||||
String nameConcessione = StringUtil.ellipsize(refConcessione.getNome(), 40);
|
|
||||||
|
// BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
|
||||||
|
String nameConcessione = StringUtil.ellipsize("TODO : UCD", 40);
|
||||||
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
|
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
|
||||||
labelConcessione.setTitle(refConcessione.getNome());
|
labelConcessione.setTitle("TODO : PROJECT");
|
||||||
|
|
||||||
getElement().getStyle().setMarginTop(5, Unit.PX);
|
getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||||
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
|
@ -105,7 +105,9 @@ public class MapView extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setBaseLayers() {
|
protected void setBaseLayers() {
|
||||||
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getListBaseMapLayers();
|
|
||||||
|
// TODO pass layers as parameters?
|
||||||
|
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getStatus().getConfig().getBaseLayers();
|
||||||
|
|
||||||
if(listBaseLayers==null)
|
if(listBaseLayers==null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
public abstract class ControlledCallBack<T> implements AsyncCallback<T> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
before();
|
||||||
|
if(caught instanceof ControlledError) {
|
||||||
|
GWT.log("Controlled error "+caught);
|
||||||
|
Window.alert(caught.getMessage());
|
||||||
|
}else {
|
||||||
|
GWT.log("Uncontrolled failure, check server log.", caught);
|
||||||
|
Window.alert("Sorry, an unexpected error occurred. Please, contact the support");
|
||||||
|
}
|
||||||
|
after();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void before() {}
|
||||||
|
|
||||||
|
public void after() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(T result) {
|
||||||
|
before();
|
||||||
|
after();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import ol.Coordinate;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
|
|
||||||
|
public class OGCUtils {
|
||||||
|
|
||||||
|
public static void performWFSQueryOnCentroid(RecordDV record) {
|
||||||
|
GWT.log("WFS Query for : "+record);
|
||||||
|
|
||||||
|
if (record != null) {
|
||||||
|
// GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: "
|
||||||
|
// + record.getItemId());
|
||||||
|
// GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: "
|
||||||
|
// +(record instanceof ConcessioneDV));
|
||||||
|
// if (record instanceof ConcessioneDV) {
|
||||||
|
// ConcessioneDV concessioneDV = (ConcessioneDV) record;
|
||||||
|
// Double x = concessioneDV.getCentroidLong();
|
||||||
|
// Double y = concessioneDV.getCentroidLat();
|
||||||
|
// GWT.log("X: " + x + ", Y:" + y);
|
||||||
|
// if (x != null && y != null) {
|
||||||
|
// Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
|
||||||
|
// GeoportalDataViewerConstants.MAP_PROJECTION.EPSG_4326.getName(), GeoportalDataViewerConstants.MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
// GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
|
||||||
|
// GWT.log("GeoQuery: " + select);
|
||||||
|
// // GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
||||||
|
// ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
|
||||||
|
// transfCoord.getY());
|
||||||
|
// layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(),
|
||||||
|
// true, GeoportalDataViewerConstants.MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
|
||||||
|
// } else {
|
||||||
|
// GeoportalDataViewerConstants.printJs(
|
||||||
|
// "I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
|
||||||
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -10,34 +13,39 @@ import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.bson.Document;
|
||||||
|
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||||
|
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
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.UploadedImage;
|
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
|
import org.gcube.application.geoportal.common.rest.Projects;
|
||||||
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.faults.InvalidObjectException;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.ConcessioniMongoServiceIdentityProxy;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.ConcessioniMongoServiceIdentityProxy;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accesspolicy.GeoNACheckAccessPolicy;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.DVConversion;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -77,6 +85,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
private GNADataViewerConfigProfile getGNADataVieweConfigProfile() throws Exception {
|
private GNADataViewerConfigProfile getGNADataVieweConfigProfile() throws Exception {
|
||||||
|
LOG.info("METHOD getDataResult called");
|
||||||
|
|
||||||
GNADataViewerConfigProfile profile = SessionUtil.getGNADataViewerConfigProfile(getThreadLocalRequest());
|
GNADataViewerConfigProfile profile = SessionUtil.getGNADataViewerConfigProfile(getThreadLocalRequest());
|
||||||
if (profile == null) {
|
if (profile == null) {
|
||||||
|
@ -114,6 +123,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
*/
|
*/
|
||||||
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
||||||
try {
|
try {
|
||||||
|
LOG.info("METHOD load GEO infor for WMS Req called");
|
||||||
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
||||||
String wmsServiceHost = validator.getWmsServiceHost();
|
String wmsServiceHost = validator.getWmsServiceHost();
|
||||||
String validWMSRequest = validator.parseWMSRequest(true, true);
|
String validWMSRequest = validator.parseWMSRequest(true, true);
|
||||||
|
@ -140,7 +150,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
// MAP ZAXIS INTO GWT-SERIALIZABLE OBJECT
|
// MAP ZAXIS INTO GWT-SERIALIZABLE OBJECT
|
||||||
ZAxis zAxis = layerZAxis != null
|
ZAxis zAxis = layerZAxis != null
|
||||||
? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues())
|
? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues())
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs,
|
return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs,
|
||||||
mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
||||||
|
@ -164,7 +174,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
@Override
|
@Override
|
||||||
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
|
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
|
||||||
LOG.info("getDataResult called");
|
LOG.info("METHOD getDataResult called");
|
||||||
|
|
||||||
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
||||||
|
|
||||||
|
@ -197,7 +207,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
}
|
}
|
||||||
geoDAO.setSourceLayerObject(layerObject);
|
geoDAO.setSourceLayerObject(layerObject);
|
||||||
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
||||||
+ " feature/s");
|
+ " feature/s");
|
||||||
listDAO.add(geoDAO);
|
listDAO.add(geoDAO);
|
||||||
}
|
}
|
||||||
LOG.info("returning " + listDAO + " geona data objects");
|
LOG.info("returning " + listDAO + " geona data objects");
|
||||||
|
@ -221,201 +231,201 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return getUploadedImagesForId(this.getThreadLocalRequest(), itemType, itemId, maxImages);
|
return getUploadedImagesForId(this.getThreadLocalRequest(), itemType, itemId, maxImages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Gets the layers for id.
|
// * Gets the layers for id.
|
||||||
*
|
// *
|
||||||
* @param itemType the item type
|
// * @param itemType the item type
|
||||||
* @param itemId the item id
|
// * @param itemId the item id
|
||||||
* @return the layers for id
|
// * @return the layers for id
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
@Override
|
// @Override
|
||||||
public List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception {
|
// public List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception {
|
||||||
LOG.info("getLayersForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
|
// LOG.info("getLayersForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
|
||||||
|
//
|
||||||
|
// if (itemType == null)
|
||||||
|
// throw new Exception("Invalid parameter. The itemType is null");
|
||||||
|
//
|
||||||
|
// if (itemId == null)
|
||||||
|
// throw new Exception("Invalid parameter. The itemId is null");
|
||||||
|
//
|
||||||
|
// List<LayerConcessioneDV> listLayers = null;
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
//
|
||||||
|
// SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
// String userName = null;
|
||||||
|
// try {
|
||||||
|
// userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LOG.info("User not found in session, the userName for cecking policy will be null");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (itemType.equalsIgnoreCase("concessione")) {
|
||||||
|
//
|
||||||
|
// LOG.info("Trying to get concessione for id " + itemId);
|
||||||
|
// ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(
|
||||||
|
// this.getThreadLocalRequest());
|
||||||
|
// Concessione concessione = cms.getItemById(itemId);
|
||||||
|
//
|
||||||
|
// BaseConcessioneDV baseConcessione = ConvertToDataViewModel.toBaseConcessione(concessione);
|
||||||
|
// if (concessione != null) {
|
||||||
|
// LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
||||||
|
// listLayers = new ArrayList<LayerConcessioneDV>();
|
||||||
|
// if (concessione.getPianteFineScavo() != null) {
|
||||||
|
//
|
||||||
|
// for (LayerConcessione lc : concessione.getPianteFineScavo()) {
|
||||||
|
// if (GeoNACheckAccessPolicy.isAccessible(lc.getPolicy().name(), userName)) {
|
||||||
|
// listLayers.add(ConvertToDataViewModel.toLayerConcessione(lc, baseConcessione));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// LayerConcessione lcPosizionamento = concessione.getPosizionamentoScavo();
|
||||||
|
//
|
||||||
|
// if (lcPosizionamento != null) {
|
||||||
|
//
|
||||||
|
// if (GeoNACheckAccessPolicy.isAccessible(lcPosizionamento.getPolicy().name(), userName)) {
|
||||||
|
//
|
||||||
|
// LayerConcessioneDV thePosizScavo = ConvertToDataViewModel
|
||||||
|
// .toLayerConcessione(lcPosizionamento, baseConcessione);
|
||||||
|
// if (thePosizScavo != null)
|
||||||
|
// listLayers.add(thePosizScavo);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// } else
|
||||||
|
// throw new Exception("Concessione with id '" + itemId + "' not available");
|
||||||
|
// }
|
||||||
|
// LOG.info("For id " + itemId + ", returning " + listLayers.size() + " layer/s");
|
||||||
|
// return listLayers;
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// String erroMsg = "Layers are not available for " + Concessione.class.getSimpleName() + " with id " + itemId;
|
||||||
|
// LOG.error(erroMsg, e);
|
||||||
|
// throw new Exception(erroMsg);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
if (itemType == null)
|
// /**
|
||||||
throw new Exception("Invalid parameter. The itemType is null");
|
// * Gets the concessione for id.
|
||||||
|
// *
|
||||||
if (itemId == null)
|
// * @param mongoId the mongo id
|
||||||
throw new Exception("Invalid parameter. The itemId is null");
|
// * @return the concessione for id
|
||||||
|
// * @throws Exception the exception
|
||||||
List<LayerConcessioneDV> listLayers = null;
|
// */
|
||||||
|
// @Override
|
||||||
try {
|
// public ConcessioneDV getConcessioneForId(String mongoId) throws Exception {
|
||||||
|
// LOG.info("getConcessioneForId " + mongoId + " called");
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
//
|
||||||
String userName = null;
|
// ConcessioneDV concessionDV = null;
|
||||||
try {
|
//
|
||||||
userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
// if (mongoId == null)
|
||||||
} catch (Exception e) {
|
// throw new Exception("Invalid parameter. The itemId is null");
|
||||||
LOG.info("User not found in session, the userName for cecking policy will be null");
|
//
|
||||||
}
|
// try {
|
||||||
|
// LOG.info("Trying to get record for id " + mongoId);
|
||||||
if (itemType.equalsIgnoreCase("concessione")) {
|
//
|
||||||
|
// ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(
|
||||||
LOG.info("Trying to get concessione for id " + itemId);
|
// this.getThreadLocalRequest());
|
||||||
ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(
|
// Concessione concessione = cms.getItemById(mongoId);
|
||||||
this.getThreadLocalRequest());
|
//
|
||||||
Concessione concessione = cms.getItemById(itemId);
|
// LOG.info("Got concessione for mongoId: " + mongoId);
|
||||||
|
// if (concessione != null) {
|
||||||
BaseConcessioneDV baseConcessione = ConvertToDataViewModel.toBaseConcessione(concessione);
|
// concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
||||||
if (concessione != null) {
|
//
|
||||||
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
// String userName = null;
|
||||||
listLayers = new ArrayList<LayerConcessioneDV>();
|
// try {
|
||||||
if (concessione.getPianteFineScavo() != null) {
|
// userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
||||||
|
//
|
||||||
for (LayerConcessione lc : concessione.getPianteFineScavo()) {
|
// } catch (Exception e) {
|
||||||
if (GeoNACheckAccessPolicy.isAccessible(lc.getPolicy().name(), userName)) {
|
// LOG.info("User not found in session, so going to apply the acess policies");
|
||||||
listLayers.add(ConvertToDataViewModel.toLayerConcessione(lc, baseConcessione));
|
// }
|
||||||
}
|
//
|
||||||
}
|
// // TODO THIS IS A WORKAROUND WAITING FOR ADOPTING OF USER ROLES. AT THE MOMENT,
|
||||||
|
// // A USER AUTHENTICATED CAN ACCESS EVERYTHING
|
||||||
LayerConcessione lcPosizionamento = concessione.getPosizionamentoScavo();
|
// // I CAN CHECK THE ACCCESS POLICIES IF AND ONLY IF THE USER IS NOT LOGGED IN.
|
||||||
|
// if (userName == null) {
|
||||||
if (lcPosizionamento != null) {
|
//
|
||||||
|
// // CHECKING ACCESS POLICY
|
||||||
if (GeoNACheckAccessPolicy.isAccessible(lcPosizionamento.getPolicy().name(), userName)) {
|
// LOG.info("Applying access policies for concessione " + mongoId + " returned by service");
|
||||||
|
// LayerConcessioneDV layerPosizionamento = concessionDV.getPosizionamentoScavo();
|
||||||
LayerConcessioneDV thePosizScavo = ConvertToDataViewModel
|
// if (layerPosizionamento != null) {
|
||||||
.toLayerConcessione(lcPosizionamento, baseConcessione);
|
// if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
||||||
if (thePosizScavo != null)
|
// concessionDV.setPosizionamentoScavo(null);
|
||||||
listLayers.add(thePosizScavo);
|
// LOG.info("Posizionamento di Scavo is not accessible by current user: " + userName);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// List<LayerConcessioneDV> listLayersDV = concessionDV.getPianteFineScavo();
|
||||||
|
// if (listLayersDV != null) {
|
||||||
} else
|
// List<LayerConcessioneDV> accessibleListLayersDV = new ArrayList<LayerConcessioneDV>();
|
||||||
throw new Exception("Concessione with id '" + itemId + "' not available");
|
// for (LayerConcessioneDV layerDV : listLayersDV) {
|
||||||
}
|
// if (GeoNACheckAccessPolicy.isAccessible(layerDV.getPolicy(), userName)) {
|
||||||
LOG.info("For id " + itemId + ", returning " + listLayers.size() + " layer/s");
|
// accessibleListLayersDV.add(layerDV);
|
||||||
return listLayers;
|
// } else {
|
||||||
|
// LOG.info("(Pianta) Layer " + layerDV.getLayerName()
|
||||||
} catch (Exception e) {
|
// + " is not accessible by current user: " + userName);
|
||||||
String erroMsg = "Layers are not available for " + Concessione.class.getSimpleName() + " with id " + itemId;
|
// }
|
||||||
LOG.error(erroMsg, e);
|
// }
|
||||||
throw new Exception(erroMsg);
|
// concessionDV.setPianteFineScavo(accessibleListLayersDV);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
}
|
// AbstractRelazioneScavoDV abstractRS = concessionDV.getAbstractRelazioneScavo();
|
||||||
|
// if (abstractRS != null) {
|
||||||
/**
|
// if (!GeoNACheckAccessPolicy.isAccessible(abstractRS.getPolicy(), userName)) {
|
||||||
* Gets the concessione for id.
|
// concessionDV.setAbstractRelazioneScavo(null);
|
||||||
*
|
// LOG.info("Abstract relazione is not accessible by current user: " + userName);
|
||||||
* @param mongoId the mongo id
|
// }
|
||||||
* @return the concessione for id
|
// }
|
||||||
* @throws Exception the exception
|
//
|
||||||
*/
|
// RelazioneScavoDV relazioneScavo = concessionDV.getRelazioneScavo();
|
||||||
@Override
|
// if (relazioneScavo != null) {
|
||||||
public ConcessioneDV getConcessioneForId(String mongoId) throws Exception {
|
// if (!GeoNACheckAccessPolicy.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
||||||
LOG.info("getConcessioneForId " + mongoId + " called");
|
// concessionDV.setRelazioneScavo(null);
|
||||||
|
// LOG.info("Relazione scavo is not accessible by current user: " + userName);
|
||||||
ConcessioneDV concessionDV = null;
|
// }
|
||||||
|
// }
|
||||||
if (mongoId == null)
|
//
|
||||||
throw new Exception("Invalid parameter. The itemId is null");
|
// List<UploadedImageDV> immagini = concessionDV.getImmaginiRappresentative();
|
||||||
|
// if (immagini != null && immagini.size() > 0) {
|
||||||
try {
|
// List<UploadedImageDV> accessibleListImages = new ArrayList<UploadedImageDV>();
|
||||||
LOG.info("Trying to get record for id " + mongoId);
|
//
|
||||||
|
// // SHOWING ACESSIBLE IMAGES
|
||||||
ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(
|
// for (UploadedImageDV uploadedImageDV : immagini) {
|
||||||
this.getThreadLocalRequest());
|
//
|
||||||
Concessione concessione = cms.getItemById(mongoId);
|
// if (GeoNACheckAccessPolicy.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
||||||
|
// accessibleListImages.add(uploadedImageDV);
|
||||||
LOG.info("Got concessione for mongoId: " + mongoId);
|
// } else {
|
||||||
if (concessione != null) {
|
// LOG.info("Immagine " + uploadedImageDV.getTitolo()
|
||||||
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
// + " is not accessible by current user: " + userName);
|
||||||
|
// }
|
||||||
String userName = null;
|
//
|
||||||
try {
|
// }
|
||||||
userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
// concessionDV.setImmaginiRappresentative(accessibleListImages);
|
||||||
|
//
|
||||||
} catch (Exception e) {
|
// }
|
||||||
LOG.info("User not found in session, so going to apply the acess policies");
|
//
|
||||||
}
|
// // END CHECKING ACCESS POLICY
|
||||||
|
// LOG.info("Access policies applied");
|
||||||
// TODO THIS IS A WORKAROUND WAITING FOR ADOPTING OF USER ROLES. AT THE MOMENT,
|
// }
|
||||||
// A USER AUTHENTICATED CAN ACCESS EVERYTHING
|
// }
|
||||||
// I CAN CHECK THE ACCCESS POLICIES IF AND ONLY IF THE USER IS NOT LOGGED IN.
|
//
|
||||||
if (userName == null) {
|
// if (concessionDV == null)
|
||||||
|
// throw new Exception("Concessione with id '" + mongoId + "' not available");
|
||||||
// CHECKING ACCESS POLICY
|
//
|
||||||
LOG.info("Applying access policies for concessione " + mongoId + " returned by service");
|
// LOG.debug("For id " + mongoId + " returning " + ConcessioneDV.class.getSimpleName() + ": " + concessionDV);
|
||||||
LayerConcessioneDV layerPosizionamento = concessionDV.getPosizionamentoScavo();
|
// return concessionDV;
|
||||||
if (layerPosizionamento != null) {
|
//
|
||||||
if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
// } catch (Exception e) {
|
||||||
concessionDV.setPosizionamentoScavo(null);
|
// String erroMsg = Concessione.class.getSimpleName() + " with id '" + mongoId + "' not available";
|
||||||
LOG.info("Posizionamento di Scavo is not accessible by current user: " + userName);
|
// LOG.error(erroMsg, e);
|
||||||
}
|
// throw new Exception(erroMsg);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
List<LayerConcessioneDV> listLayersDV = concessionDV.getPianteFineScavo();
|
// }
|
||||||
if (listLayersDV != null) {
|
|
||||||
List<LayerConcessioneDV> accessibleListLayersDV = new ArrayList<LayerConcessioneDV>();
|
|
||||||
for (LayerConcessioneDV layerDV : listLayersDV) {
|
|
||||||
if (GeoNACheckAccessPolicy.isAccessible(layerDV.getPolicy(), userName)) {
|
|
||||||
accessibleListLayersDV.add(layerDV);
|
|
||||||
} else {
|
|
||||||
LOG.info("(Pianta) Layer " + layerDV.getLayerName()
|
|
||||||
+ " is not accessible by current user: " + userName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
concessionDV.setPianteFineScavo(accessibleListLayersDV);
|
|
||||||
}
|
|
||||||
|
|
||||||
AbstractRelazioneScavoDV abstractRS = concessionDV.getAbstractRelazioneScavo();
|
|
||||||
if (abstractRS != null) {
|
|
||||||
if (!GeoNACheckAccessPolicy.isAccessible(abstractRS.getPolicy(), userName)) {
|
|
||||||
concessionDV.setAbstractRelazioneScavo(null);
|
|
||||||
LOG.info("Abstract relazione is not accessible by current user: " + userName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RelazioneScavoDV relazioneScavo = concessionDV.getRelazioneScavo();
|
|
||||||
if (relazioneScavo != null) {
|
|
||||||
if (!GeoNACheckAccessPolicy.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
|
||||||
concessionDV.setRelazioneScavo(null);
|
|
||||||
LOG.info("Relazione scavo is not accessible by current user: " + userName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<UploadedImageDV> immagini = concessionDV.getImmaginiRappresentative();
|
|
||||||
if (immagini != null && immagini.size() > 0) {
|
|
||||||
List<UploadedImageDV> accessibleListImages = new ArrayList<UploadedImageDV>();
|
|
||||||
|
|
||||||
// SHOWING ACESSIBLE IMAGES
|
|
||||||
for (UploadedImageDV uploadedImageDV : immagini) {
|
|
||||||
|
|
||||||
if (GeoNACheckAccessPolicy.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
|
||||||
accessibleListImages.add(uploadedImageDV);
|
|
||||||
} else {
|
|
||||||
LOG.info("Immagine " + uploadedImageDV.getTitolo()
|
|
||||||
+ " is not accessible by current user: " + userName);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
concessionDV.setImmaginiRappresentative(accessibleListImages);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// END CHECKING ACCESS POLICY
|
|
||||||
LOG.info("Access policies applied");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (concessionDV == null)
|
|
||||||
throw new Exception("Concessione with id '" + mongoId + "' not available");
|
|
||||||
|
|
||||||
LOG.debug("For id " + mongoId + " returning " + ConcessioneDV.class.getSimpleName() + ": " + concessionDV);
|
|
||||||
return concessionDV;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
String erroMsg = Concessione.class.getSimpleName() + " with id '" + mongoId + "' not available";
|
|
||||||
LOG.error(erroMsg, e);
|
|
||||||
throw new Exception(erroMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the parameters from URL.
|
* Gets the parameters from URL.
|
||||||
|
@ -426,6 +436,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Map<String, String> getParametersFromURL(String theURL, List<String> parameters) {
|
public Map<String, String> getParametersFromURL(String theURL, List<String> parameters) {
|
||||||
|
LOG.info("METHOD getPAramsFromURL");
|
||||||
|
|
||||||
|
|
||||||
if (theURL == null)
|
if (theURL == null)
|
||||||
return null;
|
return null;
|
||||||
|
@ -450,6 +462,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getMyLogin() {
|
public String getMyLogin() {
|
||||||
|
LOG.info("METHOD getMYLogin ");
|
||||||
try {
|
try {
|
||||||
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
|
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
|
||||||
if (user == null)
|
if (user == null)
|
||||||
|
@ -551,6 +564,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public boolean isSessionExpired() throws Exception {
|
public boolean isSessionExpired() throws Exception {
|
||||||
|
LOG.info("METHOD isSessionExpired ");
|
||||||
return SessionUtil.isSessionExpired(this.getThreadLocalRequest());
|
return SessionUtil.isSessionExpired(this.getThreadLocalRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +593,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
geoDAO.setFeatures(features);
|
geoDAO.setFeatures(features);
|
||||||
geoDAO.setSourceLayerObject(layerObject);
|
geoDAO.setSourceLayerObject(layerObject);
|
||||||
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
||||||
+ " feature/s");
|
+ " feature/s");
|
||||||
listDAO.add(geoDAO);
|
listDAO.add(geoDAO);
|
||||||
}
|
}
|
||||||
LOG.info("returning " + listDAO + " geona data objects");
|
LOG.info("returning " + listDAO + " geona data objects");
|
||||||
|
@ -691,73 +705,163 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the list base layers.
|
|
||||||
*
|
|
||||||
* @return the list base layers
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<BaseMapLayer> getListBaseLayers() {
|
|
||||||
LOG.info("getListBaseLayers called");
|
|
||||||
List<BaseMapLayer> listBL = new ArrayList<BaseMapLayer>();
|
|
||||||
// Setting scope in the cuurent thread
|
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
|
||||||
listBL = SessionUtil.getGNABaseMaps(this.getThreadLocalRequest());
|
|
||||||
LOG.info("getListBaseLayers returning " + listBL.size() + " base maps");
|
|
||||||
return listBL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO THIS PART REQUIRES THE JSON MAPPING based on keys read from gCube Meta
|
// TODO THIS PART REQUIRES THE JSON MAPPING based on keys read from gCube Meta
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* List of fields for searching.
|
// * List of fields for searching.
|
||||||
*
|
// *
|
||||||
* @return the list
|
// * @return the list
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
|
// @Override
|
||||||
|
// public List<ItemField> listOfFieldsForSearching() throws Exception {
|
||||||
|
// LOG.info("listOfFieldsForSearching called");
|
||||||
|
// SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
|
// GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||||
|
// return profile.getListItemFields();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Gets the list concessioni.
|
||||||
|
// *
|
||||||
|
// * @param start the start
|
||||||
|
// * @param limit the limit
|
||||||
|
// * @param filter the filter
|
||||||
|
// * @param reloadFromService the reload from service
|
||||||
|
// * @return the list concessioni
|
||||||
|
// * @throws Exception the exception
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
||||||
|
// boolean reloadFromService) throws Exception {
|
||||||
|
// LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// // setting identity as D4S User or KC client
|
||||||
|
// new ConcessioniMongoServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
|
// SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||||
|
// MongoServiceCommon serviceCommon = new MongoServiceCommon();
|
||||||
|
// // TODO MUST BE REPLACED BY COUNT
|
||||||
|
// List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
||||||
|
// reloadFromService);
|
||||||
|
// int listConcessioniSize = listOfConcessioni.size();
|
||||||
|
//
|
||||||
|
// ResultSetPaginatedData searchedData = serviceCommon.queryOnMongo(listConcessioniSize, start, limit, filter,
|
||||||
|
// "concessione");
|
||||||
|
// return searchedData;
|
||||||
|
//
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LOG.error("Error on loading paginated and filtered list of concessioni: ", e);
|
||||||
|
// throw new Exception("Error occurred on loading list of Concessioni. Error: " + e.getMessage());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************** COLLECTIONS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemField> listOfFieldsForSearching() throws Exception {
|
public ViewerConfiguration getInitialConfiguration(Map<String,List<String>> parameters) throws Exception {
|
||||||
LOG.info("listOfFieldsForSearching called");
|
LOG.debug("Received Initial configuration request with params "+parameters);
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
|
||||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
return new ContextRequest<ViewerConfiguration>(this.getThreadLocalRequest()) {
|
||||||
return profile.getListItemFields();
|
@Override
|
||||||
|
protected ViewerConfiguration run() throws Exception, ControlledError {
|
||||||
|
try {
|
||||||
|
|
||||||
|
// ************* LOAD BASE LAYERS
|
||||||
|
|
||||||
|
final ViewerConfiguration config = new ViewerConfiguration();
|
||||||
|
LOG.info("Getting initial configuration ");
|
||||||
|
LOG.debug("Loading base layers..");
|
||||||
|
List<BaseMapLayer> listBL= SessionUtil.getGNABaseMaps(request);
|
||||||
|
|
||||||
|
LOG.debug("getListBaseLayers returning " + listBL.size() + " base maps");
|
||||||
|
config.setBaseLayers(listBL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ************** LOAD AVAILABLE COLLECTIONS
|
||||||
|
|
||||||
|
LOG.debug("Loading available collections.. ");
|
||||||
|
config.setAvailableCollections(new HashMap<String,GCubeCollection>());
|
||||||
|
|
||||||
|
// TODO filter by
|
||||||
|
// configured ?
|
||||||
|
// gis indexed
|
||||||
|
QueryRequest request = new QueryRequest();
|
||||||
|
|
||||||
|
// TODO Constant
|
||||||
|
String Id="org.gcube.portlets.user.geoportaldataviewer";
|
||||||
|
request.setFilter(Document.parse("{\""+UseCaseDescriptor.HANDLERS+"."+
|
||||||
|
org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration.ID+"\" : "
|
||||||
|
+ "{\"$eq\" : \""+Id+"\"}}"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
useCaseDescriptors().build().query(new QueryRequest()).forEachRemaining(u->{
|
||||||
|
try{
|
||||||
|
LOG.debug("Checking configuration for collection "+u.getId());
|
||||||
|
|
||||||
|
Projects<Project> p=projects(u.getId()).build();
|
||||||
|
UseCaseDescriptorDV ucd = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(u, null);
|
||||||
|
Configuration ucdConfig = p.getConfiguration();
|
||||||
|
GCubeCollection coll=new GCubeCollection();
|
||||||
|
coll.setUcd(ucd);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//TODO TO Check index flag should be in configuration or evaluated according to user credentials
|
||||||
|
|
||||||
|
String toCheckFlag = "internal";
|
||||||
|
|
||||||
|
// TODO constant
|
||||||
|
coll.setIndexes(new ArrayList());
|
||||||
|
|
||||||
|
LOG.debug("Checking if "+u.getId()+" is GIS Indexed. Index flag needed is "+toCheckFlag);
|
||||||
|
|
||||||
|
for(Index index : ucdConfig.getIndexes()) {
|
||||||
|
try {
|
||||||
|
IndexLayer toAdd = DVConversion.convert(index);
|
||||||
|
if(toAdd.getFlag().equals(toCheckFlag))
|
||||||
|
coll.getIndexes().add(toAdd);
|
||||||
|
}catch(InvalidObjectException e) {
|
||||||
|
LOG.debug("Skipping invalid index ",e);
|
||||||
|
}catch(Throwable t) {
|
||||||
|
LOG.error("Unable to check index ",t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Return only if gis indexed
|
||||||
|
if(coll.getIndexes().isEmpty())
|
||||||
|
LOG.info("No available GIS Index for collection "+coll.getUcd().getName());
|
||||||
|
else config.getAvailableCollections().put(coll.getUcd().getId(),coll);
|
||||||
|
|
||||||
|
}catch(Throwable t) {
|
||||||
|
LOG.warn("Invalid UCD, can't translate to DV. UCID : "+u.getId(),t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// TODO load initial layers from query parameters
|
||||||
|
LOG.debug("Found "+config.getAvailableCollections().size()+" collections");
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}catch(Throwable t) {
|
||||||
|
LOG.error("Unexpected exception while loading initial config",t);
|
||||||
|
throw new ControlledError("Unable to configure viewer. Please retry in a few minutes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}.execute().getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the list concessioni.
|
|
||||||
*
|
|
||||||
* @param start the start
|
|
||||||
* @param limit the limit
|
|
||||||
* @param filter the filter
|
|
||||||
* @param reloadFromService the reload from service
|
|
||||||
* @return the list concessioni
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
|
||||||
boolean reloadFromService) throws Exception {
|
|
||||||
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
|
||||||
|
|
||||||
try {
|
|
||||||
// setting identity as D4S User or KC client
|
|
||||||
new ConcessioniMongoServiceIdentityProxy(this.getThreadLocalRequest());
|
|
||||||
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
|
||||||
MongoServiceCommon serviceCommon = new MongoServiceCommon();
|
|
||||||
// TODO MUST BE REPLACED BY COUNT
|
|
||||||
List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
|
||||||
reloadFromService);
|
|
||||||
int listConcessioniSize = listOfConcessioni.size();
|
|
||||||
|
|
||||||
ResultSetPaginatedData searchedData = serviceCommon.queryOnMongo(listConcessioniSize, start, limit, filter,
|
|
||||||
"concessione");
|
|
||||||
return searchedData;
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.error("Error on loading paginated and filtered list of concessioni: ", e);
|
|
||||||
throw new Exception("Error occurred on loading list of Concessioni. Error: " + e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.faults;
|
||||||
|
|
||||||
|
public class InvalidObjectException extends Exception {
|
||||||
|
|
||||||
|
public InvalidObjectException() {
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(String message) {
|
||||||
|
super(message);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(String message, Throwable cause, boolean enableSuppression,
|
||||||
|
boolean writableStackTrace) {
|
||||||
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,66 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
|
||||||
|
|
||||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class ConcessioniMongoService.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Sep 23, 2021
|
|
||||||
*/
|
|
||||||
public class ConcessioniMongoService {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoService.class);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new concessioni mongo service.
|
|
||||||
*/
|
|
||||||
protected ConcessioniMongoService() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the item by id.
|
|
||||||
*
|
|
||||||
* @param mongoItemId the mongo item id
|
|
||||||
* @return the item by id
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
protected Concessione getItemById(String mongoItemId) throws Exception {
|
|
||||||
LOG.info("called getItemById: " + mongoItemId);
|
|
||||||
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
|
||||||
// Returning item by Id
|
|
||||||
return concessioniManager.getById(mongoItemId);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* To concessione.
|
|
||||||
*
|
|
||||||
* @param jsonString the json string
|
|
||||||
* @return the concessione
|
|
||||||
*/
|
|
||||||
protected Concessione toConcessione(String jsonString) {
|
|
||||||
LOG.info("toConcessione called");
|
|
||||||
try {
|
|
||||||
return org.gcube.application.geoportal.client.utils.Serialization.read(jsonString, Concessione.class);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.warn("Error on serializing: ", e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For testing public Concessione iamClientGetItemBy(HttpServletRequest request,
|
|
||||||
* String mongoItemId, String clientId, String secret) throws Exception { String
|
|
||||||
* scope = SessionUtil.getCurrentContext(request, true); return
|
|
||||||
* iamClientGetItemBy(scope, mongoItemId, clientId, secret); }
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
|
|
@ -67,9 +67,10 @@ public class ConcessioniMongoServiceIdentityProxy {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Obtain the client
|
// Obtain the client
|
||||||
ConcessioniMongoService concessioniManager = new ConcessioniMongoService();
|
// ConcessioniMongoService concessioniManager = new ConcessioniMongoService();
|
||||||
// Returning item by Id
|
// Returning item by Id
|
||||||
return concessioniManager.getItemById(mongoItemId);
|
// return concessioniManager.getItemById(mongoItemId);
|
||||||
|
return null;
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
LOG.error("Error on reading itemById: "+mongoItemId, e);
|
LOG.error("Error on reading itemById: "+mongoItemId, e);
|
||||||
throw(e);
|
throw(e);
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class ContextRequest<T> {
|
||||||
|
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ContextRequest.class);
|
||||||
|
|
||||||
|
private static List<Runnable> preoperations=new ArrayList<>();
|
||||||
|
|
||||||
|
public static void addPreoperation(Runnable preoperation){
|
||||||
|
preoperations.add(preoperation);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected HttpServletRequest request;
|
||||||
|
private T result=null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public ContextRequest(HttpServletRequest httpRequest) {
|
||||||
|
this.request=httpRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public ContextRequest<T> execute() throws Exception,ControlledError{
|
||||||
|
try {
|
||||||
|
if (!preoperations.isEmpty()) {
|
||||||
|
LOG.trace("Running preops (size : {} )", preoperations.size());
|
||||||
|
for (Runnable r : preoperations)
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("Context is "+SessionUtil.getCurrentContext(request, true));
|
||||||
|
LOG.debug("Context is "+SessionUtil.getCurrentToken(request, true)==null?null:"***");
|
||||||
|
LOG.trace("Executing actual method..");
|
||||||
|
result = run();
|
||||||
|
return this;
|
||||||
|
}catch(ControlledError e) {
|
||||||
|
throw e;
|
||||||
|
}catch(Throwable t) {
|
||||||
|
LOG.error("Unexpected error ",t);
|
||||||
|
throw new Exception("Unexpected error contacting the infrastructure", t);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected abstract T run() throws Exception,ControlledError;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.filesets.sdi.GCubeSDILayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.faults.InvalidObjectException;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
|
|
||||||
|
public class DVConversion {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
"_type": "GIS-CENTROIDS",
|
||||||
|
"layer": {
|
||||||
|
"_type": "gcube-sdi-layer",
|
||||||
|
"_platformInfo": [
|
||||||
|
{
|
||||||
|
"_type": "Geoserver",
|
||||||
|
"workspace": "profiledconcessioni_devvre",
|
||||||
|
"storeName": "profiledconcessioni_devvre_centroids",
|
||||||
|
"_host": "geoserver-218.dev.d4science.org"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_bbox": {
|
||||||
|
"_maxX": 180.0,
|
||||||
|
"_minX": -180.0,
|
||||||
|
"_maxY": 90.0,
|
||||||
|
"_minY": -90.0
|
||||||
|
},
|
||||||
|
"_ogcLinks": {
|
||||||
|
"wms": {
|
||||||
|
"wms": "https://geoserver-218.dev.d4science.org/geoserver/profiledconcessioni_devvre/wms?service=WMS&version=1.1.0&request=GetMap&layers=profiledconcessioni_devvre:null&styles=&bbox=-180.000000,-90.000000,180.000000,90.000000&srs=EPSG:4326&format=application/openlayers&width=400&height=400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexName": "profiledconcessioni_devvre_centroids",
|
||||||
|
"records": 4,
|
||||||
|
"crossReferencedLayers": {},
|
||||||
|
"flag": "public"
|
||||||
|
}
|
||||||
|
* @throws InvalidObjectException
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static IndexLayer convert(Index toConvert) throws InvalidObjectException {
|
||||||
|
IndexLayer toReturn = null;
|
||||||
|
|
||||||
|
|
||||||
|
switch(toConvert.getType()) {
|
||||||
|
case "GIS-CENTROIDS" : {
|
||||||
|
toReturn = Serialization.convert(toConvert,IndexLayer.class);
|
||||||
|
// toReturn.setLayer(Serialization.read(toConvert.get("layer"), GCubeSDILayer.class));
|
||||||
|
// toReturn.setFlag(toConvert.getString("flag"));
|
||||||
|
// toReturn.setIndexName(toConvert.getString());
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
default:{
|
||||||
|
throw new InvalidObjectException("Unable to convert Index. Unknown type : "+toConvert.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,16 +3,11 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
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.MongoServiceCommon;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
|
@ -214,39 +209,39 @@ public class SessionUtil {
|
||||||
* @return the list of concessioni
|
* @return the list of concessioni
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public static List<Concessione> getListOfConcessioni(HttpServletRequest httpServletRequest,
|
// public static List<Concessione> getListOfConcessioni(HttpServletRequest httpServletRequest,
|
||||||
boolean reloadFromService) throws Exception {
|
// boolean reloadFromService) throws Exception {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
// HttpSession session = httpServletRequest.getSession();
|
||||||
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
// List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||||
|
//
|
||||||
// setting null to force reloading from service
|
// // setting null to force reloading from service
|
||||||
if (reloadFromService)
|
// if (reloadFromService)
|
||||||
listOfConcessioni = null;
|
// listOfConcessioni = null;
|
||||||
|
//
|
||||||
if (listOfConcessioni == null) {
|
// if (listOfConcessioni == null) {
|
||||||
listOfConcessioni = new ArrayList<Concessione>();
|
// listOfConcessioni = new ArrayList<Concessione>();
|
||||||
LOG.info("Loading list of concessione from client mongo");
|
// LOG.info("Loading list of concessione from client mongo");
|
||||||
SessionUtil.getCurrentContext(httpServletRequest, true);
|
// SessionUtil.getCurrentContext(httpServletRequest, true);
|
||||||
MongoServiceCommon serviceUtil = new MongoServiceCommon();
|
// MongoServiceCommon serviceUtil = new MongoServiceCommon();
|
||||||
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
// MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
//
|
||||||
Iterator<Concessione> concessioni = clientMongo.getList();
|
// Iterator<Concessione> concessioni = clientMongo.getList();
|
||||||
if (concessioni != null) {
|
// if (concessioni != null) {
|
||||||
while (concessioni.hasNext()) {
|
// while (concessioni.hasNext()) {
|
||||||
Concessione concessione = (Concessione) concessioni.next();
|
// Concessione concessione = (Concessione) concessioni.next();
|
||||||
listOfConcessioni.add(concessione);
|
// listOfConcessioni.add(concessione);
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
// // LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
||||||
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
// session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
||||||
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
// LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
||||||
} else
|
// } else
|
||||||
LOG.info("list of concessioni presents in session, using it");
|
// LOG.info("list of concessioni presents in session, using it");
|
||||||
|
//
|
||||||
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
// LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||||
return listOfConcessioni;
|
// return listOfConcessioni;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the GNA data viewer config profile.
|
* Gets the GNA data viewer config profile.
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
|
|
||||||
|
|
||||||
|
public class GCubeCollection implements Serializable {
|
||||||
|
|
||||||
|
private UseCaseDescriptorDV ucd;
|
||||||
|
private List<IndexLayer> indexes;
|
||||||
|
|
||||||
|
|
||||||
|
public UseCaseDescriptorDV getUcd() {
|
||||||
|
return ucd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IndexLayer> getIndexes() {
|
||||||
|
return indexes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setUcd(UseCaseDescriptorDV ucd) {
|
||||||
|
this.ucd = ucd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexes(List<IndexLayer> indexes) {
|
||||||
|
this.indexes = indexes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GCubeCollection [ucd=" + ucd + ", indexes=" + indexes + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public class ViewerConfiguration implements IsSerializable{
|
||||||
|
|
||||||
|
|
||||||
|
//TODO BaseLayers
|
||||||
|
private List<BaseMapLayer> baseLayers;
|
||||||
|
|
||||||
|
|
||||||
|
private Map<String,GCubeCollection> availableCollections;
|
||||||
|
|
||||||
|
|
||||||
|
public List<BaseMapLayer> getBaseLayers() {
|
||||||
|
return baseLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setBaseLayers(List<BaseMapLayer> baseLayers) {
|
||||||
|
this.baseLayers = baseLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Map<String, GCubeCollection> getAvailableCollections() {
|
||||||
|
return availableCollections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvailableCollections(Map<String, GCubeCollection> availableCollections) {
|
||||||
|
this.availableCollections = availableCollections;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
// public List<String> displayedCollections;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public Map<String,String> selectedProjects;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class BBOXDV extends HashMap<String,Double>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -160255589938251081L;
|
||||||
|
|
||||||
|
public BBOXDV() {
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final String asGeoJSONBBox(){
|
||||||
|
StringBuilder builder = new StringBuilder("[");
|
||||||
|
builder.append(getMaxX()+","); // W
|
||||||
|
builder.append(getMinY()+","); // S
|
||||||
|
if(is3d()) builder.append(getMinZ()+","); // Z
|
||||||
|
|
||||||
|
builder.append(getMinX()+","); // E
|
||||||
|
builder.append(getMaxY()+","); // N
|
||||||
|
if(is3d()) builder.append(getMaxZ()+","); // Z
|
||||||
|
|
||||||
|
|
||||||
|
builder.deleteCharAt(builder.length());
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
public double[] asGeoJSONArray(){
|
||||||
|
if(is3d()){
|
||||||
|
return new double[]{getMaxX(),getMinY(),getMinZ(),getMinX(),getMaxY(),getMaxZ()};
|
||||||
|
}else return new double[]{getMaxX(),getMinY(),getMinX(),getMaxY()};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final BBOXDV fromGeoJSON(double[] coords){
|
||||||
|
BBOXDV toReturn = new BBOXDV();
|
||||||
|
toReturn.setMaxX(coords[0]);
|
||||||
|
toReturn.setMinY(coords[1]);
|
||||||
|
|
||||||
|
if(coords.length == 6){
|
||||||
|
// 3D
|
||||||
|
toReturn.setMinZ(coords[2]);
|
||||||
|
toReturn.setMinX(coords[3]);
|
||||||
|
toReturn.setMaxY(coords[4]);
|
||||||
|
toReturn.setMaxZ(coords[5]);
|
||||||
|
}else {
|
||||||
|
toReturn.setMinX(coords[2]);
|
||||||
|
toReturn.setMaxY(coords[3]);
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final BBOXDV WORLD=new BBOXDV(180d,-180d,90d,-90d);
|
||||||
|
|
||||||
|
public static final BBOXDV WORLD_3D=new BBOXDV(180d,-180d,90d,-90d);
|
||||||
|
|
||||||
|
public static final String MAX_X="_maxX";
|
||||||
|
public static final String MAX_Y="_maxY";
|
||||||
|
public static final String MAX_Z="_maxZ";
|
||||||
|
public static final String MIN_X="_minX";
|
||||||
|
public static final String MIN_Y="_minY";
|
||||||
|
public static final String MIN_Z="_minZ";
|
||||||
|
|
||||||
|
|
||||||
|
public BBOXDV(Double maxX,Double minX,Double maxY,Double minY,Double maxZ,Double minZ){
|
||||||
|
this(maxX,minX,maxY,minY);
|
||||||
|
setMaxZ(maxZ);
|
||||||
|
setMinZ(minZ);
|
||||||
|
}
|
||||||
|
public BBOXDV(Double maxX,Double minX,Double maxY,Double minY){
|
||||||
|
setMaxX(maxX);
|
||||||
|
setMinX(minX);
|
||||||
|
setMaxY(maxY);
|
||||||
|
setMinY(minY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public BBOXDV setMaxX(Double d){this.put(MAX_X,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMaxY(Double d){this.put(MAX_Y,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMaxZ(Double d){this.put(MAX_Z,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMinX(Double d){this.put(MIN_X,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMinY(Double d){this.put(MIN_Y,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMinZ(Double d){this.put(MIN_Z,d);return this;}
|
||||||
|
|
||||||
|
public Double getMinY(){return (Double) this.getOrDefault(MIN_Y,-90d);}
|
||||||
|
|
||||||
|
public Double getMaxY(){return (Double) this.getOrDefault(MAX_Y,90d);}
|
||||||
|
|
||||||
|
public Double getMinX(){return (Double) this.getOrDefault(MIN_X,-180d);}
|
||||||
|
|
||||||
|
public Double getMaxX(){return (Double) this.getOrDefault(MAX_X,180d);}
|
||||||
|
|
||||||
|
public Double getMinZ(){return (Double) this.getOrDefault(MIN_Z,null);}
|
||||||
|
|
||||||
|
public Double getMaxZ(){return (Double) this.getOrDefault(MAX_Z,null);}
|
||||||
|
|
||||||
|
|
||||||
|
public Boolean is3d(){
|
||||||
|
return getMinZ()!=null && getMaxZ() !=null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public class GCubeSDILayerDV implements IsSerializable{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// TODO manage heterogeneus collection
|
||||||
|
|
||||||
|
@JsonProperty(value = "_type")
|
||||||
|
private String type;
|
||||||
|
@JsonProperty(value = "_platformInfo")
|
||||||
|
private List<GeoServerPlatformInfoDV> platformInfos;
|
||||||
|
@JsonProperty(value = "_bbox")
|
||||||
|
private BBOXDV bbox;
|
||||||
|
@JsonProperty(value = "_ogcLinks")
|
||||||
|
private HashMap<String,String> ogcLinks;
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
public List<GeoServerPlatformInfoDV> getPlatformInfos() {
|
||||||
|
return platformInfos;
|
||||||
|
}
|
||||||
|
public void setPlatformInfos(List<GeoServerPlatformInfoDV> platformInfos) {
|
||||||
|
this.platformInfos = platformInfos;
|
||||||
|
}
|
||||||
|
public BBOXDV getBbox() {
|
||||||
|
return bbox;
|
||||||
|
}
|
||||||
|
public void setBbox(BBOXDV bbox) {
|
||||||
|
this.bbox = bbox;
|
||||||
|
}
|
||||||
|
public HashMap<String, String> getOgcLinks() {
|
||||||
|
return ogcLinks;
|
||||||
|
}
|
||||||
|
public void setOgcLinks(HashMap<String, String> ogcLinks) {
|
||||||
|
this.ogcLinks = ogcLinks;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GCubeSDILayerDV [type=" + type + ", platformInfos=" + platformInfos + ", bbox=" + bbox + ", ogcLinks="
|
||||||
|
+ ogcLinks + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public class GeoServerPlatformInfoDV implements IsSerializable{
|
||||||
|
|
||||||
|
@JsonProperty(value = "_type")
|
||||||
|
private String type;
|
||||||
|
private String workspace;
|
||||||
|
private String storeName;
|
||||||
|
private String layerName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(value = "_host")
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorkspace() {
|
||||||
|
return workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkspace(String workspace) {
|
||||||
|
this.workspace = workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStoreName() {
|
||||||
|
return storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoreName(String storeName) {
|
||||||
|
this.storeName = storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getLayerName() {
|
||||||
|
return layerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayerName(String layerName) {
|
||||||
|
this.layerName = layerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GeoServerPlatformInfoDV [type=" + type + ", workspace=" + workspace + ", storeName=" + storeName
|
||||||
|
+ ", layerName=" + layerName + ", host=" + host + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.faults;
|
||||||
|
|
||||||
|
public class ControlledError extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 3471094758439575063L;
|
||||||
|
|
||||||
|
public ControlledError() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||||
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(String message) {
|
||||||
|
super(message);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GCubeSDILayerDV;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||||
|
|
||||||
|
public class IndexLayer implements IsSerializable{
|
||||||
|
|
||||||
|
|
||||||
|
@JsonProperty(value = "_type")
|
||||||
|
private String type;
|
||||||
|
private GCubeSDILayerDV layer;
|
||||||
|
private String indexName;
|
||||||
|
private int records;
|
||||||
|
private String flag;
|
||||||
|
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
public GCubeSDILayerDV getLayer() {
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
public void setLayer(GCubeSDILayerDV layer) {
|
||||||
|
this.layer = layer;
|
||||||
|
}
|
||||||
|
public String getIndexName() {
|
||||||
|
return indexName;
|
||||||
|
}
|
||||||
|
public void setIndexName(String indexName) {
|
||||||
|
this.indexName = indexName;
|
||||||
|
}
|
||||||
|
public int getRecords() {
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
public void setRecords(int records) {
|
||||||
|
this.records = records;
|
||||||
|
}
|
||||||
|
public String getFlag() {
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
public void setFlag(String flag) {
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "IndexLayer [type=" + type + ", layer=" + layer + ", indexName=" + indexName + ", records=" + records
|
||||||
|
+ ", flag=" + flag + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,13 +2,19 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GeoServerPlatformInfoDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LayerItem.
|
* The Class LayerItem.
|
||||||
*
|
*
|
||||||
|
@ -18,6 +24,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||||
*/
|
*/
|
||||||
public class LayerItem implements Serializable, Cloneable {
|
public class LayerItem implements Serializable, Cloneable {
|
||||||
|
|
||||||
|
|
||||||
/** The Constant serialVersionUID. */
|
/** The Constant serialVersionUID. */
|
||||||
private static final long serialVersionUID = 1664082688635256899L;
|
private static final long serialVersionUID = 1664082688635256899L;
|
||||||
|
|
||||||
|
@ -962,4 +969,119 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static LayerItem fromIndex(IndexLayer layer) {
|
||||||
|
|
||||||
|
// Assuming only GS platform
|
||||||
|
GeoServerPlatformInfoDV gsInfo = layer.getLayer().getPlatformInfos().get(0);
|
||||||
|
|
||||||
|
|
||||||
|
GWT.log("PlatformInfo is "+gsInfo);
|
||||||
|
|
||||||
|
return new LayerItem(LayerType.FEATURE_TYPE,
|
||||||
|
layer.getIndexName(),
|
||||||
|
gsInfo.getWorkspace()+":"+gsInfo.getLayerName(),
|
||||||
|
layer.getLayer().getOgcLinks().get("wms"), // ??
|
||||||
|
gsInfo.getHost(),
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
null,
|
||||||
|
layer.getLayer().getOgcLinks().get("wms"),
|
||||||
|
true,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
null, // TODO ZAXIS
|
||||||
|
null, // NO restrictions on resolution
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To layer item.
|
||||||
|
*
|
||||||
|
* @param layerType the layer type
|
||||||
|
* @param layerTitle the layer title
|
||||||
|
* @param layerName the layer name
|
||||||
|
* @param layerURL the layer URL
|
||||||
|
* @param mapServerHost the map server host
|
||||||
|
* @param isExternal the is external
|
||||||
|
* @param isBase the is base
|
||||||
|
* @param displayInLayerSwitcher the display in layer switcher
|
||||||
|
* @param styles the styles
|
||||||
|
* @param wmsLink the wms link
|
||||||
|
* @param onTop the on top
|
||||||
|
* @param wmsNotStandardParams the wms not standard params
|
||||||
|
* @param isNcWms the is nc wms
|
||||||
|
* @param UUID the uuid
|
||||||
|
* @param zAxis the z axis
|
||||||
|
* @param minResolution the min resolution
|
||||||
|
* @param maxResolution the max resolution
|
||||||
|
* @return the layer item
|
||||||
|
*/
|
||||||
|
|
||||||
|
private LayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
|
||||||
|
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
|
||||||
|
ArrayList<String> styles, String wmsLink, boolean onTop, HashMap<String, String> wmsNotStandardParams,
|
||||||
|
boolean isNcWms, String UUID, ZAxis zAxis, Double minResolution, Double maxResolution) {
|
||||||
|
|
||||||
|
// GWT.log("Add addLayerByWms 1");
|
||||||
|
|
||||||
|
this.setBaseLayer(isBase);
|
||||||
|
this.setTitle(layerTitle);
|
||||||
|
this.setName(layerName);
|
||||||
|
this.setUrl(layerURL);
|
||||||
|
this.setMapServerHost(mapServerHost);
|
||||||
|
// l.setExternal(isExternal);
|
||||||
|
this.setOpacity(1d);
|
||||||
|
this.setBuffer(2);
|
||||||
|
this.setWmsLink(wmsLink);
|
||||||
|
this.setWmsNotStandardParams(wmsNotStandardParams);
|
||||||
|
this.setNcWms(isNcWms);
|
||||||
|
this.setUUID(UUID);
|
||||||
|
this.setZAxis(zAxis);
|
||||||
|
this.setMinResolution(minResolution);
|
||||||
|
this.setMaxResolution(maxResolution);
|
||||||
|
|
||||||
|
switch (layerType) {
|
||||||
|
|
||||||
|
// TODO IMPLEMENT THIS CASE
|
||||||
|
case RASTER_BASELAYER:
|
||||||
|
|
||||||
|
// l.setHasLegend(false);
|
||||||
|
this.setBaseLayer(true);
|
||||||
|
this.setTrasparent(false);
|
||||||
|
this.setClickData(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FEATURE_TYPE:
|
||||||
|
|
||||||
|
// CASE FEATURE TYPE
|
||||||
|
this.setBaseLayer(false);
|
||||||
|
this.setClickData(true);
|
||||||
|
this.setTrasparent(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GWT.log("styles " + styles);
|
||||||
|
|
||||||
|
if (styles != null && styles.size() > 0) {
|
||||||
|
this.setHasLegend(true);
|
||||||
|
this.setDefaultStyle(styles.get(0));
|
||||||
|
this.setStyle(styles.get(0));
|
||||||
|
this.setStyles(styles);
|
||||||
|
} else {
|
||||||
|
String style = URLUtil.getValueOfParameter("styles", wmsLink);
|
||||||
|
if (style != null) { // CASE OF STYLE ="";
|
||||||
|
// TENTATIVE TO GET LEGEND
|
||||||
|
this.setHasLegend(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GWT.log("Built layer: " + this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,14 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GCubeSDILayerDV;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LayerObject.
|
* Represents a layer,
|
||||||
*
|
* holds the layer item and the related Collection info if existing
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
*
|
||||||
*
|
*
|
||||||
* Sep 9, 2021
|
|
||||||
*/
|
*/
|
||||||
public class LayerObject implements Serializable {
|
public class LayerObject implements Serializable {
|
||||||
|
|
||||||
|
@ -18,101 +18,118 @@ public class LayerObject implements Serializable {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2282478701630148774L;
|
private static final long serialVersionUID = -2282478701630148774L;
|
||||||
/* This is the layer/product type. E.g. Concessione */
|
|
||||||
private String itemType;
|
|
||||||
|
public static enum LayerObjectType{
|
||||||
|
BASE_LAYER,
|
||||||
|
PROJECT_LAYER,
|
||||||
|
INDEX_LAYER,
|
||||||
|
GENERIC_LAYER
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private LayerObjectType type;
|
||||||
|
|
||||||
|
private IndexLayer indexLayer; // expected for INDEX_LAYER type
|
||||||
|
private String ucid; // expected for collection layers
|
||||||
|
private GCubeSDILayerDV projectLayer; // expected for PROJECT_LAYER
|
||||||
|
private String projectId; // expected for PROJECT_LAYER
|
||||||
|
|
||||||
private LayerItem layerItem;
|
private LayerItem layerItem;
|
||||||
private BaseConcessioneDV sourceConcessione;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new layer object.
|
|
||||||
*/
|
|
||||||
public LayerObject() {
|
public LayerObject() {
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new layer object.
|
|
||||||
*
|
|
||||||
* @param itemType the item type
|
|
||||||
* @param layerItem the layer item
|
|
||||||
* @param sourceConcessione the source concessione
|
|
||||||
*/
|
|
||||||
public LayerObject(String itemType, LayerItem layerItem, BaseConcessioneDV sourceConcessione) {
|
|
||||||
super();
|
super();
|
||||||
this.itemType = itemType;
|
|
||||||
this.layerItem = layerItem;
|
|
||||||
this.sourceConcessione = sourceConcessione;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public LayerObject(LayerObjectType type,LayerItem item) {
|
||||||
* Gets the item type.
|
this.setType(type);
|
||||||
*
|
this.setLayerItem(item);
|
||||||
* @return the item type
|
}
|
||||||
*/
|
|
||||||
public String getItemType() {
|
|
||||||
return itemType;
|
public LayerObject(String ucid, IndexLayer indexLayer, LayerItem item) {
|
||||||
|
this(LayerObjectType.INDEX_LAYER,item);
|
||||||
|
this.ucid=ucid;
|
||||||
|
this.indexLayer=indexLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerObject(String ucid, String projectId, GCubeSDILayerDV projectLayer, LayerItem item) {
|
||||||
|
this(LayerObjectType.PROJECT_LAYER,item);
|
||||||
|
this.ucid=ucid;
|
||||||
|
this.projectId=projectId;
|
||||||
|
this.projectLayer = projectLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the layer item.
|
public LayerObjectType getType() {
|
||||||
*
|
return type;
|
||||||
* @return the layer item
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
public void setType(LayerObjectType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IndexLayer getIndexLayer() {
|
||||||
|
return indexLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setIndexLayer(IndexLayer indexLayer) {
|
||||||
|
this.indexLayer = indexLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUcid() {
|
||||||
|
return ucid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setUcid(String ucid) {
|
||||||
|
this.ucid = ucid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public GCubeSDILayerDV getProjectLayer() {
|
||||||
|
return projectLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setProjectLayer(GCubeSDILayerDV projectLayer) {
|
||||||
|
this.projectLayer = projectLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProjectId() {
|
||||||
|
return projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setProjectId(String projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public LayerItem getLayerItem() {
|
public LayerItem getLayerItem() {
|
||||||
return layerItem;
|
return layerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the source concessione.
|
|
||||||
*
|
|
||||||
* @return the source concessione
|
|
||||||
*/
|
|
||||||
public BaseConcessioneDV getSourceConcessione() {
|
|
||||||
return sourceConcessione;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the item type.
|
|
||||||
*
|
|
||||||
* @param itemType the new item type
|
|
||||||
*/
|
|
||||||
public void setItemType(String itemType) {
|
|
||||||
this.itemType = itemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the layer item.
|
|
||||||
*
|
|
||||||
* @param layerItem the new layer item
|
|
||||||
*/
|
|
||||||
public void setLayerItem(LayerItem layerItem) {
|
public void setLayerItem(LayerItem layerItem) {
|
||||||
this.layerItem = layerItem;
|
this.layerItem = layerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the source concessione.
|
|
||||||
*
|
|
||||||
* @param sourceConcessione the new source concessione
|
|
||||||
*/
|
|
||||||
public void setSourceConcessione(BaseConcessioneDV sourceConcessione) {
|
|
||||||
this.sourceConcessione = sourceConcessione;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
public static long getSerialversionuid() {
|
||||||
* To string.
|
return serialVersionUID;
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("LayerObject [itemType=");
|
|
||||||
builder.append(itemType);
|
|
||||||
builder.append(", layerItem=");
|
|
||||||
builder.append(layerItem);
|
|
||||||
builder.append(", sourceConcessione=");
|
|
||||||
builder.append(sourceConcessione);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,8 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<web-app>
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
|
||||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
|
||||||
version="3.0">
|
<!-- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" -->
|
||||||
|
<!-- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee -->
|
||||||
|
<!-- http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" -->
|
||||||
|
<!-- version="3.0"> -->
|
||||||
|
|
||||||
|
|
||||||
<!-- Default page to serve -->
|
<!-- Default page to serve -->
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer;
|
|
||||||
|
|
||||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
|
||||||
|
|
||||||
public class ConcessioneReader {
|
|
||||||
|
|
||||||
private static final String YOUR_TOKEN = "";
|
|
||||||
|
|
||||||
public static String SCOPE = "/gcube/devsec/devVRE";
|
|
||||||
public static String mongoConcessioneID = "6102c07002ad3d05b5f81ddc";
|
|
||||||
|
|
||||||
//@Before
|
|
||||||
public void setEnviroment() {
|
|
||||||
ScopeProvider.instance.set(SCOPE);
|
|
||||||
SecurityTokenProvider.instance.set(YOUR_TOKEN);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//@Test
|
|
||||||
public void readConcessione() throws Exception {
|
|
||||||
System.out.println("getConcessioneForId " + mongoConcessioneID + "called");
|
|
||||||
|
|
||||||
ConcessioneDV concessionDV = null;
|
|
||||||
|
|
||||||
if (mongoConcessioneID == null)
|
|
||||||
throw new Exception("Invalid parameter. The Id is null");
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println("Trying to get record for id " + mongoConcessioneID);
|
|
||||||
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
|
||||||
Concessione concessione = concessioniManager.getById(mongoConcessioneID);
|
|
||||||
System.out.println("For id " + mongoConcessioneID + ", got concessione " + concessione);
|
|
||||||
System.out.println("Immagini Rappresentative are: " + concessione.getImmaginiRappresentative());
|
|
||||||
System.out.println("Relazione scavo: " + concessione.getRelazioneScavo());
|
|
||||||
System.out.println("Pianta Fine scavo: " + concessione.getPianteFineScavo());
|
|
||||||
System.out.println("Posizionamento scavo: " + concessione.getPosizionamentoScavo());
|
|
||||||
|
|
||||||
if (concessione != null) {
|
|
||||||
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (concessionDV == null)
|
|
||||||
throw new Exception("Concessione not retrieved");
|
|
||||||
|
|
||||||
System.out.println("Got concessione: " + concessionDV);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
String erroMsg = Concessione.class.getSimpleName() + " with id " + mongoConcessioneID + " not available";
|
|
||||||
throw new Exception(erroMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer;
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.IAMClientCredentialsReader;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.IAMClientCredentialsReader;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientCredentials;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientCredentials;
|
||||||
|
@ -23,14 +23,7 @@ public class IAMClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Read credentials: " + credentials);
|
System.out.println("Read credentials: " + credentials);
|
||||||
Concessione concessione;
|
|
||||||
try {
|
|
||||||
// concessione = new ConcessioniMongoServiceIdentityProxy();
|
|
||||||
|
|
||||||
// System.out.println("Get concessione: " + concessione);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ModelConversionTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetUCD() throws Exception {
|
||||||
|
// TokenSetter.set("/gcube/devsec/devVRE");
|
||||||
|
// UseCaseDescriptorsI client = useCaseDescriptors().build();
|
||||||
|
// client.query(new QueryRequest()).forEachRemaining(u->{
|
||||||
|
//
|
||||||
|
// System.out.println(u.getName());
|
||||||
|
//
|
||||||
|
// UCD ucd = Serialization.convert(u, UCD.class);
|
||||||
|
// System.out.println(ucd.getName());
|
||||||
|
//
|
||||||
|
// });
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
|
||||||
|
public class TokenSetter {
|
||||||
|
|
||||||
|
|
||||||
|
private static Properties props=new Properties();
|
||||||
|
|
||||||
|
static{
|
||||||
|
try {
|
||||||
|
props.load(TokenSetter.class.getResourceAsStream("/tokens.properties"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("YOU NEED TO SET TOKEN FILE IN CONFIGURATION");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void set(String scope){
|
||||||
|
try{
|
||||||
|
if(!props.containsKey(scope)) throw new RuntimeException("No token found for scope : "+scope);
|
||||||
|
SecurityTokenProvider.instance.set(props.getProperty(scope));
|
||||||
|
}catch(Throwable e){
|
||||||
|
System.err.println("Unable to set token for scope "+scope);
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
}
|
||||||
|
ScopeProvider.instance.set(scope);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue