integrated with geoportal-data-common. updated according to task #20210

This commit is contained in:
Francesco Mangiacrapa 2020-12-02 14:39:52 +01:00
parent d052fd535c
commit 24541715f3
20 changed files with 147 additions and 740 deletions

89
pom.xml
View File

@ -49,33 +49,48 @@
</developer>
</developers>
<!-- <dependencyManagement> -->
<!-- <dependencies> -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.distribution</groupId> -->
<!-- <artifactId>maven-portal-bom</artifactId> -->
<!-- <version>3.6.0</version> -->
<!-- <type>pom</type> -->
<!-- <scope>import</scope> -->
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-user</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-servlet</artifactId> -->
<!-- </exclusion> -->
<!-- <exclusion> -->
<!-- <groupId>com.google.gwt</groupId> -->
<!-- <artifactId>gwt-dev</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<!-- </dependencies> -->
<!-- </dependencyManagement> -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.6.0</version>
<type>pom</type>
<scope>import</scope>
<exclusions>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
@ -113,25 +128,25 @@
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
<version>[1.0.0, 2.0.0-SNAPSHOT)</version>
<!-- <version>[1.0.0, 2.0.0-SNAPSHOT)</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<version>[1.1.0, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
<!-- <version>[1.1.0, 2.0.0-SNAPSHOT)</version> -->
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<!-- <version>[2.4.1,3.0.0-SNAPSHOT)</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<version>[2.4.1,3.0.0-SNAPSHOT)</version>
<!-- <version>[2.4.1,3.0.0-SNAPSHOT)</version> -->
<scope>provided</scope>
</dependency>
<dependency>
@ -140,6 +155,12 @@
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>
@ -155,25 +176,25 @@
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.2.5</version>
<!-- <version>6.2.5</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<!-- <version>2.0</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
<!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency>
<dependency>

View File

@ -11,6 +11,8 @@
<inherits name='ol.GwtOL' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

View File

@ -2,6 +2,8 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.Iterator;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
@ -13,8 +15,6 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMini
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.List;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -100,13 +100,4 @@ public interface GeoportalDataViewerService extends RemoteService {
*/
GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception;
/**
* Gets the short url.
*
* @param longUrl the long url
* @return the short url
* @throws Exception the exception
*/
String getShortUrl(String longUrl) throws Exception;
}

View File

@ -2,8 +2,8 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.List;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -50,5 +50,4 @@ public interface GeoportalDataViewerServiceAsync {
void getPublicLinksFor(GeoNaItemRef item, AsyncCallback<GeoNaItemRef> asyncCallback);
void getShortUrl(String longUrl, AsyncCallback<String> callback);
}

View File

@ -185,11 +185,13 @@ public class LayerManager {
}
//If recordId not passed, I'm using the first feature returned
if(feature==null && recordId==null) {
if(recordId==null) {
feature = features.get(0);
}else {
//the recordId to show has been passed but not found into list of FeatureRow
return;
if(feature==null) {
return;
}
}
Map<String, List<String>> entries = feature.getMapProperties();

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import com.google.gwt.event.shared.GwtEvent;

View File

@ -1,8 +1,8 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerOSM;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RecordDV;

View File

@ -1,9 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.PublicLink;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.PublicLink;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessio
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
@ -10,7 +11,6 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShare
import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ThumbnailImageView;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.LayerConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.RelazioneScavoDV;
@ -170,12 +170,12 @@ public class ConcessioneView extends Composite {
customTable.addNextKeyValue("ID Licenza", concessioneDV.getLicenzaID());
}
if (concessioneDV.getTitolareLicenza() != null) {
customTable.addNextKeyValue("Titolare Licenza", concessioneDV.getTitolareLicenza());
if (concessioneDV.getTitolariLicenza() != null) {
customTable.addNextKeyValues("Titolare Licenza", concessioneDV.getTitolariLicenza(), GeoportalDataViewerConstants.NEW_LINE_BR);
}
if (concessioneDV.getTitolareCopyright() != null) {
customTable.addNextKeyValue("Titolare Copyright", concessioneDV.getTitolareCopyright());
if (concessioneDV.getTitolariCopyright() != null) {
customTable.addNextKeyValues("Titolare Copyright", concessioneDV.getTitolariCopyright(),GeoportalDataViewerConstants.NEW_LINE_BR);
}
shareButton.setType(ButtonType.LINK);
@ -313,15 +313,26 @@ public class ConcessioneView extends Composite {
List<UploadedImageDV> immagini = concessioneDV.getImmaginiRappresentative();
if (immagini != null && immagini.size() > 0) {
imagesPanel.setVisible(true);
int i = 0;
boolean addedImage = false;
imagesPanel.add(thumbNails);
for (UploadedImageDV uploadedImageDV : immagini) {
if (i == 0)
imagesPanel.add(thumbNails);
thumbNails.add(new ThumbnailImageView(uploadedImageDV, viewImageButtonVisible, openImageButtonVisible));
if(uploadedImageDV.getPolicy()==null || uploadedImageDV.getPolicy().equalsIgnoreCase("OPEN")) {
thumbNails.add(new ThumbnailImageView(uploadedImageDV, viewImageButtonVisible, openImageButtonVisible));
addedImage = true;
}else {
if(myLogin!=null) {
thumbNails.add(new ThumbnailImageView(uploadedImageDV, viewImageButtonVisible, openImageButtonVisible));
addedImage = true;
}
}
}
if(!addedImage) {
imagesPanel.remove(thumbNails);
}
}
}
public ConcessioneDV getConcessioneDV() {

View File

@ -87,8 +87,8 @@ public class ConvertToDataViewModel {
theConcessione.setResponsabile(concessione.getResponsabile());
theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
theConcessione.setSoggetto(concessione.getSoggetto());
theConcessione.setTitolareCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolareLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolariCopyright(concessione.getTitolareCopyright());
theConcessione.setTitolariLicenza(concessione.getTitolareLicenza());
theConcessione.setTitolari(concessione.getTitolari());
theConcessione.setVersion(concessione.getVersion());

View File

@ -1,202 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.server;
import static org.gcube.resources.discovery.icclient.ICFactory.client;
import java.io.StringReader;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
import org.gcube.common.resources.gcore.utils.XPathHelper;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.Query;
import org.gcube.resources.discovery.client.queries.impl.QueryBox;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* The Class GeoNaViewerProfileReader.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 12, 2020
*/
public class GeoNaDataViewerProfileReader {
private static final String RESOURCE_PROFILE_BODY = "/Resource/Profile/Body";
/**
*
*/
public static final String SECONDARY_TYPE = "ApplicationProfile";
public static final String WORKSPACE_EXPLORER_APP_NAME = "GeoNa-Viewer-Profile";
private Logger logger = LoggerFactory.getLogger(GeoNaDataViewerProfileReader.class);
private String secondaryType;
private String scope;
private String appID;
/**
* Instantiates a new application profile reader.
*
* @param appID the app id
*/
public GeoNaDataViewerProfileReader(String appID) {
this.appID = appID;
this.secondaryType = SECONDARY_TYPE;
this.scope = ScopeProvider.instance.get();
}
/**
* Read profile from infrastrucure.
*
* @return the map
*/
public GeoNaDataViewerProfile readProfileFromInfrastrucure() throws Exception {
String queryString = getGcubeGenericQueryString(secondaryType, appID);
logger.info("Scope "+scope+", trying to perform query: "+queryString);
try {
if (scope == null)
throw new Exception("Scope is null, set scope into ScopeProvider");
GeoNaDataViewerProfile profile = new GeoNaDataViewerProfile();
logger.info("Trying to fetch ApplicationProfile in the scope: " + scope + ", SecondaryType: "
+ secondaryType + ", AppId: " + appID);
Query q = new QueryBox(queryString);
DiscoveryClient<String> client = client();
List<String> appProfile = client.submit(q);
if (appProfile == null || appProfile.size() == 0)
throw new ApplicationProfileNotFoundException("ApplicationProfile with SecondaryType: " + secondaryType
+ ", AppId: " + appID + " is not registered in the scope: " + scope);
else {
String elem = appProfile.get(0);
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = docBuilder.parse(new InputSource(new StringReader(elem)));
XPathHelper helper = new XPathHelper(doc.getDocumentElement());
List<String> currValue = null;
String xPathExp = RESOURCE_PROFILE_BODY+"/RestrictedPortletURL/text()";
currValue = helper.evaluate(xPathExp);
if (currValue != null && currValue.size() > 0) {
profile.setRestrictedPortletURL(currValue.get(0));
}else
throw new Exception("I'm not able to read the path: "+xPathExp);
xPathExp = RESOURCE_PROFILE_BODY+"/OpenPortletURL/text()";
currValue = helper.evaluate(xPathExp);
if (currValue != null && currValue.size() > 0) {
profile.setOpenPortletURL(currValue.get(0));
}else
throw new Exception("I'm not able to read the path: "+xPathExp);
XPath xPath = XPathFactory.newInstance().newXPath();
NodeList nodeList = (NodeList) xPath.compile("/Resource/Profile/Body/AvailableLayers/Layer")
.evaluate(doc, XPathConstants.NODESET);
Map<String, LayerItem> mapLayers = new HashMap<String, LayerItem>(nodeList.getLength());
for (int i = 0; i < nodeList.getLength(); i++) {
Node layerNode = nodeList.item(i);
if (layerNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) layerNode;
String layerType = eElement.getElementsByTagName("Type").item(0).getTextContent();
String wmsLink = eElement.getElementsByTagName("WMSLink").item(0).getTextContent();
String decodedURL = URLDecoder.decode(wmsLink, "UTF-8");
LayerItem layer = new LayerItem();
layer.setWmsLink(decodedURL);
mapLayers.put(layerType.toLowerCase(), layer);
}
}
profile.setMapLayers(mapLayers);
logger.info("returning: "+profile);
return profile;
}
} catch (Exception e) {
logger.error("Error while trying to read the " + SECONDARY_TYPE + " with SecondaryType "
+ WORKSPACE_EXPLORER_APP_NAME + " from scope " + scope, e);
return null;
} finally {
}
}
/**
* Gets the gcube generic query string.
*
* @param secondaryType the secondary type
* @param appId the app id
* @return the gcube generic query string
*/
public static String getGcubeGenericQueryString(String secondaryType, String appId) {
return "for $profile in collection('/db/Profiles/GenericResource')//Resource "
+ "where $profile/Profile/SecondaryType/string() eq '" + secondaryType
+ "' and $profile/Profile/Body/AppId/string() " + " eq '" + appId + "'" + "return $profile";
}
/**
* Gets the secondary type.
*
* @return the secondary type
*/
public String getSecondaryType() {
return secondaryType;
}
/**
* Gets the scope.
*
* @return the scope
*/
public String getScope() {
return scope;
}
@Override
public String toString() {
return "GeoNaViewerProfileReader [secondaryType=" + secondaryType + ", scope=" + scope + ", appID=" + appID
+ "]";
}
/*
public static void main(String[] args) throws Exception {
ScopeProvider.instance.set("/gcube/devNext/NextNext");
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
System.out.println(profile.getRestrictedPortletURL());
System.out.println(profile.getOpenPortletURL());
if(profile.getMapLayers()!=null) {
for (String type : profile.getMapLayers().keySet()) {
System.out.println("key: "+type+", value: "+profile.getMapLayers().get(type));
}
}
}*/
}

View File

@ -1,9 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.server;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
@ -12,16 +9,16 @@ import java.util.Map;
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;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
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;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
import org.gcube.portlets.user.geoportaldataviewer.server.util.URLParserUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaDataViewerProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.PublicLink;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
@ -31,7 +28,6 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Styles;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.ConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.urlshortener.UrlShortener;
import org.gcube.spatial.data.geoutility.GeoNcWMSMetadataUtility;
import org.gcube.spatial.data.geoutility.bean.LayerStyles;
import org.gcube.spatial.data.geoutility.bean.LayerZAxis;
@ -361,8 +357,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
LOG.info("getGeoNaDataViewProfile called");
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
GeoportalCommon gc = new GeoportalCommon();
org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile profile = gc.getGeoNaDataViewProfile(null);
LOG.info("Returning profile: "+profile);
return profile;
}
@ -371,7 +367,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
@Override
public GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception {
LOG.info("getPublicLinksFor called for: " + item);
try {
if (item == null)
@ -382,33 +378,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
if(item.getItemType()==null)
throw new Exception("Bad request, the item type is null");
GeoNaDataViewerProfile geonaDataProfile = getGeoNaDataViewProfile();
//Restricted Link
String link = String.format("%s?%s=%s&%s=%s",
geonaDataProfile.getRestrictedPortletURL(),
GeoportalDataViewerConstants.GET_GEONA_ITEM_ID,
item.getItemId(),
GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE,
item.getItemType());
String shortUrl = getShortUrl(link);
item.setRestrictedLink(new PublicLink(link, shortUrl));
//Open Link
link = String.format("%s?%s=%s&%s=%s",
geonaDataProfile.getOpenPortletURL(),
GeoportalDataViewerConstants.GET_GEONA_ITEM_ID,
item.getItemId(),
GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE,
item.getItemType());
shortUrl = getShortUrl(link);
item.setOpenLink(new PublicLink(link, shortUrl));
LOG.info("returning: " + item);
return item;
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
GeoportalCommon gc = new GeoportalCommon();
return gc.getPublicLinksFor(item);
} catch (Exception e) {
LOG.error("Error on getPublicLinksFor for: " + item, e);
@ -416,44 +389,6 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
}
}
@Override
public String getShortUrl(String longUrl) throws Exception {
LOG.info("getShortUrl called for " + longUrl);
if(longUrl==null)
return longUrl;
UrlShortener shortener = SessionUtil.getUrlShortener(this.getThreadLocalRequest());
try {
if (shortener != null && shortener.isAvailable()) {
String toShort = longUrl;
String[] splitted = toShort.split("\\?");
LOG.debug("Splitted long URL is: "+Arrays.asList(splitted));
String link = toShort;
if (splitted.length > 1) {
LOG.debug("Query string detected, encoding it...");
String encodedQuery = splitted[1];
try {
encodedQuery = URLEncoder.encode(splitted[1], "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
LOG.debug("encodedQuery is: "+encodedQuery);
link = String.format("%s?%s", splitted[0], encodedQuery);
}
return shortener.shorten(link);
}
return longUrl;
} catch (Exception e) {
LOG.error("Error on shortening the longURL "+longUrl, e);
return null;
}
}
public boolean isSessionExpired() throws Exception {
return SessionUtil.isSessionExpired(this.getThreadLocalRequest());
}

View File

@ -1,109 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.shared;
import java.io.Serializable;
import java.util.Map;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* The Class GeoNaDataViewerProfile.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 13, 2020
*/
public class GeoNaDataViewerProfile implements IsSerializable, Serializable{
/**
*
*/
private static final long serialVersionUID = 8583236018312392009L;
private String restrictedPortletURL;
private String openPortletURL;
//the key is the layer type
private Map<String, LayerItem> mapLayers;
/**
* Instantiates a new geo na data viewer profile.
*/
public GeoNaDataViewerProfile() {
}
/**
* Gets the restricted portlet URL.
*
* @return the restricted portlet URL
*/
public String getRestrictedPortletURL() {
return restrictedPortletURL;
}
/**
* Sets the restricted portlet URL.
*
* @param restrictedPortletURL the new restricted portlet URL
*/
public void setRestrictedPortletURL(String restrictedPortletURL) {
this.restrictedPortletURL = restrictedPortletURL;
}
/**
* Gets the open portlet URL.
*
* @return the open portlet URL
*/
public String getOpenPortletURL() {
return openPortletURL;
}
/**
* Sets the open portlet URL.
*
* @param openPortletURL the new open portlet URL
*/
public void setOpenPortletURL(String openPortletURL) {
this.openPortletURL = openPortletURL;
}
/**
* Gets the map layers.
*
* @return the map layers
*/
public Map<String, LayerItem> getMapLayers() {
return mapLayers;
}
/**
* Sets the map layers.
*
* @param mapLayers the map layers
*/
public void setMapLayers(Map<String, LayerItem> mapLayers) {
this.mapLayers = mapLayers;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoNaDataViewerProfile [restrictedPortletURL=");
builder.append(restrictedPortletURL);
builder.append(", openPortletURL=");
builder.append(openPortletURL);
builder.append(", mapLayers=");
builder.append(mapLayers);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,156 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.shared;
import java.io.Serializable;
/**
* The Class GeoNaItemRef.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 17, 2020
*/
public class GeoNaItemRef implements Serializable {
/**
*
*/
private static final long serialVersionUID = -7021431511279022193L;
private Long itemId;
private String itemType;
private String itemName;
private PublicLink restrictedLink;
private PublicLink openLink;
/**
* Instantiates a new geo na object.
*/
public GeoNaItemRef() {
}
/**
* Instantiates a new geo na object.
*
* @param itemId the item id
* @param itemType the item type
*/
public GeoNaItemRef(Long itemId, String itemType) {
super();
this.itemId = itemId;
this.itemType = itemType;
}
/**
* Gets the item id.
*
* @return the item id
*/
public Long getItemId() {
return itemId;
}
/**
* Sets the item id.
*
* @param itemId the new item id
*/
public void setItemId(Long itemId) {
this.itemId = itemId;
}
/**
* Gets the item type.
*
* @return the item type
*/
public String getItemType() {
return itemType;
}
/**
* Sets the item type.
*
* @param itemType the new item type
*/
public void setItemType(String itemType) {
this.itemType = itemType;
}
/**
* Gets the item name.
*
* @return the item name
*/
public String getItemName() {
return itemName;
}
/**
* Sets the item name.
*
* @param itemName the new item name
*/
public void setItemName(String itemName) {
this.itemName = itemName;
}
/**
* Gets the restricted link.
*
* @return the restricted link
*/
public PublicLink getRestrictedLink() {
return restrictedLink;
}
/**
* Sets the restricted link.
*
* @param restrictedLink the new restricted link
*/
public void setRestrictedLink(PublicLink restrictedLink) {
this.restrictedLink = restrictedLink;
}
/**
* Gets the open link.
*
* @return the open link
*/
public PublicLink getOpenLink() {
return openLink;
}
/**
* Sets the open link.
*
* @param openLink the new open link
*/
public void setOpenLink(PublicLink openLink) {
this.openLink = openLink;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GeoNaItemRef [itemId=");
builder.append(itemId);
builder.append(", itemType=");
builder.append(itemType);
builder.append(", itemName=");
builder.append(itemName);
builder.append(", restrictedLink=");
builder.append(restrictedLink);
builder.append(", openLink=");
builder.append(openLink);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,95 +0,0 @@
/**
*
*/
package org.gcube.portlets.user.geoportaldataviewer.shared;
import java.io.Serializable;
/**
* The Class PublicLink.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it
* Sep 13, 2016
*/
public class PublicLink implements Serializable {
/**
*
*/
private static final long serialVersionUID = -8157172818802297440L;
private String completeURL;
private String shortURL;
/**
* Instantiates a new public link.
*/
public PublicLink() {
}
/**
* Instantiates a new public link.
*
* @param completeURL the complete url
* @param shortURL the short url
*/
public PublicLink(String completeURL, String shortURL) {
super();
this.completeURL = completeURL;
this.shortURL = shortURL;
}
/**
* Gets the complete url.
*
* @return the completeURL
*/
public String getCompleteURL() {
return completeURL;
}
/**
* Gets the short url.
*
* @return the shortURL
*/
public String getShortURL() {
return shortURL;
}
/**
* Sets the complete url.
*
* @param completeURL the completeURL to set
*/
public void setCompleteURL(String completeURL) {
this.completeURL = completeURL;
}
/**
* Sets the short url.
*
* @param shortURL the shortURL to set
*/
public void setShortURL(String shortURL) {
this.shortURL = shortURL;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("PublicLink [completeURL=");
builder.append(completeURL);
builder.append(", shortURL=");
builder.append(shortURL);
builder.append("]");
return builder.toString();
}
}

View File

@ -12,13 +12,12 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.Uploade
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* The Class ConcessioneDV.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 4, 2020
* Nov 4, 2020
*/
public class ConcessioneDV extends RecordDV implements Serializable, IsSerializable {
@ -64,10 +63,10 @@ public class ConcessioneDV extends RecordDV implements Serializable, IsSerializa
private String dataFineProgetto;
/** The titolare licenza. */
private String titolareLicenza;
private List<String> titolariLicenza;
/** The titolare copyright. */
private String titolareCopyright;
private List<String> titolariCopyright;
/** The parole chiave libere. */
private List<String> paroleChiaveLibere;
@ -320,39 +319,39 @@ public class ConcessioneDV extends RecordDV implements Serializable, IsSerializa
}
/**
* Gets the titolare licenza.
* Gets the titolari licenza.
*
* @return the titolare licenza
* @return the titolari licenza
*/
public String getTitolareLicenza() {
return titolareLicenza;
public List<String> getTitolariLicenza() {
return titolariLicenza;
}
/**
* Sets the titolare licenza.
* Sets the titolari licenza.
*
* @param titolareLicenza the new titolare licenza
* @param titolariLicenza the new titolari licenza
*/
public void setTitolareLicenza(String titolareLicenza) {
this.titolareLicenza = titolareLicenza;
public void setTitolariLicenza(List<String> titolariLicenza) {
this.titolariLicenza = titolariLicenza;
}
/**
* Gets the titolare copyright.
* Gets the titolari copyright.
*
* @return the titolare copyright
* @return the titolari copyright
*/
public String getTitolareCopyright() {
return titolareCopyright;
public List<String> getTitolariCopyright() {
return titolariCopyright;
}
/**
* Sets the titolare copyright.
* Sets the titolari copyright.
*
* @param titolareCopyright the new titolare copyright
* @param titolariCopyright the new titolari copyright
*/
public void setTitolareCopyright(String titolareCopyright) {
this.titolareCopyright = titolareCopyright;
public void setTitolariCopyright(List<String> titolariCopyright) {
this.titolariCopyright = titolariCopyright;
}
/**
@ -508,7 +507,6 @@ public class ConcessioneDV extends RecordDV implements Serializable, IsSerializa
return genericContent;
}
/**
* Sets the generic content.
*
@ -518,15 +516,10 @@ public class ConcessioneDV extends RecordDV implements Serializable, IsSerializa
this.genericContent = genericContent;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Concessione [introduzione=");
builder.append("ConcessioneDV [introduzione=");
builder.append(introduzione);
builder.append(", descrizioneContenuto=");
builder.append(descrizioneContenuto);
@ -550,10 +543,10 @@ public class ConcessioneDV extends RecordDV implements Serializable, IsSerializa
builder.append(dataInizioProgetto);
builder.append(", dataFineProgetto=");
builder.append(dataFineProgetto);
builder.append(", titolareLicenza=");
builder.append(titolareLicenza);
builder.append(", titolareCopyright=");
builder.append(titolareCopyright);
builder.append(", titolariLicenza=");
builder.append(titolariLicenza);
builder.append(", titolariCopyright=");
builder.append(titolariCopyright);
builder.append(", paroleChiaveLibere=");
builder.append(paroleChiaveLibere);
builder.append(", paroleChiaveICCD=");
@ -562,8 +555,20 @@ public class ConcessioneDV extends RecordDV implements Serializable, IsSerializa
builder.append(centroidLat);
builder.append(", centroidLong=");
builder.append(centroidLong);
builder.append(", relazioneScavo=");
builder.append(relazioneScavo);
builder.append(", immaginiRappresentative=");
builder.append(immaginiRappresentative);
builder.append(", posizionamentoScavo=");
builder.append(posizionamentoScavo);
builder.append(", pianteFineScavo=");
builder.append(pianteFineScavo);
builder.append(", genericContent=");
builder.append(genericContent);
builder.append("]");
return builder.toString();
}
}

View File

@ -11,6 +11,8 @@
<inherits name='ol.GwtOL' />
<inherits name="com.github.gwtbootstrap.Bootstrap" />
<inherits name='org.gcube.application.geoportalcommon.GeoportalDataCommon' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

View File

@ -103,6 +103,7 @@ body {
font-size: 14px;
padding: 10px;
color: #333;
text-align: justify;
}
#page-view-details .my-custom-flex-table {
@ -210,9 +211,9 @@ body {
border: 1px solid #ddd;
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.055);
margin-right: 10px;
padding-right: 10px;
margin-bottom: 10px;
width: 99%;
width: 98%;
}
.style-layer table {