improvement display features
This commit is contained in:
parent
b6af6ad299
commit
fb1ee8456f
|
@ -42,7 +42,7 @@ public class GeoportalDataViewerConstants {
|
||||||
|
|
||||||
public static DateTimeFormat DT_FORMAT = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
|
public static DateTimeFormat DT_FORMAT = DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT);
|
||||||
|
|
||||||
public static final int MAX_WFS_FEATURES = 3; // zero for no limit
|
public static final int MAX_WFS_FEATURES = 10; // zero for no limit
|
||||||
|
|
||||||
public static final String NEW_LINE_BR = "<br/>";
|
public static final String NEW_LINE_BR = "<br/>";
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ import com.google.gwt.user.client.EventListener;
|
||||||
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;
|
||||||
|
import com.google.gwt.user.client.ui.FlowPanel;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.gwt.user.client.ui.ScrollPanel;
|
import com.google.gwt.user.client.ui.ScrollPanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
@ -147,13 +148,12 @@ public class LayerManager {
|
||||||
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
|
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
|
||||||
// GeoportalDataViewerConstants.print("calling getDataResult");
|
// GeoportalDataViewerConstants.print("calling getDataResult");
|
||||||
|
|
||||||
|
|
||||||
List<LayerObject> listLO = new ArrayList<LayerObject>();
|
List<LayerObject> listLO = new ArrayList<LayerObject>();
|
||||||
//for querying base layers
|
// for querying base layers
|
||||||
listLO.addAll(mapBaseLayerObjects.values());
|
listLO.addAll(mapBaseLayerObjects.values());
|
||||||
|
|
||||||
//for querying detail layers only in this case
|
// for querying detail layers only in this case
|
||||||
if(olMap.getCurrentResolution()<OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
if (olMap.getCurrentResolution() < OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
|
||||||
listLO.addAll(mapDetailLayerObjects.values());
|
listLO.addAll(mapDetailLayerObjects.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ public class LayerManager {
|
||||||
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
|
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
|
||||||
|
|
||||||
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
|
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
|
||||||
//GWT.log("GeoNaDataObject's: " + listGeonaDataObjects);
|
// GWT.log("GeoNaDataObject's: " + listGeonaDataObjects);
|
||||||
// GeoportalDataViewerConstants.print("GeoNaDataObject's:
|
// GeoportalDataViewerConstants.print("GeoNaDataObject's:
|
||||||
// "+listGeonaDataObjects);
|
// "+listGeonaDataObjects);
|
||||||
|
|
||||||
|
@ -223,11 +223,10 @@ public class LayerManager {
|
||||||
// to a record/concessione (not centroid layer),
|
// to a record/concessione (not centroid layer),
|
||||||
// so calling show popuup info on detail layers if the
|
// so calling show popuup info on detail layers if the
|
||||||
// following events are true.
|
// following events are true.
|
||||||
if (sourceEvent
|
if (sourceEvent.equals(MapEventType.MOUSE_CLICK) && olMap
|
||||||
.equals(MapEventType.MOUSE_CLICK)
|
.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
|
||||||
&& olMap.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
|
|
||||||
|
|
||||||
//Here I need to pass only the visible layers
|
// Here I need to pass only the visible layers
|
||||||
showPopupInfoForLayer(listGeonaDataObjects,
|
showPopupInfoForLayer(listGeonaDataObjects,
|
||||||
queryEvent.getQueryClickExtent());
|
queryEvent.getQueryClickExtent());
|
||||||
}
|
}
|
||||||
|
@ -244,8 +243,8 @@ public class LayerManager {
|
||||||
|
|
||||||
GWT.log("the product id is: " + theProductId);
|
GWT.log("the product id is: " + theProductId);
|
||||||
// Displaying popup info for centroid layer
|
// Displaying popup info for centroid layer
|
||||||
if (sourceEvent
|
if (sourceEvent.equals(MapEventType.MOUSE_CLICK)
|
||||||
.equals(MapEventType.MOUSE_CLICK) || sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)){
|
|| sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)) {
|
||||||
showPopupInfoForCentroidLayer(geoNaDataObject, feature,
|
showPopupInfoForCentroidLayer(geoNaDataObject, feature,
|
||||||
queryEvent.getQueryClickExtent().getCenter());
|
queryEvent.getQueryClickExtent().getCenter());
|
||||||
}
|
}
|
||||||
|
@ -271,7 +270,8 @@ public class LayerManager {
|
||||||
layer.getLayerName(), layer.getWmsLink(),
|
layer.getLayerName(), layer.getWmsLink(),
|
||||||
false, false, layer.getLayerUUID(), true,
|
false, false, layer.getLayerUUID(), true,
|
||||||
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
|
||||||
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,layer.getRefersTo());
|
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
|
||||||
|
layer.getRefersTo());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,8 @@ public class LayerManager {
|
||||||
*/
|
*/
|
||||||
public void addLayer(final String geonaItemType, final String layerTitle, final String layerName,
|
public void addLayer(final String geonaItemType, 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, BaseConcessioneDV refersToBaseConcessione) {
|
final boolean asDetailLayer, Double minResolution, Double maxResolution,
|
||||||
|
BaseConcessioneDV refersToBaseConcessione) {
|
||||||
|
|
||||||
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
|
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
|
||||||
//
|
//
|
||||||
|
@ -404,24 +405,24 @@ public class LayerManager {
|
||||||
lo.setItemType(geonaItemType);
|
lo.setItemType(geonaItemType);
|
||||||
lo.setSourceConcessione(refersToBaseConcessione);
|
lo.setSourceConcessione(refersToBaseConcessione);
|
||||||
|
|
||||||
String key = layerItem.getName(); //should be unique
|
String key = layerItem.getName(); // should be unique
|
||||||
//layerObjects.put(key, lo);
|
// layerObjects.put(key, lo);
|
||||||
|
|
||||||
if(!asDetailLayer) {
|
if (!asDetailLayer) {
|
||||||
//is a base layer
|
// is a base layer
|
||||||
LayerObject blo = mapBaseLayerObjects.get(key);
|
LayerObject blo = mapBaseLayerObjects.get(key);
|
||||||
if(blo==null) {
|
if (blo == null) {
|
||||||
olMap.addWMSLayer(layerItem);
|
olMap.addWMSLayer(layerItem);
|
||||||
mapBaseLayerObjects.put(key, lo);
|
mapBaseLayerObjects.put(key, lo);
|
||||||
}else {
|
} else {
|
||||||
GWT.log("Skipping base layer " + key + " already added to Map");
|
GWT.log("Skipping base layer " + key + " already added to Map");
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
LayerObject dlo = mapDetailLayerObjects.get(key);
|
LayerObject dlo = mapDetailLayerObjects.get(key);
|
||||||
if(dlo==null) {
|
if (dlo == null) {
|
||||||
mapDetailLayerObjects.put(key, lo);
|
mapDetailLayerObjects.put(key, lo);
|
||||||
olMap.addWMSDetailLayer(layerItem);
|
olMap.addWMSDetailLayer(layerItem);
|
||||||
}else {
|
} else {
|
||||||
GWT.log("Skipping detail layer " + key + " already added to Map");
|
GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -520,35 +521,36 @@ public class LayerManager {
|
||||||
* @param feature the feature
|
* @param feature the feature
|
||||||
* @param onFailureCenterTo the on failure center to
|
* @param onFailureCenterTo the on failure center to
|
||||||
*/
|
*/
|
||||||
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject,
|
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
|
||||||
ExtentWrapped queryClick) {
|
|
||||||
|
|
||||||
ScrollPanel scrollPanel = new ScrollPanel();
|
ScrollPanel scrollPanel = new ScrollPanel();
|
||||||
VerticalPanel vpPanel = new VerticalPanel();
|
FlowPanel flowPanel = new FlowPanel();
|
||||||
scrollPanel.add(vpPanel);
|
scrollPanel.add(flowPanel);
|
||||||
|
|
||||||
String prevConcessioneName = "";
|
String prevConcessioneName = "";
|
||||||
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||||
|
try {
|
||||||
GWT.log("baseLayerFromISProfile.getName() :"+baseLayerFromISProfile.getName());
|
GWT.log("baseLayerFromISProfile.getName() :" + baseLayerFromISProfile.getName());
|
||||||
LayerObject lo = geoNaSpatialQueryResult.getSourceLayerObject();
|
LayerObject lo = geoNaSpatialQueryResult.getSourceLayerObject();
|
||||||
LayerItem sourceLI = lo.getLayerItem();
|
LayerItem sourceLI = lo.getLayerItem();
|
||||||
|
|
||||||
String layerSourceName = sourceLI.getName();
|
String layerSourceName = sourceLI.getName();
|
||||||
|
|
||||||
//skipping centroid layer
|
// skipping centroid layer
|
||||||
if(layerSourceName==null || layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName())==0) {
|
if (layerSourceName == null
|
||||||
|
|| layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName()) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nomeConcessione = lo.getSourceConcessione().getNome();
|
String nomeConcessione = lo.getSourceConcessione().getNome();
|
||||||
if(prevConcessioneName.compareTo(nomeConcessione)!=0) {
|
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
|
||||||
String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
|
String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
|
||||||
Heading heading = new Heading(4, concessioneIntro);
|
Heading heading = new Heading(4, concessioneIntro);
|
||||||
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
vpPanel.add(heading);
|
flowPanel.add(heading);
|
||||||
HTML subText = new HTML("<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
|
HTML subText = new HTML(
|
||||||
vpPanel.add(subText);
|
"<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
|
||||||
|
flowPanel.add(subText);
|
||||||
}
|
}
|
||||||
|
|
||||||
prevConcessioneName = nomeConcessione;
|
prevConcessioneName = nomeConcessione;
|
||||||
|
@ -559,7 +561,7 @@ public class LayerManager {
|
||||||
layerLabel.setText(layerSourceName);
|
layerLabel.setText(layerSourceName);
|
||||||
layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||||
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
||||||
vpPanel.add(layerLabel);
|
flowPanel.add(layerLabel);
|
||||||
|
|
||||||
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||||
|
|
||||||
|
@ -568,44 +570,55 @@ public class LayerManager {
|
||||||
flex.setCellPadding(1);
|
flex.setCellPadding(1);
|
||||||
flex.setCellSpacing(1);
|
flex.setCellSpacing(1);
|
||||||
flex.getElement().addClassName("table-feature");
|
flex.getElement().addClassName("table-feature");
|
||||||
flex.setHTML(0, 0, new HTML("No data available").toString());
|
flex.setHTML(0, 0, new HTML("<i>No data available</i>").toString());
|
||||||
vpPanel.add(flex);
|
flowPanel.add(flex);
|
||||||
continue;
|
continue;
|
||||||
//olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
// olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FeatureRow feature : features) {
|
GWT.log("Displaying "+features.size() + " features");
|
||||||
|
|
||||||
FlexTable intFlex = new FlexTable();
|
FlexTable intFlex = new FlexTable();
|
||||||
intFlex.setCellPadding(1);
|
intFlex.setCellPadding(1);
|
||||||
intFlex.setCellSpacing(1);
|
intFlex.setCellSpacing(1);
|
||||||
intFlex.getElement().addClassName("table-feature");
|
intFlex.getElement().addClassName("table-feature");
|
||||||
|
|
||||||
intFlex.setHTML(0, 0, new HTML("Feature Id").toString());
|
intFlex.setHTML(0, 0, new HTML("Feature Id").toString());
|
||||||
intFlex.setHTML(1, 0, new HTML(feature.getId()).toString());
|
|
||||||
|
|
||||||
// Showing properties belonging to concessioni centroid layer
|
int i = 0;
|
||||||
|
for (FeatureRow feature : features) {
|
||||||
|
|
||||||
|
intFlex.setHTML(i + 1, 0, new HTML(feature.getId()).toString());
|
||||||
|
|
||||||
|
// Showing properties belonging to concessioni layer
|
||||||
Map<String, List<String>> entries = feature.getMapProperties();
|
Map<String, List<String>> entries = feature.getMapProperties();
|
||||||
|
|
||||||
if (entries.size() == 0) {
|
if (entries.size() == 0) {
|
||||||
intFlex.setHTML(1, 1, new HTML("No property available").toString());
|
//Adding this row to show "no property" for feature
|
||||||
|
//intFlex.setHTML(i + 1, 1, new HTML("<i>No property</i>").toString());
|
||||||
}
|
}
|
||||||
int j = 1;
|
int j = 0;
|
||||||
for (String key : entries.keySet()) {
|
for (String key : entries.keySet()) {
|
||||||
List<String> theValues = entries.get(key);
|
List<String> theValues = entries.get(key);
|
||||||
String valueToDisplay = "";
|
String valueToDisplay = "";
|
||||||
for (String value : theValues) {
|
for (String value : theValues) {
|
||||||
valueToDisplay+=value+", ";
|
valueToDisplay += value + ", ";
|
||||||
|
|
||||||
}
|
}
|
||||||
valueToDisplay = valueToDisplay.substring(0,valueToDisplay.length()-2);
|
valueToDisplay = valueToDisplay.substring(0, valueToDisplay.length() - 2);
|
||||||
intFlex.setHTML(0, j, new HTML(key).toString());
|
|
||||||
intFlex.setHTML(1, j, new HTML(valueToDisplay).toString());
|
// adding the keys only of first feature row. They are equal for all features
|
||||||
|
// (beloning to same layer).
|
||||||
|
if (i == 0)
|
||||||
|
intFlex.setHTML(0, j + 1, new HTML(key).toString());
|
||||||
|
|
||||||
|
intFlex.setHTML(i + 1, j + 1, new HTML(valueToDisplay).toString());
|
||||||
j++;
|
j++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
vpPanel.add(intFlex);
|
}
|
||||||
|
flowPanel.add(intFlex);
|
||||||
|
} catch (Exception e) {
|
||||||
|
GeoportalDataViewerConstants.printJs("Error: "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,6 +626,106 @@ public class LayerManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Show popup info for layer.
|
||||||
|
// *
|
||||||
|
// * @param geoNaDataObject the geo na data object
|
||||||
|
// * @param feature the feature
|
||||||
|
// * @param onFailureCenterTo the on failure center to
|
||||||
|
// */
|
||||||
|
// public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject,
|
||||||
|
// ExtentWrapped queryClick) {
|
||||||
|
//
|
||||||
|
// ScrollPanel scrollPanel = new ScrollPanel();
|
||||||
|
// VerticalPanel vpPanel = new VerticalPanel();
|
||||||
|
// scrollPanel.add(vpPanel);
|
||||||
|
//
|
||||||
|
// String prevConcessioneName = "";
|
||||||
|
// for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
|
||||||
|
//
|
||||||
|
// GWT.log("baseLayerFromISProfile.getName() :"+baseLayerFromISProfile.getName());
|
||||||
|
// LayerObject lo = geoNaSpatialQueryResult.getSourceLayerObject();
|
||||||
|
// LayerItem sourceLI = lo.getLayerItem();
|
||||||
|
//
|
||||||
|
// String layerSourceName = sourceLI.getName();
|
||||||
|
//
|
||||||
|
// //skipping centroid layer
|
||||||
|
// if(layerSourceName==null || layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName())==0) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// String nomeConcessione = lo.getSourceConcessione().getNome();
|
||||||
|
// if(prevConcessioneName.compareTo(nomeConcessione)!=0) {
|
||||||
|
// String concessioneIntro = StringUtil.ellipsize(lo.getSourceConcessione().getNome(), 40);
|
||||||
|
// Heading heading = new Heading(4, concessioneIntro);
|
||||||
|
// heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
|
// vpPanel.add(heading);
|
||||||
|
// HTML subText = new HTML("<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
|
||||||
|
// vpPanel.add(subText);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// prevConcessioneName = nomeConcessione;
|
||||||
|
//
|
||||||
|
// Label layerLabel = new Label();
|
||||||
|
// layerLabel.setType(LabelType.INFO);
|
||||||
|
//
|
||||||
|
// layerLabel.setText(layerSourceName);
|
||||||
|
// layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||||
|
// layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
||||||
|
// vpPanel.add(layerLabel);
|
||||||
|
//
|
||||||
|
// List<FeatureRow> features = geoNaSpatialQueryResult.getFeatures();
|
||||||
|
//
|
||||||
|
// if (features == null || features.isEmpty()) {
|
||||||
|
// FlexTable flex = new FlexTable();
|
||||||
|
// flex.setCellPadding(1);
|
||||||
|
// flex.setCellSpacing(1);
|
||||||
|
// flex.getElement().addClassName("table-feature");
|
||||||
|
// flex.setHTML(0, 0, new HTML("No data available").toString());
|
||||||
|
// vpPanel.add(flex);
|
||||||
|
// continue;
|
||||||
|
// //olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// for (FeatureRow feature : features) {
|
||||||
|
//
|
||||||
|
// FlexTable intFlex = new FlexTable();
|
||||||
|
// intFlex.setCellPadding(1);
|
||||||
|
// intFlex.setCellSpacing(1);
|
||||||
|
// intFlex.getElement().addClassName("table-feature");
|
||||||
|
//
|
||||||
|
// intFlex.setHTML(0, 0, new HTML("Feature Id").toString());
|
||||||
|
// intFlex.setHTML(1, 0, new HTML(feature.getId()).toString());
|
||||||
|
//
|
||||||
|
// // Showing properties belonging to concessioni centroid layer
|
||||||
|
// Map<String, List<String>> entries = feature.getMapProperties();
|
||||||
|
//
|
||||||
|
// if (entries.size() == 0) {
|
||||||
|
// intFlex.setHTML(1, 1, new HTML("No property available").toString());
|
||||||
|
// }
|
||||||
|
// int j = 1;
|
||||||
|
// for (String key : entries.keySet()) {
|
||||||
|
// List<String> theValues = entries.get(key);
|
||||||
|
// String valueToDisplay = "";
|
||||||
|
// for (String value : theValues) {
|
||||||
|
// valueToDisplay+=value+", ";
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// valueToDisplay = valueToDisplay.substring(0,valueToDisplay.length()-2);
|
||||||
|
// intFlex.setHTML(0, j, new HTML(key).toString());
|
||||||
|
// intFlex.setHTML(1, j, new HTML(valueToDisplay).toString());
|
||||||
|
// j++;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// vpPanel.add(intFlex);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show popup info for centroid layer.
|
* Show popup info for centroid layer.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -54,10 +50,8 @@ public class ConcessioneImageUtil {
|
||||||
if (itemType.equalsIgnoreCase("concessione")) {
|
if (itemType.equalsIgnoreCase("concessione")) {
|
||||||
|
|
||||||
LOG.info("Trying to get concessione for id " + itemId);
|
LOG.info("Trying to get concessione for id " + itemId);
|
||||||
SessionUtil.getCurrentContext(httpServletRequest, true);
|
ConcessioniMongoService cms = new ConcessioniMongoService();
|
||||||
SessionUtil.getCurrentToken(httpServletRequest, true);
|
Concessione concessione = cms.getItemById(httpServletRequest, itemId);
|
||||||
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
|
||||||
Concessione concessione = concessioniManager.getById(itemId);
|
|
||||||
if (concessione != null) {
|
if (concessione != null) {
|
||||||
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
||||||
List<UploadedImage> images = concessione.getImmaginiRappresentative();
|
List<UploadedImage> images = concessione.getImmaginiRappresentative();
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
||||||
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class ConcessioniMongoService.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 9, 2021
|
||||||
|
*/
|
||||||
|
public class ConcessioniMongoService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new concessioni mongo service, interface for client statefulMongoConcessioni.
|
||||||
|
*/
|
||||||
|
public ConcessioniMongoService() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the item by id.
|
||||||
|
*
|
||||||
|
* @param request the request
|
||||||
|
* @param mongoItemId the mongo item id
|
||||||
|
* @return the item by id
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
Concessione getItemById(HttpServletRequest request, String mongoItemId) throws Exception{
|
||||||
|
SessionUtil.getCurrentContext(request, true);
|
||||||
|
SessionUtil.getCurrentToken(request, true);
|
||||||
|
//Obtain the client
|
||||||
|
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
||||||
|
//Returning item by Id
|
||||||
|
return concessioniManager.getById(mongoItemId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -9,7 +7,6 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportal.client.legacy.ConcessioniManagerI;
|
|
||||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
|
@ -29,7 +26,7 @@ import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.CheckAccessUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.CheckAccessPolicyUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
@ -145,6 +142,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
maxWFSFeature);
|
maxWFSFeature);
|
||||||
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
|
||||||
geoDAO.setFeatures(features);
|
geoDAO.setFeatures(features);
|
||||||
|
|
||||||
|
//Getting the concessioneId from WFS features
|
||||||
for (FeatureRow fRow : features) {
|
for (FeatureRow fRow : features) {
|
||||||
if (fRow.getMapProperties() != null) {
|
if (fRow.getMapProperties() != null) {
|
||||||
List<String> concessioneIds = fRow.getMapProperties().get("product_id");
|
List<String> concessioneIds = fRow.getMapProperties().get("product_id");
|
||||||
|
@ -218,10 +217,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (itemType.equalsIgnoreCase("concessione")) {
|
if (itemType.equalsIgnoreCase("concessione")) {
|
||||||
|
|
||||||
LOG.info("Trying to get concessione for id " + itemId);
|
LOG.info("Trying to get concessione for id " + itemId);
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
ConcessioniMongoService cms = new ConcessioniMongoService();
|
||||||
SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
|
Concessione concessione = cms.getItemById(this.getThreadLocalRequest(), itemId);
|
||||||
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
|
|
||||||
Concessione concessione = concessioniManager.getById(itemId);
|
|
||||||
BaseConcessioneDV baseConcessione = ConvertToDataViewModel.toBaseConcessione(concessione);
|
BaseConcessioneDV baseConcessione = ConvertToDataViewModel.toBaseConcessione(concessione);
|
||||||
if (concessione != null) {
|
if (concessione != null) {
|
||||||
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
|
||||||
|
@ -272,11 +270,15 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
try {
|
try {
|
||||||
LOG.info("Trying to get record for id " + mongoId);
|
LOG.info("Trying to get record for id " + mongoId);
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
// SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
|
// SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
|
||||||
// Obtain the client
|
// // Obtain the client
|
||||||
ConcessioniManagerI manager = statefulMongoConcessioni().build();
|
// ConcessioniManagerI manager = statefulMongoConcessioni().build();
|
||||||
Concessione concessione = manager.getById(mongoId);
|
// Concessione concessione = manager.getById(mongoId);
|
||||||
|
|
||||||
|
ConcessioniMongoService cms = new ConcessioniMongoService();
|
||||||
|
Concessione concessione = cms.getItemById(this.getThreadLocalRequest(), mongoId);
|
||||||
|
|
||||||
LOG.info("Got concessione for mongoId: " + mongoId);
|
LOG.info("Got concessione for mongoId: " + mongoId);
|
||||||
if (concessione != null) {
|
if (concessione != null) {
|
||||||
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
||||||
|
@ -292,7 +294,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.info("Applying access policies for concessione " + mongoId + " returned by service");
|
LOG.info("Applying access policies for concessione " + mongoId + " returned by service");
|
||||||
LayerConcessioneDV layerPosizionamento = concessionDV.getPosizionamentoScavo();
|
LayerConcessioneDV layerPosizionamento = concessionDV.getPosizionamentoScavo();
|
||||||
if (layerPosizionamento != null) {
|
if (layerPosizionamento != null) {
|
||||||
if (!CheckAccessUtil.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
if (!CheckAccessPolicyUtil.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
||||||
concessionDV.setPosizionamentoScavo(null);
|
concessionDV.setPosizionamentoScavo(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +303,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (listLayersDV != null) {
|
if (listLayersDV != null) {
|
||||||
List<LayerConcessioneDV> accessibleListLayersDV = new ArrayList<LayerConcessioneDV>();
|
List<LayerConcessioneDV> accessibleListLayersDV = new ArrayList<LayerConcessioneDV>();
|
||||||
for (LayerConcessioneDV layerDV : listLayersDV) {
|
for (LayerConcessioneDV layerDV : listLayersDV) {
|
||||||
if (CheckAccessUtil.isAccessible(layerDV.getPolicy(), userName)) {
|
if (CheckAccessPolicyUtil.isAccessible(layerDV.getPolicy(), userName)) {
|
||||||
accessibleListLayersDV.add(layerDV);
|
accessibleListLayersDV.add(layerDV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -310,14 +312,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
AbstractRelazioneScavoDV abstractRS = concessionDV.getAbstractRelazioneScavo();
|
AbstractRelazioneScavoDV abstractRS = concessionDV.getAbstractRelazioneScavo();
|
||||||
if (abstractRS != null) {
|
if (abstractRS != null) {
|
||||||
if (!CheckAccessUtil.isAccessible(abstractRS.getPolicy(), userName)) {
|
if (!CheckAccessPolicyUtil.isAccessible(abstractRS.getPolicy(), userName)) {
|
||||||
concessionDV.setAbstractRelazioneScavo(null);
|
concessionDV.setAbstractRelazioneScavo(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RelazioneScavoDV relazioneScavo = concessionDV.getRelazioneScavo();
|
RelazioneScavoDV relazioneScavo = concessionDV.getRelazioneScavo();
|
||||||
if (relazioneScavo != null) {
|
if (relazioneScavo != null) {
|
||||||
if (!CheckAccessUtil.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
if (!CheckAccessPolicyUtil.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
||||||
concessionDV.setRelazioneScavo(null);
|
concessionDV.setRelazioneScavo(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,7 +331,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
// SHOWING ACESSIBLE IMAGES
|
// SHOWING ACESSIBLE IMAGES
|
||||||
for (UploadedImageDV uploadedImageDV : immagini) {
|
for (UploadedImageDV uploadedImageDV : immagini) {
|
||||||
|
|
||||||
if (CheckAccessUtil.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
if (CheckAccessPolicyUtil.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
||||||
accessibleListImages.add(uploadedImageDV);
|
accessibleListImages.add(uploadedImageDV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class CheckAccessUtil.
|
* The Class CheckAccessPolicyUtil.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Sep 8, 2021
|
* Sep 9, 2021
|
||||||
*/
|
*/
|
||||||
public class CheckAccessUtil {
|
public class CheckAccessPolicyUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Enum ACCESS_POLICY.
|
* The Enum ACCESS_POLICY.
|
||||||
|
@ -51,7 +52,7 @@ public class CheckAccessUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is accessible.
|
* Checks if is accessible accoding to access policies
|
||||||
*
|
*
|
||||||
* @param policy the policy
|
* @param policy the policy
|
||||||
* @param myLogin the my login
|
* @param myLogin the my login
|
Loading…
Reference in New Issue