improvement display features

task_21890
Francesco Mangiacrapa 3 years ago
parent b6af6ad299
commit fb1ee8456f

@ -42,7 +42,7 @@ public class GeoportalDataViewerConstants {
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/>";

@ -57,6 +57,7 @@ import com.google.gwt.user.client.EventListener;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
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.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
@ -147,16 +148,15 @@ public class LayerManager {
GWT.log("MAX_WFS_FEATURES is: " + GeoportalDataViewerConstants.MAX_WFS_FEATURES);
// GeoportalDataViewerConstants.print("calling getDataResult");
List<LayerObject> listLO = new ArrayList<LayerObject>();
//for querying base layers
// for querying base layers
listLO.addAll(mapBaseLayerObjects.values());
//for querying detail layers only in this case
if(olMap.getCurrentResolution()<OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
// for querying detail layers only in this case
if (olMap.getCurrentResolution() < OLMapManager.LAYER_DETAIL_MAX_RESOLUTION) {
listLO.addAll(mapDetailLayerObjects.values());
}
GeoportalDataViewerServiceAsync.Util.getInstance().getDataResult(listLO, olMap.getProjectionCode(),
mapBBOX, GeoportalDataViewerConstants.MAX_WFS_FEATURES, olMap.getCurrentZoomLevel(),
new AsyncCallback<List<GeoNaSpatialQueryResult>>() {
@ -171,7 +171,7 @@ public class LayerManager {
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
//GWT.log("GeoNaDataObject's: " + listGeonaDataObjects);
// GWT.log("GeoNaDataObject's: " + listGeonaDataObjects);
// GeoportalDataViewerConstants.print("GeoNaDataObject's:
// "+listGeonaDataObjects);
@ -179,7 +179,7 @@ public class LayerManager {
return;
FeatureRow feature = null;
MapEventType sourceEvent = queryEvent.getSourceMapEventType();
// TODO SWTCH FOR EARCH ITEM TYPE
@ -223,11 +223,10 @@ public class LayerManager {
// to a record/concessione (not centroid layer),
// so calling show popuup info on detail layers if the
// following events are true.
if (sourceEvent
.equals(MapEventType.MOUSE_CLICK)
&& olMap.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
//Here I need to pass only the visible layers
if (sourceEvent.equals(MapEventType.MOUSE_CLICK) && olMap
.getCurrentZoomLevel() > OLMapManager.QUERY_MIN_ZOOM_LEVEL) {
// Here I need to pass only the visible layers
showPopupInfoForLayer(listGeonaDataObjects,
queryEvent.getQueryClickExtent());
}
@ -244,8 +243,8 @@ public class LayerManager {
GWT.log("the product id is: " + theProductId);
// Displaying popup info for centroid layer
if (sourceEvent
.equals(MapEventType.MOUSE_CLICK) || sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)){
if (sourceEvent.equals(MapEventType.MOUSE_CLICK)
|| sourceEvent.equals(MapEventType.ADDED_CENTROID_LAYER_TO_MAP)) {
showPopupInfoForCentroidLayer(geoNaDataObject, feature,
queryEvent.getQueryClickExtent().getCenter());
}
@ -271,7 +270,8 @@ public class LayerManager {
layer.getLayerName(), layer.getWmsLink(),
false, false, layer.getLayerUUID(), true,
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,layer.getRefersTo());
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,
layer.getRefersTo());
}
}
@ -308,7 +308,7 @@ public class LayerManager {
}
});
}
public void removeAllDetailLayers() {
mapDetailLayerObjects.clear();
olMap.removeAllDetailLayers();
@ -343,21 +343,22 @@ public class LayerManager {
/**
* Adds the layer.
*
* @param geonaItemType the geona item type
* @param layerTitle the layer title
* @param layerName the layer name
* @param wmsLink the wms link
* @param isBase the is base
* @param displayInLayerSwitcher the display in layer switcher
* @param UUID the uuid
* @param asDetailLayer the as detail layer
* @param minResolution the min resolution
* @param maxResolution the max resolution
* @param geonaItemType the geona item type
* @param layerTitle the layer title
* @param layerName the layer name
* @param wmsLink the wms link
* @param isBase the is base
* @param displayInLayerSwitcher the display in layer switcher
* @param UUID the uuid
* @param asDetailLayer the as detail layer
* @param minResolution the min resolution
* @param maxResolution the max resolution
* @param refersToBaseConcessione the refers to base concessione
*/
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 boolean asDetailLayer, Double minResolution, Double maxResolution, BaseConcessioneDV refersToBaseConcessione) {
final boolean asDetailLayer, Double minResolution, Double maxResolution,
BaseConcessioneDV refersToBaseConcessione) {
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
//
@ -398,30 +399,30 @@ public class LayerManager {
displayInLayerSwitcher, (ArrayList<String>) geoInfoWMS.getStyles().getGeoStyles(),
geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(),
geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution);
LayerObject lo = new LayerObject();
lo.setLayerItem(layerItem);
lo.setItemType(geonaItemType);
lo.setSourceConcessione(refersToBaseConcessione);
String key = layerItem.getName(); //should be unique
//layerObjects.put(key, lo);
if(!asDetailLayer) {
//is a base layer
String key = layerItem.getName(); // should be unique
// layerObjects.put(key, lo);
if (!asDetailLayer) {
// is a base layer
LayerObject blo = mapBaseLayerObjects.get(key);
if(blo==null) {
if (blo == null) {
olMap.addWMSLayer(layerItem);
mapBaseLayerObjects.put(key, lo);
}else {
} else {
GWT.log("Skipping base layer " + key + " already added to Map");
}
}else {
} else {
LayerObject dlo = mapDetailLayerObjects.get(key);
if(dlo==null) {
if (dlo == null) {
mapDetailLayerObjects.put(key, lo);
olMap.addWMSDetailLayer(layerItem);
}else {
} else {
GWT.log("Skipping detail layer " + key + " already added to Map");
}
}
@ -520,98 +521,210 @@ public class LayerManager {
* @param feature the feature
* @param onFailureCenterTo the on failure center to
*/
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject,
ExtentWrapped queryClick) {
public void showPopupInfoForLayer(List<GeoNaSpatialQueryResult> listGeoNaDataObject, ExtentWrapped queryClick) {
ScrollPanel scrollPanel = new ScrollPanel();
VerticalPanel vpPanel = new VerticalPanel();
scrollPanel.add(vpPanel);
FlowPanel flowPanel = new FlowPanel();
scrollPanel.add(flowPanel);
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) {
try {
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);
flowPanel.add(heading);
HTML subText = new HTML(
"<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
flowPanel.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);
flowPanel.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("<i>No data available</i>").toString());
flowPanel.add(flex);
continue;
// olMap.showPopup(vpPanel.toString(), onFailureCenterTo);
}
GWT.log("Displaying "+features.size() + " 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+", ";
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();
if (entries.size() == 0) {
//Adding this row to show "no property" for feature
//intFlex.setHTML(i + 1, 1, new HTML("<i>No property</i>").toString());
}
valueToDisplay = valueToDisplay.substring(0,valueToDisplay.length()-2);
intFlex.setHTML(0, j, new HTML(key).toString());
intFlex.setHTML(1, j, new HTML(valueToDisplay).toString());
j++;
int j = 0;
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);
// 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++;
}
i++;
}
vpPanel.add(intFlex);
flowPanel.add(intFlex);
} catch (Exception e) {
GeoportalDataViewerConstants.printJs("Error: "+e.getMessage());
}
}
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());
}
// /**
// * 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.

@ -1,18 +1,14 @@
package org.gcube.portlets.user.geoportaldataviewer.server;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
import java.util.ArrayList;
import java.util.List;
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.UploadedImage;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
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.LoggerFactory;
@ -54,10 +50,8 @@ public class ConcessioneImageUtil {
if (itemType.equalsIgnoreCase("concessione")) {
LOG.info("Trying to get concessione for id " + itemId);
SessionUtil.getCurrentContext(httpServletRequest, true);
SessionUtil.getCurrentToken(httpServletRequest, true);
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
Concessione concessione = concessioniManager.getById(itemId);
ConcessioniMongoService cms = new ConcessioniMongoService();
Concessione concessione = cms.getItemById(httpServletRequest, itemId);
if (concessione != null) {
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
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;
import static org.gcube.application.geoportal.client.GeoportalAbstractPlugin.statefulMongoConcessioni;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@ -9,7 +7,6 @@ import java.util.LinkedHashMap;
import java.util.List;
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.LayerConcessione;
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.server.gis.FeatureParser;
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.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -145,6 +142,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
maxWFSFeature);
LOG.debug("For layer name: " + layerObject.getLayerItem().getName() + " got features: " + features);
geoDAO.setFeatures(features);
//Getting the concessioneId from WFS features
for (FeatureRow fRow : features) {
if (fRow.getMapProperties() != null) {
List<String> concessioneIds = fRow.getMapProperties().get("product_id");
@ -218,10 +217,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
if (itemType.equalsIgnoreCase("concessione")) {
LOG.info("Trying to get concessione for id " + itemId);
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
Concessione concessione = concessioniManager.getById(itemId);
ConcessioniMongoService cms = new ConcessioniMongoService();
Concessione concessione = cms.getItemById(this.getThreadLocalRequest(), itemId);
BaseConcessioneDV baseConcessione = ConvertToDataViewModel.toBaseConcessione(concessione);
if (concessione != null) {
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
@ -272,11 +270,15 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
try {
LOG.info("Trying to get record for id " + mongoId);
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
// Obtain the client
ConcessioniManagerI manager = statefulMongoConcessioni().build();
Concessione concessione = manager.getById(mongoId);
// SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
// SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
// // Obtain the client
// ConcessioniManagerI manager = statefulMongoConcessioni().build();
// Concessione concessione = manager.getById(mongoId);
ConcessioniMongoService cms = new ConcessioniMongoService();
Concessione concessione = cms.getItemById(this.getThreadLocalRequest(), mongoId);
LOG.info("Got concessione for mongoId: " + mongoId);
if (concessione != null) {
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");
LayerConcessioneDV layerPosizionamento = concessionDV.getPosizionamentoScavo();
if (layerPosizionamento != null) {
if (!CheckAccessUtil.isAccessible(layerPosizionamento.getPolicy(), userName)) {
if (!CheckAccessPolicyUtil.isAccessible(layerPosizionamento.getPolicy(), userName)) {
concessionDV.setPosizionamentoScavo(null);
}
}
@ -301,7 +303,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
if (listLayersDV != null) {
List<LayerConcessioneDV> accessibleListLayersDV = new ArrayList<LayerConcessioneDV>();
for (LayerConcessioneDV layerDV : listLayersDV) {
if (CheckAccessUtil.isAccessible(layerDV.getPolicy(), userName)) {
if (CheckAccessPolicyUtil.isAccessible(layerDV.getPolicy(), userName)) {
accessibleListLayersDV.add(layerDV);
}
}
@ -310,14 +312,14 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
AbstractRelazioneScavoDV abstractRS = concessionDV.getAbstractRelazioneScavo();
if (abstractRS != null) {
if (!CheckAccessUtil.isAccessible(abstractRS.getPolicy(), userName)) {
if (!CheckAccessPolicyUtil.isAccessible(abstractRS.getPolicy(), userName)) {
concessionDV.setAbstractRelazioneScavo(null);
}
}
RelazioneScavoDV relazioneScavo = concessionDV.getRelazioneScavo();
if (relazioneScavo != null) {
if (!CheckAccessUtil.isAccessible(relazioneScavo.getPolicy(), userName)) {
if (!CheckAccessPolicyUtil.isAccessible(relazioneScavo.getPolicy(), userName)) {
concessionDV.setRelazioneScavo(null);
}
}
@ -329,7 +331,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
// SHOWING ACESSIBLE IMAGES
for (UploadedImageDV uploadedImageDV : immagini) {
if (CheckAccessUtil.isAccessible(uploadedImageDV.getPolicy(), userName)) {
if (CheckAccessPolicyUtil.isAccessible(uploadedImageDV.getPolicy(), userName)) {
accessibleListImages.add(uploadedImageDV);
}

@ -1,13 +1,14 @@
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.
@ -51,7 +52,7 @@ public class CheckAccessUtil {
}
/**
* Checks if is accessible.
* Checks if is accessible accoding to access policies
*
* @param policy the policy
* @param myLogin the my login
Loading…
Cancel
Save