animated_map #10

Merged
francesco.mangiacrapa merged 7 commits from animated_map into master 2023-01-12 11:40:23 +01:00
21 changed files with 995 additions and 532 deletions

View File

@ -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-3.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/geoportal-data-viewer-app-3.1.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-3.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.1.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-3.0.1-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-viewer-app-3.1.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -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-3.0.1-SNAPSHOT lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.1.0-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -36,7 +36,13 @@
<wb-module deploy-name="geoportal-data-viewer-app-3.0.1-SNAPSHOT">
<wb-module deploy-name="geoportal-data-viewer-app-3.1.0-SNAPSHOT">
@ -94,6 +100,9 @@
@ -132,6 +141,9 @@
@ -170,6 +182,9 @@
@ -208,6 +223,9 @@
@ -228,6 +246,15 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.0.1.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -284,6 +311,9 @@
@ -322,6 +352,9 @@
@ -360,6 +393,9 @@

View File

@ -4,14 +4,17 @@
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.1] - 2022-12-21 ## [v3.1.0-SNAPSHOT] - 2023-01-11
#### Enhancement #### Enhancement
- [#24300] Improved the GUI of the search functionality when multiple collections are available. - [#24300] Improved the GUI of the search functionality when multiple collections are available
- [#24404] Improved the handlers of events: Search, Locate
- Improved the user experience providing an animated map and zoom to layers facility
#### Fixes #### Fixes
- Reduced the BBOX when resolving a project by share link - Reduced the BBOX when resolving a project by share link
- GNA Project binding with automatically adding of the layers to Map - GNA Project binding with automatically adding of the layers to Map
- [#24390] Read the access policy from the fileset json section
## [v3.0.0] - 2022-11-28 ## [v3.0.0] - 2022-11-28

View File

@ -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>3.0.1</version> <version>3.1.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 Geoportal projects/documents by a Web-Map Interface</description> <description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>

View File

@ -6,7 +6,6 @@ import java.util.Set;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView; import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
@ -31,9 +30,10 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroidEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroidEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE; import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEventHandler;
@ -246,7 +246,8 @@ public class GeoportalDataViewer implements EntryPoint {
} }
GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID, GeoportalItemReferences gir = new GeoportalItemReferences(paramGeonaItemID,
paramGeonaItemType); paramGeonaItemType);
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, true)); applicationBus.fireEvent(
new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_ON_INIT));
} }
mainPanel.openCollectionMenu(); mainPanel.openCollectionMenu();
@ -388,8 +389,15 @@ public class GeoportalDataViewer implements EntryPoint {
boolean found = false; boolean found = false;
GWT.log("Product with id: " + projectID + " found? " + found); GWT.log("Product with id: " + projectID + " found? " + found);
if (!showDetailsEvent.isEventFromTimeline()) final EVENT_SOURCE sourceEvent = showDetailsEvent.getSourceEvent();
if (!sourceEvent.equals(EVENT_SOURCE.LOCATE_FROM_TIMELINE)) {
timelineMS.hideTimelineProjectRelations(); timelineMS.hideTimelineProjectRelations();
}
if (sourceEvent.equals(EVENT_SOURCE.LOCATE_SEARCHED)) {
layerManager.removeAllDetailLayers();
}
GeoportalDataViewerServiceAsync.Util.getInstance().getProjectViewForId(profileID, projectID, GeoportalDataViewerServiceAsync.Util.getInstance().getProjectViewForId(profileID, projectID,
new AsyncCallback<ProjectView>() { new AsyncCallback<ProjectView>() {
@ -412,6 +420,25 @@ public class GeoportalDataViewer implements EntryPoint {
GWT.log("LoadTimelineRelationships is true and the project has Relationships"); GWT.log("LoadTimelineRelationships is true and the project has Relationships");
timelineMS.showTimelineProjectRelations(result.getTheProjectDV(), false); timelineMS.showTimelineProjectRelations(result.getTheProjectDV(), false);
} }
if (sourceEvent != null) {
switch (sourceEvent) {
case LOCATE_FROM_TIMELINE:
case LOCATE_SEARCHED: {
applicationBus.fireEvent(new ShowPopupOnCentroidEvent(result));
break;
}
case LOCATE_ON_INIT: {
applicationBus.fireEvent(new ShowPopupOnCentroidEvent(result));
layerManager.fireGoToLayers();
break;
}
default:
break;
}
}
} }
}); });
@ -426,63 +453,6 @@ public class GeoportalDataViewer implements EntryPoint {
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: " GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "
+ addedLayerToMapEvent.getLayerType()); + addedLayerToMapEvent.getLayerType());
try {
attempt = 0;
if (paramGeonaItemID != null && initApplication) { // waiting for record retrieved by service before
// calling the WFS
// forcing once at init time
initApplication = false;
final int MAX_RETRY = 15;
Timer timer = new com.google.gwt.user.client.Timer() {
@Override
public void run() {
attempt++;
GWT.log("waiting get record: " + attempt);
ProjectView record = mainPanel.getDisplayedProject();
if (record != null) {
this.cancel();
GWT.log("cancelled timer");
GeoJSON spatialReference = record.getTheProjectDV().getSpatialReference();
if (spatialReference == null) {
GWT.log("No spatial reference found, cancelling timer");
this.cancel();
}
try {
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
spatialReference.getBbox().getMinY(),
spatialReference.getBbox().getMaxX(),
spatialReference.getBbox().getMaxY());
Coordinate centerCoordinate = ew.getCenter();
performWFSQueryOnCentroid(record.getTheProjectDV().getId(),
centerCoordinate.getX(), centerCoordinate.getY());
} catch (Exception e) {
GWT.log("Error on calculating center of the extent " + e.getMessage());
}
}
if (attempt > MAX_RETRY) {
GWT.log("MAX_RETRY reached, cancelled timer");
this.cancel();
}
}
};
timer.scheduleRepeating(1000);
}
} catch (Exception e) {
// TODO: handle exception
}
LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType(); LAYER_TYPE layerType = addedLayerToMapEvent.getLayerType();
if (layerType != null) { if (layerType != null) {
@ -617,18 +587,23 @@ public class GeoportalDataViewer implements EntryPoint {
} }
}); });
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() { applicationBus.addHandler(ShowPopupOnCentroidEvent.TYPE, new ShowPopupOnCentroidEventHandler() {
@Override @Override
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) { public void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent) {
GWT.log("ShowPopupOnCentroidEvent: " + showPopupOnCentroiEvent);
//Showing popup after clicking on map
if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) { if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) {
GWT.log("ShowPopupOnCentroiEvent: " + showPopupOnCentroiEvent);
Coordinate transfCoord = MapUtils Coordinate transfCoord = MapUtils
.geoJSONTToBBoxCenter(showPopupOnCentroiEvent.getSpatialReference(), null, null); .geoJSONTToBBoxCenter(showPopupOnCentroiEvent.getSpatialReference(), null, null);
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getProjectID(), transfCoord.getX(), performWFSQueryOnCentroid(showPopupOnCentroiEvent.getProjectID(), transfCoord.getX(),
transfCoord.getY()); transfCoord.getY());
//Showing popup after locate on Map
}else if(showPopupOnCentroiEvent.getProjectView()!=null) {
layerManager.showPopupInfoForCentroidLayer(showPopupOnCentroiEvent.getProjectView());
} }
} }

View File

@ -73,10 +73,6 @@ public class GeoportalDataViewerConstants {
} }
public enum RECORD_TYPE {
CONCESSIONE
}
public static final double ITALY_CENTER_LONG = 12.45; public static final double ITALY_CENTER_LONG = 12.45;
public static final double ITALY_CENTER_LAT = 42.98; public static final double ITALY_CENTER_LAT = 42.98;

View File

@ -11,11 +11,16 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
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.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
@ -25,6 +30,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMap
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler; import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped; import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
@ -52,6 +58,7 @@ import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.dom.client.Style.Visibility;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.event.shared.HandlerManager;
@ -62,6 +69,7 @@ import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Event; import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.EventListener; import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.Random; import com.google.gwt.user.client.Random;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.FlexTable;
@ -190,14 +198,24 @@ public class LayerManager {
@Override @Override
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) { public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size()); if (listGeonaDataObjects == null)
if (listGeonaDataObjects == null || listGeonaDataObjects.isEmpty())
return; return;
List<FeatureRow> theFeatures = null; GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
MapEventType sourceEvent = queryEvent.getSourceMapEventType(); MapEventType sourceEvent = queryEvent.getSourceMapEventType();
GWT.log("sourceEvent is: " + sourceEvent);
if (sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)
&& (listGeonaDataObjects.size() == 0)) {
// here the centroid is not available
// GeoportalDataViewer.showPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
// "No centroid available for the selected project",
// "Project without a centroid");
olMap.setCenter(queryEvent.getQueryClickExtent().getCenter());
return;
}
List<FeatureRow> theFeatures = null;
// TODO SWTCH FOR EARCH ITEM TYPE // TODO SWTCH FOR EARCH ITEM TYPE
for (final GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) { for (final GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
@ -249,6 +267,12 @@ public class LayerManager {
// list of // list of
// FeatureRow // FeatureRow
if (theFeatures == null || theFeatures.isEmpty()) { if (theFeatures == null || theFeatures.isEmpty()) {
// means that another version of the project has been passed without
// features
// stored into centroid layers.
// so centering the map on the centroid passed into query and stored
// into project metadata
olMap.setCenter(queryEvent.getQueryClickExtent().getCenter());
return; return;
} }
} }
@ -407,7 +431,7 @@ public class LayerManager {
String productId = productIds.get(0); String productId = productIds.get(0);
LayerObjectType layerObjectType = layerObject.getType(); LayerObjectType layerObjectType = layerObject.getType();
return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null, return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null,
layerObject.getProfileID(), productId, fRow, true); layerObject.getProfileID(), productId, fRow, true, EVENT_SOURCE.OPEN_DETAILS);
} }
return null; return null;
@ -456,6 +480,7 @@ public class LayerManager {
* @param profileID the profile ID * @param profileID the profile ID
* @param projectID the project ID * @param projectID the project ID
* @param projectDV the project DV * @param projectDV the project DV
* @param notifyLayerAlreadyAdded the notify layer already added
*/ */
private void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName, private void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID, final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
@ -498,9 +523,9 @@ public class LayerManager {
lo.setProfileID(profileID); lo.setProfileID(profileID);
lo.setProjectDV(projectDV); lo.setProjectDV(projectDV);
GWT.log("LayerObject ID is: "+lo.getProjectID()); GWT.log("LayerObject ID is: " + lo.getProjectID());
if(lo.getProjectDV()!=null) if (lo.getProjectDV() != null)
GWT.log("LayerObject into ProjectDV is: "+lo.getProjectDV().getId()); GWT.log("LayerObject into ProjectDV is: " + lo.getProjectDV().getId());
String layerNameKey = layerItem.getName(); String layerNameKey = layerItem.getName();
@ -544,10 +569,16 @@ public class LayerManager {
}); });
} }
/**
* Sets the CQL for layer to index layer.
*
* @param layerName the layer name
* @param cqlFilter the cql filter
*/
public void setCQLForLayerToIndexLayer(String layerName, String cqlFilter) { public void setCQLForLayerToIndexLayer(String layerName, String cqlFilter) {
LayerObject theLo = mapIndexLayerObjects.get(layerName); LayerObject theLo = mapIndexLayerObjects.get(layerName);
if(theLo!=null) { if (theLo != null) {
boolean isCQLFilter = cqlFilter!=null; boolean isCQLFilter = cqlFilter != null;
theLo.getLayerItem().setCqlFilter(cqlFilter); theLo.getLayerItem().setCqlFilter(cqlFilter);
theLo.getLayerItem().setCqlFilterAvailable(isCQLFilter); theLo.getLayerItem().setCqlFilterAvailable(isCQLFilter);
@ -559,7 +590,6 @@ public class LayerManager {
* *
* @param layer the layer * @param layer the layer
* @param profileID the profile ID * @param profileID the profile ID
* @param projectDV the project DV
*/ */
public void addIndexLayer(IndexLayerDV layer, String profileID) { public void addIndexLayer(IndexLayerDV layer, String profileID) {
GWT.log("Adding index layer: " + layer); GWT.log("Adding index layer: " + layer);
@ -570,6 +600,11 @@ public class LayerManager {
} }
/**
* Removes the index layer.
*
* @param layer the layer
*/
public void removeIndexLayer(IndexLayerDV layer) { public void removeIndexLayer(IndexLayerDV layer) {
String wmsLink = layer.getLayer().getOgcLinks().get("wms"); String wmsLink = layer.getLayer().getOgcLinks().get("wms");
@ -794,8 +829,9 @@ public class LayerManager {
@Override @Override
public void onBrowserEvent(Event event) { public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) { if (Event.ONCLICK == event.getTypeInt()) {
applicationBus.fireEvent(new ShowDetailsEvent(lo.getType().name(), applicationBus.fireEvent(
lo.getProfileID(), newProjectID, null, true)); new ShowDetailsEvent(lo.getType().name(), lo.getProfileID(),
newProjectID, null, true, EVENT_SOURCE.OPEN_PROJECTS));
} }
} }
@ -875,13 +911,215 @@ public class LayerManager {
/** /**
* Show popup info for centroid layer. * Show popup info for centroid layer.
* *
* @param projectView the project view
*/
public void showPopupInfoForCentroidLayer(ProjectView projectView) {
GWT.log("showPopupInfoForCentroidLayer for projectView: " + projectView);
FlexTable flex = new FlexTable();
flex.setCellPadding(1);
flex.setCellSpacing(1);
flex.getElement().addClassName("popup-table");
VerticalPanel vpPanel = new VerticalPanel();
vpPanel.add(flex);
final ProjectDV projectDV = projectView.getTheProjectDV();
FlexTable intFlex = new FlexTable();
intFlex.setCellPadding(1);
intFlex.setCellSpacing(1);
if (projectDV.getTheDocument() != null) {
LinkedHashMap<String, Object> map = projectDV.getTheDocument().getDocumentAsMap();
// my-html-table
// intFlex.getElement().addClassName("my-html-table");
int i = 0;
for (String key : map.keySet()) {
try {
Object theValue = map.get(key);
String toStringValue = theValue + "";
// intFlex.setHTML(i, 0, key);
intFlex.setHTML(intFlex.getRowCount() + 1, 0, "<span title='" + toStringValue + "'>"
+ StringUtil.ellipsize(toStringValue, 100) + "</span>");
i++;
// showing the first two fields returned into document
if (i == 2)
break;
} catch (Exception e) {
// TODO: handle exception
}
}
flex.setHTML(flex.getRowCount() + 1, 0, intFlex.getElement().getString());
}
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
}
List<SectionView> selections = projectView.getListSections();
boolean firstImageFound = false;
for (SectionView sectionView : selections) {
List<SubDocumentView> subDocuments = sectionView.getListSubDocuments();
for (SubDocumentView subDoc : subDocuments) {
List<FilesetDV> images = subDoc.getListImages();
if (images != null && images.size() > 0) {
for (FilesetDV fileset : images) {
List<PayloadDV> payloads = fileset.getListPayload();
if (payloads != null && payloads.size() > 0) {
PayloadDV img = payloads.get(0);
if (img != null && img.getLink() != null) {
String theImgHTML = "<img src=\"" + img.getLink() + "\"></img>";
GWT.log("theImgHTML: " + theImgHTML);
flex.setHTML(flex.getRowCount() + 1, 0, theImgHTML);
firstImageFound = true;
break;
}
}
}
}
if (firstImageFound)
break;
}
if (firstImageFound)
break;
}
Button buttonOpenDtl = new Button("Open Details");
buttonOpenDtl.getElement().setId("open-details");
buttonOpenDtl.setType(ButtonType.LINK);
buttonOpenDtl.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("Open Details clicked");
ShowDetailsEvent toEvent = new ShowDetailsEvent(LayerObjectType.INDEX_LAYER.name(),
projectDV.getProfileID(), projectDV.getId(), null, true, EVENT_SOURCE.OPEN_DETAILS);
applicationBus.fireEvent(toEvent);
}
});
final Button buttonViewLayers = new Button("Zoom to Layers");
buttonViewLayers.getElement().setId("go-to-layers");
buttonViewLayers.getElement().setTitle("Zoom to Layers");
buttonViewLayers.setType(ButtonType.LINK);
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
buttonViewLayers.setVisible(false);
}
buttonViewLayers.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("View Layers clicked");
fireGoToLayers();
buttonViewLayers.setVisible(false);
}
});
FlowPanel flow = new FlowPanel();
flow.add(buttonOpenDtl);
flow.add(buttonViewLayers);
vpPanel.add(flow);
Coordinate positionTo = null;
GeoJSON spatialReference = projectDV.getSpatialReference();
if (spatialReference == null) {
return;
}
try {
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
spatialReference.getBbox().getMinY(), spatialReference.getBbox().getMaxX(),
spatialReference.getBbox().getMaxY());
positionTo = MapUtils.transformCoordiante(ew.getCenter(), MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
} catch (Exception e) {
GWT.log("Error on calculating center of the extent " + e.getMessage());
}
// fallback
if (positionTo == null)
return;
final Coordinate centerTo = positionTo;
new Timer() {
@Override
public void run() {
olMap.showPopup(vpPanel.toString(), centerTo);
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Element buttonElement = DOM.getElementById("open-details");
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
ShowDetailsEvent toEvent = new ShowDetailsEvent(LayerObjectType.INDEX_LAYER.name(),
projectDV.getProfileID(), projectDV.getId(), null, true,
EVENT_SOURCE.OPEN_DETAILS);
applicationBus.fireEvent(toEvent);
}
}
});
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Element buttonElement = DOM.getElementById("go-to-layers");
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
// buttonElement.setAttribute("visible", "none");
// buttonElement.getStyle().setVisibility(Visibility.HIDDEN);
fireGoToLayers();
}
}
});
}
});
}
}.schedule(OpenLayerMap.SET_CENTER_ANIMATED_DURATION + 100);
olMap.setCenter(centerTo);
}
/**
* Show popup info for centroid layer after clicking on map
*
* @param geoNaDataObject the geo na data object * @param geoNaDataObject the geo na data object
* @param feature the feature * @param feature the feature
* @param onFailureCenterTo the on failure center to * @param onFailureCenterTo the on failure center to
*/ */
public void showPopupInfoForCentroidLayer(GeoNaSpatialQueryResult geoNaDataObject, FeatureRow feature, public void showPopupInfoForCentroidLayer(GeoNaSpatialQueryResult geoNaDataObject, FeatureRow feature,
Coordinate onFailureCenterTo) { Coordinate onFailureCenterTo) {
GWT.log("showPopupInfoForCentroidLayer showing feature: " + feature); GWT.log("showPopupInfoForCentroidLayer showing feature: " + feature);
GWT.log("showPopupInfoForCentroidLayer showing layerObject: " + geoNaDataObject.getSourceLayerObject()); GWT.log("showPopupInfoForCentroidLayer showing layerObject: " + geoNaDataObject.getSourceLayerObject());
@ -892,12 +1130,6 @@ public class LayerManager {
VerticalPanel vpPanel = new VerticalPanel(); VerticalPanel vpPanel = new VerticalPanel();
vpPanel.add(flex); vpPanel.add(flex);
if (feature == null) {
flex.setHTML(0, 0, new HTML("No data available").toString());
olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
return;
}
ProjectDV projectDV = geoNaDataObject.getSourceLayerObject().getProjectDV(); ProjectDV projectDV = geoNaDataObject.getSourceLayerObject().getProjectDV();
if (projectDV != null) { if (projectDV != null) {
@ -933,9 +1165,6 @@ public class LayerManager {
} }
} }
// Showing properties belonging to centroid layer, ignoring this
// Map<String, List<String>> entries = feature.getMapProperties();
if (geoNaDataObject.getMapImages() != null) { if (geoNaDataObject.getMapImages() != null) {
for (String key : geoNaDataObject.getMapImages().keySet()) { for (String key : geoNaDataObject.getMapImages().keySet()) {
List<PayloadDV> listUI = geoNaDataObject.getMapImages().get(key); List<PayloadDV> listUI = geoNaDataObject.getMapImages().get(key);
@ -954,27 +1183,51 @@ public class LayerManager {
} }
GWT.log("The selected Feature is: " + feature); GWT.log("The selected Feature is: " + feature);
// GeoportalDataViewerConstants.print("The selected Feature is: "+feature);
FeatureRow theFeature = feature; FeatureRow theFeature = feature;
Button button = new Button("Open Details"); Button buttonOpenDtl = new Button("Open Details");
button.getElement().setId("open-details"); buttonOpenDtl.getElement().setId("open-details");
button.setType(ButtonType.LINK); buttonOpenDtl.setType(ButtonType.LINK);
if (button != null) { buttonOpenDtl.addClickHandler(new ClickHandler() {
vpPanel.add(button);
button.setType(ButtonType.LINK);
button.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
ShowDetailsEvent toEvent = parseGeonaReferences(geoNaDataObject.getSourceLayerObject(), theFeature); GWT.log("Open Details clicked");
applicationBus.fireEvent(toEvent); fireOpenDetails(geoNaDataObject.getSourceLayerObject(), theFeature);
} }
}); });
final Button buttonViewLayers = new Button("Zoom to Layers");
buttonViewLayers.getElement().setId("go-to-layers");
buttonViewLayers.getElement().setTitle("Zoom to Layers");
buttonViewLayers.setType(ButtonType.LINK);
if (olMap.getCurrentZoomLevel() >= OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
buttonViewLayers.setVisible(false);
} }
Coordinate centerTo = null; buttonViewLayers.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("View Layers clicked");
fireGoToLayers();
buttonViewLayers.setVisible(false);
}
});
FlowPanel flow = new FlowPanel();
flow.add(buttonOpenDtl);
flow.add(buttonViewLayers);
vpPanel.add(flow);
Coordinate positionTo = null;
if (feature == null) {
positionTo = onFailureCenterTo;
} else {
GWT.log("geometry is: " + feature.getGeometry()); GWT.log("geometry is: " + feature.getGeometry());
if (feature.getGeometry() != null) { if (feature.getGeometry() != null) {
GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject()); GWT.log("trasforming geometry: " + feature.getGeometry().getToJSONObject());
@ -986,28 +1239,29 @@ public class LayerManager {
GWT.log("geometry: is a point"); GWT.log("geometry: is a point");
String coordinateJSON = feature.getGeometry().getCoordinatesJSON(); String coordinateJSON = feature.getGeometry().getCoordinatesJSON();
JSONArray centerJSON = (JSONArray) JSONParser.parseStrict(coordinateJSON); JSONArray centerJSON = (JSONArray) JSONParser.parseStrict(coordinateJSON);
// Coordinate center = OLFactory.createCoordinate(
// new Double(centerJSON.get(0).toString()),
// new Double(centerJSON.get(1).toString()));
Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()), Coordinate center = new Coordinate(new Double(centerJSON.get(0).toString()),
new Double(centerJSON.get(1).toString())); new Double(centerJSON.get(1).toString()));
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) { if (feature.getCrsName() != null
&& feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
center = MapUtils.transformCoordiante(center, MAP_PROJECTION.EPSG_4326.getName(), center = MapUtils.transformCoordiante(center, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName()); MAP_PROJECTION.EPSG_3857.getName());
} }
centerTo = center; positionTo = center;
} else { } else {
Extent geomExtent = geom.getExtent(); Extent geomExtent = geom.getExtent();
Coordinate lower = OLFactory.createCoordinate(geomExtent.getLowerLeftX(), geomExtent.getLowerLeftY()); Coordinate lower = OLFactory.createCoordinate(geomExtent.getLowerLeftX(),
Coordinate upper = OLFactory.createCoordinate(geomExtent.getUpperRightX(), geomExtent.getUpperRightY()); geomExtent.getLowerLeftY());
Coordinate upper = OLFactory.createCoordinate(geomExtent.getUpperRightX(),
geomExtent.getUpperRightY());
Coordinate lowerCoord = lower; Coordinate lowerCoord = lower;
Coordinate upperCoord = upper; Coordinate upperCoord = upper;
if (feature.getCrsName() != null && feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) { if (feature.getCrsName() != null
&& feature.getCrsName().endsWith(MAP_PROJECTION.EPSG_4326.getId())) {
lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(), lowerCoord = MapUtils.transformCoordiante(lower, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName()); MAP_PROJECTION.EPSG_3857.getName());
@ -1018,16 +1272,22 @@ public class LayerManager {
ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(), ExtentWrapped ew = new ExtentWrapped(lowerCoord.getX(), lowerCoord.getY(), upperCoord.getX(),
upperCoord.getY()); upperCoord.getY());
centerTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY()); positionTo = new Coordinate(ew.getCenter().getX(), ew.getCenter().getY());
} }
GWT.log("center is: " + centerTo); GWT.log("positionTo is: " + positionTo);
}
} }
// fallback // fallback
if (centerTo == null) if (positionTo == null)
centerTo = onFailureCenterTo; positionTo = onFailureCenterTo;
final Coordinate centerTo = positionTo;
new Timer() {
@Override
public void run() {
olMap.showPopup(vpPanel.toString(), centerTo); olMap.showPopup(vpPanel.toString(), centerTo);
Scheduler.get().scheduleDeferred(new ScheduledCommand() { Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@ -1041,17 +1301,68 @@ public class LayerManager {
@Override @Override
public void onBrowserEvent(Event event) { public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) { if (Event.ONCLICK == event.getTypeInt()) {
ShowDetailsEvent toEvent = parseGeonaReferences(geoNaDataObject.getSourceLayerObject(), fireOpenDetails(geoNaDataObject.getSourceLayerObject(), theFeature);
theFeature); }
}
});
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
Element buttonElement = DOM.getElementById("go-to-layers");
Event.sinkEvents(buttonElement, Event.ONCLICK);
Event.setEventListener(buttonElement, new EventListener() {
@Override
public void onBrowserEvent(Event event) {
if (Event.ONCLICK == event.getTypeInt()) {
// buttonElement.setAttribute("visible", "none");
// buttonElement.getStyle().setVisibility(Visibility.HIDDEN);
fireGoToLayers();
}
}
});
}
});
}
}.schedule(OpenLayerMap.SET_CENTER_ANIMATED_DURATION + 100);
olMap.setCenter(centerTo);
}
/**
* Fire go to layers.
*/
protected void fireGoToLayers() {
int zoomValue = (int) (OLMapManager.LAYER_DETAIL_MAX_RESOLUTION + 1);
olMap.setZoom(zoomValue);
try {
Element buttonElement = DOM.getElementById("go-to-layers");
buttonElement.getStyle().setVisibility(Visibility.HIDDEN);
} catch (Exception e) {
// TODO: handle exception
}
}
/**
* Fire open details.
*
* @param layerObject the layer object
* @param theFeature the the feature
*/
protected void fireOpenDetails(LayerObject layerObject, FeatureRow theFeature) {
ShowDetailsEvent toEvent = parseGeonaReferences(layerObject, theFeature);
applicationBus.fireEvent(toEvent); applicationBus.fireEvent(toEvent);
} }
}
});
}
});
}
/** /**
* Sets the ol map. * Sets the ol map.

View File

@ -1,83 +1,83 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events; //package org.gcube.portlets.user.geoportaldataviewer.client.events;
//
import org.gcube.application.geoportalcommon.shared.SearchingFilter; //import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.RECORD_TYPE; //import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.RECORD_TYPE;
//
import com.google.gwt.event.shared.GwtEvent; //import com.google.gwt.event.shared.GwtEvent;
//
/** ///**
* The Class GetListOfRecordsEvent. // * The Class GetListOfRecordsEvent.
* // *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it // * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* // *
* Dec 7, 2021 // * Dec 7, 2021
*/ // */
public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler> { //public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler> {
//
/** The type. */ // /** The type. */
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>(); // public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
private RECORD_TYPE recordType; // private RECORD_TYPE recordType;
private SearchingFilter sortFilter; // private SearchingFilter sortFilter;
//
/** // /**
* Instantiates a new cancel upload event. // * Instantiates a new cancel upload event.
* // *
* @param recordType the record type // * @param recordType the record type
* @param sortFilter the sort filter // * @param sortFilter the sort filter
*/ // */
public GetListOfRecordsEvent(RECORD_TYPE recordType, SearchingFilter sortFilter) { // public GetListOfRecordsEvent(RECORD_TYPE recordType, SearchingFilter sortFilter) {
this.recordType = recordType; // this.recordType = recordType;
this.sortFilter = sortFilter; // this.sortFilter = sortFilter;
} // }
//
/** // /**
* Gets the associated type. // * Gets the associated type.
* // *
* @return the associated type // * @return the associated type
*/ // */
/* // /*
* (non-Javadoc) // * (non-Javadoc)
* // *
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() // * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/ // */
@Override // @Override
public Type<GetListOfRecordsEventHandler> getAssociatedType() { // public Type<GetListOfRecordsEventHandler> getAssociatedType() {
return TYPE; // return TYPE;
} // }
//
/** // /**
* Dispatch. // * Dispatch.
* // *
* @param handler the handler // * @param handler the handler
*/ // */
/* // /*
* (non-Javadoc) // * (non-Javadoc)
* // *
* @see // * @see
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared. // * com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
* EventHandler) // * EventHandler)
*/ // */
@Override // @Override
protected void dispatch(GetListOfRecordsEventHandler handler) { // protected void dispatch(GetListOfRecordsEventHandler handler) {
handler.onGetList(this); // handler.onGetList(this);
} // }
//
/** // /**
* Gets the record type. // * Gets the record type.
* // *
* @return the record type // * @return the record type
*/ // */
public RECORD_TYPE getRecordType() { // public RECORD_TYPE getRecordType() {
return recordType; // return recordType;
} // }
//
/** // /**
* Gets the sort filter. // * Gets the sort filter.
* // *
* @return the sort filter // * @return the sort filter
*/ // */
public SearchingFilter getSortFilter() { // public SearchingFilter getSortFilter() {
return sortFilter; // return sortFilter;
} // }
//
} //}

View File

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

View File

@ -21,6 +21,18 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
private String projectID; private String projectID;
private boolean loadTimelineRelationships; private boolean loadTimelineRelationships;
private boolean isEventFromTimeline; private boolean isEventFromTimeline;
private EVENT_SOURCE sourceEvent;
/**
* The Enum EVENT_SOURCE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 22, 2022
*/
public static enum EVENT_SOURCE {
LOCATE_ON_INIT, OPEN_DETAILS, OPEN_PROJECTS, LOCATE_SEARCHED, LOCATE_FROM_TIMELINE, GO_TO_LAYERS
}
/** /**
* Instantiates a new show details event. * Instantiates a new show details event.
@ -30,14 +42,16 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
* @param projectID the project ID * @param projectID the project ID
* @param featureRow the feature row * @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships * @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
*/ */
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, FeatureRow featureRow, public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, FeatureRow featureRow,
boolean loadTimelineRelationships) { boolean loadTimelineRelationships, EVENT_SOURCE sourceEvent) {
this.layerObjectType = layerObjectType; this.layerObjectType = layerObjectType;
this.profileID = profileID; this.profileID = profileID;
this.projectID = projectID; this.projectID = projectID;
this.featureRow = featureRow; this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships; this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
} }
/** /**
@ -46,13 +60,16 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
* @param gir the gir * @param gir the gir
* @param featureRow the feature row * @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships * @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
*/ */
public ShowDetailsEvent(GeoportalItemReferences gir, FeatureRow featureRow, boolean loadTimelineRelationships) { public ShowDetailsEvent(GeoportalItemReferences gir, FeatureRow featureRow, boolean loadTimelineRelationships,
boolean goToLayers, EVENT_SOURCE sourceEvent) {
this.layerObjectType = gir.getLayerObjectType(); this.layerObjectType = gir.getLayerObjectType();
this.profileID = gir.getProfileID(); this.profileID = gir.getProfileID();
this.projectID = gir.getProjectID(); this.projectID = gir.getProjectID();
this.featureRow = featureRow; this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships; this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
} }
/** /**
@ -73,6 +90,15 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
return isEventFromTimeline; return isEventFromTimeline;
} }
/**
* Gets the source event.
*
* @return the source event
*/
public EVENT_SOURCE getSourceEvent() {
return sourceEvent;
}
/** /**
* Gets the type. * Gets the type.
* *
@ -157,11 +183,6 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
return new GeoportalItemReferences(projectID, profileID, layerObjectType); return new GeoportalItemReferences(projectID, profileID, layerObjectType);
} }
/**
* To string.
*
* @return the string
*/
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
@ -177,6 +198,10 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
builder.append(projectID); builder.append(projectID);
builder.append(", loadTimelineRelationships="); builder.append(", loadTimelineRelationships=");
builder.append(loadTimelineRelationships); builder.append(loadTimelineRelationships);
builder.append(", isEventFromTimeline=");
builder.append(isEventFromTimeline);
builder.append(", sourceEvent=");
builder.append(sourceEvent);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }

View File

@ -1,81 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowDetailsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jul 30, 2021
*/
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<ShowPopupOnCentroiEventHandler>();
private String profileID;
private String projectID;
private GeoJSON spatialReference;
/**
* Instantiates a new show details event.
*
* @param geonaItemType the geona item type
* @param geonaMongoID the geona mongo ID
* @param itemName the item name
* @param featureRow the feature row
*/
public ShowPopupOnCentroiEvent(String profileID, String projectID, GeoJSON spatialReference) {
this.profileID = profileID;
this.projectID = projectID;
this.spatialReference = spatialReference;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowPopupOnCentroiEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowPopupOnCentroiEventHandler handler) {
handler.onShowPopup(this);
}
public String getProfileID() {
return profileID;
}
public String getProjectID() {
return projectID;
}
public GeoJSON getSpatialReference() {
return spatialReference;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowPopupOnCentroiEvent [profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,122 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowPopupOnCentroidEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 12, 2023
*/
public class ShowPopupOnCentroidEvent extends GwtEvent<ShowPopupOnCentroidEventHandler> {
public static Type<ShowPopupOnCentroidEventHandler> TYPE = new Type<ShowPopupOnCentroidEventHandler>();
private String profileID;
private String projectID;
private GeoJSON spatialReference;
private ProjectView projectView;
/**
* Instantiates a new show popup on centroid event.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param spatialReference the spatial reference
*/
public ShowPopupOnCentroidEvent(String profileID, String projectID, GeoJSON spatialReference) {
this.profileID = profileID;
this.projectID = projectID;
this.spatialReference = spatialReference;
}
/**
* Instantiates a new show popup on centroid event.
*
* @param projectView the project view
*/
public ShowPopupOnCentroidEvent(ProjectView projectView) {
this.projectView = projectView;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowPopupOnCentroidEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowPopupOnCentroidEventHandler handler) {
handler.onShowPopup(this);
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
* Gets the spatial reference.
*
* @return the spatial reference
*/
public GeoJSON getSpatialReference() {
return spatialReference;
}
/**
* Gets the project view.
*
* @return the project view
*/
public ProjectView getProjectView() {
return projectView;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowPopupOnCentroidEvent [profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", projectView=");
builder.append(projectView);
builder.append("]");
return builder.toString();
}
}

View File

@ -2,20 +2,19 @@ package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
/** /**
* The Interface ShowPopupOnCentroiEventHandler. * The Interface ShowPopupOnCentroidEventHandler.
* *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Dec 10, 2021 * Jan 12, 2023
*/ */
public interface ShowPopupOnCentroiEventHandler extends EventHandler { public interface ShowPopupOnCentroidEventHandler extends EventHandler {
/** /**
* On show popup. * On show popup.
* *
* @param showPopupOnCentroiEvent the show popup on centroi event * @param showPopupOnCentroiEvent the show popup on centroi event
*/ */
void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent); void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent);
} }

View File

@ -36,6 +36,7 @@ import ol.OverlayOptions;
import ol.Size; import ol.Size;
import ol.View; import ol.View;
import ol.ViewOptions; import ol.ViewOptions;
import ol.animation.AnimationOptions;
import ol.event.EventListener; import ol.event.EventListener;
import ol.geom.Geometry; import ol.geom.Geometry;
import ol.interaction.Draw; import ol.interaction.Draw;
@ -71,6 +72,10 @@ import ol.source.XyzOptions;
*/ */
public abstract class OpenLayerMap { public abstract class OpenLayerMap {
public static final int SET_CENTER_ANIMATED_DURATION = 500;
public static final int ZOOM_ANIMATED_DURATION = 3000;
public static final int MAX_ZOOM = 21; public static final int MAX_ZOOM = 21;
/** /**
@ -297,7 +302,13 @@ public abstract class OpenLayerMap {
* @param centerCoordinate the new center * @param centerCoordinate the new center
*/ */
public void setCenter(Coordinate centerCoordinate) { public void setCenter(Coordinate centerCoordinate) {
view.setCenter(centerCoordinate);
AnimationOptions animations = new AnimationOptions();
animations.setCenter(centerCoordinate);
animations.setDuration(SET_CENTER_ANIMATED_DURATION);
view.animate(animations);
//view.setCenter(centerCoordinate);
} }
/** /**
@ -306,7 +317,11 @@ public abstract class OpenLayerMap {
* @param zoom the new zoom * @param zoom the new zoom
*/ */
public void setZoom(int zoom) { public void setZoom(int zoom) {
view.setZoom(zoom); AnimationOptions animations = new AnimationOptions();
animations.setDuration(ZOOM_ANIMATED_DURATION);
animations.setZoom(zoom);
view.animate(animations);
//view.setZoom(zoom);
} }
/** /**
@ -952,4 +967,6 @@ public abstract class OpenLayerMap {
return map.get((map.keySet().toArray())[index]); return map.get((map.keySet().toArray())[index]);
} }
} }

View File

@ -3,11 +3,10 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relati
import java.util.List; import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; 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.events.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages; import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil; import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon; import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
@ -129,7 +128,9 @@ public class TimelineRelationPanel extends Composite {
public void setTimelineContainerVisible(boolean bool) { public void setTimelineContainerVisible(boolean bool) {
timelineContainer.setVisible(bool); timelineContainer.setVisible(bool);
} }
/*
* Called when a project (box) is clicked into Timeline
*/
private void setSelectedProject(String theComposedProjectID) { private void setSelectedProject(String theComposedProjectID) {
this.selectedTimelineProjectID = theComposedProjectID; this.selectedTimelineProjectID = theComposedProjectID;
//selectedTimelineProjectID is the couple ProfileID,ProjectID //selectedTimelineProjectID is the couple ProfileID,ProjectID
@ -143,31 +144,11 @@ public class TimelineRelationPanel extends Composite {
final String thePofileID = references[0]; final String thePofileID = references[0];
final String theProjectID = references[1]; final String theProjectID = references[1];
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID); GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false); ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false, EVENT_SOURCE.LOCATE_FROM_TIMELINE);
showDetailsEvent.setEventFromTimeline(true); showDetailsEvent.setEventFromTimeline(true);
GWT.log("fireEvent: " + showDetailsEvent); GWT.log("fireEvent: " + showDetailsEvent);
applicationBus.fireEvent(showDetailsEvent); applicationBus.fireEvent(showDetailsEvent);
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(thePofileID, theProjectID,
new AsyncCallback<GeoJSON>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(GeoJSON spatialReference) {
if (spatialReference != null) {
applicationBus.fireEvent(
new ShowPopupOnCentroiEvent(thePofileID, theProjectID, spatialReference));
}
}
});
} }
public String getSelectedProjectID() { public String getSelectedProjectID() {

View File

@ -19,7 +19,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerSer
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.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.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
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 org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs; import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
@ -356,9 +356,9 @@ public class SearchFacilityUI extends Composite {
profileID); profileID);
// here // here
appManagerBus.fireEvent(new ClosedViewDetailsEvent()); appManagerBus.fireEvent(new ClosedViewDetailsEvent());
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true)); appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_SEARCHED));
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(profileID, // appManagerBus.fireEvent(new ShowPopupOnCentroidEvent(profileID,
resultDoc.getProjectID(), resultDoc.getSpatialReference())); // resultDoc.getProjectID(), resultDoc.getSpatialReference()));
} }
}); });

View File

@ -35,6 +35,8 @@ import org.gcube.application.geoportalcommon.ProjectDVBuilder;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller; import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller; import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller; import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
import org.gcube.application.geoportalcommon.geoportal.access.GeportalCheckAccessPolicy;
import org.gcube.application.geoportalcommon.geoportal.access.GeportalCheckAccessPolicy.ACCESS_POLICY;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter; import org.gcube.application.geoportalcommon.shared.SearchingFilter;
@ -662,26 +664,26 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.info("Total Docs read from config: " + totalProjectForProfile); LOG.info("Total Docs read from config: " + totalProjectForProfile);
// FIRST QUERY TO RETRIEVE IDs // FIRST QUERY TO RETRIEVE IDs
// LIMIT IS NULL AND START = 0 MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS // LIMIT IS NULL AND START = 0 MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF
// DOCUMENTS
final Iterator<Project> projectsIDs = client.queryOnMongo(theProfileID, totalProjectForProfile, 0, null, final Iterator<Project> projectsIDs = client.queryOnMongo(theProfileID, totalProjectForProfile, 0, null,
filter); filter);
//Getting the Project IDs from the Iterable // Getting the Project IDs from the Iterable
Iterable<Project> itP = () -> projectsIDs; Iterable<Project> itP = () -> projectsIDs;
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false); Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList()); List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
searchedDataIDs.setResultSetProjectIDs(listProjectIDs); searchedDataIDs.setResultSetProjectIDs(listProjectIDs);
//Total number of Projects are exactly listProjectIDs.size() // Total number of Projects are exactly listProjectIDs.size()
int totalItems = listProjectIDs.size(); int totalItems = listProjectIDs.size();
searchedDataIDs.setTotalItems(totalItems); searchedDataIDs.setTotalItems(totalItems);
LOG.info("Total IDs read from query: " + totalItems); LOG.info("Total IDs read from query: " + totalItems);
//NOW PERFORMING THE (REAL) SECOND QUERY FROM CLIENT // NOW PERFORMING THE (REAL) SECOND QUERY FROM CLIENT
// SETTING ORIGINAL PROJECTION FROM CLIENT // SETTING ORIGINAL PROJECTION FROM CLIENT
filter.setProjection(originalProjection); filter.setProjection(originalProjection);
// LIMIT IS FROM CLIENT // LIMIT IS FROM CLIENT
Iterator<Project> projects = client.queryOnMongo(theProfileID, totalItems, start, limit, Iterator<Project> projects = client.queryOnMongo(theProfileID, totalItems, start, limit, filter);
filter);
searchedDataIDs.setClientStartIndex(start); searchedDataIDs.setClientStartIndex(start);
searchedDataIDs.setLimit(limit); searchedDataIDs.setLimit(limit);
@ -749,24 +751,38 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
try { try {
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true); SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
String username = null;
try { try {
SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername(); username = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
} catch (Exception e) { } catch (Exception e) {
LOG.info("User not found in session, the userName for cecking policy will be null"); LOG.info("User not found in session, the userName for checking the policy will be null");
} }
LOG.info("Trying to get project for id " + profileID); LOG.trace("Trying to get project for id " + projectID);
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest()); new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID); Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
String jsonDocument = theProject.getTheDocument().toJson(); String jsonDocument = theProject.getTheDocument().toJson();
LOG.trace("JSON Project is: " + jsonDocument); LOG.trace("JSON Project is: " + jsonDocument);
String materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER, LOG.debug("Checking access policy for the layer...");
Geoportal_JSON_Mapper.FILESET); ACCESS_POLICY accessPolicy = GeportalCheckAccessPolicy.accessPolicyFromSessionLogin(username);
LOG.info("Access policy for discovering the layers is: " + accessPolicy);
listLayers = Geoportal_JSON_Mapper.readGcubeSDILayersForFileset(materializationParentJSONPath, String filesetParentJSONPath = null;
jsonDocument);
//(see ticket #24390)
if (accessPolicy.equals(ACCESS_POLICY.OPEN)) {
// Filtering for ACCESS_POLICY.OPEN from the fileset when the username is not in session. IAM
// identity is running, no logged in user.
filesetParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]",
Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET, accessPolicy);
} else {
// Accessing to all fileset (with any ACCESS_POLICY) when the user is logged in.
filesetParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
Geoportal_JSON_Mapper.FILESET);
}
listLayers = Geoportal_JSON_Mapper.readGcubeSDILayersForFileset(filesetParentJSONPath, jsonDocument);
LOG.info("For projectID " + projectID + ", returning " + listLayers.size() + " layer/s"); LOG.info("For projectID " + projectID + ", returning " + listLayers.size() + " layer/s");
return listLayers; return listLayers;
@ -807,7 +823,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
try { try {
SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername(); SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
} catch (Exception e) { } catch (Exception e) {
LOG.info("User not found in session, the userName for cecking policy will be null"); LOG.info("User not found in session, the userName for checking the policy will be null");
} }
LOG.info("Trying to get project for id " + profileID); LOG.info("Trying to get project for id " + profileID);
@ -856,7 +872,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
try { try {
userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername(); userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
} catch (Exception e) { } catch (Exception e) {
LOG.info("User not found in session, the userName for cecking policy will be null"); LOG.info("User not found in session, the userName for checking the policy will be null");
} }
LOG.info("Trying to get project for id " + profileID); LOG.info("Trying to get project for id " + profileID);
@ -920,7 +936,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
try { try {
userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername(); userName = SessionUtil.getCurrentUser(this.getThreadLocalRequest()).getUsername();
} catch (Exception e) { } catch (Exception e) {
LOG.info("User not found in session, the userName for cecking policy will be null"); LOG.info("User not found in session, the userName for checking the policy will be null");
} }
LOG.info("Trying to get project for id " + profileID); LOG.info("Trying to get project for id " + profileID);
@ -975,7 +991,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.info("getDataResult called"); LOG.info("getDataResult called");
for (LayerObject layerObject : layerObjects) { for (LayerObject layerObject : layerObjects) {
LOG.info("ProfileID: "+layerObject.getProfileID() + ", ProjectID: " +layerObject.getProjectID() + ", TYPE: "+layerObject.getType()); LOG.info("ProfileID: " + layerObject.getProfileID() + ", ProjectID: " + layerObject.getProjectID()
+ ", TYPE: " + layerObject.getType());
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
@ -1007,8 +1024,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
// Expected more than 1 feature for the BBOX of the Map // Expected more than 1 feature for the BBOX of the Map
FeatureRow fRow = features.get(0); FeatureRow fRow = features.get(0);
//using only the first feature returned from BBOX of the Map // using only the first feature returned from BBOX of the Map
//when querying the centroid layers // when querying the centroid layers
geoDAO.setFeatures(Arrays.asList(fRow)); geoDAO.setFeatures(Arrays.asList(fRow));
if (fRow.getMapProperties() != null) { if (fRow.getMapProperties() != null) {
List<String> productIDs = fRow.getMapProperties() List<String> productIDs = fRow.getMapProperties()
@ -1138,7 +1155,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.info("returning " + listDAO.size() + " geona data objects"); LOG.info("returning " + listDAO.size() + " geona data objects");
if(LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("returning " + listDAO + " geona data objects"); LOG.debug("returning " + listDAO + " geona data objects");
} }

View File

@ -55,6 +55,8 @@ public class Geoportal_JSON_Mapper {
public static final String _MATERIALIZATIONS = "_materializations"; public static final String _MATERIALIZATIONS = "_materializations";
public static final String _TYPE_GCUBE_SDI_LAYER = "gcube-sdi-layer";
private static final Logger LOG = LoggerFactory.getLogger(Geoportal_JSON_Mapper.class); private static final Logger LOG = LoggerFactory.getLogger(Geoportal_JSON_Mapper.class);
public static final String FILESET = "fileset"; public static final String FILESET = "fileset";
@ -113,7 +115,8 @@ public class Geoportal_JSON_Mapper {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
//LinkedHashMap<Integer, MetaDataProfileBeanExt> mapOfProfilesBeanExt = new LinkedHashMap<Integer, MetaDataProfileBeanExt>(); // LinkedHashMap<Integer, MetaDataProfileBeanExt> mapOfProfilesBeanExt = new
// LinkedHashMap<Integer, MetaDataProfileBeanExt>();
ArrayList<MetaDataProfileBeanExt> listOfProfilesBeanExt = new ArrayList<MetaDataProfileBeanExt>(); ArrayList<MetaDataProfileBeanExt> listOfProfilesBeanExt = new ArrayList<MetaDataProfileBeanExt>();
@ -124,7 +127,7 @@ public class Geoportal_JSON_Mapper {
// SectionView sectionView = new SectionView(); // SectionView sectionView = new SectionView();
// sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle()); // sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle());
System.out.println("\n\n##### Sto creando la sezione: "+gcubeProfileDV.getSectionTitle()); System.out.println("\n\n##### Sto creando la sezione: " + gcubeProfileDV.getSectionTitle());
LOG.debug("\n\nThe profile is: " + gcubeProfileDV); LOG.debug("\n\nThe profile is: " + gcubeProfileDV);
// Building JSON/section full PATH and section name // Building JSON/section full PATH and section name
String sectionJSONPath = ""; String sectionJSONPath = "";
@ -179,11 +182,10 @@ public class Geoportal_JSON_Mapper {
List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean(); List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean();
MetaDataProfileBean theProfileBean = theProfileBeans.get(0); MetaDataProfileBean theProfileBean = theProfileBeans.get(0);
// For each bson.Document filling the MetaDataProfileBean and its file // For each bson.Document filling the MetaDataProfileBean and its file
for (int i = 0; i < listBSONDocument.size(); i++) { for (int i = 0; i < listBSONDocument.size(); i++) {
System.out.println("DOCUMENT number "+i+ " of the section: "+theProfileBean.getTitle()); System.out.println("DOCUMENT number " + i + " of the section: " + theProfileBean.getTitle());
MetaDataProfileBeanExt theProfileBeanExt = new MetaDataProfileBeanExt(); MetaDataProfileBeanExt theProfileBeanExt = new MetaDataProfileBeanExt();
theProfileBeanExt.setCategories(theProfileBean.getCategories()); theProfileBeanExt.setCategories(theProfileBean.getCategories());
theProfileBeanExt.setTitle(theProfileBean.getTitle()); theProfileBeanExt.setTitle(theProfileBean.getTitle());
@ -199,30 +201,31 @@ public class Geoportal_JSON_Mapper {
// } // }
// } // }
Document fromSectionDoc = listBSONDocument.get(i); Document fromSectionDoc = listBSONDocument.get(i);
LOG.debug("\n\nNew section DOC for index " + i + " is: " + new JSONObject(fromSectionDoc.toJson()).toString(2)); LOG.debug("\n\nNew section DOC for index " + i + " is: "
//Creating the corresponding MetaDataProfileBeanExt for each section + new JSONObject(fromSectionDoc.toJson()).toString(2));
// Creating the corresponding MetaDataProfileBeanExt for each section
//Reading policy and license statically // Reading policy and license statically
//eg. "_access":{"_policy":"OPEN","_license":"CC0-1.0"}} // eg. "_access":{"_policy":"OPEN","_license":"CC0-1.0"}}
Document docAccess = null; Document docAccess = null;
Access access = null; Access access = null;
try { try {
docAccess = fromSectionDoc.get("_access", Document.class); docAccess = fromSectionDoc.get("_access", Document.class);
System.out.println("docAccess is: "+docAccess); System.out.println("docAccess is: " + docAccess);
access = new Access(); access = new Access();
access.setPolicy(AccessPolicy.valueOf(docAccess.getString("_policy"))); access.setPolicy(AccessPolicy.valueOf(docAccess.getString("_policy")));
access.setLicense(docAccess.getString("_license")); access.setLicense(docAccess.getString("_license"));
// Access. access.get("_policy"); // Access. access.get("_policy");
// access.get("_license"); // access.get("_license");
System.out.println("access is: "+access); System.out.println("access is: " + access);
}catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
//List<MetadataFieldWrapper> copyOfMetadataFields = new ArrayList<MetadataFieldWrapper>(theProfileBean.getMetadataFields()); // List<MetadataFieldWrapper> copyOfMetadataFields = new
//int forIndex = 0; // ArrayList<MetadataFieldWrapper>(theProfileBean.getMetadataFields());
// int forIndex = 0;
List<MetadataFieldWrapper> cloneListOfMFW = cloneList(theProfileBean.getMetadataFields()); List<MetadataFieldWrapper> cloneListOfMFW = cloneList(theProfileBean.getMetadataFields());
@ -232,22 +235,22 @@ public class Geoportal_JSON_Mapper {
: metadataField.getFieldName(); : metadataField.getFieldName();
LOG.debug("reading theFieldName: " + theFieldName); LOG.debug("reading theFieldName: " + theFieldName);
Object theOBJFieldValue = fromSectionDoc.get(theFieldName); Object theOBJFieldValue = fromSectionDoc.get(theFieldName);
metadataField.setCurrentValue(theOBJFieldValue+""); metadataField.setCurrentValue(theOBJFieldValue + "");
if(access!=null) { if (access != null) {
if(theFieldName.equalsIgnoreCase("policy")) { if (theFieldName.equalsIgnoreCase("policy")) {
metadataField.setCurrentValue(access.getPolicy().name()); metadataField.setCurrentValue(access.getPolicy().name());
}else if(theFieldName.equalsIgnoreCase("licenseID")) { } else if (theFieldName.equalsIgnoreCase("licenseID")) {
metadataField.setCurrentValue(access.getLicense()); metadataField.setCurrentValue(access.getLicense());
} }
} }
//copyOfMetadataFields.set(forIndex++, metadataField); // copyOfMetadataFields.set(forIndex++, metadataField);
} }
LOG.debug("Before assigning it Metadata fields are: "+cloneListOfMFW); LOG.debug("Before assigning it Metadata fields are: " + cloneListOfMFW);
theProfileBeanExt.setMetadataFields(new ArrayList<MetadataFieldWrapper>(cloneListOfMFW)); theProfileBeanExt.setMetadataFields(new ArrayList<MetadataFieldWrapper>(cloneListOfMFW));
LOG.debug("Metadata fields are: "+theProfileBeanExt.getMetadataFields()); LOG.debug("Metadata fields are: " + theProfileBeanExt.getMetadataFields());
// Reading filePaths // Reading filePaths
List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths(); List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths();
@ -272,15 +275,16 @@ public class Geoportal_JSON_Mapper {
} }
// Reading Fileset _materializations // Reading Fileset _materializations
//listLayers = readGcubeSDILayersForFileset(filesetJSONPath, fromSectionDocJSON); // listLayers = readGcubeSDILayersForFileset(filesetJSONPath,
//theProfileBeanExt.set // fromSectionDocJSON);
// theProfileBeanExt.set
} }
theProfileBeanExt.setListFileset(listFiles); theProfileBeanExt.setListFileset(listFiles);
} }
System.out.println("\nputting theProfileBeanExt: "+theProfileBeanExt); System.out.println("\nputting theProfileBeanExt: " + theProfileBeanExt);
listOfProfilesBeanExt.add(theProfileBeanExt); listOfProfilesBeanExt.add(theProfileBeanExt);
// System.out.println("\nPRINTING PROJECT VIEW ON END: "); // System.out.println("\nPRINTING PROJECT VIEW ON END: ");
@ -294,14 +298,14 @@ public class Geoportal_JSON_Mapper {
// } // }
// //
// System.out.println(listProfileBeansExt.get(listProfileBeansExt.size()-1)); // System.out.println(listProfileBeansExt.get(listProfileBeansExt.size()-1));
//Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView); // Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView);
} }
} }
projectView.setTheProfileBeans(listOfProfilesBeanExt); projectView.setTheProfileBeans(listOfProfilesBeanExt);
//Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView); // Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView);
return projectView; return projectView;
} }
@ -647,22 +651,29 @@ public class Geoportal_JSON_Mapper {
LOG.info("readGcubeSDILayersForFileset called"); LOG.info("readGcubeSDILayersForFileset called");
List<GCubeSDIViewerLayerDV> listSDILayers = new ArrayList<GCubeSDIViewerLayerDV>(); List<GCubeSDIViewerLayerDV> listSDILayers = new ArrayList<GCubeSDIViewerLayerDV>();
String _materializationsJSONPath = String.format("%s.%s", materializationParentJSONPath, _MATERIALIZATIONS); // _materializations AT THE MOMENT ARE ONLY OF TYPE gcube-sdi-layer. I'm adding
// the filtering "_type": "gcube-sdi-layer" to be sure of reading SDI layer
String _materializationsJSONPath = String.format("%s.%s[?(@._type=='%s')]", materializationParentJSONPath,
_MATERIALIZATIONS, _TYPE_GCUBE_SDI_LAYER);
// [?(@._access._policy=='%s')]
try { try {
com.jayway.jsonpath.Configuration configurationJSONSmart = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configurationJSONSmart = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
LOG.debug("Reading sectionPath {} into section document {}", _materializationsJSONPath, sectionJSONDocument); LOG.debug("GcubeSDILayers Reading sectionPath {} into section document {}", _materializationsJSONPath,
JsonPath theSectionPolycJsonPath = JsonPath.compile(_materializationsJSONPath); sectionJSONDocument);
Object _materializations = theSectionPolycJsonPath.read(sectionJSONDocument, configurationJSONSmart);
JsonPath theSectionMaterializationJsonPath = JsonPath.compile(_materializationsJSONPath);
Object _materializations = theSectionMaterializationJsonPath.read(sectionJSONDocument,
configurationJSONSmart);
LOG.trace("_materializations.class(): " + _materializations.getClass()); LOG.trace("_materializations.class(): " + _materializations.getClass());
listSDILayers = recursiveFetchingLayers(configurationJSONSmart, _materializations, listSDILayers); listSDILayers = recursiveFetchingLayers(configurationJSONSmart, _materializations, listSDILayers);
} catch (Exception e) { } catch (Exception e) {
LOG.warn("Error on reading the JSON Path " + _materializationsJSONPath + " in the doc " LOG.debug("Error on reading the JSON Path " + _materializationsJSONPath + " in the doc "
+ sectionJSONDocument, e); + sectionJSONDocument, e);
} }
LOG.info("returning list of layers {}", listSDILayers); LOG.info("returning list of layers {}", listSDILayers);
@ -686,14 +697,14 @@ public class Geoportal_JSON_Mapper {
if (objectJSON instanceof JSONArray) { if (objectJSON instanceof JSONArray) {
JSONArray theJsonArray = (JSONArray) objectJSON; JSONArray theJsonArray = (JSONArray) objectJSON;
LOG.trace("jsonArray: " + theJsonArray.toString(3)); LOG.debug("jsonArray: " + theJsonArray.toString(3));
for (int i = 0; i < theJsonArray.length(); i++) { for (int i = 0; i < theJsonArray.length(); i++) {
recursiveFetchingLayers(config, theJsonArray.get(i), listSDILayers); recursiveFetchingLayers(config, theJsonArray.get(i), listSDILayers);
} }
} else if (objectJSON instanceof JSONObject) { } else if (objectJSON instanceof JSONObject) {
JSONObject theJsonObject = (JSONObject) objectJSON; JSONObject theJsonObject = (JSONObject) objectJSON;
LOG.trace("theJSONObject: " + theJsonObject.toString(3)); LOG.debug("theJSONObject: " + theJsonObject.toString(3));
GCubeSDIViewerLayerDV gsdiLayer = converLayer(config, theJsonObject); GCubeSDIViewerLayerDV gsdiLayer = converLayer(config, theJsonObject);
listSDILayers.add(gsdiLayer); listSDILayers.add(gsdiLayer);
} }
@ -806,7 +817,7 @@ public class Geoportal_JSON_Mapper {
* @param myLogin the my login * @param myLogin the my login
* @return true, if is accessible section according to policy * @return true, if is accessible section according to policy
*/ */
private static boolean isAccessibleSectionAccordingToPolicy(Document section, String sectionJSONPath, public static boolean isAccessibleSectionAccordingToPolicy(Document section, String sectionJSONPath,
String myLogin) { String myLogin) {
LOG.debug("isAccessibleSectionAccordingToPolicy called"); LOG.debug("isAccessibleSectionAccordingToPolicy called");
boolean isAccessible = true; boolean isAccessible = true;
@ -829,21 +840,50 @@ public class Geoportal_JSON_Mapper {
private static boolean checkAccessPolicy(String sectionDocumentJSON, String myLogin) { private static boolean checkAccessPolicy(String sectionDocumentJSON, String myLogin) {
LOG.info("checkAccessPolicy called"); LOG.info("checkAccessPolicy called");
// CHECKING THE POLICY // CHECKING THE POLICY
String accessPolicyPath = JSON_$_POINTER + "._access._policy"; // see ticket #24390
// First reading the access policy from the fileset
String accessPolicyPath = JSON_$_POINTER + ".fileset._access._policy";
boolean isAccessible = true; boolean isAccessible = true;
try { try {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
LOG.debug("Reading access policy at {} into section document {}", accessPolicyPath, sectionDocumentJSON); LOG.debug("Reading access policy at {} into section document {}", accessPolicyPath, sectionDocumentJSON);
String _policy = null;
try {
JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath); JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath);
String _policy = theSectionPolycJsonPath.read(sectionDocumentJSON, configuration).toString(); _policy = theSectionPolycJsonPath.read(sectionDocumentJSON, configuration).toString();
if (_policy == null)
throw new Exception("Policy is null");
} catch (Exception e) {
LOG.debug("Access policy not found in: " + accessPolicyPath);
}
// If policy does not exist into fileset, reading from the parent section
if (_policy == null) {
accessPolicyPath = JSON_$_POINTER + "._access._policy";
LOG.debug("Reading access policy at {} into section document {}", accessPolicyPath,
sectionDocumentJSON);
try {
JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath);
_policy = theSectionPolycJsonPath.read(sectionDocumentJSON, configuration).toString();
if (_policy == null)
throw new Exception("Policy is null");
} catch (Exception e) {
LOG.debug("Access policy not found in: " + accessPolicyPath);
}
}
LOG.debug("The section {} has policy {}", accessPolicyPath, _policy); LOG.debug("The section {} has policy {}", accessPolicyPath, _policy);
isAccessible = GeportalCheckAccessPolicy.isAccessible(_policy, myLogin); isAccessible = GeportalCheckAccessPolicy.isAccessible(_policy, myLogin);
} catch (Exception e) { } catch (Exception e) {
LOG.error(accessPolicyPath + " not found. Check OK"); LOG.error(accessPolicyPath + " not found. Check OK");
} }
LOG.info("Is the section {} accessible? {}", sectionDocumentJSON, isAccessible); LOG.info("It is {} accessible the section {} accessible? {}", isAccessible, sectionDocumentJSON);
return isAccessible; return isAccessible;
} }

View File

@ -134,10 +134,12 @@ public class SessionUtil {
GCubeUser user = pContext.getCurrentUser(request); GCubeUser user = pContext.getCurrentUser(request);
String token = PortalContext.getConfiguration().getCurrentUserToken(scope, user.getUsername()); String token = PortalContext.getConfiguration().getCurrentUserToken(scope, user.getUsername());
if (token != null && setInThread) if (token != null) {
SecurityTokenProvider.instance.set(token);
LOG.debug("Returning token " + token.substring(1, 10) + "_MASKED_TOKEN_"); LOG.debug("Returning token " + token.substring(1, 10) + "_MASKED_TOKEN_");
if(setInThread)
SecurityTokenProvider.instance.set(token);
}
return token; return token;
} }

View File

@ -22,6 +22,8 @@ import org.gcube.application.geoportalcommon.ProjectDVBuilder;
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller; import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller; import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller; import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
import org.gcube.application.geoportalcommon.geoportal.access.GeportalCheckAccessPolicy;
import org.gcube.application.geoportalcommon.geoportal.access.GeportalCheckAccessPolicy.ACCESS_POLICY;
import org.gcube.application.geoportalcommon.geoportal.util.GisUtil; import org.gcube.application.geoportalcommon.geoportal.util.GisUtil;
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;
@ -40,6 +42,7 @@ import org.gcube.portlets.user.geoportaldataviewer.server.Geoportal_JSON_Mapper;
import org.gcube.portlets.user.geoportaldataviewer.shared.ProjectEdit; import org.gcube.portlets.user.geoportaldataviewer.shared.ProjectEdit;
import org.json.JSONObject; import org.json.JSONObject;
import org.junit.Before; import org.junit.Before;
import org.junit.Test;
/** /**
* The Class GeoportalViewer_Tests. * The Class GeoportalViewer_Tests.
@ -54,14 +57,15 @@ public class GeoportalViewer_Tests {
private ProjectsCaller clientProjects; private ProjectsCaller clientProjects;
private static String CONTEXT = "/pred4s/preprod/preVRE"; //private static String CONTEXT = "/pred4s/preprod/preVRE";
private static String TOKEN = ""; //preVRE private static String CONTEXT = "/d4science.research-infrastructures.eu/D4OS/GNA";
private static String TOKEN = ""; //GNA
//private static String CONTEXT = "/gcube/devsec/devVRE"; //private static String CONTEXT = "/gcube/devsec/devVRE";
//private static String TOKEN = ""; // devVRE //private static String TOKEN = ""; // devVRE
private static String PROFILE_ID = "profiledConcessioni"; private static String PROFILE_ID = "profiledConcessioni";
private static String PROJECT_ID = "637ceb4d21dd0d6fb9f24706"; private static String PROJECT_ID = "6388ea6ca1e60e66b7b584e0";
private static String USERNAME = "francesco.mangiacrapa"; private static String USERNAME = "francesco.mangiacrapa";
@ -99,7 +103,7 @@ public class GeoportalViewer_Tests {
} }
} }
// @Test //@Test
public void getLayersForId() { public void getLayersForId() {
System.out.println("getLayersForId [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called"); System.out.println("getLayersForId [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called");
@ -113,9 +117,25 @@ public class GeoportalViewer_Tests {
String jsonDocument = project.getTheDocument().toJson(); String jsonDocument = project.getTheDocument().toJson();
System.out.println("JSON Project is: " + jsonDocument); System.out.println("JSON Project is: " + jsonDocument);
String materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER, ACCESS_POLICY accessPolicy = GeportalCheckAccessPolicy.accessPolicyFromSessionLogin(null);
Geoportal_JSON_Mapper.FILESET);
String materializationParentJSONPath = null;
if(accessPolicy.equals(ACCESS_POLICY.OPEN)) {
//Filtering for ACCESS_POLICY.OPEN when the username is not in session. IAM identity is running, no logged in user.
materializationParentJSONPath = String.format("%s..%s[?(@._access._policy=='%s')]", Geoportal_JSON_Mapper.JSON_$_POINTER,
Geoportal_JSON_Mapper.FILESET, accessPolicy);
}else {
//Accessing to all fileset (with any ACCESS_POLICY) when the user is logged in.
materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
Geoportal_JSON_Mapper.FILESET);
}
System.out.println("jsonPathQuery is: "+materializationParentJSONPath);
// String materializationParentJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
// Geoportal_JSON_Mapper.FILESET);
//
listLayers = Geoportal_JSON_Mapper.readGcubeSDILayersForFileset(materializationParentJSONPath, listLayers = Geoportal_JSON_Mapper.readGcubeSDILayersForFileset(materializationParentJSONPath,
jsonDocument); jsonDocument);