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.
|
||||
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
|
||||
|
||||
#### Bug fixed
|
||||
|
|
134
pom.xml
134
pom.xml
|
@ -14,13 +14,13 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.3.0</version>
|
||||
<version>3.0.0-SNAPSHOT</version>
|
||||
<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>
|
||||
|
||||
<properties>
|
||||
<!-- 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>
|
||||
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||
<!-- GWT 2.9 support 8, 9 and 11 -->
|
||||
|
@ -63,11 +63,74 @@
|
|||
|
||||
<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>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<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>
|
||||
|
@ -105,22 +168,7 @@
|
|||
<artifactId>oidc-library</artifactId>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
|
@ -141,73 +189,33 @@
|
|||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
<!-- <version>6.2.5</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.portlet</groupId>
|
||||
<artifactId>portlet-api</artifactId>
|
||||
<!-- <version>2.0</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<!-- <version>1.6.4</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<!-- <version>1.6.4</version> -->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- TEST -->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
|
|
|
@ -1,51 +1,37 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.model.RecordDV;
|
||||
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.events.AddedLayerToMapEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEventHandler;
|
||||
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.events.application.ClosedViewDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.SearchPerformedEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ShowPopupOnCentroiEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ZoomOutOverMinimumEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.ChangeBaseMapLayerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent.LAYER_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.SwapLayer;
|
||||
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.util.ControlledCallBack;
|
||||
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.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.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.ResizeHandler;
|
||||
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.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.layer.Image;
|
||||
|
||||
/**
|
||||
|
@ -82,40 +66,23 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
/** The main panel. */
|
||||
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("");
|
||||
|
||||
/** The layer manager. */
|
||||
private LayerManager layerManager = new LayerManager(applicationBus);
|
||||
|
||||
private String paramGeonaItemID;
|
||||
|
||||
private GNADataViewerConfigProfile geonaDataViewerProfile;
|
||||
|
||||
private OLMapManager olMapMng = null;
|
||||
|
||||
|
||||
int attempt = 0;
|
||||
|
||||
private LoaderIcon loaderApp = new LoaderIcon("Loading application... please wait");
|
||||
|
||||
private HTML attributionDiv = new HTML();
|
||||
|
||||
private static List<BaseMapLayer> listBaseMapLayers = null;
|
||||
|
||||
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
||||
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
||||
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
||||
|
||||
private static ViewerStatus viewerStatus=new ViewerStatus();
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
*/
|
||||
|
@ -123,90 +90,45 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
loaderApp.getElement().addClassName("loader-gna-app");
|
||||
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
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
// Fields configurations are read on open collection event
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<ItemField> result) {
|
||||
GWT.log("Loaded item fields: "+result);
|
||||
|
||||
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();
|
||||
}
|
||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
|
||||
RootPanel.get(APP_DIV).add(mainPanel);
|
||||
|
||||
initApplication();
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initApplication() {
|
||||
|
||||
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
//LOADING THE BASE MAP LAYERS
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListBaseLayers(new AsyncCallback<List<BaseMapLayer>>() {
|
||||
|
||||
Map<String,List<String>> queryParameters = new HashMap<String,List<String>> ();
|
||||
queryParameters.putAll(Window.Location.getParameterMap());
|
||||
|
||||
GWT.log("Sending query params : "+ queryParameters);
|
||||
// Load Initial Configuration
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getInitialConfiguration(queryParameters, new ControlledCallBack<ViewerConfiguration>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
||||
Window.alert("Sorry, an error occurred on instancing the GeoPortale Viewer. Please, contact the support");
|
||||
}
|
||||
|
||||
public void after() {RootPanel.get(APP_DIV).remove(loaderApp);}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
|
||||
try {
|
||||
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);
|
||||
public void onSuccess(ViewerConfiguration result) {
|
||||
super.onSuccess(result);
|
||||
|
||||
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
|
||||
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
||||
layerManager.getLayerManagerBus(), firstBaseLayer);
|
||||
|
@ -215,14 +137,21 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
mainPanel.setMap(olMap);
|
||||
|
||||
updateSize();
|
||||
|
||||
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||
.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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||
return listBaseMapLayers;
|
||||
public static ViewerStatus getStatus() {
|
||||
return viewerStatus;
|
||||
}
|
||||
|
||||
private void loadGeonaDataViewerProfile() {
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||
.getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GNADataViewerConfigProfile profile) {
|
||||
geonaDataViewerProfile = profile;
|
||||
GWT.log("Profile: " + geonaDataViewerProfile);
|
||||
Iterator<String> it;
|
||||
String theItemType = paramGeonaItemType;
|
||||
if (theItemType == null) {
|
||||
it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
||||
it.hasNext();
|
||||
theItemType = it.next();
|
||||
}
|
||||
|
||||
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
||||
|
||||
if (layerItem == null) {
|
||||
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());
|
||||
layerItem.setName(layerName);
|
||||
layerManager.setBaseLayerFromIsProfile(layerItem);
|
||||
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
||||
null, false, null, null, null);
|
||||
|
||||
if (paramGeonaItemID != null) {
|
||||
if (paramGeonaItemType == null) {
|
||||
Window.alert(
|
||||
"Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
|
||||
+ " (GeoNa Data Type) where to search the item id: "
|
||||
+ paramGeonaItemID);
|
||||
return;
|
||||
}
|
||||
GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
|
||||
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// private void loadGeonaDataViewerProfile() {
|
||||
//
|
||||
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
//
|
||||
// @Override
|
||||
// public void execute() {
|
||||
// GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||
// .getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
// Window.alert(caught.getMessage());
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(GNADataViewerConfigProfile profile) {
|
||||
// geonaDataViewerProfile = profile;
|
||||
// GWT.log("Profile: " + geonaDataViewerProfile);
|
||||
// Iterator<String> it;
|
||||
// String theItemType = paramGeonaItemType;
|
||||
// if (theItemType == null) {
|
||||
// it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
||||
// it.hasNext();
|
||||
// theItemType = it.next();
|
||||
// }
|
||||
//
|
||||
// LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
||||
//
|
||||
// if (layerItem == null) {
|
||||
// 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());
|
||||
// layerItem.setName(layerName);
|
||||
// layerManager.setBaseLayerFromIsProfile(layerItem);
|
||||
// layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
||||
// null, false, null, null, null);
|
||||
//
|
||||
// if (paramGeonaItemID != null) {
|
||||
// if (paramGeonaItemType == null) {
|
||||
// Window.alert(
|
||||
// "Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
|
||||
// + " (GeoNa Data Type) where to search the item id: "
|
||||
// + paramGeonaItemID);
|
||||
// return;
|
||||
// }
|
||||
// GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
|
||||
// applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Update window size.
|
||||
|
@ -322,302 +253,278 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
return rootHeight;
|
||||
}
|
||||
|
||||
|
||||
//************************************************************************************************************************
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
||||
GWT.log("Fired event: " + showDetailsEvent);
|
||||
|
||||
String geonaMongoId = showDetailsEvent.getGeonaMongoID();
|
||||
|
||||
if (geonaMongoId == null) {
|
||||
Window.alert("Item Id not found");
|
||||
return;
|
||||
}
|
||||
|
||||
// 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());
|
||||
|
||||
// ************************** COLLECTIONS
|
||||
|
||||
|
||||
applicationBus.addHandler(OpenCollectionEvent.TYPE, openCollectionEvent ->{
|
||||
GWT.log("Fired event: " + openCollectionEvent);
|
||||
// Check if ID is available
|
||||
String collId=openCollectionEvent.getCollectionId();
|
||||
if(!GeoportalDataViewer.getStatus().getConfig().getAvailableCollections().containsKey(collId)) {
|
||||
GWT.log("!! Collection "+collId+" is not available");
|
||||
Window.alert("Collection "+collId+" is not found.");
|
||||
}else {
|
||||
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) {
|
||||
case OPACITY:
|
||||
GWT.log("opacity: "+doLayerActionEvent.getOpacity());
|
||||
olMap.setWMSDetailLayerOpacity(doLayerActionEvent.getLayerItem(),
|
||||
doLayerActionEvent.getOpacity());
|
||||
break;
|
||||
GCubeCollection toOpen = GeoportalDataViewer.getStatus().getConfig().getAvailableCollections().get(collId);
|
||||
|
||||
// Check if indexes is empty
|
||||
if(toOpen.getIndexes()==null || toOpen.getIndexes().isEmpty()) {
|
||||
GWT.log("Unexpected empty indexes in collection "+toOpen);
|
||||
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();
|
||||
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
|
||||
GWT.log("SWAPPING source "+swLS.getLayerItem().getName() +", target: "+swLT.getLayerItem().getName());
|
||||
olMap.swapDetailsLayers(swLS, swLT);
|
||||
break;
|
||||
// ???
|
||||
// Open details popup (if called on startup)
|
||||
|
||||
case VISIBILITY:
|
||||
GWT.log("visibility: "+doLayerActionEvent.getVisibility());
|
||||
olMap.setWMSDetailLayerVisible(doLayerActionEvent.getLayerItem(),
|
||||
doLayerActionEvent.getVisibility());
|
||||
|
||||
|
||||
|
||||
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");
|
||||
// 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;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent) {
|
||||
//**************************** User actions On MAP
|
||||
applicationBus.addHandler(ShowDetailsEvent.TYPE, showDetailsEvent -> {
|
||||
GWT.log("Fired event: " + showDetailsEvent);
|
||||
|
||||
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("");
|
||||
String geonaMongoId = showDetailsEvent.getGeonaMongoID();
|
||||
|
||||
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) {
|
||||
|
||||
// /**
|
||||
// * 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;
|
||||
// };
|
||||
// if (showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
|
||||
//
|
||||
// }-*/;
|
||||
|
||||
private void performWFSQueryOnCentroid(RecordDV 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),
|
||||
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);
|
||||
}
|
||||
// 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(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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
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.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.wms.GeoInformationForWMSRequest;
|
||||
|
||||
|
@ -52,14 +49,14 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
|
||||
int maxWFSFeature, double zoomLevel);
|
||||
|
||||
/**
|
||||
* Gets the concessione for id.
|
||||
*
|
||||
* @param mongoId the mongo id
|
||||
* @return the concessione for id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ConcessioneDV getConcessioneForId(String mongoId) throws Exception;
|
||||
// /**
|
||||
// * Gets the concessione for id.
|
||||
// *
|
||||
// * @param mongoId the mongo id
|
||||
// * @return the concessione for id
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// ConcessioneDV getConcessioneForId(String mongoId) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the my login.
|
||||
|
@ -105,15 +102,15 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
*/
|
||||
GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the layers for id.
|
||||
*
|
||||
* @param itemType the item type
|
||||
* @param itemId the item id
|
||||
* @return the layers for id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
|
||||
// /**
|
||||
// * Gets the layers for id.
|
||||
// *
|
||||
// * @param itemType the item type
|
||||
// * @param itemId the item id
|
||||
// * @return the layers for id
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the WFS features.
|
||||
|
@ -128,27 +125,9 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
|
||||
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;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
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.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.wms.GeoInformationForWMSRequest;
|
||||
|
||||
|
@ -43,8 +39,6 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
|
||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||
|
||||
void getConcessioneForId(String mongoId, AsyncCallback<ConcessioneDV> callback);
|
||||
|
||||
void getMyLogin(AsyncCallback<String> callback);
|
||||
|
||||
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||
|
@ -56,16 +50,13 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
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,
|
||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||
|
||||
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
||||
|
||||
void listOfFieldsForSearching(AsyncCallback<List<ItemField>> callback);
|
||||
|
||||
void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
||||
AsyncCallback<ResultSetPaginatedData> callback);
|
||||
|
||||
// PROJECTS SUPPORT
|
||||
|
||||
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.MapEventType;
|
||||
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.MapUtils;
|
||||
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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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.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;
|
||||
|
||||
|
@ -18,4 +18,5 @@ public interface ShowDetailsEventHandler extends EventHandler {
|
|||
* @param showDetailsEvent the show details event
|
||||
*/
|
||||
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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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 com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class ChangeMapLayerEvent.
|
||||
* The Class ChangeBaseMapLayerEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Nov 12, 2021
|
||||
*/
|
||||
public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
||||
public static Type<ChangeMapLayerEventHandler> TYPE = new Type<ChangeMapLayerEventHandler>();
|
||||
public class ChangeBaseMapLayerEvent extends GwtEvent<ChangeBaseMapLayerEventHandler> {
|
||||
public static Type<ChangeBaseMapLayerEventHandler> TYPE = new Type<ChangeBaseMapLayerEventHandler>();
|
||||
private BaseMapLayer baseMapLayer;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
|||
*
|
||||
* @param baseMapLayer the base map layer
|
||||
*/
|
||||
public ChangeMapLayerEvent(BaseMapLayer baseMapLayer) {
|
||||
public ChangeBaseMapLayerEvent(BaseMapLayer baseMapLayer) {
|
||||
this.baseMapLayer = baseMapLayer;
|
||||
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
|||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<ChangeMapLayerEventHandler> getAssociatedType() {
|
||||
public Type<ChangeBaseMapLayerEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
|
|||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ChangeMapLayerEventHandler handler) {
|
||||
protected void dispatch(ChangeBaseMapLayerEventHandler handler) {
|
||||
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;
|
||||
|
||||
/**
|
||||
* The Interface ChangeMapLayerEventHandler.
|
||||
* The Interface ChangeBaseMapLayerEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Nov 12, 2021
|
||||
*/
|
||||
public interface ChangeMapLayerEventHandler extends EventHandler {
|
||||
public interface ChangeBaseMapLayerEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On change base map layer.
|
||||
*
|
||||
* @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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -166,7 +166,7 @@ public class LightOpenLayerMap {
|
|||
map.addInteraction(new KeyboardPan());
|
||||
map.addInteraction(new KeyboardZoom());
|
||||
|
||||
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getListBaseMapLayers();
|
||||
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getStatus().getConfig().getBaseLayers();
|
||||
BaseMapLayer bml = null;
|
||||
if(listBaseMapLayers!=null)
|
||||
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.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent.LAYER_TYPE;
|
||||
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.LayerItem;
|
||||
|
||||
|
@ -59,6 +59,7 @@ import ol.source.ImageWmsParams;
|
|||
import ol.source.Osm;
|
||||
import ol.source.Source;
|
||||
import ol.source.Vector;
|
||||
import ol.source.WmsServerType;
|
||||
import ol.source.Xyz;
|
||||
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.
|
||||
*
|
||||
|
@ -467,6 +447,8 @@ public abstract class OpenLayerMap {
|
|||
*/
|
||||
public synchronized void addWMSDetailLayer(LayerItem layerItem) {
|
||||
|
||||
GWT.log("Adding WMS Detail Layer on map "+layerItem);
|
||||
|
||||
if (wmsDetailsLayerMap == null)
|
||||
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");
|
||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||
imageWMSParams.setLayers(layerItem.getName());
|
||||
|
||||
|
||||
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||
|
||||
imageWMSOptions.setServerType(WmsServerType.GEOSERVER);
|
||||
imageWMSOptions.setUrl(layerItem.getWmsLink().substring(0, layerItem.getWmsLink().lastIndexOf("?")));
|
||||
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
// imageWMSOptions.setRatio(1.5f);
|
||||
|
||||
|
@ -510,26 +497,55 @@ public abstract class OpenLayerMap {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the all detail layers.
|
||||
*/
|
||||
public void removeAllDetailLayers() {
|
||||
|
||||
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
|
||||
|
||||
// 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)
|
||||
return;
|
||||
|
||||
GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
|
||||
|
||||
for (String key : wmsDetailsLayerMap.keySet()) {
|
||||
Image layer = wmsDetailsLayerMap.get(key);
|
||||
map.removeLayer(layer);
|
||||
if (cqlFilterExpression == null) {
|
||||
imageWMSParams.delete("CQL_FILTER");
|
||||
} else {
|
||||
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
|
||||
}
|
||||
|
||||
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.
|
||||
|
|
|
@ -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.products.ConcessioneDV;
|
||||
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 com.github.gwtbootstrap.client.ui.Button;
|
||||
|
|
|
@ -1,30 +1,29 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||
|
||||
import java.util.Collection;
|
||||
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.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.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.resources.GNAIcons;
|
||||
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.Location;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
|
||||
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.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
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.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
|
@ -92,14 +91,26 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
@UiField
|
||||
Button linkLayers;
|
||||
|
||||
|
||||
//TODO Search By Collection, postponed
|
||||
// @UiField
|
||||
// DropdownButton searchFacilityButton;
|
||||
//
|
||||
// @UiField
|
||||
// ScrollPanel searchFacilityPanel;
|
||||
//
|
||||
|
||||
@UiField
|
||||
DropdownButton searchFacilityButton;
|
||||
DropdownButton openCollectionDropDown;
|
||||
|
||||
@UiField
|
||||
HTMLPanel openCollectionPanel;
|
||||
|
||||
|
||||
@UiField
|
||||
ScrollPanel overlayLayersPanel;
|
||||
|
||||
@UiField
|
||||
ScrollPanel searchFacilityPanel;
|
||||
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelAttribution;
|
||||
|
@ -128,8 +139,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
* @param applicationBus the application bus
|
||||
* @param mapHeight the map height
|
||||
*/
|
||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight, List<ItemField> sortByFields,
|
||||
List<ItemField> searchForFields, SearchingFilter initialSortFilter) {
|
||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.applicationBus = applicationBus;
|
||||
mapPanel = new MapPanel(mapHeight + "px");
|
||||
|
@ -155,23 +165,33 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||
|
||||
searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
openCollectionDropDown.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||
|
||||
|
||||
// TODO
|
||||
GWT.log("!!! NB TODO : Search facility is skipped ");
|
||||
|
||||
|
||||
// searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
||||
// 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);
|
||||
bindEvents();
|
||||
|
||||
GWT.log("Main Panel Created");
|
||||
}
|
||||
|
||||
private void bindEvents() {
|
||||
|
@ -191,15 +211,17 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
}
|
||||
});
|
||||
|
||||
searchFacilityButton.addDomHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
//event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
}
|
||||
}, ClickEvent.getType());
|
||||
|
||||
// TODO Search
|
||||
// searchFacilityButton.addDomHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// //event.preventDefault();
|
||||
// event.stopPropagation();
|
||||
//
|
||||
// }
|
||||
// }, ClickEvent.getType());
|
||||
|
||||
}
|
||||
|
||||
|
@ -308,16 +330,19 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show as details.
|
||||
*
|
||||
* @param concessioneDV the concessione DV
|
||||
* @param geonaItemRef the geona item ref
|
||||
*/
|
||||
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
|
||||
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
|
||||
|
||||
}
|
||||
|
||||
// TODO Generic Open Details
|
||||
|
||||
// /**
|
||||
// * Show as details.
|
||||
// *
|
||||
// * @param concessioneDV the concessione DV
|
||||
// * @param geonaItemRef the geona item ref
|
||||
// */
|
||||
// public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
|
||||
// detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Hide panel details.
|
||||
|
@ -327,6 +352,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
}
|
||||
|
||||
|
||||
// TODO Check method
|
||||
|
||||
/**
|
||||
* Gets the displyed record.
|
||||
*
|
||||
|
@ -394,6 +422,48 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
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) {
|
||||
|
||||
if(listBaseLayers==null)
|
||||
|
@ -413,7 +483,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
|
||||
applicationBus.fireEvent(new ChangeBaseMapLayerEvent(baseMapLayer));
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -35,16 +35,29 @@
|
|||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK" text="Search"
|
||||
|
||||
<!-- <b:DropdownButton type="LINK" text="Search"
|
||||
ui:field="searchFacilityButton">
|
||||
<g:ScrollPanel ui:field="searchFacilityPanel"
|
||||
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"
|
||||
title="Select the Map" text="Map" ui:field="linkMap">
|
||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
|
||||
|
||||
|
||||
<b:DropdownButton type="LINK"
|
||||
title="Center Map to Location" text="Preset Location"
|
||||
ui:field="linkPresetLocation">
|
||||
|
|
|
@ -1,50 +1,22 @@
|
|||
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.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.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.StringUtil;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
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.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
|
@ -85,9 +57,9 @@ public class SearchFacilityUI extends Composite {
|
|||
@UiField
|
||||
HorizontalPanel toogleSortBy;
|
||||
|
||||
private List<ItemField> searchForFields;
|
||||
|
||||
private List<ItemField> sortByFields;
|
||||
// private List<ItemField> searchForFields;
|
||||
//
|
||||
// private List<ItemField> sortByFields;
|
||||
|
||||
private SearchingFilter currentSortFilter;
|
||||
|
||||
|
@ -109,122 +81,122 @@ public class SearchFacilityUI extends Composite {
|
|||
interface SearchFacilityPanelUiBinder extends UiBinder<Widget, SearchFacilityUI> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new search facility UI.
|
||||
*
|
||||
* @param appManagerBus the app manager bus
|
||||
* @param sortByFields the sort by fields
|
||||
* @param searchForFields the search for fields
|
||||
* @param initialSortFilter the initial sort filter
|
||||
*/
|
||||
public SearchFacilityUI(HandlerManager appManagerBus, List<ItemField> sortByFields, List<ItemField> searchForFields,
|
||||
SearchingFilter initialSortFilter) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.searchForFields = searchForFields;
|
||||
this.currentSortFilter = initialSortFilter;
|
||||
this.sortByFields = sortByFields;
|
||||
this.appManagerBus = appManagerBus;
|
||||
// /**
|
||||
// * Instantiates a new search facility UI.
|
||||
// *
|
||||
// * @param appManagerBus the app manager bus
|
||||
// * @param sortByFields the sort by fields
|
||||
// * @param searchForFields the search for fields
|
||||
// * @param initialSortFilter the initial sort filter
|
||||
// */
|
||||
// public SearchFacilityUI(HandlerManager appManagerBus, List<ItemField> sortByFields, List<ItemField> searchForFields,
|
||||
// SearchingFilter initialSortFilter) {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// this.searchForFields = searchForFields;
|
||||
// this.currentSortFilter = initialSortFilter;
|
||||
// this.sortByFields = sortByFields;
|
||||
// this.appManagerBus = appManagerBus;
|
||||
//
|
||||
// resetSearch.setType(ButtonType.LINK);
|
||||
//
|
||||
// listBoxSortBy.setWidth("180px");
|
||||
// listBoxSearchFor.setWidth("140px");
|
||||
//
|
||||
// bindEvents();
|
||||
// }
|
||||
|
||||
resetSearch.setType(ButtonType.LINK);
|
||||
|
||||
listBoxSortBy.setWidth("180px");
|
||||
listBoxSearchFor.setWidth("140px");
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* To label filter.
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
// /**
|
||||
// * To label filter.
|
||||
// *
|
||||
// * @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.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
for (ItemField record_FIELD : sortByFields) {
|
||||
if(record_FIELD.isSortable()) {
|
||||
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||
listBoxSortBy.addItem(labelASC);
|
||||
listBoxSortBy.addItem(labelDESC);
|
||||
}
|
||||
}
|
||||
|
||||
listBoxSortBy.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
if(latestResult!=null && latestResult.getData().size()>0) {
|
||||
doSearchEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (ItemField record_FIELD : searchForFields) {
|
||||
GWT.log("search for: "+record_FIELD);
|
||||
if(record_FIELD.isSearchable()) {
|
||||
listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
listBoxSearchFor.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
||||
doSearchEvent();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
sortByToogle.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (toogleSortBy.isVisible())
|
||||
toogleSortBy.setVisible(false);
|
||||
else
|
||||
toogleSortBy.setVisible(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
searchField.addKeyPressHandler(new KeyPressHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
|
||||
GWT.log(searchField.getText());
|
||||
doSearchEvent();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
resetSearch.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
searchField.setText("");
|
||||
resetSearch.setVisible(false);
|
||||
panelResults.clear();
|
||||
latestResult = null;
|
||||
appManagerBus.fireEvent(new SearchPerformedEvent(null,true));
|
||||
setSearchEnabled(false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
// private void bindEvents() {
|
||||
//
|
||||
// for (ItemField record_FIELD : sortByFields) {
|
||||
// if(record_FIELD.isSortable()) {
|
||||
// String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||
// String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||
// listBoxSortBy.addItem(labelASC);
|
||||
// listBoxSortBy.addItem(labelDESC);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// listBoxSortBy.addChangeHandler(new ChangeHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onChange(ChangeEvent event) {
|
||||
// if(latestResult!=null && latestResult.getData().size()>0) {
|
||||
// doSearchEvent();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// for (ItemField record_FIELD : searchForFields) {
|
||||
// GWT.log("search for: "+record_FIELD);
|
||||
// if(record_FIELD.isSearchable()) {
|
||||
// listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// listBoxSearchFor.addChangeHandler(new ChangeHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onChange(ChangeEvent event) {
|
||||
// if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
||||
// doSearchEvent();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// sortByToogle.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// if (toogleSortBy.isVisible())
|
||||
// toogleSortBy.setVisible(false);
|
||||
// else
|
||||
// toogleSortBy.setVisible(true);
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// searchField.addKeyPressHandler(new KeyPressHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onKeyPress(KeyPressEvent event) {
|
||||
// if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
|
||||
// GWT.log(searchField.getText());
|
||||
// doSearchEvent();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// resetSearch.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// searchField.setText("");
|
||||
// resetSearch.setVisible(false);
|
||||
// panelResults.clear();
|
||||
// latestResult = null;
|
||||
// appManagerBus.fireEvent(new SearchPerformedEvent(null,true));
|
||||
// setSearchEnabled(false);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// }
|
||||
|
||||
private void setSearchEnabled(boolean bool) {
|
||||
if(bool) {
|
||||
|
@ -243,136 +215,138 @@ public class SearchFacilityUI extends Composite {
|
|||
SearchingFilter filter = getCurrentSortFilter();
|
||||
panelResults.clear();
|
||||
panelResults.add(new HTML("<hr>"));
|
||||
panelResults.add(new LoaderIcon("Searching..."));
|
||||
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) {
|
||||
panelResults.add(new LoaderIcon("TODO..."));
|
||||
//TODO
|
||||
|
||||
// GeoportalDataViewerServiceAsync.Util.getInstance().getListConcessioni(0, 30, filter, false,
|
||||
// new AsyncCallback<ResultSetPaginatedData>() {
|
||||
//
|
||||
// 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;
|
||||
// @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
|
||||
//// && 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) {
|
||||
// ft.setWidget(i, 2, new Image(GNAImages.ICONS.italyIcon()));
|
||||
// }
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
panelResults.add(ft);
|
||||
|
||||
}
|
||||
});
|
||||
// panelResults.add(ft);
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -409,75 +383,77 @@ public class SearchFacilityUI extends Composite {
|
|||
searchConcessioni();
|
||||
}
|
||||
|
||||
/**
|
||||
* To sort filter.
|
||||
*
|
||||
* @param labelFilter the label filter
|
||||
* @return the searching filter
|
||||
*/
|
||||
public SearchingFilter toSortFilter(String labelFilter) {
|
||||
GWT.log("toSortFilter for label " + labelFilter);
|
||||
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||
|
||||
SearchingFilter sortFilter = null;
|
||||
try {
|
||||
ItemField recordField = null;
|
||||
for (ItemField value : sortByFields) {
|
||||
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
||||
recordField = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ORDER orderField = ORDER.valueOf(array[1]);
|
||||
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
GWT.log("toSortFilter Got " + sortFilter);
|
||||
return sortFilter;
|
||||
|
||||
}
|
||||
// /**
|
||||
// * To sort filter.
|
||||
// *
|
||||
// * @param labelFilter the label filter
|
||||
// * @return the searching filter
|
||||
// */
|
||||
// public SearchingFilter toSortFilter(String labelFilter) {
|
||||
// GWT.log("toSortFilter for label " + labelFilter);
|
||||
// String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||
//
|
||||
// SearchingFilter sortFilter = null;
|
||||
// try {
|
||||
// ItemField recordField = null;
|
||||
// for (ItemField value : sortByFields) {
|
||||
// if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
||||
// recordField = value;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// ORDER orderField = ORDER.valueOf(array[1]);
|
||||
// sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||
// } catch (Exception e) {
|
||||
//
|
||||
// }
|
||||
// GWT.log("toSortFilter Got " + sortFilter);
|
||||
// return sortFilter;
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Built searching filter.
|
||||
*
|
||||
* @return the searching filter
|
||||
*/
|
||||
private SearchingFilter builtSearchingFilter() {
|
||||
SearchingFilter searchingFilter = toSortFilter(listBoxSortBy.getSelectedValue());
|
||||
String searchText = searchField.getText();
|
||||
if (searchText != null && !searchText.isEmpty()) {
|
||||
Map<String, Object> searchInto = new HashMap<String, Object>();
|
||||
|
||||
List<String> listOfSeachingFields = new ArrayList<String>();
|
||||
|
||||
for (ItemField recordField : searchForFields) {
|
||||
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
||||
listOfSeachingFields = recordField.getJsonFields();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(listOfSeachingFields.size()==0) {
|
||||
listOfSeachingFields.add("nome");
|
||||
}
|
||||
for (String fieldname : listOfSeachingFields) {
|
||||
searchInto.put(fieldname, searchText);
|
||||
}
|
||||
|
||||
WhereClause where = new WhereClause();
|
||||
where.setSearchInto(searchInto);
|
||||
where.setOperator(LOGICAL_OP.OR);
|
||||
|
||||
//THIS CLAUSE IS ADDED IN ORDER TO SEARCH ONLY PUBLISHED PRODUCT (WITH SUCCESS)
|
||||
Map<String, Object> searchInto2 = new HashMap<String, Object>();
|
||||
searchInto2.put("report.status", "PASSED");
|
||||
WhereClause where2 = new WhereClause(LOGICAL_OP.AND, searchInto2);
|
||||
|
||||
searchingFilter.setConditions(Arrays.asList(where, where2));
|
||||
}
|
||||
return searchingFilter;
|
||||
}
|
||||
//TODO
|
||||
|
||||
// private SearchingFilter builtSearchingFilter() {
|
||||
// SearchingFilter searchingFilter = toSortFilter(listBoxSortBy.getSelectedValue());
|
||||
// String searchText = searchField.getText();
|
||||
// if (searchText != null && !searchText.isEmpty()) {
|
||||
// Map<String, Object> searchInto = new HashMap<String, Object>();
|
||||
//
|
||||
// List<String> listOfSeachingFields = new ArrayList<String>();
|
||||
//
|
||||
// for (ItemField recordField : searchForFields) {
|
||||
// if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
||||
// listOfSeachingFields = recordField.getJsonFields();
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(listOfSeachingFields.size()==0) {
|
||||
// listOfSeachingFields.add("nome");
|
||||
// }
|
||||
// for (String fieldname : listOfSeachingFields) {
|
||||
// searchInto.put(fieldname, searchText);
|
||||
// }
|
||||
//
|
||||
// WhereClause where = new WhereClause();
|
||||
// where.setSearchInto(searchInto);
|
||||
// where.setOperator(LOGICAL_OP.OR);
|
||||
//
|
||||
// //THIS CLAUSE IS ADDED IN ORDER TO SEARCH ONLY PUBLISHED PRODUCT (WITH SUCCESS)
|
||||
// Map<String, Object> searchInto2 = new HashMap<String, Object>();
|
||||
// searchInto2.put("report.status", "PASSED");
|
||||
// WhereClause where2 = new WhereClause(LOGICAL_OP.AND, searchInto2);
|
||||
//
|
||||
// searchingFilter.setConditions(Arrays.asList(where, where2));
|
||||
// }
|
||||
// return searchingFilter;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the current sort filter.
|
||||
|
@ -485,7 +461,9 @@ public class SearchFacilityUI extends Composite {
|
|||
* @return the current sort filter
|
||||
*/
|
||||
public SearchingFilter getCurrentSortFilter() {
|
||||
currentSortFilter = builtSearchingFilter();
|
||||
|
||||
//TODO
|
||||
//currentSortFilter = builtSearchingFilter();
|
||||
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||
return currentSortFilter;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
||||
|
||||
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.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||
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.util.StringUtil;
|
||||
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.setType(LabelType.INFO);
|
||||
|
||||
BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
|
||||
String nameConcessione = StringUtil.ellipsize(refConcessione.getNome(), 40);
|
||||
// TODO Manage Collection
|
||||
|
||||
// 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);
|
||||
labelConcessione.setTitle(refConcessione.getNome());
|
||||
labelConcessione.setTitle("TODO : PROJECT");
|
||||
|
||||
getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
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.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
|
|
@ -105,7 +105,9 @@ public class MapView extends Composite {
|
|||
}
|
||||
|
||||
protected void setBaseLayers() {
|
||||
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getListBaseMapLayers();
|
||||
|
||||
// TODO pass layers as parameters?
|
||||
List<BaseMapLayer> listBaseLayers = GeoportalDataViewer.getStatus().getConfig().getBaseLayers();
|
||||
|
||||
if(listBaseLayers==null)
|
||||
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;
|
||||
|
||||
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.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
@ -10,34 +13,39 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
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.LayerConcessione;
|
||||
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.GeoportalCommon;
|
||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||
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.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||
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.util.URLParserUtil;
|
||||
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.WMSUrlValidator;
|
||||
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.shared.GCubeCollection;
|
||||
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.IndexLayer;
|
||||
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.wms.GeoInformationForWMSRequest;
|
||||
|
@ -77,6 +85,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
private GNADataViewerConfigProfile getGNADataVieweConfigProfile() throws Exception {
|
||||
LOG.info("METHOD getDataResult called");
|
||||
|
||||
GNADataViewerConfigProfile profile = SessionUtil.getGNADataViewerConfigProfile(getThreadLocalRequest());
|
||||
if (profile == null) {
|
||||
|
@ -114,6 +123,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
*/
|
||||
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
||||
try {
|
||||
LOG.info("METHOD load GEO infor for WMS Req called");
|
||||
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
||||
String wmsServiceHost = validator.getWmsServiceHost();
|
||||
String validWMSRequest = validator.parseWMSRequest(true, true);
|
||||
|
@ -140,7 +150,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
// MAP ZAXIS INTO GWT-SERIALIZABLE OBJECT
|
||||
ZAxis zAxis = layerZAxis != null
|
||||
? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues())
|
||||
: null;
|
||||
: null;
|
||||
|
||||
return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs,
|
||||
mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
||||
|
@ -164,7 +174,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
@Override
|
||||
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
||||
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel) {
|
||||
LOG.info("getDataResult called");
|
||||
LOG.info("METHOD getDataResult called");
|
||||
|
||||
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
||||
|
||||
|
@ -197,7 +207,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}
|
||||
geoDAO.setSourceLayerObject(layerObject);
|
||||
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
||||
+ " feature/s");
|
||||
+ " feature/s");
|
||||
listDAO.add(geoDAO);
|
||||
}
|
||||
LOG.info("returning " + listDAO + " geona data objects");
|
||||
|
@ -221,201 +231,201 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
return getUploadedImagesForId(this.getThreadLocalRequest(), itemType, itemId, maxImages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the layers for id.
|
||||
*
|
||||
* @param itemType the item type
|
||||
* @param itemId the item id
|
||||
* @return the layers for id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception {
|
||||
LOG.info("getLayersForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
|
||||
// /**
|
||||
// * Gets the layers for id.
|
||||
// *
|
||||
// * @param itemType the item type
|
||||
// * @param itemId the item id
|
||||
// * @return the layers for id
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// @Override
|
||||
// public List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception {
|
||||
// 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");
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the concessione for id.
|
||||
*
|
||||
* @param mongoId the mongo id
|
||||
* @return the concessione for id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public ConcessioneDV getConcessioneForId(String mongoId) throws Exception {
|
||||
LOG.info("getConcessioneForId " + mongoId + " called");
|
||||
|
||||
ConcessioneDV concessionDV = null;
|
||||
|
||||
if (mongoId == null)
|
||||
throw new Exception("Invalid parameter. The itemId is null");
|
||||
|
||||
try {
|
||||
LOG.info("Trying to get record for id " + mongoId);
|
||||
|
||||
ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(
|
||||
this.getThreadLocalRequest());
|
||||
Concessione concessione = cms.getItemById(mongoId);
|
||||
|
||||
LOG.info("Got concessione for mongoId: " + mongoId);
|
||||
if (concessione != null) {
|
||||
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
||||
|
||||
String userName = null;
|
||||
try {
|
||||
userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.info("User not found in session, so going to apply the acess policies");
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
||||
// CHECKING ACCESS POLICY
|
||||
LOG.info("Applying access policies for concessione " + mongoId + " returned by service");
|
||||
LayerConcessioneDV layerPosizionamento = concessionDV.getPosizionamentoScavo();
|
||||
if (layerPosizionamento != null) {
|
||||
if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
||||
concessionDV.setPosizionamentoScavo(null);
|
||||
LOG.info("Posizionamento di Scavo is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
|
||||
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 concessione for id.
|
||||
// *
|
||||
// * @param mongoId the mongo id
|
||||
// * @return the concessione for id
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// @Override
|
||||
// public ConcessioneDV getConcessioneForId(String mongoId) throws Exception {
|
||||
// LOG.info("getConcessioneForId " + mongoId + " called");
|
||||
//
|
||||
// ConcessioneDV concessionDV = null;
|
||||
//
|
||||
// if (mongoId == null)
|
||||
// throw new Exception("Invalid parameter. The itemId is null");
|
||||
//
|
||||
// try {
|
||||
// LOG.info("Trying to get record for id " + mongoId);
|
||||
//
|
||||
// ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(
|
||||
// this.getThreadLocalRequest());
|
||||
// Concessione concessione = cms.getItemById(mongoId);
|
||||
//
|
||||
// LOG.info("Got concessione for mongoId: " + mongoId);
|
||||
// if (concessione != null) {
|
||||
// concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
||||
//
|
||||
// String userName = null;
|
||||
// try {
|
||||
// userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
|
||||
//
|
||||
// } catch (Exception e) {
|
||||
// LOG.info("User not found in session, so going to apply the acess policies");
|
||||
// }
|
||||
//
|
||||
// // 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) {
|
||||
//
|
||||
// // CHECKING ACCESS POLICY
|
||||
// LOG.info("Applying access policies for concessione " + mongoId + " returned by service");
|
||||
// LayerConcessioneDV layerPosizionamento = concessionDV.getPosizionamentoScavo();
|
||||
// if (layerPosizionamento != null) {
|
||||
// if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
||||
// concessionDV.setPosizionamentoScavo(null);
|
||||
// LOG.info("Posizionamento di Scavo is not accessible by current user: " + userName);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// 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.
|
||||
|
@ -426,6 +436,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
*/
|
||||
|
||||
public Map<String, String> getParametersFromURL(String theURL, List<String> parameters) {
|
||||
LOG.info("METHOD getPAramsFromURL");
|
||||
|
||||
|
||||
if (theURL == null)
|
||||
return null;
|
||||
|
@ -450,6 +462,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
*/
|
||||
@Override
|
||||
public String getMyLogin() {
|
||||
LOG.info("METHOD getMYLogin ");
|
||||
try {
|
||||
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
|
||||
if (user == null)
|
||||
|
@ -551,6 +564,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
public boolean isSessionExpired() throws Exception {
|
||||
LOG.info("METHOD isSessionExpired ");
|
||||
return SessionUtil.isSessionExpired(this.getThreadLocalRequest());
|
||||
}
|
||||
|
||||
|
@ -579,7 +593,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
geoDAO.setFeatures(features);
|
||||
geoDAO.setSourceLayerObject(layerObject);
|
||||
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
||||
+ " feature/s");
|
||||
+ " feature/s");
|
||||
listDAO.add(geoDAO);
|
||||
}
|
||||
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
|
||||
|
||||
/**
|
||||
* List of fields for searching.
|
||||
*
|
||||
* @return the list
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
// /**
|
||||
// * List of fields for searching.
|
||||
// *
|
||||
// * @return the list
|
||||
// * @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
|
||||
public List<ItemField> listOfFieldsForSearching() throws Exception {
|
||||
LOG.info("listOfFieldsForSearching called");
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
return profile.getListItemFields();
|
||||
public ViewerConfiguration getInitialConfiguration(Map<String,List<String>> parameters) throws Exception {
|
||||
LOG.debug("Received Initial configuration request with params "+parameters);
|
||||
|
||||
return new ContextRequest<ViewerConfiguration>(this.getThreadLocalRequest()) {
|
||||
@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 {
|
||||
// Obtain the client
|
||||
ConcessioniMongoService concessioniManager = new ConcessioniMongoService();
|
||||
// ConcessioniMongoService concessioniManager = new ConcessioniMongoService();
|
||||
// Returning item by Id
|
||||
return concessioniManager.getItemById(mongoItemId);
|
||||
// return concessioniManager.getItemById(mongoItemId);
|
||||
return null;
|
||||
}catch(Exception e) {
|
||||
LOG.error("Error on reading itemById: "+mongoItemId, 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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
|
@ -214,39 +209,39 @@ public class SessionUtil {
|
|||
* @return the list of concessioni
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static List<Concessione> getListOfConcessioni(HttpServletRequest httpServletRequest,
|
||||
boolean reloadFromService) throws Exception {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||
|
||||
// setting null to force reloading from service
|
||||
if (reloadFromService)
|
||||
listOfConcessioni = null;
|
||||
|
||||
if (listOfConcessioni == null) {
|
||||
listOfConcessioni = new ArrayList<Concessione>();
|
||||
LOG.info("Loading list of concessione from client mongo");
|
||||
SessionUtil.getCurrentContext(httpServletRequest, true);
|
||||
MongoServiceCommon serviceUtil = new MongoServiceCommon();
|
||||
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||
|
||||
Iterator<Concessione> concessioni = clientMongo.getList();
|
||||
if (concessioni != null) {
|
||||
while (concessioni.hasNext()) {
|
||||
Concessione concessione = (Concessione) concessioni.next();
|
||||
listOfConcessioni.add(concessione);
|
||||
|
||||
}
|
||||
}
|
||||
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
||||
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
||||
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
||||
} else
|
||||
LOG.info("list of concessioni presents in session, using it");
|
||||
|
||||
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||
return listOfConcessioni;
|
||||
}
|
||||
// public static List<Concessione> getListOfConcessioni(HttpServletRequest httpServletRequest,
|
||||
// boolean reloadFromService) throws Exception {
|
||||
// HttpSession session = httpServletRequest.getSession();
|
||||
// List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||
//
|
||||
// // setting null to force reloading from service
|
||||
// if (reloadFromService)
|
||||
// listOfConcessioni = null;
|
||||
//
|
||||
// if (listOfConcessioni == null) {
|
||||
// listOfConcessioni = new ArrayList<Concessione>();
|
||||
// LOG.info("Loading list of concessione from client mongo");
|
||||
// SessionUtil.getCurrentContext(httpServletRequest, true);
|
||||
// MongoServiceCommon serviceUtil = new MongoServiceCommon();
|
||||
// MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||
//
|
||||
// Iterator<Concessione> concessioni = clientMongo.getList();
|
||||
// if (concessioni != null) {
|
||||
// while (concessioni.hasNext()) {
|
||||
// Concessione concessione = (Concessione) concessioni.next();
|
||||
// listOfConcessioni.add(concessione);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// // LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
||||
// session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
||||
// LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
||||
// } else
|
||||
// LOG.info("list of concessioni presents in session, using it");
|
||||
//
|
||||
// LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||
// return listOfConcessioni;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the 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.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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.ZAxis;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
||||
/**
|
||||
* The Class LayerItem.
|
||||
*
|
||||
|
@ -18,6 +24,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
|||
*/
|
||||
public class LayerItem implements Serializable, Cloneable {
|
||||
|
||||
|
||||
/** The Constant serialVersionUID. */
|
||||
private static final long serialVersionUID = 1664082688635256899L;
|
||||
|
||||
|
@ -962,4 +969,119 @@ public class LayerItem implements Serializable, Cloneable {
|
|||
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 org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GCubeSDILayerDV;
|
||||
|
||||
|
||||
/**
|
||||
* The Class LayerObject.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
* Represents a layer,
|
||||
* holds the layer item and the related Collection info if existing
|
||||
*
|
||||
*
|
||||
* Sep 9, 2021
|
||||
*/
|
||||
public class LayerObject implements Serializable {
|
||||
|
||||
|
@ -18,101 +18,118 @@ public class LayerObject implements Serializable {
|
|||
*
|
||||
*/
|
||||
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 BaseConcessioneDV sourceConcessione;
|
||||
|
||||
/**
|
||||
* Instantiates a new layer object.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
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();
|
||||
this.itemType = itemType;
|
||||
this.layerItem = layerItem;
|
||||
this.sourceConcessione = sourceConcessione;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the item type.
|
||||
*
|
||||
* @return the item type
|
||||
*/
|
||||
public String getItemType() {
|
||||
return itemType;
|
||||
public LayerObject(LayerObjectType type,LayerItem item) {
|
||||
this.setType(type);
|
||||
this.setLayerItem(item);
|
||||
}
|
||||
|
||||
|
||||
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.
|
||||
*
|
||||
* @return the layer item
|
||||
*/
|
||||
|
||||
public LayerObjectType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
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() {
|
||||
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) {
|
||||
this.layerItem = layerItem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the source concessione.
|
||||
*
|
||||
* @param sourceConcessione the new source concessione
|
||||
*/
|
||||
public void setSourceConcessione(BaseConcessioneDV sourceConcessione) {
|
||||
this.sourceConcessione = sourceConcessione;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @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();
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
<?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"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||
version="3.0">
|
||||
<web-app>
|
||||
|
||||
|
||||
<!-- 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 -->
|
||||
<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;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.IAMClientCredentialsReader;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientCredentials;
|
||||
|
@ -23,14 +23,7 @@ public class IAMClient {
|
|||
}
|
||||
|
||||
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