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); layerItem.setName(layerName);
layerManager.setBaseLayerFromIsProfile(layerItem); layerManager.setBaseLayerFromIsProfile(layerItem);
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false, layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
null, false, null, null); null, false, null, null,null);
if (paramGeonaItemID != null) { if (paramGeonaItemID != null) {
if (paramGeonaItemType == null) { if (paramGeonaItemType == null) {

View File

@ -9,6 +9,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap; 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.content.WorkspaceContentDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV; 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 org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
import com.github.gwtbootstrap.client.ui.Button; 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.Label;
import com.github.gwtbootstrap.client.ui.constants.ButtonType; import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.LabelType; import com.github.gwtbootstrap.client.ui.constants.LabelType;
@ -269,7 +271,7 @@ 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); OLMapManager.LAYER_DETAIL_MAX_RESOLUTION,layer.getRefersTo());
} }
} }
@ -351,10 +353,11 @@ public class LayerManager {
* @param asDetailLayer the as detail layer * @param asDetailLayer the as detail layer
* @param minResolution the min resolution * @param minResolution the min resolution
* @param maxResolution the max 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, 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) { final boolean asDetailLayer, Double minResolution, Double maxResolution, BaseConcessioneDV refersToBaseConcessione) {
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent(); // final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
// //
@ -399,6 +402,7 @@ public class LayerManager {
LayerObject lo = new LayerObject(); LayerObject lo = new LayerObject();
lo.setLayerItem(layerItem); lo.setLayerItem(layerItem);
lo.setItemType(geonaItemType); lo.setItemType(geonaItemType);
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);
@ -523,20 +527,36 @@ public class LayerManager {
VerticalPanel vpPanel = new VerticalPanel(); VerticalPanel vpPanel = new VerticalPanel();
scrollPanel.add(vpPanel); scrollPanel.add(vpPanel);
String prevConcessioneName = "";
for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) { for (GeoNaSpatialQueryResult geoNaSpatialQueryResult : listGeoNaDataObject) {
GWT.log("baseLayerFromISProfile.getName() :"+baseLayerFromISProfile.getName()); 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 //skipping centroid layer
if(layerSource==null || layerSource.compareToIgnoreCase(baseLayerFromISProfile.getName())==0) { if(layerSourceName==null || layerSourceName.compareToIgnoreCase(baseLayerFromISProfile.getName())==0) {
continue; 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(); Label layerLabel = new Label();
layerLabel.setType(LabelType.INFO); layerLabel.setType(LabelType.INFO);
layerLabel.setText(layerSource); 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); vpPanel.add(layerLabel);
@ -587,7 +607,6 @@ public class LayerManager {
vpPanel.add(intFlex); vpPanel.add(intFlex);
} }
} }
olMap.showPopup(scrollPanel.toString(), queryClick.getCenter()); olMap.showPopup(scrollPanel.toString(), queryClick.getCenter());

View File

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

View File

@ -46,7 +46,7 @@ public class RelazioneScavoView extends Composite {
private CustomFlexTable customTable = new CustomFlexTable(); private CustomFlexTable customTable = new CustomFlexTable();
public RelazioneScavoView(AbstractRelazioneScavoDV abstractDV, RelazioneScavoDV relazioneScavoDV, boolean autheticatedUser) { public RelazioneScavoView(AbstractRelazioneScavoDV abstractDV, RelazioneScavoDV relazioneScavoDV) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
if(abstractDV.getAbstractSectionIta()!=null) { if(abstractDV.getAbstractSectionIta()!=null) {
@ -58,6 +58,10 @@ public class RelazioneScavoView extends Composite {
} }
} }
if(relazioneScavoDV==null)
return;
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime()); //customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
//customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID()); //customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(), GeoportalDataViewerConstants.NEW_LINE_BR); 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 //Showing the Download PDF relazione accoding to policy
if(relazioneScavoDV.getPolicy()==null || relazioneScavoDV.getPolicy().equalsIgnoreCase("OPEN")) { //NO LONGER NEEDED. MANAGED ON THE SERVER-SIDE #21976
relazioneScavoPanel.setVisible(true); // if(relazioneScavoDV.getPolicy()==null || relazioneScavoDV.getPolicy().equalsIgnoreCase("OPEN")) {
showLintToDownloadLastContent(relazioneScavoDV.getListWsContent()); // relazioneScavoPanel.setVisible(true);
//DOWNLOAD RS // showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
}else { // //DOWNLOAD RS
//I need to be authenticated to show the fields according to POLICY // }else {
if(autheticatedUser) { // //I need to be authenticated to show the fields according to POLICY
showLintToDownloadLastContent(relazioneScavoDV.getListWsContent()); // if(autheticatedUser) {
} // showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
} // }
// }
//
relazioneScavoPanel.setVisible(true);
showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
relazioneScavoPanel.add(customTable); 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.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.LayerItem; import org.gcube.application.geoportalcommon.shared.LayerItem;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap; 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.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV; import org.gcube.application.geoportalcommon.shared.products.model.AbstractRelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
@ -221,19 +222,20 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true); SessionUtil.getCurrentToken(this.getThreadLocalRequest(), true);
ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build(); ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
Concessione concessione = concessioniManager.getById(itemId); Concessione concessione = concessioniManager.getById(itemId);
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");
listLayers = new ArrayList<LayerConcessioneDV>(); listLayers = new ArrayList<LayerConcessioneDV>();
if (concessione.getPianteFineScavo() != null) { if (concessione.getPianteFineScavo() != null) {
for (LayerConcessione lc : concessione.getPianteFineScavo()) { for (LayerConcessione lc : concessione.getPianteFineScavo()) {
listLayers.add(ConvertToDataViewModel.toLayerConcessione(lc)); listLayers.add(ConvertToDataViewModel.toLayerConcessione(lc, baseConcessione));
} }
} }
if (concessione.getPosizionamentoScavo() != null) { if (concessione.getPosizionamentoScavo() != null) {
LayerConcessioneDV thePosizScavo = ConvertToDataViewModel LayerConcessioneDV thePosizScavo = ConvertToDataViewModel
.toLayerConcessione(concessione.getPosizionamentoScavo()); .toLayerConcessione(concessione.getPosizionamentoScavo(), baseConcessione);
if (thePosizScavo != null) if (thePosizScavo != null)
listLayers.add(thePosizScavo); listLayers.add(thePosizScavo);
} }
@ -282,8 +284,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest()); GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
String userName = user == null ? null : user.getUsername(); String userName = user == null ? null : user.getUsername();
//TODO THIS IS A WORKAROUND WAITING FOR USER ROLE. // 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. // I CAN CHECK THE ACCCESS POLICIES IF AND ONLY IF THE USER IS NOT LOGGED IN.
if (user == null) { if (user == null) {
// CHECKING ACCESS POLICY // CHECKING ACCESS POLICY
@ -339,7 +341,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
// END CHECKING ACCESS POLICY // END CHECKING ACCESS POLICY
LOG.info("Access policies applied"); LOG.info("Access policies applied");
} }
} }
if (concessionDV == null) if (concessionDV == null)

View File

@ -2,12 +2,15 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
import java.io.Serializable; import java.io.Serializable;
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
/** /**
* The Class LayerObject. * 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 { public class LayerObject implements Serializable {
@ -18,6 +21,7 @@ public class LayerObject implements Serializable {
/* This is the layer/product type. E.g. Concessione */ /* This is the layer/product type. E.g. Concessione */
private String itemType; private String itemType;
private LayerItem layerItem; private LayerItem layerItem;
private BaseConcessioneDV sourceConcessione;
/** /**
* Instantiates a new layer object. * Instantiates a new layer object.
@ -25,10 +29,18 @@ public class LayerObject implements Serializable {
public LayerObject() { 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(); super();
this.itemType = itemType; this.itemType = itemType;
this.layerItem = layerItem; this.layerItem = layerItem;
this.sourceConcessione = sourceConcessione;
} }
/** /**
@ -40,15 +52,6 @@ public class LayerObject implements Serializable {
return itemType; return itemType;
} }
/**
* Sets the item type.
*
* @param itemType the new item type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
}
/** /**
* Gets the layer item. * Gets the layer item.
* *
@ -58,6 +61,24 @@ public class LayerObject implements Serializable {
return layerItem; 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. * Sets the layer item.
* *
@ -67,6 +88,15 @@ public class LayerObject implements Serializable {
this.layerItem = layerItem; this.layerItem = layerItem;
} }
/**
* Sets the source concessione.
*
* @param sourceConcessione the new source concessione
*/
public void setSourceConcessione(BaseConcessioneDV sourceConcessione) {
this.sourceConcessione = sourceConcessione;
}
/** /**
* To string. * To string.
* *
@ -79,8 +109,10 @@ public class LayerObject implements Serializable {
builder.append(itemType); builder.append(itemType);
builder.append(", layerItem="); builder.append(", layerItem=");
builder.append(layerItem); builder.append(layerItem);
builder.append(", sourceConcessione=");
builder.append(sourceConcessione);
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }
} }

View File

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