#22040 Revisited the "Abstract e Relazione di Scavo". Removed commented

code
This commit is contained in:
Francesco Mangiacrapa 2021-09-24 13:14:02 +02:00
parent 46ae55e8dd
commit 6224dd7f7c
11 changed files with 156 additions and 514 deletions

View File

@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
[#21946] Show layers of a concessione automatically on map according to zoom level [#21946] Show layers of a concessione automatically on map according to zoom level
[#21976] Access policies checked on server-side [#21976] Access policies checked on server-side
[#22042] Implemented the public access [#22042] Implemented the public access
[#22040] Revisited the "Abstract and Relazione di Scavo"
## [v1.2.0-SNAPSHOT] - 2021-07-19 ## [v1.2.0-SNAPSHOT] - 2021-07-19

View File

@ -7,6 +7,7 @@ import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
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;
import org.gcube.application.geoportalcommon.shared.products.model.RelazioneScavoDV;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV; import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
@ -41,7 +42,7 @@ import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate; import ol.Coordinate;
public class ConcessioneView extends Composite { public class ConcessioneView extends Composite {
private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class); private static ConcessioneViewUiBinder uiBinder = GWT.create(ConcessioneViewUiBinder.class);
interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> { interface ConcessioneViewUiBinder extends UiBinder<Widget, ConcessioneView> {
@ -52,10 +53,10 @@ public class ConcessioneView extends Composite {
@UiField @UiField
Paragraph introduzione; Paragraph introduzione;
@UiField @UiField
HTMLPanel concessioniPanel; HTMLPanel concessioniPanel;
@UiField @UiField
HTMLPanel relazioneScavoPanel; HTMLPanel relazioneScavoPanel;
@ -67,19 +68,16 @@ public class ConcessioneView extends Composite {
@UiField @UiField
HTMLPanel mapViewPanel; HTMLPanel mapViewPanel;
@UiField @UiField
HTMLPanel posizionamentoAreaIndaginePanel; HTMLPanel posizionamentoAreaIndaginePanel;
@UiField @UiField
HTMLPanel piantaFineScavoPanel; HTMLPanel piantaFineScavoPanel;
// @UiField
// HTMLPanel sharePanel;
@UiField @UiField
Button shareButton; Button shareButton;
@UiField @UiField
Button expandButton; Button expandButton;
@ -90,7 +88,7 @@ public class ConcessioneView extends Composite {
private CustomFlexTable customTable = new CustomFlexTable(); private CustomFlexTable customTable = new CustomFlexTable();
private GeoNaItemRef geonaItemRef; private GeoNaItemRef geonaItemRef;
private String myLogin; private String myLogin;
private boolean viewImageButtonVisible = true; private boolean viewImageButtonVisible = true;
@ -101,36 +99,41 @@ public class ConcessioneView extends Composite {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().setId("page-view-details"); pageViewDetails.getElement().setId("page-view-details");
} }
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV) { public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV) {
this(item, concDV, true, true); this(item, concDV, true, true);
} }
public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible, boolean openImageButtonVisible) { public ConcessioneView(GeoNaItemRef item, ConcessioneDV concDV, boolean viewImageButtonVisible,
boolean openImageButtonVisible) {
this(); this();
GWT.log("Rendering "+concDV.getNome()); GWT.log("Rendering " + concDV.getNome());
this.concessioneDV = concDV; this.concessioneDV = concDV;
this.geonaItemRef = item; this.geonaItemRef = item;
this.viewImageButtonVisible = viewImageButtonVisible; this.viewImageButtonVisible = viewImageButtonVisible;
this.openImageButtonVisible = openImageButtonVisible; this.openImageButtonVisible = openImageButtonVisible;
titolo.setText(concessioneDV.getNome()); titolo.setText(concessioneDV.getNome());
introduzione.setText(concessioneDV.getIntroduzione()); introduzione.setText(concessioneDV.getIntroduzione());
if (concessioneDV.getDataInizioProgetto() != null) { if (concessioneDV.getDataInizioProgetto() != null) {
customTable.addNextKeyValue("Data Inizio Progetto", GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataInizioProgetto())); customTable.addNextKeyValue("Data Inizio Progetto",
GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataInizioProgetto()));
} }
if (concessioneDV.getDataFineProgetto() != null) { if (concessioneDV.getDataFineProgetto() != null) {
customTable.addNextKeyValue("Data Fine Progetto", GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataFineProgetto())); customTable.addNextKeyValue("Data Fine Progetto",
GeoportalDataViewerConstants.DT_FORMAT.format(concessioneDV.getDataFineProgetto()));
} }
if (concessioneDV.getParoleChiaveLibere() != null) { if (concessioneDV.getParoleChiaveLibere() != null) {
customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Parole chiave Libere", concessioneDV.getParoleChiaveLibere(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getParoleChiaveICCD() != null) { if (concessioneDV.getParoleChiaveICCD() != null) {
customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Parole chiave Cronologia", concessioneDV.getParoleChiaveICCD(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getAuthors() != null) { if (concessioneDV.getAuthors() != null) {
@ -144,21 +147,24 @@ public class ConcessioneView extends Composite {
if (concessioneDV.getEditore() != null) { if (concessioneDV.getEditore() != null) {
customTable.addNextKeyValue("Editore", concessioneDV.getEditore()); customTable.addNextKeyValue("Editore", concessioneDV.getEditore());
} }
if (concessioneDV.getResponsabile() != null) { if (concessioneDV.getResponsabile() != null) {
customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile()); customTable.addNextKeyValue("Responsabile", concessioneDV.getResponsabile());
} }
if (concessioneDV.getRisorseCorrelate() != null) { if (concessioneDV.getRisorseCorrelate() != null) {
customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Risorse Correlate", concessioneDV.getRisorseCorrelate(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getTitolari() != null) { if (concessioneDV.getTitolari() != null) {
customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Titolari dei dati", concessioneDV.getTitolari(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getSoggetto() != null) { if (concessioneDV.getSoggetto() != null) {
customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Soggetti", concessioneDV.getSoggetto(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getEditore() != null) { if (concessioneDV.getEditore() != null) {
@ -166,60 +172,63 @@ public class ConcessioneView extends Composite {
} }
if (concessioneDV.getFontiFinanziamento() != null) { if (concessioneDV.getFontiFinanziamento() != null) {
customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Fonti di Finanziamento", concessioneDV.getFontiFinanziamento(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getLicenzaID() != null) { if (concessioneDV.getLicenzaID() != null) {
customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID()); customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
} }
if (concessioneDV.getTitolariLicenza() != null) { if (concessioneDV.getTitolariLicenza() != null) {
customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(), GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
if (concessioneDV.getTitolariCopyright() != null) { if (concessioneDV.getTitolariCopyright() != null) {
customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(),GeoportalDataViewerConstants.NEW_LINE_BR); customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(),
GeoportalDataViewerConstants.NEW_LINE_BR);
} }
shareButton.setType(ButtonType.LINK); shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE); shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with..."); shareButton.setTitle("Get a link to share with...");
shareButton.addClickHandler(new ClickHandler() { shareButton.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null); DialogShareableLink dg = new DialogShareableLink(geonaItemRef, null);
} }
}); });
expandButton.setType(ButtonType.LINK); expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND); expandButton.setIcon(IconType.EXPAND);
expandButton.setTitle("Show this view in new Window"); expandButton.setTitle("Show this view in new Window");
expandButton.addClickHandler(new ClickHandler() { expandButton.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
ConcessioneView cv = new ConcessioneView(geonaItemRef, concessioneDV, false, openImageButtonVisible); ConcessioneView cv = new ConcessioneView(geonaItemRef, concessioneDV, false, openImageButtonVisible);
cv.setExpandViewButtonVisible(false); cv.setExpandViewButtonVisible(false);
int width = Window.getClientWidth()*75/100; int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight()*70/100; int height = Window.getClientHeight() * 70 / 100;
ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height); ModalWindow mw = new ModalWindow(concessioneDV.getNome(), width, height);
mw.add(cv); mw.add(cv);
mw.setCaller(ConcessioneView.this); mw.setCaller(ConcessioneView.this);
//mw.setWidth(900); // mw.setWidth(900);
mw.show(); mw.show();
} }
}); });
concessioniPanel.add(customTable); concessioniPanel.add(customTable);
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() { GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
@Override @Override
public void onSuccess(String result) { public void onSuccess(String result) {
myLogin = result; myLogin = result;
@ -228,135 +237,84 @@ public class ConcessioneView extends Composite {
addPosizionamentoAreaIndagine(); addPosizionamentoAreaIndagine();
addPiantaFineScavo(); addPiantaFineScavo();
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
} }
}); });
addUploadedImages(); addUploadedImages();
} }
private void addPosizionamentoAreaIndagine() { private void addPosizionamentoAreaIndagine() {
LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo(); LayerConcessioneDV layer = concessioneDV.getPosizionamentoScavo();
if(layer==null) if (layer == null)
return; return;
//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.setVisible(true);
posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer)); posizionamentoAreaIndaginePanel.add(new LayerConcessioneView(layer));
} }
private void addPiantaFineScavo() { private void addPiantaFineScavo() {
List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo(); List<LayerConcessioneDV> listLayersDV = concessioneDV.getPianteFineScavo();
if(listLayersDV==null) if (listLayersDV == null)
return; return;
for (LayerConcessioneDV layerDV : listLayersDV) { for (LayerConcessioneDV layerDV : listLayersDV) {
//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.setVisible(true);
piantaFineScavoPanel.add(new LayerConcessioneView(layerDV)); piantaFineScavoPanel.add(new LayerConcessioneView(layerDV));
} }
} }
private void addRelazioneDiScavo() { private void addRelazioneDiScavo() {
AbstractRelazioneScavoDV abstractRS = concessioneDV.getAbstractRelazioneScavo(); AbstractRelazioneScavoDV abstractRS = concessioneDV.getAbstractRelazioneScavo();
RelazioneScavoDV relazioneScavo = concessioneDV.getRelazioneScavo();
if(abstractRS==null) if (abstractRS == null && relazioneScavo==null)
return; return;
//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.setVisible(true);
relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo())); relazioneScavoPanel.add(new RelazioneScavoView(abstractRS, concessioneDV.getRelazioneScavo()));
} }
private void addCentroidMap() { private void addCentroidMap() {
// Coordinate centerCoordinate = OLFactory.createCoordinate(GeoportalDataViewerConstants.ITALY_CENTER_LONG, GeoportalDataViewerConstants.ITALY_CENTER_LAT);
// Coordinate transformedCenterCoordinate = MapUtils.transformCoordiante(centerCoordinate, GeoportalDataViewerConstants.EPSG_4326, GeoportalDataViewerConstants.EPSG_3857);
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY); Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857); Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate, GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px"); MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
if(concessioneDV!=null && concessioneDV.getCentroidLat()!=null && concessioneDV.getCentroidLong()!=null) {
if (concessioneDV != null && concessioneDV.getCentroidLat() != null
&& concessioneDV.getCentroidLong() != null) {
Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat()); Coordinate coord = new Coordinate(concessioneDV.getCentroidLong(), concessioneDV.getCentroidLat());
Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(), MAP_PROJECTION.EPSG_3857.getName()); Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
//Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord); MAP_PROJECTION.EPSG_3857.getName());
boolean authenticatedUser = myLogin!=null?true:false; // Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
boolean authenticatedUser = myLogin != null ? true : false;
mapView.addMarker(transfCoord, authenticatedUser); mapView.addMarker(transfCoord, authenticatedUser);
mapViewPanel.add(mapView); mapViewPanel.add(mapView);
}else if(concessioneDV!=null){ } else if (concessioneDV != null) {
GeoportalDataViewerConstants.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "+concessioneDV.getCentroidLong() +", Long:"+concessioneDV.getCentroidLat()); GeoportalDataViewerConstants
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
+ concessioneDV.getCentroidLong() + ", Long:" + concessioneDV.getCentroidLat());
} }
} }
private void addUploadedImages() { private void addUploadedImages() {
GWT.log("Managing immagini: "+concessioneDV.getImmaginiRappresentative()); GWT.log("Managing immagini: " + concessioneDV.getImmaginiRappresentative());
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative(); List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
if (immagini != null && immagini.size() > 0) { if (immagini != null && immagini.size() > 0) {
imagesPanel.setVisible(true); imagesPanel.setVisible(true);
List<UploadedImageDV> immaginiToShow = new ArrayList<UploadedImageDV>(); List<UploadedImageDV> immaginiToShow = new ArrayList<UploadedImageDV>();
//SHOWING ONLY OPEN IMAGES OR IF THE USER IS LOGGED
for (UploadedImageDV uploadedImageDV : immagini) { for (UploadedImageDV uploadedImageDV : immagini) {
//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); immaginiToShow.add(uploadedImageDV);
} }
if(immaginiToShow.size()>0) { if (immaginiToShow.size() > 0) {
ImagesGallery gallery = new ImagesGallery(immaginiToShow); ImagesGallery gallery = new ImagesGallery(immaginiToShow);
imagesPanel.add(gallery.getGalleryPanel()); imagesPanel.add(gallery.getGalleryPanel());
gallery.fillGallery(); gallery.fillGallery();
@ -367,7 +325,7 @@ public class ConcessioneView extends Composite {
public ConcessioneDV getConcessioneDV() { public ConcessioneDV getConcessioneDV() {
return concessioneDV; return concessioneDV;
} }
protected void setExpandViewButtonVisible(boolean bool) { protected void setExpandViewButtonVisible(boolean bool) {
expandButton.setVisible(bool); expandButton.setVisible(bool);
} }

View File

@ -30,86 +30,90 @@ public class RelazioneScavoView extends Composite {
interface RelazioneScavoViewUiBinder extends UiBinder<Widget, RelazioneScavoView> { interface RelazioneScavoViewUiBinder extends UiBinder<Widget, RelazioneScavoView> {
} }
@UiField @UiField
HTMLPanel relazioneScavoPanel; HTMLPanel relazioneScavoPanel;
@UiField @UiField
Paragraph abstractParagraphIta; Paragraph abstractParagraphIta;
@UiField @UiField
Paragraph abstractParagraphEng; Paragraph abstractParagraphEng;
@UiField @UiField
Button linkAbstractLanguage; Button linkAbstractLanguage;
private CustomFlexTable customTable = new CustomFlexTable(); private CustomFlexTable customTable = new CustomFlexTable();
public RelazioneScavoView(AbstractRelazioneScavoDV abstractRelazioneDV, RelazioneScavoDV relazioneScavoDV) {
public RelazioneScavoView(AbstractRelazioneScavoDV abstractDV, RelazioneScavoDV relazioneScavoDV) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
GWT.log("Showing abstract: "+abstractRelazioneDV);
if(abstractDV.getAbstractSectionIta()!=null) { GWT.log("Showing relazioneScavoDV: "+relazioneScavoDV);
abstractParagraphIta.setText(abstractDV.getAbstractSectionIta());
if(abstractDV.getAbstractSectionEng()!=null) { if (abstractRelazioneDV != null) {
linkAbstractLanguage.setVisible(true); relazioneScavoPanel.setVisible(true);
abstractParagraphEng.setText(abstractDV.getAbstractSectionEng()); if (abstractRelazioneDV.getAbstractSectionIta() != null) {
linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR); abstractParagraphIta.setText(abstractRelazioneDV.getAbstractSectionIta());
if (abstractRelazioneDV.getAbstractSectionEng() != null) {
linkAbstractLanguage.setVisible(true);
abstractParagraphEng.setText(abstractRelazioneDV.getAbstractSectionEng());
linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR);
}
} }
showLinkToDownloadWsContent("Abstract Relazione", abstractRelazioneDV.getListWsContent());
} }
if(relazioneScavoDV==null)
return;
//customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
//customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(), GeoportalDataViewerConstants.NEW_LINE_BR);
linkAbstractLanguage.addClickHandler(new ClickHandler() { linkAbstractLanguage.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
GWT.log("Clicked"); GWT.log("Clicked");
if(abstractParagraphIta.isVisible()) { if (abstractParagraphIta.isVisible()) {
linkAbstractLanguage.setText(SHOW_ITALIAN_DESCR); linkAbstractLanguage.setText(SHOW_ITALIAN_DESCR);
abstractParagraphIta.setVisible(false); abstractParagraphIta.setVisible(false);
abstractParagraphEng.setVisible(true); abstractParagraphEng.setVisible(true);
}else { } else {
linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR); linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR);
abstractParagraphIta.setVisible(true); abstractParagraphIta.setVisible(true);
abstractParagraphEng.setVisible(false); abstractParagraphEng.setVisible(false);
} }
} }
}); });
//Showing the Download PDF relazione accoding to policy if (relazioneScavoDV != null) {
//NO LONGER NEEDED. MANAGED ON THE SERVER-SIDE #21976 relazioneScavoPanel.setVisible(true);
// if(relazioneScavoDV.getPolicy()==null || relazioneScavoDV.getPolicy().equalsIgnoreCase("OPEN")) { // customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
// relazioneScavoPanel.setVisible(true); // customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
// showLintToDownloadLastContent(relazioneScavoDV.getListWsContent()); customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(),
// //DOWNLOAD RS GeoportalDataViewerConstants.NEW_LINE_BR);
// }else {
// //I need to be authenticated to show the fields according to POLICY showLinkToDownloadWsContent("Relazione", relazioneScavoDV.getListWsContent());
// if(autheticatedUser) { }
// showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
// }
// }
//
relazioneScavoPanel.setVisible(true);
showLintToDownloadLastContent(relazioneScavoDV.getListWsContent());
relazioneScavoPanel.add(customTable); relazioneScavoPanel.add(customTable);
} }
private void showLintToDownloadLastContent(List<WorkspaceContentDV> listContent) { private void showLinkToDownloadWsContent(String title, List<WorkspaceContentDV> listContent) {
if(listContent!=null) { if (listContent != null) {
int size = listContent.size(); int i = 0;
WorkspaceContentDV lastDoc = listContent.get(size-1); String fieldLabel = title;
customTable.addNextKeyWidget("PDF Relazione", new HTML("<a href=\""+lastDoc.getLink()+"\">download</a>")); for (WorkspaceContentDV workspaceContentDV : listContent) {
if (i > 0) {
fieldLabel = "";
}
String downloadLabel = "download";
if(workspaceContentDV.getName()!=null) {
downloadLabel = workspaceContentDV.getName();
}
customTable.addNextKeyWidget(fieldLabel, new HTML(
"<a href=\"" + workspaceContentDV.getLink() + "\">" + downloadLabel + "</a>"));
}
} }
} }
} }

View File

@ -1,20 +0,0 @@
//package org.gcube.portlets.user.geoportaldataviewer.server;
//
///**
// * The Class ApplicationProfileException.
// *
// * @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
// * Sep 6, 2016
// */
//@SuppressWarnings("serial")
//public class ApplicationProfileNotFoundException extends Exception {
//
// /**
// * Instantiates a new application profile exception.
// *
// * @param message the message
// */
// public ApplicationProfileNotFoundException(String message) {
// super(message);
// }
//}

View File

@ -1,163 +0,0 @@
//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.common.authorization.library.provider.AccessTokenProvider;
//import org.gcube.common.keycloak.KeycloakClientFactory;
//import org.gcube.common.keycloak.model.TokenResponse;
//import org.gcube.common.scope.api.ScopeProvider;
//import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//
///**
// * The Class ConcessioniMongoServiceIdentityProxy.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
// *
// * Sep 23, 2021
// */
//public class ConcessioniMongoService2 {
//
// private static final Logger LOG = LoggerFactory.getLogger(ConcessioniMongoService2.class);
//
// /**
// * Instantiates a new concessioni mongo service, interface for client
// * statefulMongoConcessioni.
// */
// public ConcessioniMongoService2() {
// }
//
// /**
// * Gets the item by id.
// *
// * @param request the request
// * @param mongoItemId the mongo item id
// * @return the item by id
// * @throws Exception the exception
// */
// public Concessione getItemById(HttpServletRequest request, String mongoItemId) throws Exception {
// LOG.info("called getItemById: " + mongoItemId);
// SessionUtil.getCurrentContext(request, true);
// SessionUtil.getCurrentToken(request, true);
// // Obtain the client
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
// // Returning item by Id
// return concessioniManager.getById(mongoItemId);
// }
//
// /**
// * Gets the item by id.
// *
// * @param request the request
// * @param mongoItemId the mongo item id
// * @return the item by id
// * @throws Exception the exception
// */
// public Concessione getItemById(String mongoItemId) throws Exception {
// LOG.info("called getItemById: " + mongoItemId);
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
// // Returning item by Id
// return concessioniManager.getById(mongoItemId);
// }
//
// /**
// * Iam client get item by.
// *
// * @param scope the scope
// * @param mongoItemId the mongo item id
// * @param clientId the client id
// * @param clientSecret the secret
// * @return the concessione
// * @throws Exception the exception
// */
// public Concessione iamClientGetItemBy(String scope, String mongoItemId, String clientId, String clientSecret)
// throws Exception {
// LOG.info("called IAM Client getItemById: " + mongoItemId);
//
// ScopeProvider.instance.set(scope);
//
// if (clientId == null) {
// throw new Exception("Invalid parameter 'clientId'");
// }
//
// if (clientSecret == null) {
// throw new Exception("Invalid parameter 'secret'");
// }
//
// String umaAcessToken = null;
// try {
//
// LOG.info("Querying KeycloakClientFactory to get UMA token..");
// TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(clientId, clientSecret, scope, null);
// umaAcessToken = tr.getAccessToken();
// if (umaAcessToken != null && !umaAcessToken.isEmpty()) {
// LOG.info("UMA Access Token read correctly");
// } else {
// LOG.error("UMA Access Token NOT RETRIEVED!!!");
// throw new Exception("UMA Access Token is null or empty");
// }
// } catch (Exception e2) {
// throw new Exception("Error occurred on reading UMA access token:", e2);
// }
//
// String previousUMAToken = null;
// try {
//
// try {
// // Here the previousUMAToken should be null
// previousUMAToken = AccessTokenProvider.instance.get();
// } catch (Exception e) {
// // catching excpetion to be sure
// // silent
// }
//
// LOG.debug("JWT token: " + umaAcessToken.substring(0, 20) + "_MASKED_TOKEN_");
// LOG.info("Setting clientId '" + clientId + "' identity by JWT token in the "
// + AccessTokenProvider.class.getSimpleName());
// AccessTokenProvider.instance.set(umaAcessToken);
// ConcessioniManagerI concessioniManager = statefulMongoConcessioni().build();
// // Returning item by Id
// return concessioniManager.getById(mongoItemId);
//
// } catch (Exception e) {
// LOG.error(e.getMessage(), e);
// throw new Exception(e.getMessage());
// } finally {
// try {
// AccessTokenProvider.instance.set(previousUMAToken);
// LOG.info("Done reset to prevoius UMA token into " + AccessTokenProvider.class.getSimpleName());
// } catch (Exception e) {
// }
// }
// }
//
// /**
// * To concessione.
// *
// * @param jsonString the json string
// * @return the concessione
// */
// public Concessione toConcessione(String jsonString) {
// LOG.info("toConcessione called");
// try {
// return org.gcube.application.geoportal.client.utils.Serialization.read(jsonString, Concessione.class);
// } catch (Exception e) {
// LOG.warn("Error on serializing: ", e);
// return null;
// }
// }
//
// /*
// * For testing public Concessione iamClientGetItemBy(HttpServletRequest request,
// * String mongoItemId, String clientId, String secret) throws Exception { String
// * scope = SessionUtil.getCurrentContext(request, true); return
// * iamClientGetItemBy(scope, mongoItemId, clientId, secret); }
// */
//
//}

View File

@ -75,7 +75,7 @@ public class GisMakers {
LOG.debug("wms url contains wxs is a map server? no appending /wfs "); LOG.debug("wms url contains wxs is a map server? no appending /wfs ");
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, outputFormat); outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, outputFormat);
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
// TODO DEBUG // DEBUG
LOG.debug("SERVERTYPE.MAPSERVER outputformat: " + outputformat); LOG.debug("SERVERTYPE.MAPSERVER outputformat: " + outputformat);
LOG.debug("SERVERTYPE.MAPSERVER srsName: " + mapSrsName); LOG.debug("SERVERTYPE.MAPSERVER srsName: " + mapSrsName);
LOG.debug("SERVERTYPE.MAPSERVER boundingBox: " + boundingBox); LOG.debug("SERVERTYPE.MAPSERVER boundingBox: " + boundingBox);
@ -85,7 +85,7 @@ public class GisMakers {
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.GEOSEVER, outputFormat); outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.GEOSEVER, outputFormat);
mapSrsName = "urn:x-ogc:def:crs:"+mapSrsName; mapSrsName = "urn:x-ogc:def:crs:"+mapSrsName;
boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY boundingBox = BBOX_FORMAT(COORDINATE_FORMAT.YX, ",",mapBBOX.getLowerLeftX(),mapBBOX.getLowerLeftY(),mapBBOX.getUpperRightX(),mapBBOX.getUpperRightY()); // USE AXIS XY
// TODO DEBUG // DEBUG
LOG.debug("SERVERTYPE.GEOSEVER outputformat: " + outputformat); LOG.debug("SERVERTYPE.GEOSEVER outputformat: " + outputformat);
LOG.debug("SERVERTYPE.GEOSEVER srsName: " + mapSrsName); LOG.debug("SERVERTYPE.GEOSEVER srsName: " + mapSrsName);
} }

View File

@ -395,7 +395,6 @@ public class WMSUrlValidator {
System.out.println("Returned wms: "+wms.toString()); System.out.println("Returned wms: "+wms.toString());
} }
catch (Exception e) { catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -1,83 +0,0 @@
//package org.gcube.portlets.user.geoportaldataviewer.server.mongoservice;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import javax.servlet.http.HttpServletRequest;
//
//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.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
///**
// * The Class ConcessioneImageUtil.
// *
// * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
// *
// * Sep 7, 2021
// */
//public class ConcessioneImageUtil {
//
// private static final Logger LOG = LoggerFactory.getLogger(ConcessioneImageUtil.class);
//
// /**
// * Gets the uploaded images for id.
// *
// * @param httpServletRequest the http servlet request
// * @param itemType the item type
// * @param itemId the item id
// * @param maxImages the max images
// * @return the uploaded images for id
// * @throws Exception the exception
// */
// public List<UploadedImageDV> getUploadedImagesForId(HttpServletRequest httpServletRequest, String itemType,
// String itemId, Integer maxImages) throws Exception {
// LOG.info("getUploadedImagesForId [itemId: " + itemId + ", itemType: " + itemType + "] called");
//
// if (itemType == null)
// throw new Exception("Invalid parameter. The itemType is null");
//
// if (itemId == null)
// throw new Exception("Invalid parameter. The itemId is null");
//
// List<UploadedImageDV> listUI = null;
//
// try {
//
// if (itemType.equalsIgnoreCase("concessione")) {
//
// LOG.info("Trying to get concessione for id " + itemId);
// ConcessioniMongoServiceIdentityProxy cms = new ConcessioniMongoServiceIdentityProxy(httpServletRequest);
// Concessione concessione = cms.getItemById(itemId);
// if (concessione != null) {
// LOG.info("For id " + itemId + ", got concessione " + concessione.getNome() + " from service");
// List<UploadedImage> images = concessione.getImmaginiRappresentative();
//
// if (images != null) {
// listUI = new ArrayList<UploadedImageDV>();
// int max = maxImages < images.size() ? maxImages : images.size();
// for (int i = 0; i < max; i++) {
// UploadedImageDV ui = ConvertToDataViewModel.toUploadedImage(images.get(i));
// listUI.add(ui);
// }
// LOG.info("For id " + itemId + ", got " + listUI.size() + " image/s");
// }
// } else
// throw new Exception("Concessione with id '" + itemId + "' not available");
// }
//
// return listUI;
//
// } catch (Exception e) {
// String erroMsg = UploadedImage.class.getSimpleName() + " not available for "
// + Concessione.class.getSimpleName() + " with id " + itemId;
// LOG.error(erroMsg, e);
// throw new Exception(erroMsg);
// }
//
// }
//
//}

View File

@ -121,7 +121,7 @@ public class SessionUtil {
if (token != null && setInThread) if (token != null && setInThread)
SecurityTokenProvider.instance.set(token); SecurityTokenProvider.instance.set(token);
LOG.debug("Returning token " + token.substring(1, 10) + "MASKED_TOKEN"); LOG.debug("Returning token " + token.substring(1, 10) + "_MASKED_TOKEN_");
return token; return token;
} }
@ -168,50 +168,4 @@ public class SessionUtil {
return shortener; return shortener;
} }
// /**
// * Gets the preview image for concessione. It is the first image retrieved from
// * mongoService for mongoConcessioneId. Caching it into session
// *
// * @param httpServletRequest the http servlet request
// * @param itemType the item type
// * @param mongoConcessioneId the mongo concessione id
// * @return the preview image for concessione
// */
// public static UploadedImageDV getPreviewImageForConcessione(HttpServletRequest httpServletRequest, String itemType,
// String mongoConcessioneId) {
//
// HttpSession session = httpServletRequest.getSession();
// Map<String, List<UploadedImageDV>> mapImages = null;
// List<UploadedImageDV> lUI = null;
// try {
// mapImages = (LinkedHashMap) session.getAttribute(CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE);
//
// if (mapImages == null) {
// mapImages = new LinkedHashMap<String, List<UploadedImageDV>>();
// }
//
// List<UploadedImageDV> imagePreviewForConcessione = mapImages.get(mongoConcessioneId);
//
// if (imagePreviewForConcessione == null || imagePreviewForConcessione.size() == 0) {
// LOG.info("Into " + CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE + " object session the mongoConcessioneId "
// + mongoConcessioneId + " is empty or null, loading from service and filling it");
// lUI = new ConcessioneImageUtil().getUploadedImagesForId(httpServletRequest, itemType,
// mongoConcessioneId, 1);
// mapImages.put(mongoConcessioneId, lUI);
// }
//
// lUI = mapImages.get(mongoConcessioneId);
// LOG.info("From " + CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE + " object session read image: " + lUI);
// session.setAttribute(CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE, mapImages);
//
// } catch (Exception e) {
// LOG.warn("Error occurred when instancing the " + UrlShortener.class.getSimpleName(), e);
// }
//
// if (lUI == null || lUI.isEmpty())
// return null;
//
// return lUI.get(0);
// }
} }

View File

@ -6,16 +6,14 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
// TODO: Auto-generated Javadoc
/** /**
* The Class ZAxis. * The Class ZAxis.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* *
* Oct 27, 2020 * Oct 27, 2020
*/ */
public class ZAxis implements Serializable{ public class ZAxis implements Serializable {
/** /**
* *
@ -24,10 +22,10 @@ public class ZAxis implements Serializable{
/** The units. */ /** The units. */
private String units; private String units;
/** The positive. */ /** The positive. */
private boolean positive; private boolean positive;
/** The values. */ /** The values. */
private List<Double> values; private List<Double> values;
@ -40,9 +38,9 @@ public class ZAxis implements Serializable{
/** /**
* Instantiates a new layer z axis. * Instantiates a new layer z axis.
* *
* @param units the units * @param units the units
* @param positive the positive * @param positive the positive
* @param values the values * @param values the values
*/ */
public ZAxis(String units, boolean positive, List<Double> values) { public ZAxis(String units, boolean positive, List<Double> values) {
this.units = units; this.units = units;
@ -50,7 +48,6 @@ public class ZAxis implements Serializable{
this.values = values; this.values = values;
} }
/** /**
* Gets the units. * Gets the units.
* *
@ -61,7 +58,6 @@ public class ZAxis implements Serializable{
return units; return units;
} }
/** /**
* Checks if is positive. * Checks if is positive.
* *
@ -72,7 +68,6 @@ public class ZAxis implements Serializable{
return positive; return positive;
} }
/** /**
* Gets the values. * Gets the values.
* *
@ -83,7 +78,6 @@ public class ZAxis implements Serializable{
return values; return values;
} }
/** /**
* Sets the units. * Sets the units.
* *
@ -94,7 +88,6 @@ public class ZAxis implements Serializable{
this.units = units; this.units = units;
} }
/** /**
* Sets the positive. * Sets the positive.
* *
@ -105,7 +98,6 @@ public class ZAxis implements Serializable{
this.positive = positive; this.positive = positive;
} }
/** /**
* Sets the values. * Sets the values.
* *
@ -121,7 +113,9 @@ public class ZAxis implements Serializable{
* *
* @return the string * @return the string
*/ */
/* (non-Javadoc) /*
* (non-Javadoc)
*
* @see java.lang.Object#toString() * @see java.lang.Object#toString()
*/ */
@Override @Override

View File

@ -21,7 +21,6 @@ public class IAMClient {
try { try {
credentials = IAMClientCredentialsReader.getCredentials(); credentials = IAMClientCredentialsReader.getCredentials();
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
@ -32,7 +31,6 @@ public class IAMClient {
// System.out.println("Get concessione: " + concessione); // System.out.println("Get concessione: " + concessione);
} catch (Exception e) { } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
} }