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

code
task_21890
Francesco Mangiacrapa 3 years ago
parent 46ae55e8dd
commit 6224dd7f7c

@ -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
[#21976] Access policies checked on server-side
[#22042] Implemented the public access
[#22040] Revisited the "Abstract and Relazione di Scavo"
## [v1.2.0-SNAPSHOT] - 2021-07-19

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

@ -30,86 +30,90 @@ public class RelazioneScavoView extends Composite {
interface RelazioneScavoViewUiBinder extends UiBinder<Widget, RelazioneScavoView> {
}
@UiField
HTMLPanel relazioneScavoPanel;
@UiField
Paragraph abstractParagraphIta;
@UiField
Paragraph abstractParagraphEng;
@UiField
Button linkAbstractLanguage;
private CustomFlexTable customTable = new CustomFlexTable();
public RelazioneScavoView(AbstractRelazioneScavoDV abstractDV, RelazioneScavoDV relazioneScavoDV) {
public RelazioneScavoView(AbstractRelazioneScavoDV abstractRelazioneDV, RelazioneScavoDV relazioneScavoDV) {
initWidget(uiBinder.createAndBindUi(this));
if(abstractDV.getAbstractSectionIta()!=null) {
abstractParagraphIta.setText(abstractDV.getAbstractSectionIta());
if(abstractDV.getAbstractSectionEng()!=null) {
linkAbstractLanguage.setVisible(true);
abstractParagraphEng.setText(abstractDV.getAbstractSectionEng());
linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR);
GWT.log("Showing abstract: "+abstractRelazioneDV);
GWT.log("Showing relazioneScavoDV: "+relazioneScavoDV);
if (abstractRelazioneDV != null) {
relazioneScavoPanel.setVisible(true);
if (abstractRelazioneDV.getAbstractSectionIta() != null) {
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() {
@Override
public void onClick(ClickEvent event) {
GWT.log("Clicked");
if(abstractParagraphIta.isVisible()) {
if (abstractParagraphIta.isVisible()) {
linkAbstractLanguage.setText(SHOW_ITALIAN_DESCR);
abstractParagraphIta.setVisible(false);
abstractParagraphEng.setVisible(true);
}else {
} else {
linkAbstractLanguage.setText(SHOW_ENGLISH_DESCR);
abstractParagraphIta.setVisible(true);
abstractParagraphEng.setVisible(false);
}
}
});
//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());
if (relazioneScavoDV != null) {
relazioneScavoPanel.setVisible(true);
// customTable.addNextKeyValue("Created", relazioneScavoDV.getCreationTime());
// customTable.addNextKeyValue("ID Licenza", relazioneScavoDV.getLicenseID());
customTable.addNextKeyValues("Responsabili", relazioneScavoDV.getResponsabili(),
GeoportalDataViewerConstants.NEW_LINE_BR);
showLinkToDownloadWsContent("Relazione", relazioneScavoDV.getListWsContent());
}
relazioneScavoPanel.add(customTable);
}
private void showLintToDownloadLastContent(List<WorkspaceContentDV> listContent) {
if(listContent!=null) {
int size = listContent.size();
WorkspaceContentDV lastDoc = listContent.get(size-1);
customTable.addNextKeyWidget("PDF Relazione", new HTML("<a href=\""+lastDoc.getLink()+"\">download</a>"));
private void showLinkToDownloadWsContent(String title, List<WorkspaceContentDV> listContent) {
if (listContent != null) {
int i = 0;
String fieldLabel = title;
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>"));
}
}
}
}

@ -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);
// }
//}

@ -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); }
// */
//
//}

@ -75,7 +75,7 @@ public class GisMakers {
LOG.debug("wms url contains wxs is a map server? no appending /wfs ");
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.MAPSERVER, outputFormat);
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 srsName: " + mapSrsName);
LOG.debug("SERVERTYPE.MAPSERVER boundingBox: " + boundingBox);
@ -85,7 +85,7 @@ public class GisMakers {
outputformat = MapServerRecognize.outputFormatRecognize(SERVERTYPE.GEOSEVER, outputFormat);
mapSrsName = "urn:x-ogc:def:crs:"+mapSrsName;
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 srsName: " + mapSrsName);
}

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

@ -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);
// }
//
// }
//
//}

@ -121,7 +121,7 @@ public class SessionUtil {
if (token != null && setInThread)
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;
}
@ -168,50 +168,4 @@ public class SessionUtil {
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);
// }
}

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

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

Loading…
Cancel
Save