2020-10-23 18:18:06 +02:00
|
|
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
import java.util.ArrayList;
|
2020-10-27 16:04:34 +01:00
|
|
|
import java.util.HashMap;
|
2020-11-19 15:19:27 +01:00
|
|
|
import java.util.LinkedHashMap;
|
2020-10-29 15:18:14 +01:00
|
|
|
import java.util.List;
|
2020-10-27 16:04:34 +01:00
|
|
|
import java.util.Map;
|
|
|
|
|
2020-11-24 17:24:41 +01:00
|
|
|
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
|
|
|
|
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|
|
|
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
2020-12-02 14:39:52 +01:00
|
|
|
import org.gcube.application.geoportalcommon.GeoNaDataViewerProfileReader;
|
|
|
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
|
|
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
|
|
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
2020-12-02 14:43:08 +01:00
|
|
|
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
2020-10-26 12:24:23 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
2020-10-29 15:18:14 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
2020-10-27 16:04:34 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
2020-11-03 18:04:47 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
2020-11-19 15:19:27 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
2020-10-29 15:18:14 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
|
2020-11-19 15:19:27 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
2020-11-03 13:09:08 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Styles;
|
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
2020-11-02 18:18:03 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
|
2020-11-19 15:19:27 +01:00
|
|
|
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
|
2020-10-27 16:04:34 +01:00
|
|
|
import org.gcube.spatial.data.geoutility.GeoNcWMSMetadataUtility;
|
|
|
|
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
|
|
|
|
import org.gcube.spatial.data.geoutility.bean.LayerZAxis;
|
|
|
|
import org.gcube.spatial.data.geoutility.bean.WmsParameters;
|
2020-11-19 15:19:27 +01:00
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
2020-10-27 16:04:34 +01:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
2020-10-23 18:18:06 +02:00
|
|
|
|
|
|
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The server side implementation of the RPC service.
|
2020-11-19 15:19:27 +01:00
|
|
|
*
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
|
|
|
*
|
|
|
|
* Nov 12, 2020
|
2020-10-23 18:18:06 +02:00
|
|
|
*/
|
|
|
|
@SuppressWarnings("serial")
|
2020-10-26 12:24:23 +01:00
|
|
|
public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet implements
|
|
|
|
GeoportalDataViewerService {
|
2020-10-27 16:04:34 +01:00
|
|
|
|
2020-11-02 18:18:03 +01:00
|
|
|
public static final String PRODUCT_ID = "product_id";
|
2020-10-27 16:04:34 +01:00
|
|
|
/** The Constant LOG. */
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerServiceImpl.class);
|
2020-10-23 18:18:06 +02:00
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
/**
|
|
|
|
* Parses the wms request.
|
|
|
|
*
|
|
|
|
* @param wmsRequest the wms request
|
|
|
|
* @param layerName the layer name
|
|
|
|
* @return the geo information for WMS request
|
|
|
|
* @throws Exception the exception
|
|
|
|
*/
|
2020-10-27 16:04:34 +01:00
|
|
|
@Override
|
2020-10-27 16:41:30 +01:00
|
|
|
public GeoInformationForWMSRequest parseWmsRequest(String wmsRequest, String layerName) throws Exception {
|
2020-10-27 16:04:34 +01:00
|
|
|
return loadGeoInfoForWmsRequest(wmsRequest, layerName);
|
|
|
|
}
|
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load geo info for wms request.
|
2020-10-27 16:04:34 +01:00
|
|
|
*
|
2020-11-19 15:19:27 +01:00
|
|
|
* @param wmsLink the wms link
|
2020-10-27 16:04:34 +01:00
|
|
|
* @param layerName the layer name
|
2020-11-19 15:19:27 +01:00
|
|
|
* @return the geo information for WMS request
|
2020-10-27 16:04:34 +01:00
|
|
|
* @throws Exception the exception
|
|
|
|
*/
|
2020-11-19 15:19:27 +01:00
|
|
|
public static GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception{
|
2020-10-27 16:04:34 +01:00
|
|
|
try {
|
2020-11-19 15:19:27 +01:00
|
|
|
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
2020-10-27 16:04:34 +01:00
|
|
|
String wmsServiceHost = validator.getWmsServiceHost();
|
|
|
|
String validWMSRequest = validator.parseWMSRequest(true, true);
|
|
|
|
layerName = validator.getLayerName();
|
|
|
|
String versionWms = validator.getValueOfParsedWMSParameter(WmsParameters.VERSION);
|
|
|
|
String crs = validator.getValueOfParsedWMSParameter(WmsParameters.CRS);
|
|
|
|
//
|
|
|
|
HashMap<String, String> mapWmsNotStandard = new HashMap<String, String>();
|
|
|
|
|
|
|
|
if(validator.getMapWmsNoStandardParams()!=null){
|
|
|
|
mapWmsNotStandard.putAll(validator.getMapWmsNoStandardParams());
|
|
|
|
}
|
|
|
|
//
|
|
|
|
GeoNcWMSMetadataUtility geoGS = new GeoNcWMSMetadataUtility(validWMSRequest, 4000);
|
|
|
|
//STYLES
|
|
|
|
LayerStyles layerStyle = geoGS.loadStyles();
|
|
|
|
Map<String,String> mapNcWmsStyles = layerStyle.getMapNcWmsStyles()==null?new HashMap<String, String>(1):layerStyle.getMapNcWmsStyles();
|
|
|
|
mapWmsNotStandard.putAll(mapNcWmsStyles);
|
|
|
|
//MAP STYLES INTO GWT-SERIALIZABLE OBJECT
|
|
|
|
Styles styles = new Styles(layerStyle.getGeoStyles(), layerStyle.getMapNcWmsStyles(), layerStyle.isNcWms());
|
|
|
|
//ZAxis
|
|
|
|
LayerZAxis layerZAxis = geoGS.loadZAxis();
|
|
|
|
//MAP ZAXIS INTO GWT-SERIALIZABLE OBJECT
|
|
|
|
ZAxis zAxis = layerZAxis!=null?new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues()):null;
|
|
|
|
|
|
|
|
return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs, mapWmsNotStandard, styles, styles.isNcWms(), zAxis);
|
|
|
|
}
|
|
|
|
catch (Exception e) {
|
|
|
|
String msg = "An error occurred during wms request validation for layer: "+layerName;
|
|
|
|
LOG.error(msg,e);
|
|
|
|
throw new Exception(msg);
|
|
|
|
}
|
|
|
|
}
|
2020-11-19 15:19:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the data result.
|
|
|
|
*
|
|
|
|
* @param layerObjects the layer objects
|
|
|
|
* @param mapSrsName the map srs name
|
|
|
|
* @param selectBBOX the select BBOX
|
|
|
|
* @param maxWFSFeature the max WFS feature
|
|
|
|
* @param zoomLevel the zoom level
|
|
|
|
* @return the data result
|
2020-10-29 15:18:14 +01:00
|
|
|
*/
|
|
|
|
@Override
|
2020-11-19 15:19:27 +01:00
|
|
|
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX,
|
2020-11-02 18:18:03 +01:00
|
|
|
int maxWFSFeature, double zoomLevel) {
|
2020-10-29 15:18:14 +01:00
|
|
|
LOG.info("getDataResult called");
|
2020-11-19 15:19:27 +01:00
|
|
|
|
|
|
|
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
|
|
|
|
|
|
|
for (LayerObject layerObject : layerObjects) {
|
|
|
|
GeoNaSpatialQueryResult geoDAO = new GeoNaSpatialQueryResult();
|
|
|
|
List<FeatureRow> features = FeatureParser.getWFSFeatures(layerObject.getLayerItem(), mapSrsName, selectBBOX, maxWFSFeature);
|
|
|
|
LOG.debug("For layer name: "+layerObject.getLayerItem().getName() +" got features: "+features);
|
|
|
|
geoDAO.setFeatures(features);
|
|
|
|
for (FeatureRow fRow : features) {
|
|
|
|
if(fRow.getMapProperties()!=null) {
|
|
|
|
List<String> concessioneIds = fRow.getMapProperties().get("product_id");
|
|
|
|
if(concessioneIds!=null && concessioneIds.size()>0) {
|
|
|
|
String cId = concessioneIds.get(0);
|
|
|
|
try {
|
|
|
|
long theConcessionID = Long.parseLong(cId);
|
|
|
|
List<UploadedImageDV> listUI = getUploadedImagesForId("Concessione", theConcessionID, 1);
|
|
|
|
Map<Long, List<UploadedImageDV>> mapImages = new LinkedHashMap<Long, List<UploadedImageDV>>();
|
|
|
|
mapImages.put(theConcessionID, listUI);
|
|
|
|
geoDAO.setMapImages(mapImages);
|
|
|
|
}catch (Exception e) {
|
|
|
|
LOG.warn("Error on loading uploaded images for concessione: "+cId, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
geoDAO.setSourceLayerObject(layerObject);
|
2020-11-25 18:44:09 +01:00
|
|
|
LOG.info("For layer name: "+layerObject.getLayerItem().getName() +" got "+features.size()+" feature/s");
|
2020-11-19 15:19:27 +01:00
|
|
|
listDAO.add(geoDAO);
|
|
|
|
}
|
|
|
|
LOG.info("returning "+listDAO+" geona data objects");
|
|
|
|
return listDAO;
|
2020-10-29 15:18:14 +01:00
|
|
|
}
|
2020-11-02 13:05:53 +01:00
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the uploaded images for id.
|
|
|
|
*
|
|
|
|
* @param id the id
|
|
|
|
* @return the uploaded images for id
|
|
|
|
* @throws Exception the exception
|
|
|
|
*/
|
2020-11-03 13:09:08 +01:00
|
|
|
@Override
|
2020-11-19 15:19:27 +01:00
|
|
|
public List<UploadedImageDV> getUploadedImagesForId(String itemType, Long id, int maxImages) throws Exception{
|
2020-11-27 11:12:53 +01:00
|
|
|
LOG.info("getUploadedImagesForId [id: "+id+", itemType: "+itemType+"] called");
|
2020-11-02 13:05:53 +01:00
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
if(itemType==null)
|
|
|
|
throw new Exception("Invalid parameter. The itemType is null");
|
|
|
|
|
|
|
|
if(id==null)
|
|
|
|
throw new Exception("Invalid parameter. The Id is null");
|
|
|
|
|
|
|
|
List<UploadedImageDV> listUI = null;
|
|
|
|
|
|
|
|
try {
|
2020-11-25 18:44:09 +01:00
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
|
|
|
|
2020-11-25 18:44:09 +01:00
|
|
|
if(itemType.equalsIgnoreCase("concessione")) {
|
|
|
|
|
|
|
|
LOG.info("Trying to get concessione for id "+id);
|
|
|
|
ConcessioniManager concessioniManager = new ConcessioniManager();
|
|
|
|
Concessione concessione = concessioniManager.getById(id+"");
|
|
|
|
if (concessione != null) {
|
|
|
|
LOG.info("For id "+id+", 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 "+id+", got "+listUI.size() +" image/s");
|
2020-11-19 15:19:27 +01:00
|
|
|
}
|
2020-11-25 18:44:09 +01:00
|
|
|
}else
|
|
|
|
throw new Exception("Concessione with id: "+id +" not available");
|
2020-11-19 15:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return listUI;
|
|
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
|
String erroMsg = UploadedImage.class.getSimpleName() +" not available for "+Concessione.class.getSimpleName() +" with id "+id;
|
|
|
|
LOG.error(erroMsg,e);
|
2020-11-27 11:12:53 +01:00
|
|
|
throw new Exception(erroMsg);
|
2020-11-19 15:19:27 +01:00
|
|
|
//TODO REMOTE THIS
|
2020-11-27 11:12:53 +01:00
|
|
|
// listUI = new ArrayList<UploadedImageDV>(1);
|
|
|
|
// UploadedImageDV img = new UploadedImageDV();
|
|
|
|
// List<WorkspaceContentDV> listWsContent = new ArrayList<WorkspaceContentDV>();
|
|
|
|
// WorkspaceContentDV wcDV = new WorkspaceContentDV();
|
|
|
|
// wcDV.setLink("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Tempio_di_Giove_2.jpg/1280px-Tempio_di_Giove_2.jpg");
|
|
|
|
// listWsContent.add(wcDV);
|
|
|
|
// img.setListWsContent(listWsContent);
|
|
|
|
// listUI.add(img);
|
|
|
|
// LOG.warn("DUMMY UploadedImageDVs: "+listUI);
|
|
|
|
// return listUI;
|
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
|
2020-11-03 18:04:47 +01:00
|
|
|
}
|
2020-11-04 16:00:13 +01:00
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the concessione for id.
|
|
|
|
*
|
|
|
|
* @param id the id
|
|
|
|
* @return the concessione for id
|
|
|
|
* @throws Exception the exception
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public ConcessioneDV getConcessioneForId(Long id) throws Exception{
|
2020-11-24 17:24:41 +01:00
|
|
|
LOG.info("getConcessioneForId "+id+ " called");
|
2020-11-19 15:19:27 +01:00
|
|
|
|
2020-11-04 16:00:13 +01:00
|
|
|
ConcessioneDV concessionDV = null;
|
2020-11-03 18:04:47 +01:00
|
|
|
|
2020-11-02 13:05:53 +01:00
|
|
|
if(id==null)
|
|
|
|
throw new Exception("Invalid parameter. The Id is null");
|
|
|
|
|
|
|
|
try {
|
2020-11-03 18:04:47 +01:00
|
|
|
LOG.info("Trying to get record for id "+id);
|
2020-11-19 15:19:27 +01:00
|
|
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
2020-11-24 17:24:41 +01:00
|
|
|
Concessione concessione = new ConcessioniManager().getById(id+"");
|
|
|
|
LOG.info("Got concessione for id "+id);
|
|
|
|
if(concessione !=null) {
|
2020-11-04 16:00:13 +01:00
|
|
|
concessionDV = ConvertToDataViewModel.toConcessione(concessione);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(concessionDV==null)
|
2020-11-25 18:44:09 +01:00
|
|
|
throw new Exception("Concessione with id: "+id +" not available");
|
2020-11-02 13:05:53 +01:00
|
|
|
|
2020-11-27 11:12:53 +01:00
|
|
|
LOG.debug("For id "+id+" returning "+ConcessioneDV.class.getSimpleName()+": "+concessionDV);
|
2020-11-04 16:00:13 +01:00
|
|
|
return concessionDV;
|
2020-11-02 13:05:53 +01:00
|
|
|
|
|
|
|
}catch (Exception e) {
|
2020-11-02 18:18:03 +01:00
|
|
|
String erroMsg = Concessione.class.getSimpleName() +" with id "+id+" not available";
|
|
|
|
LOG.error(erroMsg,e);
|
2020-11-24 17:24:41 +01:00
|
|
|
throw new Exception(erroMsg);
|
2020-11-02 13:05:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-11-19 15:19:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the parameters from URL.
|
|
|
|
*
|
|
|
|
* @param theURL the the URL
|
|
|
|
* @param parameters the parameters
|
|
|
|
* @return a map with couple (paramKey, paramValue)
|
|
|
|
*/
|
|
|
|
|
|
|
|
public Map<String, String> getParametersFromURL(String theURL, List<String> parameters) {
|
2020-10-29 15:18:14 +01:00
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
if (theURL == null)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
if (parameters == null || parameters.size() == 0)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
Map<String, String> hashParameters = new HashMap<String, String>(parameters.size());
|
|
|
|
for (String paramKey : parameters) {
|
|
|
|
String paramValue = URLParserUtil.extractValueOfParameterFromURL(paramKey, theURL);
|
|
|
|
hashParameters.put(paramKey, paramValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hashParameters;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the my login.
|
|
|
|
*
|
|
|
|
* @return the my login
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public String getMyLogin(){
|
|
|
|
try {
|
|
|
|
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
|
|
|
|
if(user==null)
|
|
|
|
return null;
|
|
|
|
return user.getUsername();
|
|
|
|
}catch (Exception e) {
|
|
|
|
LOG.warn("Error on getting the login, am I out of portal? Returning null");
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the layer for type.
|
|
|
|
*
|
|
|
|
* @param layerType the layer type
|
|
|
|
* @return the layer for type
|
|
|
|
* @throws Exception the exception
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public GeoInformationForWMSRequest getLayerForType(String layerType) throws Exception{
|
|
|
|
LOG.info("Called getLayerForType for:"+layerType);
|
|
|
|
|
|
|
|
if(layerType==null || layerType.isEmpty())
|
|
|
|
throw new Exception("The input parameter layerType is null or empty");
|
|
|
|
|
|
|
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
|
|
|
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
|
|
|
|
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
|
|
|
|
LOG.info("Read profile: "+profile);
|
|
|
|
|
|
|
|
String lowerLayerType = layerType.toLowerCase();
|
|
|
|
LOG.info("Reading map layers for type:"+lowerLayerType);
|
|
|
|
LayerItem layer = profile.getMapLayers().get(lowerLayerType);
|
|
|
|
|
|
|
|
if(layer==null || layer.getWmsLink()==null)
|
|
|
|
throw new Exception("The layer type "+lowerLayerType+" has not been found. Please check your input parameter");
|
|
|
|
|
|
|
|
if(layer.getWmsLink()==null)
|
|
|
|
throw new Exception("The layer type "+lowerLayerType+" has not a WMS Link associated. Please check your input parameter");
|
|
|
|
|
|
|
|
|
|
|
|
return parseWmsRequest(layer.getWmsLink(), null);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the geo na data view profile.
|
|
|
|
*
|
|
|
|
* @return the geo na data view profile
|
|
|
|
* @throws Exception the exception
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
public GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception{
|
|
|
|
LOG.info("getGeoNaDataViewProfile called");
|
|
|
|
|
|
|
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
2020-12-02 14:39:52 +01:00
|
|
|
GeoportalCommon gc = new GeoportalCommon();
|
|
|
|
org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile profile = gc.getGeoNaDataViewProfile(null);
|
2020-11-19 15:19:27 +01:00
|
|
|
LOG.info("Returning profile: "+profile);
|
|
|
|
return profile;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception {
|
|
|
|
LOG.info("getPublicLinksFor called for: " + item);
|
2020-12-02 14:39:52 +01:00
|
|
|
|
2020-11-19 15:19:27 +01:00
|
|
|
try {
|
|
|
|
|
|
|
|
if (item == null)
|
|
|
|
throw new Exception("Bad request, the item is null");
|
|
|
|
|
|
|
|
if(item.getItemId()==null)
|
|
|
|
throw new Exception("Bad request, the item id is null");
|
|
|
|
|
|
|
|
if(item.getItemType()==null)
|
|
|
|
throw new Exception("Bad request, the item type is null");
|
|
|
|
|
2020-12-02 14:39:52 +01:00
|
|
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
|
|
|
GeoportalCommon gc = new GeoportalCommon();
|
|
|
|
return gc.getPublicLinksFor(item);
|
2020-11-19 15:19:27 +01:00
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
LOG.error("Error on getPublicLinksFor for: " + item, e);
|
|
|
|
throw new Exception("Share link not available for this item. Try later or contact the support. Error: "+e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isSessionExpired() throws Exception {
|
|
|
|
return SessionUtil.isSessionExpired(this.getThreadLocalRequest());
|
|
|
|
}
|
|
|
|
|
2020-10-23 18:18:06 +02:00
|
|
|
}
|