in progress
This commit is contained in:
parent
0a5cd91c55
commit
0900cd46c5
|
@ -1,5 +1,7 @@
|
||||||
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +25,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-module deploy-name="geoportal-data-viewer-app-3.0.0-SNAPSHOT">
|
<wb-module deploy-name="geoportal-data-viewer-app-3.0.0-SNAPSHOT">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +51,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,7 +77,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,7 +103,9 @@
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -119,7 +129,9 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,7 +158,9 @@
|
||||||
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
<dependent-module archiveName="geoportal-data-common-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,7 +184,9 @@
|
||||||
|
|
||||||
|
|
||||||
<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"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -194,7 +210,9 @@
|
||||||
|
|
||||||
|
|
||||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,7 +236,9 @@
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,7 @@ 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.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
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.ProjectDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
|
@ -304,7 +301,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
IndexLayerDV layer = toOpen.getIndexes().get(0);
|
IndexLayerDV layer = toOpen.getIndexes().get(0);
|
||||||
// Open Index Layer
|
// Open Index Layer
|
||||||
|
|
||||||
layerManager.addIndexLayer(layer, toOpen.getUcd().getProfileID());
|
layerManager.addIndexLayer(layer, toOpen.getUcd().getProfileID(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -406,7 +403,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
if (record != null) {
|
if (record != null) {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
GWT.log("cancelled timer");
|
GWT.log("cancelled timer");
|
||||||
performWFSQueryOnCentroid(record);
|
performWFSQueryOnCentroid(record.getTheProjectDV().getId(),
|
||||||
|
record.getCentroidLong(), record.getCentroidLat());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attempt > MAX_RETRY) {
|
if (attempt > MAX_RETRY) {
|
||||||
|
@ -540,16 +538,17 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
|
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
||||||
//
|
|
||||||
// if (showPopupOnCentroiEvent.getRecord() != null)
|
if (showPopupOnCentroiEvent.getDocument() != null)
|
||||||
// performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
|
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getDocument().getProjectID(),
|
||||||
//
|
showPopupOnCentroiEvent.getCentroidLong(), showPopupOnCentroiEvent.getCentroidLat());
|
||||||
// }
|
|
||||||
// });
|
}
|
||||||
|
});
|
||||||
|
|
||||||
applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() {
|
applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() {
|
||||||
|
|
||||||
|
@ -602,10 +601,11 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
//
|
//
|
||||||
// }-*/;
|
// }-*/;
|
||||||
|
|
||||||
private void performWFSQueryOnCentroid(ProjectView project) {
|
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
||||||
if (project != null) {
|
GWT.log("Perform performWFSQueryOnCentroid: "+projectID+ " long: "+centroidLong + ", lat: "+centroidLat);
|
||||||
Double x = project.getCentroidLong();
|
if (projectID != null) {
|
||||||
Double y = project.getCentroidLat();
|
Double x = centroidLong;
|
||||||
|
Double y = centroidLat;
|
||||||
GWT.log("X: " + x + ", Y:" + y);
|
GWT.log("X: " + x + ", Y:" + y);
|
||||||
if (x != null && y != null) {
|
if (x != null && y != null) {
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
|
Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
|
||||||
|
@ -615,8 +615,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
// GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
||||||
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
|
ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
|
||||||
transfCoord.getY());
|
transfCoord.getY());
|
||||||
layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt,
|
layerManager.getLayerManagerBus().fireEvent(
|
||||||
project.getTheProjectDV().getId(), true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
|
new QueryDataEvent(select, toExt, projectID, true, MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
|
||||||
} else {
|
} else {
|
||||||
GeoportalDataViewerConstants
|
GeoportalDataViewerConstants
|
||||||
.printJs("I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
|
.printJs("I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class LayerManager {
|
||||||
MapEventType sourceEvent = queryEvent.getSourceMapEventType();
|
MapEventType sourceEvent = queryEvent.getSourceMapEventType();
|
||||||
|
|
||||||
// TODO SWTCH FOR EARCH ITEM TYPE
|
// TODO SWTCH FOR EARCH ITEM TYPE
|
||||||
for (GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
for (final GeoNaSpatialQueryResult geoNaDataObject : listGeonaDataObjects) {
|
||||||
GWT.log("GeoNaDataObject: " + geoNaDataObject);
|
GWT.log("GeoNaDataObject: " + geoNaDataObject);
|
||||||
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
List<FeatureRow> features = geoNaDataObject.getFeatures();
|
||||||
LayerItem layerItem = geoNaDataObject.getSourceLayerObject().getLayerItem();
|
LayerItem layerItem = geoNaDataObject.getSourceLayerObject().getLayerItem();
|
||||||
|
@ -344,7 +344,7 @@ public class LayerManager {
|
||||||
true,
|
true,
|
||||||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||||
theProfileID, theProductID);
|
theProfileID, theProductID, geoNaDataObject.getSourceLayerObject().getProjectDV());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -464,11 +464,12 @@ public class LayerManager {
|
||||||
* @param maxResolution the max resolution
|
* @param maxResolution the max resolution
|
||||||
* @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
|
||||||
*/
|
*/
|
||||||
public void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
|
public 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,
|
||||||
final boolean asDetailLayer, Double minResolution, Double maxResolution, final String profileID,
|
final boolean asDetailLayer, Double minResolution, Double maxResolution, final String profileID,
|
||||||
final String projectID) {
|
final String projectID, final ProjectDV projectDV) {
|
||||||
|
|
||||||
final LayerType featureType = isBase ? LayerType.RASTER_BASELAYER : LayerType.FEATURE_TYPE;
|
final LayerType featureType = isBase ? LayerType.RASTER_BASELAYER : LayerType.FEATURE_TYPE;
|
||||||
|
|
||||||
|
@ -507,6 +508,7 @@ public class LayerManager {
|
||||||
lo.setType(lot);
|
lo.setType(lot);
|
||||||
lo.setProjectID(projectID);
|
lo.setProjectID(projectID);
|
||||||
lo.setProfileID(profileID);
|
lo.setProfileID(profileID);
|
||||||
|
lo.setProjectDV(projectDV);
|
||||||
|
|
||||||
String layerNameKey = layerItem.getName();
|
String layerNameKey = layerItem.getName();
|
||||||
|
|
||||||
|
@ -531,6 +533,7 @@ public class LayerManager {
|
||||||
mapOtherLayerObjects.put(layerNameKey, theLo);
|
mapOtherLayerObjects.put(layerNameKey, theLo);
|
||||||
GWT.log("mapOtherLayerObjects is: " + mapIndexLayerObjects);
|
GWT.log("mapOtherLayerObjects is: " + mapIndexLayerObjects);
|
||||||
olMap.addWMSDetailLayer(layerItem);
|
olMap.addWMSDetailLayer(layerItem);
|
||||||
|
overlayLayerManager.addLayerItem(theLo);
|
||||||
} else {
|
} else {
|
||||||
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
|
GWT.log("Skipping " + lo.getType() + " layer " + theLo.getLayerItem().getName()
|
||||||
+ " already added to Map");
|
+ " already added to Map");
|
||||||
|
@ -565,17 +568,20 @@ public class LayerManager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the index layer.
|
* Adds the index layer.
|
||||||
*
|
*
|
||||||
* @param layer the layer
|
* @param layer the layer
|
||||||
|
* @param profileID the profile ID
|
||||||
|
* @param projectDV the project DV
|
||||||
*/
|
*/
|
||||||
public void addIndexLayer(IndexLayerDV layer, String profileID) {
|
public void addIndexLayer(IndexLayerDV layer, String profileID, ProjectDV projectDV) {
|
||||||
GWT.log("Adding index layer: " + layer);
|
GWT.log("Adding index layer: " + layer);
|
||||||
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
|
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
|
||||||
GWT.log("index layer wmsLink: " + wmsLink);
|
GWT.log("index layer wmsLink: " + wmsLink);
|
||||||
addLayer(LayerObjectType.INDEX_LAYER, null, null, wmsLink, false, false, null, false, null, null, profileID,
|
addLayer(LayerObjectType.INDEX_LAYER, null, null, wmsLink, false, false, null, false, null, null, profileID,
|
||||||
null);
|
null, projectDV);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,25 @@
|
||||||
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.HashMap;
|
||||||
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Label;
|
||||||
|
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.user.client.ui.FlowPanel;
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
|
|
||||||
public class OverlayLayerManager {
|
public class OverlayLayerManager {
|
||||||
|
|
||||||
private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
|
// private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
|
||||||
private FlowPanel fp = new FlowPanel();
|
// private FlowPanel fp = new FlowPanel();
|
||||||
|
private FlowPanel clusterCollectionsMainPanel = new FlowPanel();
|
||||||
|
private HashMap<String, ArrayList<DragDropLayer>> mapCollectionsPerProfileID = new HashMap<String, ArrayList<DragDropLayer>>();
|
||||||
|
private HashMap<String, FlowPanel> mapCollectionsContainersPerProfileID = new HashMap<String, FlowPanel>();
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
public OverlayLayerManager(HandlerManager applicationBus) {
|
public OverlayLayerManager(HandlerManager applicationBus) {
|
||||||
|
@ -19,18 +27,43 @@ public class OverlayLayerManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
void addLayerItem(LayerObject lo) {
|
void addLayerItem(LayerObject lo) {
|
||||||
|
GWT.log("Adding LayerObject having project: "+lo.getProjectDV());
|
||||||
|
|
||||||
|
ArrayList<DragDropLayer> listDDLayers = mapCollectionsPerProfileID.get(lo.getProfileID());
|
||||||
|
|
||||||
|
if (listDDLayers == null) {
|
||||||
|
|
||||||
|
String collectionName = lo.getProjectDV() != null && lo.getProjectDV().getProfileName() != null
|
||||||
|
? lo.getProjectDV().getProfileName()
|
||||||
|
: lo.getProfileID();
|
||||||
|
|
||||||
|
Label labelCollectionName = new Label(collectionName);
|
||||||
|
labelCollectionName.setType(LabelType.WARNING);
|
||||||
|
clusterCollectionsMainPanel.add(labelCollectionName);
|
||||||
|
listDDLayers = new ArrayList<DragDropLayer>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FlowPanel fp = new FlowPanel();
|
||||||
|
fp.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||||
|
|
||||||
DragDropLayer dandd = new DragDropLayer(applicationBus, lo, true, true);
|
DragDropLayer dandd = new DragDropLayer(applicationBus, lo, true, true);
|
||||||
layers.add(lo);
|
listDDLayers.add(dandd);
|
||||||
fp.add(dandd);
|
fp.add(dandd);
|
||||||
|
|
||||||
|
mapCollectionsContainersPerProfileID.put(lo.getProfileID(), fp);
|
||||||
|
mapCollectionsPerProfileID.put(lo.getProfileID(), listDDLayers);
|
||||||
|
clusterCollectionsMainPanel.add(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetLayers() {
|
public void resetLayers() {
|
||||||
layers.clear();
|
clusterCollectionsMainPanel.clear();
|
||||||
fp.clear();
|
mapCollectionsContainersPerProfileID.clear();
|
||||||
|
mapCollectionsPerProfileID.clear();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlowPanel getPanel() {
|
public FlowPanel getPanel() {
|
||||||
return fp;
|
return clusterCollectionsMainPanel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,8 @@ import com.google.gwt.event.shared.GwtEvent;
|
||||||
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
|
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
|
||||||
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<ShowPopupOnCentroiEventHandler>();
|
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<ShowPopupOnCentroiEventHandler>();
|
||||||
private DocumentDV document;
|
private DocumentDV document;
|
||||||
|
private Double centroidLong;
|
||||||
|
private Double centroidLat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new show details event.
|
* Instantiates a new show details event.
|
||||||
|
@ -23,8 +25,10 @@ public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHan
|
||||||
* @param itemName the item name
|
* @param itemName the item name
|
||||||
* @param featureRow the feature row
|
* @param featureRow the feature row
|
||||||
*/
|
*/
|
||||||
public ShowPopupOnCentroiEvent(DocumentDV document) {
|
public ShowPopupOnCentroiEvent(DocumentDV document, Double centroidLong, Double centroidLat) {
|
||||||
this.document = document;
|
this.document = document;
|
||||||
|
this.centroidLong = centroidLong;
|
||||||
|
this.centroidLat = centroidLat;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,5 +56,13 @@ public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHan
|
||||||
public DocumentDV getDocument() {
|
public DocumentDV getDocument() {
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Double getCentroidLat() {
|
||||||
|
return centroidLat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getCentroidLong() {
|
||||||
|
return centroidLong;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@
|
||||||
}
|
}
|
||||||
.to-align-right{
|
.to-align-right{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 40px;
|
top: 50px;
|
||||||
right: 10px;
|
right: 10px;
|
||||||
}
|
}
|
||||||
</ui:style>
|
</ui:style>
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
|
|
||||||
|
public class ProjectUtil {
|
||||||
|
|
||||||
|
public static <T extends DocumentDV> String toHMLCode(T document, String projectID) {
|
||||||
|
String htmlCode = "";
|
||||||
|
|
||||||
|
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
|
||||||
|
if (firstEntrySet != null) {
|
||||||
|
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (projectID != null) {
|
||||||
|
htmlCode += "(id: " + projectID + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
return htmlCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -19,7 +19,6 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
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.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
.the-title {
|
.the-title {
|
||||||
background-color: rgba(0,60,136,.7);
|
background-color: rgba(0,60,136,.7);
|
||||||
color: white;
|
color: white;
|
||||||
font-style: italic;
|
padding: 10px 10px;
|
||||||
padding: 5px 10px;
|
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Column;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
|
import com.google.gwt.user.client.ui.Composite;
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
public class RelationshipPanel extends Composite {
|
||||||
|
|
||||||
|
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
|
||||||
|
|
||||||
|
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, RelationshipPanel> {
|
||||||
|
}
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel rootRow;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Column leftChildColumn;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
Column rightChildColumn;
|
||||||
|
|
||||||
|
private HandlerManager appManagerBus;
|
||||||
|
|
||||||
|
|
||||||
|
public RelationshipPanel(HandlerManager appManagerBus, ProjectDV fromProject, List<ProjectDV> relationships) {
|
||||||
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
|
this.appManagerBus = appManagerBus;
|
||||||
|
|
||||||
|
String html = ProjectUtil.toHMLCode(fromProject.getTheDocument(), fromProject.getId());
|
||||||
|
rootRow.add(new HTML(html));
|
||||||
|
|
||||||
|
showRelationsOf(fromProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showRelationsOf(ProjectDV project) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<!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>
|
||||||
|
<b:Row ui:field="rootRow">
|
||||||
|
<b:FlowPanel ui:field="rootPanel"></b:FlowPanel>
|
||||||
|
</b:Row>
|
||||||
|
<b:Row>
|
||||||
|
<b:Column size="4">
|
||||||
|
<b:FlowPanel ui:field="leftChildPanel"></b:FlowPanel>
|
||||||
|
</b:Column>
|
||||||
|
<b:Column size="4">
|
||||||
|
<b:FlowPanel ui:field="rightChildPanel"></b:FlowPanel>
|
||||||
|
</b:Column>
|
||||||
|
</b:Row>
|
||||||
|
</g:HTMLPanel>
|
||||||
|
|
||||||
|
</ui:UiBinder>
|
|
@ -13,6 +13,7 @@ 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.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
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;
|
||||||
|
@ -38,10 +39,8 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
|
|
||||||
import com.google.gwt.uibinder.client.UiBinder;
|
import com.google.gwt.uibinder.client.UiBinder;
|
||||||
import com.google.gwt.uibinder.client.UiField;
|
import com.google.gwt.uibinder.client.UiField;
|
||||||
import com.google.gwt.user.cellview.client.TextColumn;
|
|
||||||
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;
|
||||||
|
@ -308,9 +307,11 @@ public class SearchFacilityUI extends Composite {
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
for (DocumentDV documentDV : result.getData()) {
|
for (DocumentDV documentDV : result.getData()) {
|
||||||
|
|
||||||
|
ResultDocumentDV resultDoc = (ResultDocumentDV) documentDV;
|
||||||
|
|
||||||
NavLink locateOnMap = new NavLink("Show");
|
NavLink locateOnMap = new NavLink("Show");
|
||||||
locateOnMap.setTitle("Locate on the Map and show details");
|
locateOnMap.setTitle("Open this project and show details");
|
||||||
locateOnMap.setIcon(IconType.MAP_MARKER);
|
locateOnMap.setIcon(IconType.MAP_MARKER);
|
||||||
|
|
||||||
locateOnMap.addClickHandler(new ClickHandler() {
|
locateOnMap.addClickHandler(new ClickHandler() {
|
||||||
|
@ -320,7 +321,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
GeoportalItemReferences gir = new GeoportalItemReferences(documentDV.getProjectID(),
|
GeoportalItemReferences gir = new GeoportalItemReferences(documentDV.getProjectID(),
|
||||||
profileID);
|
profileID);
|
||||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||||
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(documentDV));
|
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(documentDV, resultDoc.getCentroidLong(), resultDoc.getCentroidLat()));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -995,8 +995,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<PayloadDV> getImagesForId(String profileID, String projectID) throws Exception {
|
protected List<PayloadDV> getImagesForId(String profileID, String projectID, boolean limitToFirstOneFound)
|
||||||
LOG.info("getImagesForId [profileID: " + profileID + ", projectID: " + projectID + "] called");
|
throws Exception {
|
||||||
|
LOG.info("getImagesForId [profileID: " + profileID + ", projectID: " + projectID + ", limitToFirstOneFound: "
|
||||||
|
+ limitToFirstOneFound + "] called");
|
||||||
|
|
||||||
if (profileID == null)
|
if (profileID == null)
|
||||||
throw new Exception("Invalid parameter. The profileID is null");
|
throw new Exception("Invalid parameter. The profileID is null");
|
||||||
|
@ -1025,7 +1027,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
String filesetJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
String filesetJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
||||||
Geoportal_JSON_Mapper.FILESET);
|
Geoportal_JSON_Mapper.FILESET);
|
||||||
|
|
||||||
listImages = Geoportal_JSON_Mapper.readImagesForFileset(filesetJSONPath, jsonDocument);
|
listImages = Geoportal_JSON_Mapper.readImagesForFileset(filesetJSONPath, jsonDocument,
|
||||||
|
limitToFirstOneFound);
|
||||||
|
|
||||||
LOG.info("For projectID " + projectID + ", returning " + listImages.size() + " image/s");
|
LOG.info("For projectID " + projectID + ", returning " + listImages.size() + " image/s");
|
||||||
return listImages;
|
return listImages;
|
||||||
|
@ -1068,7 +1071,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
UseCaseDescriptor ucd = GeoportalClientCaller.useCaseDescriptors().getUCDForId(profileID);
|
UseCaseDescriptor ucd = GeoportalClientCaller.useCaseDescriptors().getUCDForId(profileID);
|
||||||
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID, projectID);
|
||||||
|
|
||||||
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
||||||
projectBuilder.relationships(true);
|
projectBuilder.relationships(true);
|
||||||
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
||||||
|
@ -1137,10 +1140,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
String projectID = productIDs.get(0);
|
String projectID = productIDs.get(0);
|
||||||
layerObject.setProjectID(projectID);
|
layerObject.setProjectID(projectID);
|
||||||
String profileID = layerObject.getProfileID();
|
String profileID = layerObject.getProfileID();
|
||||||
|
|
||||||
List<PayloadDV> images;
|
List<PayloadDV> images;
|
||||||
// Loading images for profileID and projectID
|
// Loading images for profileID and projectID
|
||||||
try {
|
try {
|
||||||
images = getImagesForId(profileID, projectID);
|
images = getImagesForId(profileID, projectID, true);
|
||||||
|
|
||||||
Map<String, List<PayloadDV>> mapImages = new LinkedHashMap<String, List<PayloadDV>>();
|
Map<String, List<PayloadDV>> mapImages = new LinkedHashMap<String, List<PayloadDV>>();
|
||||||
mapImages.put(projectID, images);
|
mapImages.put(projectID, images);
|
||||||
|
@ -1150,6 +1154,32 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.warn("Error on loading images for projectID: " + projectID + " profileID: "
|
LOG.warn("Error on loading images for projectID: " + projectID + " profileID: "
|
||||||
+ profileID);
|
+ profileID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets only profileID and profileName into ProjectDV
|
||||||
|
if (layerObject.getProjectDV() == null) {
|
||||||
|
|
||||||
|
QueryRequest request = new QueryRequest();
|
||||||
|
request.setFilter(Document.parse(
|
||||||
|
"{\"" + UseCaseDescriptor.ID + "\" : " + "{\"$eq\" : \"" + profileID + "\"}}"));
|
||||||
|
request.setProjection(Document.parse("{\"" + UseCaseDescriptor.NAME + "\" : " + "1}"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
useCaseDescriptors().build().query(request).forEachRemaining(u -> {
|
||||||
|
try {
|
||||||
|
LOG.debug("UCD for id" + u.getId() + " returend name: " + u.getName());
|
||||||
|
ProjectDV projectDV = new ProjectDV();
|
||||||
|
projectDV.setId(projectID);
|
||||||
|
projectDV.setProfileName(u.getName());
|
||||||
|
projectDV.setProfileID(u.getId());
|
||||||
|
layerObject.setProjectDV(projectDV);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.warn("Invalid UCD, UCID : " + u.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
// silent
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1160,35 +1190,56 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case PROJECT_LAYER:
|
case PROJECT_LAYER:
|
||||||
case GENERIC_LAYER: {
|
case GENERIC_LAYER: {
|
||||||
LOG.debug("The LayerObject is a of kind: "+layerObject.getType());
|
LOG.debug("The LayerObject is a of kind: " + layerObject.getType());
|
||||||
// Getting the projectid from WFS features, but limiting to the first one
|
// TODO CHECK THIS
|
||||||
for (FeatureRow fRow : features) {
|
// Getting the projectid from WFS features, but limiting to the first one, Do we
|
||||||
if (fRow.getMapProperties() != null) {
|
// have more than one centroid in the same position??
|
||||||
List<String> productIDs = fRow.getMapProperties().get("projectid");
|
|
||||||
if (productIDs != null && productIDs.size() > 0) {
|
if (layerObject.getProjectDV() == null) {
|
||||||
String projectID = productIDs.get(0);
|
|
||||||
layerObject.setProjectID(projectID);
|
Project theProject;
|
||||||
String profileID = layerObject.getProfileID();
|
try {
|
||||||
try {
|
theProject = GeoportalClientCaller.projects().getProjectByID(layerObject.getProfileID(),
|
||||||
Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID,
|
layerObject.getProjectID());
|
||||||
projectID);
|
|
||||||
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder()
|
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(false);
|
||||||
.fullDocumentMap(false);
|
ProjectDV projectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
||||||
ProjectDV projectDV = ConvertToDataValueObjectModel.toProjectDV(theProject,
|
layerObject.setProjectDV(projectDV);
|
||||||
projectBuilder);
|
} catch (Exception e) {
|
||||||
geoDAO.setProjectDV(projectDV);
|
String erroMsg = "Error occurred on loading project for profileID "+layerObject.getProfileID()+" and projectID "+layerObject.getProjectID();
|
||||||
layerObject.setProjectDV(projectDV);
|
LOG.warn(erroMsg, e);
|
||||||
// Limiting to 1 feature of Layers
|
|
||||||
continue;
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.warn("Error on loading the Project for projectID: " + projectID + " profileID: "
|
|
||||||
+ profileID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for (FeatureRow fRow : features) {
|
||||||
|
// if (fRow.getMapProperties() != null) {
|
||||||
|
// List<String> productIDs = fRow.getMapProperties().get("projectid");
|
||||||
|
// if (productIDs != null && productIDs.size() > 0) {
|
||||||
|
// String projectID = productIDs.get(0);
|
||||||
|
// layerObject.setProjectID(projectID);
|
||||||
|
// String profileID = layerObject.getProfileID();
|
||||||
|
// try {
|
||||||
|
// Project theProject = GeoportalClientCaller.projects().getProjectByID(profileID,
|
||||||
|
// projectID);
|
||||||
|
// ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder()
|
||||||
|
// .fullDocumentMap(false);
|
||||||
|
// ProjectDV projectDV = ConvertToDataValueObjectModel.toProjectDV(theProject,
|
||||||
|
// projectBuilder);
|
||||||
|
// // geoDAO.setProjectDV(projectDV);
|
||||||
|
// layerObject.setProjectDV(projectDV);
|
||||||
|
// // Limiting to 1 feature of Layers
|
||||||
|
// continue;
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LOG.warn("Error on loading the Project for projectID: " + projectID + " profileID: "
|
||||||
|
// + profileID);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
geoDAO.setSourceLayerObject(layerObject);
|
geoDAO.setSourceLayerObject(layerObject);
|
||||||
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
LOG.info("For layer name: " + layerObject.getLayerItem().getName() + " got " + features.size()
|
||||||
+ " feature/s");
|
+ " feature/s");
|
||||||
|
|
|
@ -37,6 +37,13 @@ import com.google.gson.JsonParser;
|
||||||
import com.jayway.jsonpath.JsonPath;
|
import com.jayway.jsonpath.JsonPath;
|
||||||
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class Geoportal_JSON_Mapper.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Oct 24, 2022
|
||||||
|
*/
|
||||||
public class Geoportal_JSON_Mapper {
|
public class Geoportal_JSON_Mapper {
|
||||||
|
|
||||||
public static final String _PAYLOADS = "_payloads";
|
public static final String _PAYLOADS = "_payloads";
|
||||||
|
@ -57,6 +64,15 @@ public class Geoportal_JSON_Mapper {
|
||||||
|
|
||||||
public static final String _THEDOCUMENT = "_theDocument";
|
public static final String _THEDOCUMENT = "_theDocument";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load project view.
|
||||||
|
*
|
||||||
|
* @param theProjectDV the the project DV
|
||||||
|
* @param scope the scope
|
||||||
|
* @param username the username
|
||||||
|
* @return the project view
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
public static ProjectView loadProjectView(ProjectDV theProjectDV, String scope, String username) throws Exception {
|
public static ProjectView loadProjectView(ProjectDV theProjectDV, String scope, String username) throws Exception {
|
||||||
|
|
||||||
String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON();
|
String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON();
|
||||||
|
@ -309,11 +325,13 @@ public class Geoportal_JSON_Mapper {
|
||||||
/**
|
/**
|
||||||
* Read images for fileset.
|
* Read images for fileset.
|
||||||
*
|
*
|
||||||
* @param parentJSONPath the parent JSON path
|
* @param parentJSONPath the parent JSON path
|
||||||
* @param sectionJSONDocument the section JSON document
|
* @param sectionJSONDocument the section JSON document
|
||||||
|
* @param limitToFirstOneFound the limit to first one found
|
||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
public static List<PayloadDV> readImagesForFileset(String parentJSONPath, String sectionJSONDocument) {
|
public static List<PayloadDV> readImagesForFileset(String parentJSONPath, String sectionJSONDocument,
|
||||||
|
boolean limitToFirstOneFound) {
|
||||||
LOG.debug("readImagesForFileset called");
|
LOG.debug("readImagesForFileset called");
|
||||||
|
|
||||||
List<PayloadDV> listImages = new ArrayList<PayloadDV>();
|
List<PayloadDV> listImages = new ArrayList<PayloadDV>();
|
||||||
|
@ -332,14 +350,23 @@ public class Geoportal_JSON_Mapper {
|
||||||
if (isImage) {
|
if (isImage) {
|
||||||
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
|
PayloadDV payloadDV = ConvertToDataValueObjectModel.toPayloadDV(payload);
|
||||||
listImages.add(payloadDV);
|
listImages.add(payloadDV);
|
||||||
|
if (limitToFirstOneFound && listImages.size() == 1)
|
||||||
|
return listImages;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("readImagesForFileset returning listOfImages: "+listImages);
|
LOG.debug("readImagesForFileset returning listOfImages: " + listImages);
|
||||||
return listImages;
|
return listImages;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read gcube SDI layers for fileset.
|
||||||
|
*
|
||||||
|
* @param materializationParentJSONPath the materialization parent JSON path
|
||||||
|
* @param sectionJSONDocument the section JSON document
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
public static List<GCubeSDIViewerLayerDV> readGcubeSDILayersForFileset(String materializationParentJSONPath,
|
public static List<GCubeSDIViewerLayerDV> readGcubeSDILayersForFileset(String materializationParentJSONPath,
|
||||||
String sectionJSONDocument) {
|
String sectionJSONDocument) {
|
||||||
LOG.debug("readGcubeSDILayersForFileset called");
|
LOG.debug("readGcubeSDILayersForFileset called");
|
||||||
|
@ -368,6 +395,14 @@ public class Geoportal_JSON_Mapper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursive fetching layers.
|
||||||
|
*
|
||||||
|
* @param config the config
|
||||||
|
* @param objectJSON the object JSON
|
||||||
|
* @param listSDILayers the list SDI layers
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
private static List<GCubeSDIViewerLayerDV> recursiveFetchingLayers(com.jayway.jsonpath.Configuration config,
|
private static List<GCubeSDIViewerLayerDV> recursiveFetchingLayers(com.jayway.jsonpath.Configuration config,
|
||||||
Object objectJSON, List<GCubeSDIViewerLayerDV> listSDILayers) {
|
Object objectJSON, List<GCubeSDIViewerLayerDV> listSDILayers) {
|
||||||
|
|
||||||
|
@ -392,10 +427,11 @@ public class Geoportal_JSON_Mapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read payloads for fileset.
|
* Recursive fetching payloads.
|
||||||
*
|
*
|
||||||
* @param filesetJSONPath the fileset JSON path
|
* @param config the config
|
||||||
* @param sectionJSONDocument the section JSON document
|
* @param objectJSON the object JSON
|
||||||
|
* @param payloads the payloads
|
||||||
* @return the list
|
* @return the list
|
||||||
*/
|
*/
|
||||||
public static List<Payload> recursiveFetchingPayloads(com.jayway.jsonpath.Configuration config, Object objectJSON,
|
public static List<Payload> recursiveFetchingPayloads(com.jayway.jsonpath.Configuration config, Object objectJSON,
|
||||||
|
@ -410,7 +446,7 @@ public class Geoportal_JSON_Mapper {
|
||||||
LOG.trace("jsonArray: " + theJsonArray.toString(3));
|
LOG.trace("jsonArray: " + theJsonArray.toString(3));
|
||||||
|
|
||||||
for (int i = 0; i < theJsonArray.length(); i++) {
|
for (int i = 0; i < theJsonArray.length(); i++) {
|
||||||
recursiveFetchingPayloads(config, theJsonArray.get(i), payloads);
|
payloads = recursiveFetchingPayloads(config, theJsonArray.get(i), payloads);
|
||||||
}
|
}
|
||||||
} else if (objectJSON instanceof JSONObject) {
|
} else if (objectJSON instanceof JSONObject) {
|
||||||
JSONObject toStringPayloads = (JSONObject) objectJSON;
|
JSONObject toStringPayloads = (JSONObject) objectJSON;
|
||||||
|
@ -420,8 +456,8 @@ public class Geoportal_JSON_Mapper {
|
||||||
payload = Serialization.read(toStringPayloads.toString(), Payload.class);
|
payload = Serialization.read(toStringPayloads.toString(), Payload.class);
|
||||||
payloads.add(payload);
|
payloads.add(payload);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.warn("Error on converting the JSON Boject " + toStringPayloads + "as " + Payload.class.getSimpleName()
|
LOG.warn("Error on converting the JSON Boject " + toStringPayloads + "as "
|
||||||
+ e.getMessage());
|
+ Payload.class.getSimpleName() + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -430,6 +466,13 @@ public class Geoportal_JSON_Mapper {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conver layer.
|
||||||
|
*
|
||||||
|
* @param config the config
|
||||||
|
* @param thJsonObject the th json object
|
||||||
|
* @return the g cube SDI viewer layer DV
|
||||||
|
*/
|
||||||
// TODO THIS PART SHOULD BE REVISITED/OPTIMIZED
|
// TODO THIS PART SHOULD BE REVISITED/OPTIMIZED
|
||||||
private static GCubeSDIViewerLayerDV converLayer(com.jayway.jsonpath.Configuration config,
|
private static GCubeSDIViewerLayerDV converLayer(com.jayway.jsonpath.Configuration config,
|
||||||
JSONObject thJsonObject) {
|
JSONObject thJsonObject) {
|
||||||
|
@ -576,6 +619,11 @@ public class Geoportal_JSON_Mapper {
|
||||||
return gson.toJson(jsonObject);
|
return gson.toJson(jsonObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pretty print project view.
|
||||||
|
*
|
||||||
|
* @param projectView the project view
|
||||||
|
*/
|
||||||
public static void prettyPrintProjectView(ProjectView projectView) {
|
public static void prettyPrintProjectView(ProjectView projectView) {
|
||||||
|
|
||||||
for (SectionView section : projectView.getListSections()) {
|
for (SectionView section : projectView.getListSections()) {
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
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.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ public class GeoNaSpatialQueryResult implements Serializable {
|
||||||
// Map with couple (mongoId concessione, list of uploaded GNAImages for the
|
// Map with couple (mongoId concessione, list of uploaded GNAImages for the
|
||||||
// concessione)
|
// concessione)
|
||||||
private Map<String, List<PayloadDV>> mapImages = null;
|
private Map<String, List<PayloadDV>> mapImages = null;
|
||||||
private ProjectDV projectDV;
|
// private ProjectDV projectDV;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geo na data object.
|
* Instantiates a new geo na data object.
|
||||||
|
@ -36,14 +35,14 @@ public class GeoNaSpatialQueryResult implements Serializable {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectDV(ProjectDV projectDV) {
|
// public void setProjectDV(ProjectDV projectDV) {
|
||||||
this.projectDV = projectDV;
|
// this.projectDV = projectDV;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public ProjectDV getProjectDV() {
|
// public ProjectDV getProjectDV() {
|
||||||
return projectDV;
|
// return projectDV;
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the features.
|
* Gets the features.
|
||||||
|
@ -108,8 +107,6 @@ public class GeoNaSpatialQueryResult implements Serializable {
|
||||||
builder.append(sourceLayerObject);
|
builder.append(sourceLayerObject);
|
||||||
builder.append(", mapImages=");
|
builder.append(", mapImages=");
|
||||||
builder.append(mapImages);
|
builder.append(mapImages);
|
||||||
builder.append(", projectDV=");
|
|
||||||
builder.append(projectDV);
|
|
||||||
builder.append("]");
|
builder.append("]");
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,8 +454,9 @@ body {
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
.search-facility {
|
.search-facility {
|
||||||
width: 600px;
|
width: 750px;
|
||||||
max-height: 700px;
|
max-height: 700px;
|
||||||
|
max-width: 850px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-textbox {
|
.search-textbox {
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer;
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
|
@ -120,9 +125,10 @@ public class GeoportalViewer_Tests {
|
||||||
Project project = clientProjects.getProjectByID(PROFILE_ID, PROJECT_ID);
|
Project project = clientProjects.getProjectByID(PROFILE_ID, PROJECT_ID);
|
||||||
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 filesetJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER, Geoportal_JSON_Mapper.FILESET);
|
String filesetJSONPath = String.format("%s..%s", Geoportal_JSON_Mapper.JSON_$_POINTER,
|
||||||
listImages = Geoportal_JSON_Mapper.readImagesForFileset(filesetJSONPath, jsonDocument);
|
Geoportal_JSON_Mapper.FILESET);
|
||||||
|
listImages = Geoportal_JSON_Mapper.readImagesForFileset(filesetJSONPath, jsonDocument, true);
|
||||||
|
|
||||||
listImages.stream().forEach(s -> System.out.println("Image: " + s));
|
listImages.stream().forEach(s -> System.out.println("Image: " + s));
|
||||||
|
|
||||||
|
@ -133,5 +139,31 @@ public class GeoportalViewer_Tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Test
|
||||||
|
public void testUCDQuery() {
|
||||||
|
QueryRequest request = new QueryRequest();
|
||||||
|
request.setFilter(
|
||||||
|
Document.parse("{\"" + UseCaseDescriptor.ID + "\" : " + "{\"$eq\" : \"" + PROFILE_ID + "\"}}"));
|
||||||
|
request.setProjection(Document.parse("{\"" + UseCaseDescriptor.NAME + "\" : " + "1}"));
|
||||||
|
|
||||||
|
try {
|
||||||
|
useCaseDescriptors().build().query(request).forEachRemaining(u -> {
|
||||||
|
try {
|
||||||
|
System.out.println("UCD for id" + u.getId() + " returend name: " + u.getName());
|
||||||
|
ProjectDV projectDV = new ProjectDV();
|
||||||
|
projectDV.setId(PROJECT_ID);
|
||||||
|
projectDV.setProfileName(u.getName());
|
||||||
|
projectDV.setProfileID(u.getId());
|
||||||
|
System.out.println(projectDV);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("Invalid UCD, UCID : " + u.getId());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
// silent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue