added refersTo BaseConcessione

This commit is contained in:
Francesco Mangiacrapa 2021-09-09 11:38:25 +02:00
parent 35c5ede770
commit b6af6ad299
7 changed files with 152 additions and 75 deletions

View File

@ -175,7 +175,7 @@ public class GeoportalDataViewer implements EntryPoint {
layerItem.setName(layerName);
layerManager.setBaseLayerFromIsProfile(layerItem);
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
null, false, null, null);
null, false, null, null,null);
if (paramGeonaItemID != null) {
if (paramGeonaItemType == null) {

View File

@ -9,6 +9,7 @@ import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
@ -36,6 +37,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformation
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Heading;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
@ -269,7 +271,7 @@ public class LayerManager {
layer.getLayerName(), layer.getWmsLink(),
false, false, layer.getLayerUUID(), true,
OLMapManager.LAYER_DETAIL_MIN_RESOLUTION,
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION);
OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,layer.getRefersTo());
}
}
@ -351,10 +353,11 @@ public class LayerManager {
* @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) {
final boolean asDetailLayer, Double minResolution, Double maxResolution, BaseConcessioneDV refersToBaseConcessione) {
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
//
@ -399,6 +402,7 @@ public class LayerManager {
LayerObject lo = new LayerObject();
lo.setLayerItem(layerItem);
lo.setItemType(geonaItemType);
lo.setSourceConcessione(refersToBaseConcessione);
String key = layerItem.getName(); //should be unique
//layerObjects.put(key, lo);
@ -523,20 +527,36 @@ public class LayerManager {
VerticalPanel vpPanel = new VerticalPanel();
scrollPanel.add(vpPanel);
String prevConcessioneName = "";
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
GWT.log("baseLayerFromISProfile.getName() :"+baseLayerFromISProfile.getName());
String layerSource = geoNaSpatialQueryResult.getSourceLayerObject().getLayerItem().getName();
LayerObject lo = geoNaSpatialQueryResult.getSourceLayerObject();
LayerItem sourceLI = lo.getLayerItem();
String layerSourceName = sourceLI.getName();
//skipping centroid layer
if(layerSource==null || layerSource.compareToIgnoreCase(baseLayerFromISProfile.getName())==0) {
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(layerSource);
layerLabel.setText(layerSourceName);
layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
vpPanel.add(layerLabel);
@ -587,7 +607,6 @@ public class LayerManager {
vpPanel.add(intFlex);
}
}
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());

View File

@ -244,17 +244,21 @@ public class ConcessioneView extends Composite {
if(layer==null)
return;
if(layer.getPolicy()==null || layer.getPolicy().equalsIgnoreCase("OPEN")) {
posizionamentoAreaIndaginePanel.setVisible(true);
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
}else {
//I need to be authenticated to show the fields according to POLICY
if(myLogin!=null) {
posizionamentoAreaIndaginePanel.setVisible(true);
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
}
}
//NO LONGER NEEDED. MANAGED ON THE SERVER-SIDE #21976
// if(layer.getPolicy()==null || layer.getPolicy().equalsIgnoreCase("OPEN")) {
// posizionamentoAreaIndaginePanel.setVisible(true);
// posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
// }else {
// //I need to be authenticated to show the fields according to POLICY
// if(myLogin!=null) {
// posizionamentoAreaIndaginePanel.setVisible(true);
// posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
// }
//
// }
//
posizionamentoAreaIndaginePanel.setVisible(true);
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
}
@ -266,18 +270,23 @@ public class ConcessioneView extends Composite {
if(listLayersDV==null)
return;
for (LayerConcessioneDV layerDV : listLayersDV) {
if(layerDV.getPolicy()==null || layerDV.getPolicy().equalsIgnoreCase("OPEN")) {
piantaFineScavoPanel.setVisible(true);
piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
}else {
//I need to be authenticated to show the fields according to POLICY
if(myLogin!=null) {
piantaFineScavoPanel.setVisible(true);
piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
}
}
//NO LONGER NEEDED. MANAGED ON THE SERVER-SIDE #21976
// if(layerDV.getPolicy()==null || layerDV.getPolicy().equalsIgnoreCase("OPEN")) {
// piantaFineScavoPanel.setVisible(true);
// piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
// }else {
// //I need to be authenticated to show the fields according to POLICY
// if(myLogin!=null) {
// piantaFineScavoPanel.setVisible(true);
// piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
// }
// }
//
piantaFineScavoPanel.setVisible(true);
piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
}
@ -290,16 +299,20 @@ public class ConcessioneView extends Composite {
if(abstractRS==null)
return;
if(abstractRS.getPolicy()==null || abstractRS.getPolicy().equalsIgnoreCase("OPEN")) {
relazioneScavoPanel.setVisible(true);
relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo(), false));
}else {
//I need to be authenticated to show the fields according to POLICY
if(myLogin!=null) {
relazioneScavoPanel.setVisible(true);
relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo(), true));
}
}
//NO LONGER NEEDED. MANAGED ON THE SERVER-SIDE #21976
// if(abstractRS.getPolicy()==null || abstractRS.getPolicy().equalsIgnoreCase("OPEN")) {
// relazioneScavoPanel.setVisible(true);
// relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo(), false));
// }else {
// //I need to be authenticated to show the fields according to POLICY
// if(myLogin!=null) {
// relazioneScavoPanel.setVisible(true);
// relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo(), true));
// }
// }
relazioneScavoPanel.setVisible(true);
relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo()));
}
private void addCentroidMap() {
@ -331,13 +344,16 @@ public class ConcessioneView extends Composite {
//SHOWING ONLY OPEN IMAGES OR IF THE USER IS LOGGED
for (UploadedImageDV uploadedImageDV : immagini) {
if(uploadedImageDV.getPolicy()==null || uploadedImageDV.getPolicy().equalsIgnoreCase("OPEN")) {
immaginiToShow.add(uploadedImageDV);
}else {
if(myLogin!=null) {
immaginiToShow.add(uploadedImageDV);
}
}
//NO LONGER NEEDED. MANAGED ON THE SERVER-SIDE #21976
// if(uploadedImageDV.getPolicy()==null || uploadedImageDV.getPolicy().equalsIgnoreCase("OPEN")) {
// immaginiToShow.add(uploadedImageDV);
// }else {
// if(myLogin!=null) {
// immaginiToShow.add(uploadedImageDV);
// }
// }
//
immaginiToShow.add(uploadedImageDV);
}
if(immaginiToShow.size()>0) {

View File

@ -46,7 +46,7 @@ public class RelazioneScavoView extends Composite {
private CustomFlexTable customTable = new CustomFlexTable();
public RelazioneScavoView(AbstractRelazioneScavoDV abstractDV, RelazioneScavoDV relazioneScavoDV, boolean autheticatedUser) {
public RelazioneScavoView(AbstractRelazioneScavoDV abstractDV, RelazioneScavoDV relazioneScavoDV) {
initWidget(uiBinder.createAndBindUi(this));
if(abstractDV.getAbstractSectionIta()!=null) {
@ -58,6 +58,10 @@ public class RelazioneScavoView extends Composite {
}
}
if(relazioneScavoDV==null)
return;
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
//customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(), GeoportalDataViewerConstants.NEW_LINE_BR);
@ -81,17 +85,21 @@ public class RelazioneScavoView extends Composite {
}
});
//Showing the Download PFD relazione accoding to policy
if(relazioneScavoDV.getPolicy()==null || relazioneScavoDV.getPolicy().equalsIgnoreCase("OPEN")) {
relazioneScavoPanel.setVisible(true);
showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
//DOWNLOAD RS
}else {
//I need to be authenticated to show the fields according to POLICY
if(autheticatedUser) {
showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
}
}
//Showing the Download PDF relazione accoding to policy
//NO LONGER NEEDED. MANAGED ON THE SERVER-SIDE #21976
// if(relazioneScavoDV.getPolicy()==null || relazioneScavoDV.getPolicy().equalsIgnoreCase("OPEN")) {
// relazioneScavoPanel.setVisible(true);
// showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
// //DOWNLOAD RS
// }else {
// //I need to be authenticated to show the fields according to POLICY
// if(autheticatedUser) {
// showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
// }
// }
//
relazioneScavoPanel.setVisible(true);
showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
relazioneScavoPanel.add(customTable);
}

View File

@ -19,6 +19,7 @@ import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.LayerItem;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
@ -221,19 +222,20 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
Concessione concessione = concessioniManager.getById(itemId);
BaseConcessioneDV baseConcessione = ConvertToDataViewModel.toBaseConcessione(concessione);
if (concessione != null) {
LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
listLayers = new ArrayList<LayerConcessioneDV>();
if (concessione.getPianteFineScavo() != null) {
for (LayerConcessione lc : concessione.getPianteFineScavo()) {
listLayers.add(ConvertToDataViewModel.toLayerConcessione(lc));
listLayers.add(ConvertToDataViewModel.toLayerConcessione(lc, baseConcessione));
}
}
if (concessione.getPosizionamentoScavo() != null) {
LayerConcessioneDV thePosizScavo = ConvertToDataViewModel
.toLayerConcessione(concessione.getPosizionamentoScavo());
.toLayerConcessione(concessione.getPosizionamentoScavo(), baseConcessione);
if (thePosizScavo != null)
listLayers.add(thePosizScavo);
}
@ -282,8 +284,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
String userName = user == null ? null : user.getUsername();
//TODO THIS IS A WORKAROUND WAITING FOR USER ROLE.
//I CAN CHECK THE ACCCESS POLICIES IF AND ONLY IF THE USER IS NOT LOGGED IN.
// TODO THIS IS A WORKAROUND WAITING FOR USER ROLE.
// I CAN CHECK THE ACCCESS POLICIES IF AND ONLY IF THE USER IS NOT LOGGED IN.
if (user == null) {
// CHECKING ACCESS POLICY
@ -339,7 +341,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
// END CHECKING ACCESS POLICY
LOG.info("Access policies applied");
}
}
if (concessionDV == null)

View File

@ -2,12 +2,15 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
/**
* The Class LayerObject.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 13, 2020
* Sep 9, 2021
*/
public class LayerObject implements Serializable {
@ -18,6 +21,7 @@ public class LayerObject implements Serializable {
/* This is the layer/product type. E.g. Concessione */
private String itemType;
private LayerItem layerItem;
private BaseConcessioneDV sourceConcessione;
/**
* Instantiates a new layer object.
@ -25,10 +29,18 @@ public class LayerObject implements Serializable {
public LayerObject() {
}
public LayerObject(String itemType, LayerItem layerItem) {
/**
* Instantiates a new layer object.
*
* @param itemType the item type
* @param layerItem the layer item
* @param sourceConcessione the source concessione
*/
public LayerObject(String itemType, LayerItem layerItem, BaseConcessioneDV sourceConcessione) {
super();
this.itemType = itemType;
this.layerItem = layerItem;
this.sourceConcessione = sourceConcessione;
}
/**
@ -40,15 +52,6 @@ public class LayerObject implements Serializable {
return itemType;
}
/**
* Sets the item type.
*
* @param itemType the new item type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
}
/**
* Gets the layer item.
*
@ -58,6 +61,24 @@ public class LayerObject implements Serializable {
return layerItem;
}
/**
* Gets the source concessione.
*
* @return the source concessione
*/
public BaseConcessioneDV getSourceConcessione() {
return sourceConcessione;
}
/**
* Sets the item type.
*
* @param itemType the new item type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
}
/**
* Sets the layer item.
*
@ -67,6 +88,15 @@ public class LayerObject implements Serializable {
this.layerItem = layerItem;
}
/**
* Sets the source concessione.
*
* @param sourceConcessione the new source concessione
*/
public void setSourceConcessione(BaseConcessioneDV sourceConcessione) {
this.sourceConcessione = sourceConcessione;
}
/**
* To string.
*
@ -79,6 +109,8 @@ public class LayerObject implements Serializable {
builder.append(itemType);
builder.append(", layerItem=");
builder.append(layerItem);
builder.append(", sourceConcessione=");
builder.append(sourceConcessione);
builder.append("]");
return builder.toString();
}

View File

@ -265,6 +265,7 @@ body {
text-align: left;
border-collapse: collapse;
width: 100%;
margin-bottom:10px;
}
.table-feature td {