Starting migration to UCD
This commit is contained in:
parent
0065ff35f1
commit
6363c2ea5e
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.4.0/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.4.0/WEB-INF/classes" path="src/main/resources">
|
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -35,5 +35,5 @@
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.4.0/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.4.0
|
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.0.0-SNAPSHOT
|
||||||
warSrcDir=src/main/webapp
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,8 +17,14 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-viewer-app-2.4.0">
|
|
||||||
|
|
||||||
|
|
||||||
|
<wb-module deploy-name="geoportal-data-viewer-app-3.0.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,7 +43,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,7 +65,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -75,7 +87,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +109,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +131,10 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -132,7 +153,10 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +175,10 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,7 +197,10 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [v3.0.0-SNAPSHOT] - 2022-10-11
|
||||||
|
|
||||||
|
- [#23940] Passed to CMS-UCD
|
||||||
|
|
||||||
## [v2.4.1-SNAPSHOT] - 2022-09-28
|
## [v2.4.1-SNAPSHOT] - 2022-09-28
|
||||||
|
|
||||||
|
|
||||||
- [#23906] Tested building on jenkins with JDK_11
|
- [#23906] Tested building on jenkins with JDK_11
|
||||||
|
|
||||||
|
|
||||||
## [v2.4.0] - 2022-09-07
|
## [v2.4.0] - 2022-09-07
|
||||||
|
|
||||||
#### Enhancement
|
#### Enhancement
|
||||||
|
|
55
pom.xml
55
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.4.1-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
<name>GeoPortal Data Viewer App</name>
|
<name>GeoPortal Data Viewer App</name>
|
||||||
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface</description>
|
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface</description>
|
||||||
|
|
||||||
|
@ -157,40 +157,46 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- END -->
|
<!-- END -->
|
||||||
|
|
||||||
<!-- FORCING THESE DEPENDENCIES IN ORDER TO USE THE "OLD" CONCESSIONI CLIENT/MODEL -->
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.portlets.widgets</groupId>
|
||||||
<artifactId>metadata-profile-discovery</artifactId>
|
<artifactId>metadata-profile-form-builder-widget</artifactId>
|
||||||
<version>[1.0.0-SNAPSHOT, 1.1.0-SNAPSHOT)</version>
|
<version>[2.0.0-SNAPSHOT, 3.0.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>
|
<scope>compile</scope>
|
||||||
|
<!-- does not remove these exclusions, there are conflict with jackson
|
||||||
|
2.7 used by geo-json dependency -->
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.gcube.resources.discovery</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>ic-client</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>org.ow2.asm</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>asm</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>de.grundid.opendatalab</groupId>
|
||||||
<artifactId>servlet-api</artifactId>
|
<artifactId>geojson-jackson</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- END FORCING -->
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.application</groupId>
|
||||||
|
<artifactId>geoportal-data-common</artifactId>
|
||||||
|
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jayway.jsonpath</groupId>
|
||||||
|
<artifactId>json-path</artifactId>
|
||||||
|
<version>2.7.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
|
@ -221,6 +227,7 @@
|
||||||
<!-- <version>1.6.4</version> -->
|
<!-- <version>1.6.4</version> -->
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
@ -55,7 +55,6 @@ import com.google.gwt.core.client.ScriptInjector;
|
||||||
import com.google.gwt.event.logical.shared.ResizeEvent;
|
import com.google.gwt.event.logical.shared.ResizeEvent;
|
||||||
import com.google.gwt.event.logical.shared.ResizeHandler;
|
import com.google.gwt.event.logical.shared.ResizeHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.Timer;
|
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
@ -112,9 +111,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
private static List<BaseMapLayer> listBaseMapLayers = null;
|
private static List<BaseMapLayer> listBaseMapLayers = null;
|
||||||
|
|
||||||
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
private List<ItemFieldDV> displayFields = new ArrayList<ItemFieldDV>();
|
||||||
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
private List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
|
||||||
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
private List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
|
@ -135,7 +134,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(loaderApp);
|
RootPanel.get(APP_DIV).add(loaderApp);
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().listOfFieldsForSearching(new AsyncCallback<List<ItemField>>() {
|
GeoportalDataViewerServiceAsync.Util.getInstance().listOfFieldsForSearching(new AsyncCallback<List<ItemFieldDV>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -144,10 +143,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<ItemField> result) {
|
public void onSuccess(List<ItemFieldDV> result) {
|
||||||
GWT.log("Loaded item fields: "+result);
|
GWT.log("Loaded item fields: "+result);
|
||||||
|
|
||||||
for (ItemField itemField : result) {
|
for (ItemFieldDV itemField : result) {
|
||||||
if(itemField.isDisplayAsResult()) {
|
if(itemField.isDisplayAsResult()) {
|
||||||
displayFields.add(itemField);
|
displayFields.add(itemField);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +164,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
GWT.log("List display fields: "+result);
|
GWT.log("List display fields: "+result);
|
||||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||||
initialSortFilter.setOrder(ORDER.ASC);
|
initialSortFilter.setOrder(ORDER.ASC);
|
||||||
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
|
||||||
|
//TODO MUST BE REVISITED
|
||||||
|
//initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||||
|
|
||||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),sortByFields,searchByFields,initialSortFilter);
|
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),sortByFields,searchByFields,initialSortFilter);
|
||||||
RootPanel.get(APP_DIV).add(mainPanel);
|
RootPanel.get(APP_DIV).add(mainPanel);
|
||||||
|
@ -263,7 +264,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
geonaDataViewerProfile = profile;
|
geonaDataViewerProfile = profile;
|
||||||
GWT.log("Profile: " + geonaDataViewerProfile);
|
GWT.log("Profile: " + geonaDataViewerProfile);
|
||||||
Iterator<String> it;
|
Iterator<String> it;
|
||||||
String theItemType = paramGeonaItemType;
|
|
||||||
|
|
||||||
|
|
||||||
|
String theItemType = null;
|
||||||
if (theItemType == null) {
|
if (theItemType == null) {
|
||||||
it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
||||||
it.hasNext();
|
it.hasNext();
|
||||||
|
@ -272,10 +276,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
||||||
|
|
||||||
if (layerItem == null) {
|
// if (layerItem == null) {
|
||||||
Window.alert("Not detected any layer with type: " + theItemType);
|
// Window.alert("Not detected any layer with type: " + theItemType);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
GWT.log("ON module load The layerItem is: " + layerItem);
|
GWT.log("ON module load The layerItem is: " + layerItem);
|
||||||
String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink());
|
String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink());
|
||||||
|
@ -333,39 +337,55 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
||||||
GWT.log("Fired event: " + showDetailsEvent);
|
GWT.log("Fired event: " + showDetailsEvent);
|
||||||
|
|
||||||
String geonaMongoId = showDetailsEvent.getGeonaMongoID();
|
String projectID = showDetailsEvent.getGeonaMongoID();
|
||||||
|
String profileID = showDetailsEvent.getGeonaItemType();
|
||||||
|
|
||||||
if (geonaMongoId == null) {
|
if (projectID == null) {
|
||||||
Window.alert("Item Id not found");
|
Window.alert("Item Id not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
GWT.log("Product with id: " + geonaMongoId + " found? " + found);
|
GWT.log("Product with id: " + projectID + " found? " + found);
|
||||||
|
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getProjectViewForId(profileID, projectID, new AsyncCallback<ProjectView>() {
|
||||||
|
|
||||||
if (!found) {
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
if (showDetailsEvent.getGeonaItemType().equalsIgnoreCase("Concessione")) {
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ProjectView result) {
|
||||||
|
mainPanel.showAsDetails(result, showDetailsEvent.getGeonaItemRef());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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());
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -378,6 +398,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
GWT.log("onLayerRendered Timer PART MUST BE REVISITED");
|
||||||
|
/*
|
||||||
attempt = 0;
|
attempt = 0;
|
||||||
|
|
||||||
if (paramGeonaItemID != null) {
|
if (paramGeonaItemID != null) {
|
||||||
|
@ -388,6 +410,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
public void run() {
|
public void run() {
|
||||||
attempt++;
|
attempt++;
|
||||||
GWT.log("waiting get record: " + attempt);
|
GWT.log("waiting get record: " + attempt);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
RecordDV record = mainPanel.getDisplayedRecord();
|
RecordDV record = mainPanel.getDisplayedRecord();
|
||||||
if (record != null) {
|
if (record != null) {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
|
@ -404,11 +430,12 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
};
|
};
|
||||||
timer.scheduleRepeating(1000);
|
timer.scheduleRepeating(1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
|
LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
|
||||||
|
|
||||||
if (layerType != null) {
|
if (layerType != null) {
|
||||||
|
|
|
@ -106,5 +106,72 @@ public class GeoportalDataViewerConstants {
|
||||||
public static native String toJsonObj(Object object)/*-{
|
public static native String toJsonObj(Object object)/*-{
|
||||||
return JSON.stringify(object);
|
return JSON.stringify(object);
|
||||||
}-*/;
|
}-*/;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Json to HTML.
|
||||||
|
*
|
||||||
|
* @param jsonTxt the json txt
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
public static native String jsonToTableHTML(String jsonTxt)/*-{
|
||||||
|
try {
|
||||||
|
var jsonObj = JSON.parse(jsonTxt);
|
||||||
|
|
||||||
|
if (jsonObj.length == undefined)
|
||||||
|
jsonObj = [ jsonObj ]
|
||||||
|
//console.log(jsonObj.length)
|
||||||
|
|
||||||
|
// EXTRACT VALUE FOR HTML HEADER.
|
||||||
|
var col = [];
|
||||||
|
for (var i = 0; i < jsonObj.length; i++) {
|
||||||
|
for ( var key in jsonObj[i]) {
|
||||||
|
//console.log('key json' +key)
|
||||||
|
if (col.indexOf(key) === -1) {
|
||||||
|
col.push(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// CREATE DYNAMIC TABLE.
|
||||||
|
var table = document.createElement("table");
|
||||||
|
try {
|
||||||
|
table.classList.add("my-html-table");
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
console.log('invalid css add', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ADD JSON DATA TO THE TABLE AS ROWS.
|
||||||
|
for (var i = 0; i < col.length; i++) {
|
||||||
|
tr = table.insertRow(-1);
|
||||||
|
var firstCell = tr.insertCell(-1);
|
||||||
|
//firstCell.style.cssText="font-weight: bold; text-align: center; vertical-align: middle;";
|
||||||
|
firstCell.innerHTML = col[i];
|
||||||
|
for (var j = 0; j < jsonObj.length; j++) {
|
||||||
|
var tabCell = tr.insertCell(-1);
|
||||||
|
var theValue = jsonObj[j][col[i]];
|
||||||
|
//console.log("the value: "+theValue);
|
||||||
|
if (Object.prototype.toString.call(theValue) === '[object Array]') {
|
||||||
|
var formattedValueArray = "";
|
||||||
|
for (var k = 0; k < theValue.length; k++) {
|
||||||
|
var theValueArray = theValue[k];
|
||||||
|
//console.log(theValueArray);
|
||||||
|
formattedValueArray += theValueArray + "<br>";
|
||||||
|
}
|
||||||
|
tabCell.innerHTML = formattedValueArray;
|
||||||
|
} else {
|
||||||
|
tabCell.innerHTML = theValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return table.outerHTML;
|
||||||
|
} catch (e) {
|
||||||
|
console.log('invalid json', e);
|
||||||
|
return jsonTxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
}-*/;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,10 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
|
@ -136,7 +137,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
* @return the list
|
* @return the list
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
List<ItemField> listOfFieldsForSearching() throws Exception;
|
List<ItemFieldDV> listOfFieldsForSearching() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list concessioni.
|
* Gets the list concessioni.
|
||||||
|
@ -151,4 +152,14 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
||||||
boolean reloadFromService) throws Exception;
|
boolean reloadFromService) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the project view for id.
|
||||||
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @param projectID the project ID
|
||||||
|
* @return the project view for id
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
ProjectView getProjectViewForId(String profileID, String projectID) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,10 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
|
@ -63,9 +64,11 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
|
|
||||||
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
||||||
|
|
||||||
void listOfFieldsForSearching(AsyncCallback<List<ItemField>> callback);
|
void listOfFieldsForSearching(AsyncCallback<List<ItemFieldDV>> callback);
|
||||||
|
|
||||||
void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
||||||
AsyncCallback<ResultSetPaginatedData> callback);
|
AsyncCallback<ResultSetPaginatedData> callback);
|
||||||
|
|
||||||
|
void getProjectViewForId(String profileID, String projectID, AsyncCallback<ProjectView> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
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.ClosedViewDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectViewer;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
|
@ -33,7 +32,7 @@ public class DetailsPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel detailsHTMLPanel;
|
HTMLPanel detailsHTMLPanel;
|
||||||
|
|
||||||
private RecordDV displayedRecord = null;
|
private ProjectView displayedProject = null;
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
@ -63,15 +62,17 @@ public class DetailsPanel extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
|
public void showDetailsFor(ProjectView result, GeoNaItemRef geonaItemRef) {
|
||||||
this.displayedRecord = cdv;
|
this.displayedProject = result;
|
||||||
datailsContainerPanel.clear();
|
datailsContainerPanel.clear();
|
||||||
|
|
||||||
if(detailsHTMLPanel.getParent()!=null) {
|
if(detailsHTMLPanel.getParent()!=null) {
|
||||||
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
|
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv));
|
//datailsContainerPanel.add(new ConcessioneView(geonaItemRef, result));
|
||||||
|
|
||||||
|
datailsContainerPanel.add(new ProjectViewer(geonaItemRef, result));
|
||||||
showPanelDetails();
|
showPanelDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,13 +81,13 @@ public class DetailsPanel extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hidePanelDetails() {
|
public void hidePanelDetails() {
|
||||||
this.displayedRecord = null;
|
this.displayedProject = null;
|
||||||
datailsContainerPanel.clear();
|
datailsContainerPanel.clear();
|
||||||
detailsHTMLPanel.setVisible(false);
|
detailsHTMLPanel.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordDV getDisplayedRecord() {
|
public ProjectView getDisplayedProject() {
|
||||||
return displayedRecord;
|
return displayedProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,9 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||||
|
@ -91,25 +90,25 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button linkLayers;
|
Button linkLayers;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
DropdownButton searchFacilityButton;
|
DropdownButton searchFacilityButton;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel overlayLayersPanel;
|
ScrollPanel overlayLayersPanel;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel searchFacilityPanel;
|
ScrollPanel searchFacilityPanel;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel panelAttribution;
|
HTMLPanel panelAttribution;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel panelBaseLayers;
|
HTMLPanel panelBaseLayers;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
DropdownButton linkMap;
|
DropdownButton linkMap;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
DropdownButton linkPresetLocation;
|
DropdownButton linkPresetLocation;
|
||||||
|
|
||||||
|
@ -118,18 +117,20 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
private OpenLayerMap map;
|
private OpenLayerMap map;
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
private SearchFacilityUI searchFacility;
|
private SearchFacilityUI searchFacility;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona data view main panel.
|
* Instantiates a new geona data view main panel.
|
||||||
*
|
*
|
||||||
* @param applicationBus the application bus
|
* @param applicationBus the application bus
|
||||||
* @param mapHeight the map height
|
* @param mapHeight the map height
|
||||||
|
* @param sortByFields the sort by fields
|
||||||
|
* @param searchForFields the search for fields
|
||||||
|
* @param initialSortFilter the initial sort filter
|
||||||
*/
|
*/
|
||||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight, List<ItemField> sortByFields,
|
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight, List<ItemFieldDV> sortByFields,
|
||||||
List<ItemField> searchForFields, SearchingFilter initialSortFilter) {
|
List<ItemFieldDV> searchForFields, SearchingFilter initialSortFilter) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
mapPanel = new MapPanel(mapHeight + "px");
|
mapPanel = new MapPanel(mapHeight + "px");
|
||||||
|
@ -150,11 +151,11 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
||||||
extentToEarth.getElement().appendChild(worldImg.getElement());
|
extentToEarth.getElement().appendChild(worldImg.getElement());
|
||||||
extentToEarth.setWidth("140px");
|
extentToEarth.setWidth("140px");
|
||||||
|
|
||||||
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
||||||
searchFacility.setSearchButton(searchFacilityButton);
|
searchFacility.setSearchButton(searchFacilityButton);
|
||||||
searchFacilityButton.setIcon(IconType.SEARCH);
|
searchFacilityButton.setIcon(IconType.SEARCH);
|
||||||
|
@ -164,16 +165,19 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
searchFacilityPanel.getElement().getParentElement().getStyle().setOpacity(0.9);
|
searchFacilityPanel.getElement().getParentElement().getStyle().setOpacity(0.9);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// layersDDB.setToggle(true);
|
// layersDDB.setToggle(true);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bind events.
|
||||||
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
linkLayers.addClickHandler(new ClickHandler() {
|
linkLayers.addClickHandler(new ClickHandler() {
|
||||||
|
@ -190,17 +194,17 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
searchFacilityButton.addDomHandler(new ClickHandler() {
|
searchFacilityButton.addDomHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
//event.preventDefault();
|
// event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
}
|
}
|
||||||
}, ClickEvent.getType());
|
}, ClickEvent.getType());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,6 +221,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the overlay panel max height.
|
||||||
|
*/
|
||||||
private void setOverlayPanelMaxHeight() {
|
private void setOverlayPanelMaxHeight() {
|
||||||
|
|
||||||
String overlMH = mapPanel.getOffsetHeight() - 130 + "px";
|
String overlMH = mapPanel.getOffsetHeight() - 130 + "px";
|
||||||
|
@ -311,11 +318,11 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
/**
|
/**
|
||||||
* Show as details.
|
* Show as details.
|
||||||
*
|
*
|
||||||
* @param concessioneDV the concessione DV
|
* @param result the result
|
||||||
* @param geonaItemRef the geona item ref
|
* @param geonaItemRef the geona item ref
|
||||||
*/
|
*/
|
||||||
public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
|
public void showAsDetails(ProjectView result, GeoNaItemRef geonaItemRef) {
|
||||||
detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
|
detailsPanel.showDetailsFor(result, geonaItemRef);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,13 +334,14 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the displyed record.
|
* Gets the displayed record.
|
||||||
*
|
*
|
||||||
* @return the displyed record
|
* @return the displayed record
|
||||||
*/
|
*/
|
||||||
public RecordDV getDisplayedRecord() {
|
public ProjectView getDisplayedRecord() {
|
||||||
return detailsPanel.getDisplayedRecord();
|
return detailsPanel.getDisplayedProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -361,6 +369,9 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
// layersDDBClickEvent();
|
// layersDDBClickEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Layers DDB click event.
|
||||||
|
*/
|
||||||
private void layersDDBClickEvent() {
|
private void layersDDBClickEvent() {
|
||||||
linkLayers.fireEvent(new GwtEvent<ClickHandler>() {
|
linkLayers.fireEvent(new GwtEvent<ClickHandler>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -386,6 +397,11 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
// layersDDBClickEvent();
|
// layersDDBClickEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the map attribution.
|
||||||
|
*
|
||||||
|
* @param attribution the new map attribution
|
||||||
|
*/
|
||||||
public void setMapAttribution(String attribution) {
|
public void setMapAttribution(String attribution) {
|
||||||
panelAttribution.clear();
|
panelAttribution.clear();
|
||||||
Label label = new Label("Base Map Credits");
|
Label label = new Label("Base Map Credits");
|
||||||
|
@ -393,39 +409,43 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
panelAttribution.add(label);
|
panelAttribution.add(label);
|
||||||
panelAttribution.add(p);
|
panelAttribution.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the base layers.
|
||||||
|
*
|
||||||
|
* @param listBaseLayers the new base layers
|
||||||
|
*/
|
||||||
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
||||||
|
|
||||||
if(listBaseLayers==null)
|
if (listBaseLayers == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (BaseMapLayer baseMapLayer : listBaseLayers) {
|
for (BaseMapLayer baseMapLayer : listBaseLayers) {
|
||||||
|
|
||||||
RadioButton radio = new RadioButton("base-layer");
|
RadioButton radio = new RadioButton("base-layer");
|
||||||
radio.setText(baseMapLayer.getName());
|
radio.setText(baseMapLayer.getName());
|
||||||
if(i==0) {
|
if (i == 0) {
|
||||||
radio.setValue(true, false);
|
radio.setValue(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
|
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
SimplePanel sp = new SimplePanel(radio);
|
SimplePanel sp = new SimplePanel(radio);
|
||||||
sp.getElement().addClassName("form-inline");
|
sp.getElement().addClassName("form-inline");
|
||||||
sp.getElement().addClassName("map-layers-radio");
|
sp.getElement().addClassName("map-layers-radio");
|
||||||
panelBaseLayers.add(sp);
|
panelBaseLayers.add(sp);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,21 +6,15 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||||
import org.gcube.application.geoportalcommon.shared.WhereClause;
|
import org.gcube.application.geoportalcommon.shared.WhereClause;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
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.SearchPerformedEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Alert;
|
import com.github.gwtbootstrap.client.ui.Alert;
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
@ -30,7 +24,6 @@ import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
import com.github.gwtbootstrap.client.ui.constants.AlertType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||||
|
@ -44,7 +37,6 @@ import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.Composite;
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
|
@ -85,9 +77,9 @@ public class SearchFacilityUI extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
HorizontalPanel toogleSortBy;
|
HorizontalPanel toogleSortBy;
|
||||||
|
|
||||||
private List<ItemField> searchForFields;
|
private List<ItemFieldDV> searchForFields;
|
||||||
|
|
||||||
private List<ItemField> sortByFields;
|
private List<ItemFieldDV> sortByFields;
|
||||||
|
|
||||||
private SearchingFilter currentSortFilter;
|
private SearchingFilter currentSortFilter;
|
||||||
|
|
||||||
|
@ -117,7 +109,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
* @param searchForFields the search for fields
|
* @param searchForFields the search for fields
|
||||||
* @param initialSortFilter the initial sort filter
|
* @param initialSortFilter the initial sort filter
|
||||||
*/
|
*/
|
||||||
public SearchFacilityUI(HandlerManager appManagerBus, List<ItemField> sortByFields, List<ItemField> searchForFields,
|
public SearchFacilityUI(HandlerManager appManagerBus, List<ItemFieldDV> sortByFields, List<ItemFieldDV> searchForFields,
|
||||||
SearchingFilter initialSortFilter) {
|
SearchingFilter initialSortFilter) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.searchForFields = searchForFields;
|
this.searchForFields = searchForFields;
|
||||||
|
@ -140,7 +132,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
* @param direction the direction
|
* @param direction the direction
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
private String toLabelFilter(ItemField itemField, ORDER direction) {
|
private String toLabelFilter(ItemFieldDV itemField, ORDER direction) {
|
||||||
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
|
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
|
||||||
return labelFilter;
|
return labelFilter;
|
||||||
}
|
}
|
||||||
|
@ -150,7 +142,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
*/
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
for (ItemField record_FIELD : sortByFields) {
|
for (ItemFieldDV record_FIELD : sortByFields) {
|
||||||
if(record_FIELD.isSortable()) {
|
if(record_FIELD.isSortable()) {
|
||||||
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||||
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||||
|
@ -169,7 +161,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (ItemField record_FIELD : searchForFields) {
|
for (ItemFieldDV record_FIELD : searchForFields) {
|
||||||
GWT.log("search for: "+record_FIELD);
|
GWT.log("search for: "+record_FIELD);
|
||||||
if(record_FIELD.isSearchable()) {
|
if(record_FIELD.isSearchable()) {
|
||||||
listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
||||||
|
@ -264,7 +256,11 @@ public class SearchFacilityUI extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(ResultSetPaginatedData result) {
|
public void onSuccess(ResultSetPaginatedData result) {
|
||||||
|
|
||||||
|
Window.alert("searchConcessioni must be revisited");
|
||||||
|
/*
|
||||||
appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(),false));
|
appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(),false));
|
||||||
|
|
||||||
|
|
||||||
setSearchEnabled(true);
|
setSearchEnabled(true);
|
||||||
latestResult = result;
|
latestResult = result;
|
||||||
|
|
||||||
|
@ -306,7 +302,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
for (ConcessioneDV concessione : result.getData()) {
|
for (DocumentDV concessione : result.getData()) {
|
||||||
int j = -1;
|
int j = -1;
|
||||||
|
|
||||||
NavLink locateOnMap = new NavLink("Show");
|
NavLink locateOnMap = new NavLink("Show");
|
||||||
|
@ -344,32 +340,13 @@ public class SearchFacilityUI extends Composite {
|
||||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getParoleChiaveICCD())));
|
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++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
panelResults.add(ft);
|
panelResults.add(ft);
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -421,8 +398,8 @@ public class SearchFacilityUI extends Composite {
|
||||||
|
|
||||||
SearchingFilter sortFilter = null;
|
SearchingFilter sortFilter = null;
|
||||||
try {
|
try {
|
||||||
ItemField recordField = null;
|
ItemFieldDV recordField = null;
|
||||||
for (ItemField value : sortByFields) {
|
for (ItemFieldDV value : sortByFields) {
|
||||||
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
||||||
recordField = value;
|
recordField = value;
|
||||||
break;
|
break;
|
||||||
|
@ -451,7 +428,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
|
|
||||||
List<String> listOfSeachingFields = new ArrayList<String>();
|
List<String> listOfSeachingFields = new ArrayList<String>();
|
||||||
|
|
||||||
for (ItemField recordField : searchForFields) {
|
for (ItemFieldDV recordField : searchForFields) {
|
||||||
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
||||||
listOfSeachingFields = recordField.getJsonFields();
|
listOfSeachingFields = recordField.getJsonFields();
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -0,0 +1,201 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.FilesetDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.PayloadDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.JavaScriptObject;
|
||||||
|
import com.google.gwt.json.client.JSONArray;
|
||||||
|
import com.google.gwt.json.client.JSONObject;
|
||||||
|
import com.google.gwt.json.client.JSONParser;
|
||||||
|
import com.google.gwt.json.client.JSONString;
|
||||||
|
import com.google.gwt.json.client.JSONValue;
|
||||||
|
import com.google.gwt.user.client.Random;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ImagesSectionGallery.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
|
*
|
||||||
|
* Jul 21, 2021
|
||||||
|
*/
|
||||||
|
public class ImagesSectionGallery {
|
||||||
|
|
||||||
|
private HTMLPanel galleryPanel;
|
||||||
|
private String galleryDivId;
|
||||||
|
private SectionView sectionView;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show gallery.
|
||||||
|
*
|
||||||
|
* @param json_array_images the json array images
|
||||||
|
* @param galleryDivId the gallery div id
|
||||||
|
*/
|
||||||
|
private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{
|
||||||
|
|
||||||
|
console.log("showing: " + json_array_images)
|
||||||
|
var waitForJQuery = setInterval(
|
||||||
|
function() {
|
||||||
|
if (typeof $wnd.$ != 'undefined') {
|
||||||
|
|
||||||
|
$wnd
|
||||||
|
.$("#" + galleryDivId)
|
||||||
|
.nanogallery2(
|
||||||
|
{
|
||||||
|
thumbnailHeight : '200 XS150 SM150', // RESPONSIVE THUMBNAIL HEIGHT: default=200px, XS resolution=150px, SM resolution=150px
|
||||||
|
thumbnailWidth : '218 XS150 SM150', // RESPONSIVE THUMBNAIL WIDTH: auto
|
||||||
|
thumbnailAlignment : 'left',
|
||||||
|
thumbnailBorderHorizontal : 0,
|
||||||
|
thumbnailBorderVertical : 0,
|
||||||
|
thumbnailGutterWidth : '10 XS10 SM10',
|
||||||
|
thumbnailGutterHeight : '10 XS10 SM10',
|
||||||
|
|
||||||
|
// THUMBNAIL TOOLS & LABEL
|
||||||
|
thumbnailLabel : {
|
||||||
|
display : true,
|
||||||
|
position : 'onBottom',
|
||||||
|
align : 'left'
|
||||||
|
},
|
||||||
|
thumbnailToolbarImage : {
|
||||||
|
bottomLeft : 'display'
|
||||||
|
},
|
||||||
|
// replace the default DISPLAY tool icon
|
||||||
|
icons : {
|
||||||
|
thumbnailDisplay : '<i class="fa fa-long-arrow-right" aria-hidden="true"></i> display'
|
||||||
|
},
|
||||||
|
|
||||||
|
// DISPLAY ANIMATION
|
||||||
|
galleryDisplayTransition : 'slideUp',
|
||||||
|
galleryDisplayTransitionDuration : 1000,
|
||||||
|
thumbnailDisplayTransition : 'scaleDown',
|
||||||
|
thumbnailDisplayTransitionDuration : 300,
|
||||||
|
thumbnailDisplayInterval : 50,
|
||||||
|
|
||||||
|
// THUMBNAIL'S HOVER ANIMATION
|
||||||
|
//thumbnailBuildInit2 : 'tools_font-size_1.5em|title_font-size_1.5em',
|
||||||
|
thumbnailHoverEffect2 : 'imageScaleIn80|tools_opacity_0_1|tools_translateX_-30px_0px|title_opacity_1_0|title_translateX_0px_-30px',
|
||||||
|
touchAnimation : true,
|
||||||
|
touchAutoOpenDelay : 800,
|
||||||
|
|
||||||
|
// GALLERY THEME
|
||||||
|
galleryTheme : {
|
||||||
|
thumbnail : {
|
||||||
|
borderRadius : '2px !important',
|
||||||
|
background : '#ffffff !important',
|
||||||
|
titleShadow : 'none !important',
|
||||||
|
titleColor : '#696969 !important',
|
||||||
|
labelBackground : '#f3f3f3 !important'
|
||||||
|
},
|
||||||
|
thumbnailIcon : {
|
||||||
|
color : '#000',
|
||||||
|
shadow : 'none'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
viewerToolbar : {
|
||||||
|
display : true,
|
||||||
|
standard : 'minimizeButton, label',
|
||||||
|
minimized : 'minimizeButton, label, fullscreenButton, downloadButton'
|
||||||
|
},
|
||||||
|
viewerTools : {
|
||||||
|
topLeft : 'pageCounter',
|
||||||
|
topRight : 'playPauseButton, zoomButton, fullscreenButton, downloadButton, closeButton'
|
||||||
|
},
|
||||||
|
|
||||||
|
// DEEP LINKING
|
||||||
|
locationHash : false,
|
||||||
|
items : json_array_images
|
||||||
|
})
|
||||||
|
|
||||||
|
clearInterval(waitForJQuery);
|
||||||
|
}
|
||||||
|
}, 200);
|
||||||
|
|
||||||
|
}-*/;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new images section gallery.
|
||||||
|
*
|
||||||
|
* @param sectionView the section view
|
||||||
|
*/
|
||||||
|
public ImagesSectionGallery(SectionView sectionView) {
|
||||||
|
this.galleryDivId = "nanogallery" + Random.nextInt() + Random.nextInt();
|
||||||
|
this.galleryPanel = new HTMLPanel("<div id='" + galleryDivId + "'></div>");
|
||||||
|
this.sectionView = sectionView;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the gallery panel.
|
||||||
|
*
|
||||||
|
* @return the gallery panel
|
||||||
|
*/
|
||||||
|
public HTMLPanel getGalleryPanel() {
|
||||||
|
return galleryPanel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill gallery.
|
||||||
|
*/
|
||||||
|
public void fillGallery() {
|
||||||
|
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
int index = 0;
|
||||||
|
for (SubDocumentView subdoc : sectionView.getListSubDocuments()) {
|
||||||
|
JSONValue meta = JSONParser.parseStrict(subdoc.getMetadataAsJSON());
|
||||||
|
|
||||||
|
for (FilesetDV image : subdoc.getListImages()) {
|
||||||
|
if (image.getListPayload() != null) {
|
||||||
|
for (PayloadDV payloadDV : image.getListPayload()) {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("src", new JSONString(payloadDV.getLink()));
|
||||||
|
json.put("srct", new JSONString(payloadDV.getLink()));
|
||||||
|
json.put("downloadURL", new JSONString(payloadDV.getLink()));
|
||||||
|
json.put("title", new JSONString(getFirstValueOfJSON(meta)));
|
||||||
|
json.put("description", new JSONString(meta.toString()));
|
||||||
|
jsonArray.set(index, json);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
showGallery(jsonArray.getJavaScriptObject(), galleryDivId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the first value of JSON.
|
||||||
|
*
|
||||||
|
* @param metadata the metadata
|
||||||
|
* @return the first value of JSON
|
||||||
|
*/
|
||||||
|
public String getFirstValueOfJSON(JSONValue metadata) {
|
||||||
|
|
||||||
|
String value = "";
|
||||||
|
|
||||||
|
if (metadata == null)
|
||||||
|
return value;
|
||||||
|
|
||||||
|
if (metadata.isArray() != null) {
|
||||||
|
JSONArray array = (JSONArray) metadata;
|
||||||
|
for (int i = 0; i < array.size(); i++) {
|
||||||
|
JSONObject object = (JSONObject) array.get(i);
|
||||||
|
Set<String> set = object.keySet();
|
||||||
|
value = object.get(set.iterator().next()).toString();
|
||||||
|
}
|
||||||
|
} else if (metadata.isObject() != null) {
|
||||||
|
JSONObject object = (JSONObject) metadata;
|
||||||
|
Set<String> set = object.keySet();
|
||||||
|
value = object.get(set.iterator().next()).toString();
|
||||||
|
} else if (metadata.isString() != null) {
|
||||||
|
value = metadata.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,176 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
|
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.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||||
|
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.ClickEvent;
|
||||||
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
import ol.Coordinate;
|
||||||
|
|
||||||
|
public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
|
private static ProjectViewerUiBinder uiBinder = GWT.create(ProjectViewerUiBinder.class);
|
||||||
|
|
||||||
|
interface ProjectViewerUiBinder extends UiBinder<Widget, ProjectViewer> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
PageHeader title;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel pageViewDetails;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button shareButton;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Button expandButton;
|
||||||
|
|
||||||
|
private ProjectView projectView;
|
||||||
|
|
||||||
|
private CustomFlexTable customTable = new CustomFlexTable();
|
||||||
|
|
||||||
|
private GeoNaItemRef geonaItemRef;
|
||||||
|
|
||||||
|
private String myLogin;
|
||||||
|
|
||||||
|
private boolean viewImageButtonVisible = true;
|
||||||
|
|
||||||
|
private boolean openImageButtonVisible = true;
|
||||||
|
|
||||||
|
private ProjectViewer() {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
pageViewDetails.getElement().setId("page-view-details");
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectViewer(GeoNaItemRef item, ProjectView projectView) {
|
||||||
|
this(item, projectView, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectViewer(GeoNaItemRef item, ProjectView projectView, boolean viewImageButtonVisible,
|
||||||
|
boolean openImageButtonVisible) {
|
||||||
|
this();
|
||||||
|
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
|
||||||
|
this.projectView = projectView;
|
||||||
|
this.geonaItemRef = item;
|
||||||
|
this.viewImageButtonVisible = viewImageButtonVisible;
|
||||||
|
this.openImageButtonVisible = openImageButtonVisible;
|
||||||
|
|
||||||
|
title.setText("Project: "+projectView.getTheProjectDV().getProfileID());
|
||||||
|
|
||||||
|
shareButton.setType(ButtonType.LINK);
|
||||||
|
shareButton.setIcon(IconType.SHARE);
|
||||||
|
shareButton.setTitle("Get a link to share with...");
|
||||||
|
|
||||||
|
shareButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
expandButton.setType(ButtonType.LINK);
|
||||||
|
expandButton.setIcon(IconType.EXPAND);
|
||||||
|
expandButton.setTitle("Show this view in new Window");
|
||||||
|
|
||||||
|
expandButton.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
Window.alert("Expand must be revisited");
|
||||||
|
/*
|
||||||
|
ProjectViewer cv = new ProjectViewer(geonaItemRef, concessioneDV, false, openImageButtonVisible);
|
||||||
|
cv.setExpandViewButtonVisible(false);
|
||||||
|
int width = Window.getClientWidth() * 75 / 100;
|
||||||
|
int height = Window.getClientHeight() * 70 / 100;
|
||||||
|
ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height);
|
||||||
|
mw.add(cv);
|
||||||
|
mw.setCaller(ProjectViewer.this);
|
||||||
|
// mw.setWidth(900);
|
||||||
|
mw.show();
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
myLogin = result;
|
||||||
|
addCentroidMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
for (SectionView sectionView : projectView.getListSections()) {
|
||||||
|
|
||||||
|
SectionViewer sectionViewer = new SectionViewer(sectionView);
|
||||||
|
pageViewDetails.add(sectionViewer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addCentroidMap() {
|
||||||
|
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||||
|
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
||||||
|
MapView mapView = new MapView(transformedCenterCoordinate,
|
||||||
|
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
||||||
|
|
||||||
|
Window.alert("addCentroidMap must be revisited");
|
||||||
|
|
||||||
|
// if (concessioneDV != null && concessioneDV.getCentroidLat() != null
|
||||||
|
// && concessioneDV.getCentroidLong() != null) {
|
||||||
|
// Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
|
||||||
|
// Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
|
// MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
// // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
|
||||||
|
// boolean authenticatedUser = myLogin != null ? true : false;
|
||||||
|
// mapView.addMarker(transfCoord, authenticatedUser);
|
||||||
|
// mapViewPanel.add(mapView);
|
||||||
|
// } else if (concessioneDV != null) {
|
||||||
|
// GeoportalDataViewerConstants
|
||||||
|
// .printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
|
||||||
|
// + concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectView getProjectView() {
|
||||||
|
return projectView;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setExpandViewButtonVisible(boolean bool) {
|
||||||
|
expandButton.setVisible(bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
|
||||||
|
<ui:style>
|
||||||
|
.margin-left-10 {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-size-h1-22 h1 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-to-right {
|
||||||
|
right: 20px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.the-title h1 {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-bottom-10 {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width-100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel ui:field="pageViewDetails">
|
||||||
|
<!-- <g:HTMLPanel ui:field="sharePanel" -->
|
||||||
|
<!-- addStyleNames="{style.align-to-right}"> -->
|
||||||
|
<!-- </g:HTMLPanel> -->
|
||||||
|
<b:PageHeader ui:field="title"
|
||||||
|
addStyleNames="{style.the-title}"></b:PageHeader>
|
||||||
|
<g:HorizontalPanel
|
||||||
|
addStyleNames="{style.margin-bottom-10}">
|
||||||
|
<b:Button ui:field="shareButton">Share</b:Button>
|
||||||
|
<b:Button ui:field="expandButton">Expand</b:Button>
|
||||||
|
</g:HorizontalPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
<ui:style>
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel ui:field="recordDVPanel">
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery.ImagesSectionGallery;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class SectionViewer extends Composite {
|
||||||
|
|
||||||
|
private static SectionViewerUiBinder uiBinder = GWT.create(SectionViewerUiBinder.class);
|
||||||
|
|
||||||
|
interface SectionViewerUiBinder extends UiBinder<Widget, SectionViewer> {
|
||||||
|
}
|
||||||
|
|
||||||
|
private SectionView sectionView;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel sectionPanelContainer;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
PageHeader sectionTitle;
|
||||||
|
|
||||||
|
public SectionViewer(SectionView sectionView) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.sectionView = sectionView;
|
||||||
|
|
||||||
|
List<SubDocumentView> subDocuments = sectionView.getListSubDocuments();
|
||||||
|
|
||||||
|
sectionTitle.setTitle(sectionView.getSectionTitle());
|
||||||
|
sectionTitle.setText(sectionView.getSectionTitle());
|
||||||
|
|
||||||
|
boolean displayAsGallery = false;
|
||||||
|
for (SubDocumentView subDocumentView : subDocuments) {
|
||||||
|
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
|
||||||
|
displayAsGallery = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Displaying the whole section as a Gallery
|
||||||
|
if (displayAsGallery) {
|
||||||
|
ImagesSectionGallery sectionGallery = new ImagesSectionGallery(sectionView);
|
||||||
|
sectionPanelContainer.add(sectionGallery.getGalleryPanel());
|
||||||
|
sectionGallery.fillGallery();
|
||||||
|
} else {
|
||||||
|
for (SubDocumentView subDocumentView : subDocuments) {
|
||||||
|
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
|
||||||
|
sectionPanelContainer.add(new HTML(table));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||||
|
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||||
|
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||||
|
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||||
|
|
||||||
|
<ui:style>
|
||||||
|
.margin-left-10 {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.font-size-h1-22 h1 {
|
||||||
|
font-size: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.align-to-right {
|
||||||
|
right: 20px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.the-title h1 {
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-bottom-10 {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.width-100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</ui:style>
|
||||||
|
<g:HTMLPanel ui:field="sectionPanelContainer">
|
||||||
|
<g:HTMLPanel
|
||||||
|
addStyleNames="{style.margin-left-10}">
|
||||||
|
<b:PageHeader addStyleNames="{style.font-size-h1-22}" ui:field="sectionTitle"></b:PageHeader>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
</ui:UiBinder>
|
|
@ -14,7 +14,7 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ImagesGallery.
|
* The Class ImagesSectionGallery.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||||
|
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||||
|
|
||||||
|
public class GcubeProfilesMetadataForUCD implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -8953445402356442872L;
|
||||||
|
private String profileID;
|
||||||
|
private GcubeProfileDV gcubeProfile;
|
||||||
|
private List<MetaDataProfileBean> listMetadataProfileBean;
|
||||||
|
|
||||||
|
public GcubeProfilesMetadataForUCD() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public GcubeProfilesMetadataForUCD(String profileID, GcubeProfileDV gcubeProfile,
|
||||||
|
List<MetaDataProfileBean> listMetadataProfileBean) {
|
||||||
|
|
||||||
|
this.profileID = profileID;
|
||||||
|
this.gcubeProfile = gcubeProfile;
|
||||||
|
this.listMetadataProfileBean = listMetadataProfileBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProfileID() {
|
||||||
|
return profileID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GcubeProfileDV getGcubeProfile() {
|
||||||
|
return gcubeProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MetaDataProfileBean> getListMetadataProfileBean() {
|
||||||
|
return listMetadataProfileBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfileID(String profileID) {
|
||||||
|
this.profileID = profileID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGcubeProfile(GcubeProfileDV gcubeProfile) {
|
||||||
|
this.gcubeProfile = gcubeProfile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListMetadataProfileBean(List<MetaDataProfileBean> listMetadataProfileBean) {
|
||||||
|
this.listMetadataProfileBean = listMetadataProfileBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("GcubeProfilesMetadataForUCD [profileID=");
|
||||||
|
builder.append(profileID);
|
||||||
|
builder.append(", gcubeProfile=");
|
||||||
|
builder.append(gcubeProfile);
|
||||||
|
builder.append(", listMetadataProfileBean=");
|
||||||
|
builder.append(listMetadataProfileBean);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import javax.servlet.annotation.WebListener;
|
||||||
|
import javax.servlet.http.HttpSessionEvent;
|
||||||
|
import javax.servlet.http.HttpSessionListener;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@WebListener
|
||||||
|
public class GeoportalDataViewerHttpSessionListener implements HttpSessionListener {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerHttpSessionListener.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sessionDestroyed(HttpSessionEvent event) {
|
||||||
|
LOG.info("sessionDestroyed called");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sessionCreated(HttpSessionEvent arg0) {
|
||||||
|
LOG.info("sessionCreated called. Session id is: "+arg0.getSession().getId());
|
||||||
|
|
||||||
|
new GeoportalDataViewerServiceImpl().preloadgCubeProfilesForUCDs();
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,31 +10,43 @@ import java.util.Map;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.access.GeportalCheckAccessPolicy;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.serdes.Payload;
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfileDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_CONFIGURATION_TYPE;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.FilesetDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.PayloadDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.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.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.ConcessioniMongoServiceIdentityProxy;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accesspolicy.GeoNACheckAccessPolicy;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
@ -44,15 +56,25 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformation
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Styles;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Styles;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||||
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
||||||
|
import org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderServiceImpl;
|
||||||
|
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||||
|
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
|
||||||
import org.gcube.spatial.data.geoutility.GeoNcWMSMetadataUtility;
|
import org.gcube.spatial.data.geoutility.GeoNcWMSMetadataUtility;
|
||||||
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
|
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
|
||||||
import org.gcube.spatial.data.geoutility.bean.LayerZAxis;
|
import org.gcube.spatial.data.geoutility.bean.LayerZAxis;
|
||||||
import org.gcube.spatial.data.geoutility.bean.WmsParameters;
|
import org.gcube.spatial.data.geoutility.bean.WmsParameters;
|
||||||
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
||||||
|
import org.json.JSONArray;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonParser;
|
||||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
import com.jayway.jsonpath.JsonPath;
|
||||||
|
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server side implementation of the RPC service.
|
* The server side implementation of the RPC service.
|
||||||
|
@ -70,6 +92,38 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
private static final String CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE = "MAP_IMAGE_PREVIEW_FOR_CONCESSIONE";
|
private static final String CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE = "MAP_IMAGE_PREVIEW_FOR_CONCESSIONE";
|
||||||
|
|
||||||
|
public static final String JSON_$_POINTER = "$";
|
||||||
|
|
||||||
|
public static enum COMMON_IMAGES_FORMAT {
|
||||||
|
gif, png, jpeg, jpg, bmp, tif, tiff, svg, avif, webp
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ImageDetector {
|
||||||
|
|
||||||
|
private static String[] getNames(Class<? extends Enum<?>> e) {
|
||||||
|
return Arrays.stream(e.getEnumConstants()).map(Enum::name).toArray(String[]::new);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> listFormatImages;
|
||||||
|
|
||||||
|
static {
|
||||||
|
|
||||||
|
String[] arrayImgs = ImageDetector.getNames(COMMON_IMAGES_FORMAT.class);
|
||||||
|
listFormatImages = Arrays.asList(arrayImgs);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isImage(String mimeType) {
|
||||||
|
if (mimeType == null || mimeType.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
String inputImageFormat = mimeType.replaceAll("image/", "");
|
||||||
|
|
||||||
|
return listFormatImages.contains(inputImageFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the GNA data viewe config profile.
|
* Gets the GNA data viewe config profile.
|
||||||
*
|
*
|
||||||
|
@ -221,83 +275,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return getUploadedImagesForId(this.getThreadLocalRequest(), itemType, itemId, maxImages);
|
return getUploadedImagesForId(this.getThreadLocalRequest(), itemType, itemId, maxImages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the layers for id.
|
|
||||||
*
|
|
||||||
* @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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the concessione for id.
|
* Gets the concessione for id.
|
||||||
|
@ -310,6 +288,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
public ConcessioneDV getConcessioneForId(String mongoId) throws Exception {
|
public ConcessioneDV getConcessioneForId(String mongoId) throws Exception {
|
||||||
LOG.info("getConcessioneForId " + mongoId + " called");
|
LOG.info("getConcessioneForId " + mongoId + " called");
|
||||||
|
|
||||||
|
throw new Exception("getConcessioneForId must be removed!");
|
||||||
|
/*
|
||||||
ConcessioneDV concessionDV = null;
|
ConcessioneDV concessionDV = null;
|
||||||
|
|
||||||
if (mongoId == null)
|
if (mongoId == null)
|
||||||
|
@ -318,8 +298,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
try {
|
try {
|
||||||
LOG.info("Trying to get record for id " + mongoId);
|
LOG.info("Trying to get record for id " + mongoId);
|
||||||
|
|
||||||
ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(
|
GeoportalServiceIdentityProxy cms = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
this.getThreadLocalRequest());
|
|
||||||
Concessione concessione = cms.getItemById(mongoId);
|
Concessione concessione = cms.getItemById(mongoId);
|
||||||
|
|
||||||
LOG.info("Got concessione for mongoId: " + mongoId);
|
LOG.info("Got concessione for mongoId: " + mongoId);
|
||||||
|
@ -414,7 +393,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.error(erroMsg, e);
|
LOG.error(erroMsg, e);
|
||||||
throw new Exception(erroMsg);
|
throw new Exception(erroMsg);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -648,7 +627,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
String itemId, Integer maxImages) throws Exception {
|
String itemId, Integer maxImages) throws Exception {
|
||||||
LOG.info("getUploadedImagesForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
|
LOG.info("getUploadedImagesForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
|
||||||
|
|
||||||
if (itemType == null)
|
throw new Exception("getUploadedImagesForId must be revisited");
|
||||||
|
|
||||||
|
/*if (itemType == null)
|
||||||
throw new Exception("Invalid parameter. The itemType is null");
|
throw new Exception("Invalid parameter. The itemType is null");
|
||||||
|
|
||||||
if (itemId == null)
|
if (itemId == null)
|
||||||
|
@ -661,7 +642,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (itemType.equalsIgnoreCase("concessione")) {
|
if (itemType.equalsIgnoreCase("concessione")) {
|
||||||
|
|
||||||
LOG.info("Trying to get concessione for id " + itemId);
|
LOG.info("Trying to get concessione for id " + itemId);
|
||||||
ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(httpServletRequest);
|
GeoportalServiceIdentityProxy cms = new GeoportalServiceIdentityProxy(httpServletRequest);
|
||||||
Concessione concessione = cms.getItemById(itemId);
|
Concessione concessione = cms.getItemById(itemId);
|
||||||
if (concessione != null) {
|
if (concessione != null) {
|
||||||
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
||||||
|
@ -687,7 +668,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
+ Concessione.class.getSimpleName() + " with id " + itemId;
|
+ Concessione.class.getSimpleName() + " with id " + itemId;
|
||||||
LOG.error(erroMsg, e);
|
LOG.error(erroMsg, e);
|
||||||
throw new Exception(erroMsg);
|
throw new Exception(erroMsg);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,13 +698,51 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<ItemField> listOfFieldsForSearching() throws Exception {
|
public List<ItemFieldDV> listOfFieldsForSearching() throws Exception {
|
||||||
LOG.info("listOfFieldsForSearching called");
|
LOG.info("listOfFieldsForSearching called");
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||||
return profile.getListItemFields();
|
return profile.getListItemFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NEW CODE HERE
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list concessioni.
|
* Gets the list concessioni.
|
||||||
*
|
*
|
||||||
|
@ -740,18 +759,22 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
||||||
|
|
||||||
try {
|
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,
|
throw new Exception("getListConcessioni must be revisited!!!!");
|
||||||
"concessione");
|
/*
|
||||||
return searchedData;
|
*
|
||||||
|
* // setting identity as D4S User or KC client new
|
||||||
|
* GeoportalServiceIdentityProxy(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) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on loading paginated and filtered list of concessioni: ", e);
|
LOG.error("Error on loading paginated and filtered list of concessioni: ", e);
|
||||||
|
@ -760,4 +783,519 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preloadg cube profiles for UC ds.
|
||||||
|
*/
|
||||||
|
public void preloadgCubeProfilesForUCDs() {
|
||||||
|
LOG.info("preloadgCubeProfilesForUCDs called");
|
||||||
|
try {
|
||||||
|
|
||||||
|
String currentContext = SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||||
|
LOG.info("preloadgCubeProfilesForUCDs context: "+currentContext);
|
||||||
|
UseCaseDescriptorCaller clientUCD = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||||
|
List<UseCaseDescriptor> listUCDs = clientUCD.getList();
|
||||||
|
LOG.debug("listUCDs: "+listUCDs);
|
||||||
|
|
||||||
|
for (UseCaseDescriptor ucd : listUCDs) {
|
||||||
|
|
||||||
|
LOG.info("Loaded UCD for ID: " + ucd.getId());
|
||||||
|
String profileID = ucd.getId();
|
||||||
|
GEOPORTAL_DATA_HANDLER theHandler = GEOPORTAL_DATA_HANDLER.geoportal_data_entry;
|
||||||
|
List<HandlerDeclaration> handlers = ucd.getHandlersByType(theHandler.getType());
|
||||||
|
|
||||||
|
if (handlers.size() == 0) {
|
||||||
|
LOG.warn("No handler " + theHandler + "found into UCD " + ucd.getId() + ", continue...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loading Handler gcube_profiles
|
||||||
|
HandlerDeclaration dataEntryHandler = handlers.get(0);
|
||||||
|
HandlerDeclarationDV handlerGcubeProfiles = ConvertToDataValueObjectModel
|
||||||
|
.toHandlerDeclarationDV(dataEntryHandler, ucd, GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles);
|
||||||
|
|
||||||
|
LOG.debug("Handler " + GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles + " for PROFILE_ID: " + ucd.getId());
|
||||||
|
LOG.debug("" + handlerGcubeProfiles);
|
||||||
|
|
||||||
|
ConfigurationDV<?> config = handlerGcubeProfiles.getConfiguration();
|
||||||
|
// List of gCube Profiles defined in the UCD
|
||||||
|
List<GcubeProfileDV> listGcubeProfiles = (List<GcubeProfileDV>) config.getConfiguration();
|
||||||
|
LOG.debug("List of GcubeProfileDV are: " + listGcubeProfiles);
|
||||||
|
|
||||||
|
List<GcubeProfilesMetadataForUCD> listProfilesBean = new ArrayList<GcubeProfilesMetadataForUCD>();
|
||||||
|
// Loading Metadata Profile from IS
|
||||||
|
MetadataProfileFormBuilderServiceImpl metaProfileBUilder = new MetadataProfileFormBuilderServiceImpl();
|
||||||
|
|
||||||
|
LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> linkedMap_UCDId_gCubeProfiles = new LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>();
|
||||||
|
for (GcubeProfileDV gcubeProfileDV : listGcubeProfiles) {
|
||||||
|
String context = SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||||
|
GcubeProfilesMetadataForUCD gCubeProfileMetadataForUCD = new GcubeProfilesMetadataForUCD();
|
||||||
|
List<MetaDataProfileBean> listProfiles = metaProfileBUilder.getProfilesInTheScopeForName(context,
|
||||||
|
gcubeProfileDV.getGcubeSecondaryType(), gcubeProfileDV.getGcubeName());
|
||||||
|
|
||||||
|
String key = gcubeProfileDV.getGcubeSecondaryType() + gcubeProfileDV.getGcubeName();
|
||||||
|
LOG.debug("for key: " + key + " readi profiles: " + listGcubeProfiles);
|
||||||
|
gCubeProfileMetadataForUCD.setGcubeProfile(gcubeProfileDV);
|
||||||
|
gCubeProfileMetadataForUCD.setListMetadataProfileBean(listProfiles);
|
||||||
|
listProfilesBean.add(gCubeProfileMetadataForUCD);
|
||||||
|
|
||||||
|
}
|
||||||
|
linkedMap_UCDId_gCubeProfiles.put(ucd.getId(), listProfilesBean);
|
||||||
|
|
||||||
|
for (String key : linkedMap_UCDId_gCubeProfiles.keySet()) {
|
||||||
|
LOG.debug("For key '" + key + "' got profiles: " + linkedMap_UCDId_gCubeProfiles.get(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
SessionUtil.setMap_UCDId_gCubeProfiles(getThreadLocalRequest(), profileID,
|
||||||
|
linkedMap_UCDId_gCubeProfiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
String erroMsg = "Error occurred on preloadgCubeProfilesForUCDs: ";
|
||||||
|
LOG.error(erroMsg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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");
|
||||||
|
|
||||||
|
throw new Exception("getLayersForId must be revisited!!!");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
* GeoportalServiceIdentityProxy cms = new
|
||||||
|
* GeoportalServiceIdentityProxy(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 project view for id.
|
||||||
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @param projectID the project ID
|
||||||
|
* @return the project view for id
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ProjectView getProjectViewForId(String profileID, String projectID) throws Exception {
|
||||||
|
LOG.info("getProjectForId profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||||
|
|
||||||
|
if (profileID == null || projectID == null)
|
||||||
|
throw new Exception("Invalid parameter. Either profileID or projectID is 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");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.info("Trying to get project for id " + profileID);
|
||||||
|
|
||||||
|
GeoportalServiceIdentityProxy cms = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
|
ProjectDV theProjectDV = cms.getProjectByID(profileID, projectID);
|
||||||
|
|
||||||
|
String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON();
|
||||||
|
|
||||||
|
LOG.debug("theProjectDV as JSON: " + theWholeProjectAsJSON);
|
||||||
|
LOG.debug("theProjectDV as MAP: " + theProjectDV.getTheDocument().getDocumentAsMap());
|
||||||
|
|
||||||
|
ProjectView projectView = new ProjectView();
|
||||||
|
projectView.setTheProjectDV(theProjectDV);
|
||||||
|
|
||||||
|
LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> linkedMap_UCDId_gCubeProfiles = SessionUtil
|
||||||
|
.getMap_UCDId_gCubeProfiles(getThreadLocalRequest(), profileID);
|
||||||
|
|
||||||
|
if(linkedMap_UCDId_gCubeProfiles==null) {
|
||||||
|
preloadgCubeProfilesForUCDs();
|
||||||
|
linkedMap_UCDId_gCubeProfiles = SessionUtil
|
||||||
|
.getMap_UCDId_gCubeProfiles(getThreadLocalRequest(), profileID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// NO UCD defined, applyong default
|
||||||
|
if (linkedMap_UCDId_gCubeProfiles.size() == 0) {
|
||||||
|
LOG.warn("No " + GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles + " found in the UCD");
|
||||||
|
LOG.info("Applying default business logic to display the project");
|
||||||
|
SectionView sectionView = new SectionView();
|
||||||
|
sectionView.setSectionTitle("Document");
|
||||||
|
SubDocumentView subDocumentView = new SubDocumentView();
|
||||||
|
subDocumentView.setMetadataAsJSON(theProjectDV.getTheDocument().getDocumentAsJSON());
|
||||||
|
sectionView.addSubDocument(subDocumentView);
|
||||||
|
projectView.addSectionView(sectionView);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<GcubeProfilesMetadataForUCD> listProfilesBean = linkedMap_UCDId_gCubeProfiles.get(profileID);
|
||||||
|
|
||||||
|
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
|
||||||
|
.jsonProvider(new JsonOrgJsonProvider()).build();
|
||||||
|
|
||||||
|
// Reading the Project according to list of Profile defined in the UCD
|
||||||
|
for (GcubeProfilesMetadataForUCD gcubeProfileMetaForUCD : listProfilesBean) {
|
||||||
|
|
||||||
|
GcubeProfileDV gcubeProfileDV = gcubeProfileMetaForUCD.getGcubeProfile();
|
||||||
|
SectionView sectionView = new SectionView();
|
||||||
|
sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle());
|
||||||
|
LOG.debug("\n\nThe profile is: " + gcubeProfileDV);
|
||||||
|
// Building JSON/section full PATH and section name
|
||||||
|
String sectionJSONPath = "";
|
||||||
|
String parentPathFromProfile = gcubeProfileDV.getParentName() == null ? ""
|
||||||
|
: gcubeProfileDV.getParentName();
|
||||||
|
String theSectionName = gcubeProfileDV.getSectionName();
|
||||||
|
|
||||||
|
if (theSectionName.compareTo(JSON_$_POINTER) == 0
|
||||||
|
|| theSectionName.compareTo(JSON_$_POINTER + ".") == 0) {
|
||||||
|
sectionJSONPath = JSON_$_POINTER;
|
||||||
|
theSectionName = "";
|
||||||
|
} else {
|
||||||
|
sectionJSONPath = String.format("%s%s",
|
||||||
|
parentPathFromProfile.endsWith(".") ? parentPathFromProfile : parentPathFromProfile + ".",
|
||||||
|
theSectionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("The sectionJSONPath is: " + sectionJSONPath);
|
||||||
|
|
||||||
|
JsonPath theSectionJsonPath = JsonPath.compile(sectionJSONPath);
|
||||||
|
Object data = theSectionJsonPath.read(theWholeProjectAsJSON, configuration);
|
||||||
|
|
||||||
|
LOG.debug("Data is instace of: " + data.getClass());
|
||||||
|
LOG.debug("data to string: " + data.toString());
|
||||||
|
|
||||||
|
// Splitting the General Document in bson.Document according to list of
|
||||||
|
// GcubeProfiles
|
||||||
|
List<Document> listBSONDocument = new ArrayList<Document>();
|
||||||
|
if (data instanceof org.json.JSONObject) {
|
||||||
|
String jsonString = data.toString();
|
||||||
|
LOG.debug("the JSON to string: " + jsonString);
|
||||||
|
Document sectionDoc = Document.parse(jsonString);
|
||||||
|
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, sectionJSONPath,
|
||||||
|
userName);
|
||||||
|
if (isAccessibleSection) {
|
||||||
|
listBSONDocument.add(sectionDoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (data instanceof org.json.JSONArray) {
|
||||||
|
org.json.JSONArray dataArray = (org.json.JSONArray) data;
|
||||||
|
for (int i = 0; i < dataArray.length(); i++) {
|
||||||
|
String jsonString = dataArray.get(i).toString();
|
||||||
|
LOG.debug("the array " + i + " JSON to string: " + jsonString);
|
||||||
|
Document sectionDoc = Document.parse(jsonString);
|
||||||
|
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, sectionJSONPath,
|
||||||
|
userName);
|
||||||
|
if (isAccessibleSection) {
|
||||||
|
listBSONDocument.add(sectionDoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("Result for " + gcubeProfileDV.getSectionName() + " is: " + listBSONDocument);
|
||||||
|
List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean();
|
||||||
|
MetaDataProfileBean theProfileBean = theProfileBeans.get(0);
|
||||||
|
|
||||||
|
// For each bson.Document creating the SubDocumentView
|
||||||
|
for (int i = 0; i < listBSONDocument.size(); i++) {
|
||||||
|
Document fromSectionDoc = listBSONDocument.get(i);
|
||||||
|
SubDocumentView subDocumentView = new SubDocumentView();
|
||||||
|
Document toSectionDoc = new Document();
|
||||||
|
// Filling the SubDocumentView metadata with the metadataField.getFieldName()
|
||||||
|
// read from the Profile
|
||||||
|
for (MetadataFieldWrapper metadataField : theProfileBean.getMetadataFields()) {
|
||||||
|
|
||||||
|
String theFieldName = metadataField.getFieldId() != null ? metadataField.getFieldId()
|
||||||
|
: metadataField.getFieldName();
|
||||||
|
LOG.debug("reading theFieldName: " + theFieldName);
|
||||||
|
Object theOBJFieldValue = fromSectionDoc.get(theFieldName);
|
||||||
|
|
||||||
|
// NB: Using ALWAYS THE metadataField.getFieldName() as LABEL
|
||||||
|
toSectionDoc = sanitizeDocumentValue(toSectionDoc, metadataField.getFieldName(),
|
||||||
|
theOBJFieldValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
String subToJSON = toSectionDoc.toJson();
|
||||||
|
LOG.debug("theSubSetionDoc is: " + subToJSON);
|
||||||
|
subDocumentView.setMetadataAsJSON(toSectionDoc.toJson());
|
||||||
|
|
||||||
|
// Reading filePaths
|
||||||
|
List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths();
|
||||||
|
|
||||||
|
// READING fileset* field ACCORDING TO filePaths OF THE 'gcubeProfiles' CONFIG
|
||||||
|
if (filePaths != null) {
|
||||||
|
String fromSectionDocJSON = fromSectionDoc.toJson();
|
||||||
|
List<FilesetDV> listFiles = new ArrayList<FilesetDV>();
|
||||||
|
List<FilesetDV> listImages = new ArrayList<FilesetDV>();
|
||||||
|
for (FilePathDV filePath : filePaths) {
|
||||||
|
|
||||||
|
String filesetJSONPath = String.format("%s.%s", JSON_$_POINTER, filePath.getFieldName());
|
||||||
|
List<Payload> listPayloads = readPayloadsForFileset(filesetJSONPath, fromSectionDocJSON);
|
||||||
|
FilesetDV filesetDV = new FilesetDV();
|
||||||
|
filesetDV.setName(filePath.getGcubeProfileFieldName());
|
||||||
|
for (Payload payload : listPayloads) {
|
||||||
|
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
|
||||||
|
filesetDV.addPayloadDV(payloadDV);
|
||||||
|
boolean isImage = ImageDetector.isImage(payload.getMimetype());
|
||||||
|
|
||||||
|
if (isImage) {
|
||||||
|
listImages.add(filesetDV);
|
||||||
|
} else {
|
||||||
|
listFiles.add(filesetDV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
subDocumentView.setListFiles(listFiles);
|
||||||
|
subDocumentView.setListImages(listImages);
|
||||||
|
}
|
||||||
|
|
||||||
|
sectionView.addSubDocument(subDocumentView);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
projectView.addSectionView(sectionView);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for (SectionView section : projectView.getListSections()) {
|
||||||
|
// System.out.println("\n\n###### Section Title: " + section.getSectionTitle() + " ######");
|
||||||
|
// int i = 1;
|
||||||
|
// for (SubDocumentView subDocument : section.getListSubDocuments()) {
|
||||||
|
// System.out.println("## " + SubDocumentView.class.getSimpleName() + " n." + i);
|
||||||
|
// System.out.println("***** Metadata");
|
||||||
|
// System.out.println(prettyPrintJSON(subDocument.getMetadataAsJSON()));
|
||||||
|
// System.out.println("***** Files");
|
||||||
|
// if (subDocument.getListFiles() != null) {
|
||||||
|
// for (FilesetDV filesetDV : subDocument.getListFiles()) {
|
||||||
|
// System.out.println("******* File Fileset name: " + filesetDV.getName());
|
||||||
|
// for (PayloadDV payload : filesetDV.getListPayload()) {
|
||||||
|
// System.out.println("********* Payload: " + payload);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// System.out.println("***** Images");
|
||||||
|
// if (subDocument.getListImages() != null) {
|
||||||
|
// for (FilesetDV filesetDV : subDocument.getListImages()) {
|
||||||
|
// System.out.println("******* Image Fileset name: " + filesetDV.getName());
|
||||||
|
// for (PayloadDV payload : filesetDV.getListPayload()) {
|
||||||
|
// System.out.println("********* Payload: " + payload);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// i++;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
return projectView;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
String erroMsg = "Error occurred on creating projectView for id: " + projectID;
|
||||||
|
LOG.error(erroMsg, e);
|
||||||
|
throw new Exception(erroMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read payloads for fileset.
|
||||||
|
*
|
||||||
|
* @param filesetJSONPath the fileset JSON path
|
||||||
|
* @param sectionJSONDocument the section JSON document
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
|
private List<Payload> readPayloadsForFileset(String filesetJSONPath, String sectionJSONDocument) {
|
||||||
|
LOG.debug("readPayloadsForFileset called");
|
||||||
|
|
||||||
|
List<Payload> listPayloads = new ArrayList<Payload>();
|
||||||
|
String _payloadsJSONPath = String.format("%s.%s", filesetJSONPath, "_payloads");
|
||||||
|
try {
|
||||||
|
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
|
||||||
|
.jsonProvider(new JsonOrgJsonProvider()).build();
|
||||||
|
|
||||||
|
LOG.info("Reading sectionPath at {} into section document {}", _payloadsJSONPath, sectionJSONDocument);
|
||||||
|
JsonPath theSectionPolycJsonPath = JsonPath.compile(_payloadsJSONPath);
|
||||||
|
Object _payloads = theSectionPolycJsonPath.read(sectionJSONDocument, configuration).toString();
|
||||||
|
|
||||||
|
if (_payloads instanceof String) {
|
||||||
|
String toStringPayloads = (String) _payloads;
|
||||||
|
LOG.trace("The _payloads is a String {}", toStringPayloads);
|
||||||
|
JSONArray jsonArray = new JSONArray(toStringPayloads);
|
||||||
|
for (int i = 0; i < jsonArray.length(); i++) {
|
||||||
|
Payload payloadDV = Serialization.read(jsonArray.getJSONObject(i).toString(), Payload.class);
|
||||||
|
listPayloads.add(payloadDV);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.info("returning list of payloads {}", listPayloads);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Error on reading the JSON Path {} in the doc {} ", _payloadsJSONPath, sectionJSONDocument);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return listPayloads;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is accessible section according to policy.
|
||||||
|
*
|
||||||
|
* @param section the section
|
||||||
|
* @param sectionJSONPath the section JSON path
|
||||||
|
* @param myLogin the my login
|
||||||
|
* @return true, if is accessible section according to policy
|
||||||
|
*/
|
||||||
|
private boolean isAccessibleSectionAccordingToPolicy(Document section, String sectionJSONPath, String myLogin) {
|
||||||
|
LOG.debug("isAccessibleSectionAccordingToPolicy called");
|
||||||
|
boolean isAccessible = true;
|
||||||
|
|
||||||
|
// Skipping the root, going to check the access_policy of subsections
|
||||||
|
if (sectionJSONPath.compareTo(JSON_$_POINTER) != 0) {
|
||||||
|
isAccessible = checkAccessPolicy(section.toJson(), myLogin);
|
||||||
|
}
|
||||||
|
|
||||||
|
return isAccessible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check access policy.
|
||||||
|
*
|
||||||
|
* @param sectionDocumentJSON the section document JSON
|
||||||
|
* @param myLogin the my login
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
|
private boolean checkAccessPolicy(String sectionDocumentJSON, String myLogin) {
|
||||||
|
LOG.debug("checkAccessPolicy called");
|
||||||
|
// CHECKING THE POLICY
|
||||||
|
String accessPolicyPath = JSON_$_POINTER + "._access._policy";
|
||||||
|
boolean isAccessible = true;
|
||||||
|
try {
|
||||||
|
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
|
||||||
|
.jsonProvider(new JsonOrgJsonProvider()).build();
|
||||||
|
|
||||||
|
LOG.info("Reading access policy at {} into section document {}", accessPolicyPath, sectionDocumentJSON);
|
||||||
|
JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath);
|
||||||
|
String _policy = theSectionPolycJsonPath.read(sectionDocumentJSON, configuration).toString();
|
||||||
|
LOG.info("The section {} has policy {}", accessPolicyPath, _policy);
|
||||||
|
isAccessible = GeportalCheckAccessPolicy.isAccessible(_policy, myLogin);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error(accessPolicyPath + " not found. Check OK");
|
||||||
|
}
|
||||||
|
LOG.info("Is the section {} accessible? {}", sectionDocumentJSON, isAccessible);
|
||||||
|
return isAccessible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty print JSON.
|
||||||
|
*
|
||||||
|
* @param jsonString the json string
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
private String prettyPrintJSON(String jsonString) {
|
||||||
|
|
||||||
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
|
JsonObject jsonObject = new JsonParser().parse(jsonString).getAsJsonObject();
|
||||||
|
return gson.toJson(jsonObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize document value.
|
||||||
|
*
|
||||||
|
* @param toDoc the to doc
|
||||||
|
* @param fieldLabel the field label
|
||||||
|
* @param theObjectFieldValue the the object field value
|
||||||
|
* @return the document
|
||||||
|
*/
|
||||||
|
private Document sanitizeDocumentValue(Document toDoc, String fieldLabel, Object theObjectFieldValue) {
|
||||||
|
|
||||||
|
if (theObjectFieldValue != null) {
|
||||||
|
if (theObjectFieldValue instanceof String) {
|
||||||
|
String toString = (String) theObjectFieldValue;
|
||||||
|
if (toString != null && !toString.isEmpty()) {
|
||||||
|
toDoc.append(fieldLabel, theObjectFieldValue);
|
||||||
|
} else {
|
||||||
|
LOG.debug("Skipping String field " + fieldLabel + " its value is null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (theObjectFieldValue instanceof ArrayList) {
|
||||||
|
ArrayList toArrayList = (ArrayList) theObjectFieldValue;
|
||||||
|
if (toArrayList != null && !toArrayList.isEmpty()) {
|
||||||
|
toDoc.append(fieldLabel, theObjectFieldValue);
|
||||||
|
} else {
|
||||||
|
LOG.debug("Skipping ArrayList field " + fieldLabel + " its value is null or empty");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
toDoc.append(fieldLabel, theObjectFieldValue);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
LOG.debug("Skipping field " + fieldLabel + " its value is null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
return toDoc;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,66 +1,66 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
//package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
||||||
|
//
|
||||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
//import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
//
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
//import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
//import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
import org.slf4j.Logger;
|
//import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
//import org.slf4j.LoggerFactory;
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* The Class ConcessioniMongoService.
|
// * The Class ConcessioniMongoService.
|
||||||
*
|
// *
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
// *
|
||||||
* Sep 23, 2021
|
// * Sep 23, 2021
|
||||||
*/
|
// */
|
||||||
public class ConcessioniMongoService {
|
//public class ConcessioniMongoService {
|
||||||
|
//
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoService.class);
|
// private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoService.class);
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Instantiates a new concessioni mongo service.
|
// * Instantiates a new concessioni mongo service.
|
||||||
*/
|
// */
|
||||||
protected ConcessioniMongoService() {
|
// protected ConcessioniMongoService() {
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Gets the item by id.
|
// * Gets the item by id.
|
||||||
*
|
// *
|
||||||
* @param mongoItemId the mongo item id
|
// * @param mongoItemId the mongo item id
|
||||||
* @return the item by id
|
// * @return the item by id
|
||||||
* @throws Exception the exception
|
// * @throws Exception the exception
|
||||||
*/
|
// */
|
||||||
protected Concessione getItemById(String mongoItemId) throws Exception {
|
// protected Concessione getItemById(String mongoItemId) throws Exception {
|
||||||
LOG.info("called getItemById: " + mongoItemId);
|
// LOG.info("called getItemById: " + mongoItemId);
|
||||||
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
||||||
// Returning item by Id
|
// // Returning item by Id
|
||||||
return concessioniManager.getById(mongoItemId);
|
// return concessioniManager.getById(mongoItemId);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* To concessione.
|
// * To concessione.
|
||||||
*
|
// *
|
||||||
* @param jsonString the json string
|
// * @param jsonString the json string
|
||||||
* @return the concessione
|
// * @return the concessione
|
||||||
*/
|
// */
|
||||||
protected Concessione toConcessione(String jsonString) {
|
// protected Concessione toConcessione(String jsonString) {
|
||||||
LOG.info("toConcessione called");
|
// LOG.info("toConcessione called");
|
||||||
try {
|
// try {
|
||||||
return org.gcube.application.geoportal.client.utils.Serialization.read(jsonString, Concessione.class);
|
// return org.gcube.application.geoportal.client.utils.Serialization.read(jsonString, Concessione.class);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
LOG.warn("Error on serializing: ", e);
|
// LOG.warn("Error on serializing: ", e);
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/*
|
// /*
|
||||||
* For testing public Concessione iamClientGetItemBy(HttpServletRequest request,
|
// * For testing public Concessione iamClientGetItemBy(HttpServletRequest request,
|
||||||
* String mongoItemId, String clientId, String secret) throws Exception { String
|
// * String mongoItemId, String clientId, String secret) throws Exception { String
|
||||||
* scope = SessionUtil.getCurrentContext(request, true); return
|
// * scope = SessionUtil.getCurrentContext(request, true); return
|
||||||
* iamClientGetItemBy(scope, mongoItemId, clientId, secret); }
|
// * iamClientGetItemBy(scope, mongoItemId, clientId, secret); }
|
||||||
*/
|
// */
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
||||||
import org.gcube.common.portal.PortalContext;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.GcubeIdentity;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientIdentity;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.UserIdentity;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class ConcessioniMongoServiceIdentityProxy.
|
|
||||||
*
|
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
|
||||||
* Sep 23, 2021
|
|
||||||
*/
|
|
||||||
public class ConcessioniMongoServiceIdentityProxy {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoServiceIdentityProxy.class);
|
|
||||||
|
|
||||||
private GcubeIdentity gCubeIdentity;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new concessioni mongo service proxy.
|
|
||||||
*
|
|
||||||
* @param request the request
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
public ConcessioniMongoServiceIdentityProxy(HttpServletRequest request) throws Exception {
|
|
||||||
SessionUtil.getCurrentContext(request, true);
|
|
||||||
PortalContext pContext = PortalContext.getConfiguration();
|
|
||||||
String username = null;
|
|
||||||
try {
|
|
||||||
username = pContext.getCurrentUser(request).getUsername();
|
|
||||||
if(username==null || username.isEmpty())
|
|
||||||
throw new Exception("Invalid username");
|
|
||||||
}catch (Exception e) {
|
|
||||||
LOG.info("Username not detected in session");
|
|
||||||
username = null; //to be sure that is null and not empty string
|
|
||||||
}
|
|
||||||
if (username != null) {
|
|
||||||
LOG.info("User detected, using its identity");
|
|
||||||
gCubeIdentity = new UserIdentity();
|
|
||||||
} else {
|
|
||||||
LOG.info("User not detected, using IAM Client identity");
|
|
||||||
gCubeIdentity = new IAMClientIdentity();
|
|
||||||
}
|
|
||||||
|
|
||||||
gCubeIdentity.setIdentity(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the item by id.
|
|
||||||
*
|
|
||||||
* @param mongoItemId the mongo item id
|
|
||||||
* @return the item by id
|
|
||||||
* @throws Exception the exception
|
|
||||||
*/
|
|
||||||
public Concessione getItemById(String mongoItemId) throws Exception {
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Obtain the client
|
|
||||||
ConcessioniMongoService concessioniManager = new ConcessioniMongoService();
|
|
||||||
// Returning item by Id
|
|
||||||
return concessioniManager.getItemById(mongoItemId);
|
|
||||||
}catch(Exception e) {
|
|
||||||
LOG.error("Error on reading itemById: "+mongoItemId, e);
|
|
||||||
throw(e);
|
|
||||||
}finally {
|
|
||||||
gCubeIdentity.resetIdentity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,82 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
|
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
import org.gcube.common.portal.PortalContext;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.GcubeIdentity;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientIdentity;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.UserIdentity;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GeoportalServiceIdentityProxy.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 23, 2021
|
||||||
|
*/
|
||||||
|
public class GeoportalServiceIdentityProxy {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalServiceIdentityProxy.class);
|
||||||
|
|
||||||
|
private GcubeIdentity gCubeIdentity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new concessioni mongo service proxy.
|
||||||
|
*
|
||||||
|
* @param request the request
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public GeoportalServiceIdentityProxy(HttpServletRequest request) throws Exception {
|
||||||
|
SessionUtil.getCurrentContext(request, true);
|
||||||
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
|
String username = null;
|
||||||
|
try {
|
||||||
|
username = pContext.getCurrentUser(request).getUsername();
|
||||||
|
if (username == null || username.isEmpty())
|
||||||
|
throw new Exception("Invalid username");
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.info("Username not detected in session");
|
||||||
|
username = null; // to be sure that is null and not empty string
|
||||||
|
}
|
||||||
|
if (username != null) {
|
||||||
|
LOG.info("User detected, using its identity");
|
||||||
|
gCubeIdentity = new UserIdentity();
|
||||||
|
} else {
|
||||||
|
LOG.info("User not detected, using IAM Client identity");
|
||||||
|
gCubeIdentity = new IAMClientIdentity();
|
||||||
|
}
|
||||||
|
|
||||||
|
gCubeIdentity.setIdentity(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the project by ID.
|
||||||
|
*
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @param projectID the project ID
|
||||||
|
* @return the project by ID
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
public ProjectDV getProjectByID(String profileID, String projectID) throws Exception {
|
||||||
|
ProjectsCaller clientPrj = GeoportalClientCaller.projects();
|
||||||
|
Project theProject = clientPrj.getProjectByID(profileID, projectID);
|
||||||
|
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
||||||
|
return ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
||||||
|
/*
|
||||||
|
* try { // Obtain the client ConcessioniMongoService concessioniManager = new
|
||||||
|
* ConcessioniMongoService(); // Returning item by Id return
|
||||||
|
* concessioniManager.getItemById(mongoItemId); }catch(Exception e) {
|
||||||
|
* LOG.error("Error on reading itemById: "+mongoItemId, e); throw(e); }finally {
|
||||||
|
* gCubeIdentity.resetIdentity(); }
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,21 +3,19 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
|
||||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.GNABaseMapsResourceReader;
|
import org.gcube.portlets.user.geoportaldataviewer.server.GNABaseMapsResourceReader;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.GcubeProfilesMetadataForUCD;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
import org.gcube.portlets.user.urlshortener.UrlShortener;
|
||||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||||
|
@ -39,6 +37,8 @@ import com.liferay.portal.service.UserLocalServiceUtil;
|
||||||
* Oct 20, 2020
|
* Oct 20, 2020
|
||||||
*/
|
*/
|
||||||
public class SessionUtil {
|
public class SessionUtil {
|
||||||
|
|
||||||
|
private static final String MAP_UCD_ID_TO_GCUBE_PROFILES = "MAP_UCD_ID_TO_GCUBE_PROFILES";
|
||||||
|
|
||||||
/** The log. */
|
/** The log. */
|
||||||
private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
|
private static Logger LOG = LoggerFactory.getLogger(SessionUtil.class);
|
||||||
|
@ -181,6 +181,24 @@ public class SessionUtil {
|
||||||
|
|
||||||
return shortener;
|
return shortener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> getMap_UCDId_gCubeProfiles(
|
||||||
|
HttpServletRequest httpServletRequest, String profileID) {
|
||||||
|
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
return (LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>>) session
|
||||||
|
.getAttribute(MAP_UCD_ID_TO_GCUBE_PROFILES +"_"+profileID);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setMap_UCDId_gCubeProfiles(HttpServletRequest httpServletRequest,
|
||||||
|
String profileID, LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> map) {
|
||||||
|
|
||||||
|
HttpSession session = httpServletRequest.getSession();
|
||||||
|
session.setAttribute(MAP_UCD_ID_TO_GCUBE_PROFILES +"_"+profileID, map);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the GNA base maps.
|
* Gets the GNA base maps.
|
||||||
|
@ -218,7 +236,8 @@ public class SessionUtil {
|
||||||
boolean reloadFromService) throws Exception {
|
boolean reloadFromService) throws Exception {
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||||
|
throw new Exception("getListConcessioni must be revisited!!!!");
|
||||||
|
/*
|
||||||
// setting null to force reloading from service
|
// setting null to force reloading from service
|
||||||
if (reloadFromService)
|
if (reloadFromService)
|
||||||
listOfConcessioni = null;
|
listOfConcessioni = null;
|
||||||
|
@ -241,11 +260,14 @@ public class SessionUtil {
|
||||||
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
||||||
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
||||||
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
||||||
|
|
||||||
} else
|
} else
|
||||||
LOG.info("list of concessioni presents in session, using it");
|
LOG.info("list of concessioni presents in session, using it");
|
||||||
|
|
||||||
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||||
return listOfConcessioni;
|
return listOfConcessioni;
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -510,4 +510,21 @@ body {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.my-html-table {
|
||||||
|
padding: 5px;
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-html-table td {
|
||||||
|
padding: 5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-html-table td:first-child {
|
||||||
|
color: gray;
|
||||||
|
padding-right: 15px;
|
||||||
|
width: 120px;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<web-app 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
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||||
version="3.0">
|
version="3.0">
|
||||||
|
@ -15,9 +16,25 @@
|
||||||
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl</servlet-class>
|
<servlet-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>mpformbuilderServlet</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderServiceImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>mpformbuilderServlet</servlet-name>
|
||||||
|
<url-pattern>/GeoportalDataViewer/mpformbuilderservice</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>geoportalDataViewerServlet</servlet-name>
|
<servlet-name>geoportalDataViewerServlet</servlet-name>
|
||||||
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
|
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerHttpSessionListener</listener-class>
|
||||||
|
</listener>
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer;
|
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.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
|
||||||
|
@ -27,7 +21,7 @@ public class ConcessioneReader {
|
||||||
public void readConcessione() throws Exception {
|
public void readConcessione() throws Exception {
|
||||||
System.out.println("getConcessioneForId " + mongoConcessioneID + "called");
|
System.out.println("getConcessioneForId " + mongoConcessioneID + "called");
|
||||||
|
|
||||||
ConcessioneDV concessionDV = null;
|
/*ConcessioneDV concessionDV = null;
|
||||||
|
|
||||||
if (mongoConcessioneID == null)
|
if (mongoConcessioneID == null)
|
||||||
throw new Exception("Invalid parameter. The Id is null");
|
throw new Exception("Invalid parameter. The Id is null");
|
||||||
|
@ -54,7 +48,7 @@ public class ConcessioneReader {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String erroMsg = Concessione.class.getSimpleName() + " with id " + mongoConcessioneID + " not available";
|
String erroMsg = Concessione.class.getSimpleName() + " with id " + mongoConcessioneID + " not available";
|
||||||
throw new Exception(erroMsg);
|
throw new Exception(erroMsg);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class IAMClient {
|
||||||
System.out.println("Read credentials: " + credentials);
|
System.out.println("Read credentials: " + credentials);
|
||||||
Concessione concessione;
|
Concessione concessione;
|
||||||
try {
|
try {
|
||||||
// concessione = new ConcessioniMongoServiceIdentityProxy();
|
// concessione = new GeoportalServiceIdentityProxy();
|
||||||
|
|
||||||
// System.out.println("Get concessione: " + concessione);
|
// System.out.println("Get concessione: " + concessione);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue