diff --git a/.classpath b/.classpath
index ccff2d0..bd8a9e6 100644
--- a/.classpath
+++ b/.classpath
@@ -1,12 +1,12 @@
-
+
-
+
@@ -35,5 +35,5 @@
-
+
diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
index e96e5b4..414cdfc 100644
--- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs
+++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
@@ -1,4 +1,4 @@
eclipse.preferences.version=1
-lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.2.1
+lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.3.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 36a04c4..256b7b3 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,5 +1,5 @@
-
+
@@ -51,8 +51,10 @@
-
-
+
+
+
+
@@ -105,7 +107,8 @@
-
+
+
@@ -158,7 +161,8 @@
-
+
+
@@ -211,7 +215,8 @@
-
+
+
@@ -264,7 +269,8 @@
-
+
+
@@ -317,10 +323,8 @@
-
- uses
-
-
+
+
@@ -373,7 +377,8 @@
-
+
+
@@ -426,7 +431,8 @@
-
+
+
@@ -479,7 +485,8 @@
-
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3885b93..3ef4ffd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [v3.3.0-SNAPSHOT] - 2023-02-20
+
+#### Fixes
+
+- [#24632] Returning the public layer index if the private is missing
+- [#24632] No temporal info shown if the temporal extent is missing
+
## [v3.2.1] - 2023-02-03
#### Fixes
diff --git a/pom.xml b/pom.xml
index c56d707..b85ed7a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
org.gcube.portlets.user
geoportal-data-viewer-app
war
- 3.2.1
+ 3.3.0-SNAPSHOT
GeoPortal Data Viewer App
The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java
index 46553eb..115a563 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java
@@ -806,7 +806,8 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
- flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
+ if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
+ flowPanel.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
}
Button buttOpenProject = new Button("Open Project");
@@ -956,8 +957,9 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
GWT.log("Temporal reference is: "+tempRef);
if (tempRef != null) {
-
- flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
+
+ if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
+ flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
}
List selections = projectView.getListSections();
@@ -1162,8 +1164,8 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) {
-
- flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
+ if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
+ flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
}
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/dandd/DragDropLayer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/dandd/DragDropLayer.java
index 281262b..ee965e7 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/dandd/DragDropLayer.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/dandd/DragDropLayer.java
@@ -189,8 +189,8 @@ public class DragDropLayer extends FlowPanel {
if(layerObject.getProjectDV().getTemporalReference()!=null) {
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
-// ft.setWidget(ft.getRowCount() + 1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef)));
- vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
+ if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
+ vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
}
vpInner.add(labelLayerName);
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
index 2f6dcbe..d267fc8 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java
@@ -117,6 +117,30 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
public static enum COMMON_IMAGES_FORMAT {
gif, png, jpeg, jpg, bmp, tif, tiff, svg, avif, webp
}
+
+ public static enum CENTROID_LAYER_INDEX_FLAG {
+ PUBLIC("public"), PRIVATE("internal");
+
+ String id;
+
+ CENTROID_LAYER_INDEX_FLAG(String id) {
+ this.id = id;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("CENTROID_LAYER_INDEX_FLAG [id=");
+ builder.append(id);
+ builder.append("]");
+ return builder.toString();
+ }
+
+ }
/**
* The Class ImageDetector.
@@ -452,40 +476,38 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
// TODO TO Check index flag should be in configuration or evaluated according to
// user credentials
- String indexFlag = "public"; // default
+ CENTROID_LAYER_INDEX_FLAG setIndexFlag = null;
GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy();
if (gsp.isUser()) {
- indexFlag = "internal";
- LOG.info("user logged - using indexFlag: " + indexFlag);
+ setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PRIVATE;
+ LOG.info("user logged - using indexFlag: " + setIndexFlag);
} else if (gsp.isIAMClient()) {
- indexFlag = "public";
- LOG.info("user not logged - using indexFlag: " + indexFlag);
+ setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PUBLIC;
+ LOG.info("user not logged - using indexFlag: " + setIndexFlag);
}
// TODO constant
coll.setIndexes(new ArrayList());
- LOG.debug(
- "Checking if " + u.getId() + " is GIS Indexed. Index flag needed is " + indexFlag);
-
- for (Index index : ucdConfig.getIndexes()) {
- try {
- IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
- if (toAdd.getFlag().equals(indexFlag)) {
- coll.getIndexes().add(toAdd);
- }
- } catch (Exception e) {
- LOG.debug("Skipping invalid index ", e);
- } catch (Throwable t) {
- LOG.error("Unable to check index ", t);
- }
+ LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is '" + setIndexFlag+"'");
+ IndexLayerDV toAdd = getLayerIndex(ucdConfig, setIndexFlag);
+ if(toAdd!=null) {
+ coll.getIndexes().add(toAdd);
}
- // Return only if gis indexed
- if (coll.getIndexes().isEmpty())
- LOG.info("No available GIS Index for collection " + coll.getUcd().getName());
- else
+ // Using the public centroid layer as default
+ if (coll.getIndexes().isEmpty()) {
+ LOG.info("No available GIS Index for collection " + coll.getUcd().getName() +" with flag "+setIndexFlag.getId());
+ setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PUBLIC;
+ LOG.info("Prevent fallback - getting the GIS index with flag '"+setIndexFlag.getId() + "' available");
+ toAdd = getLayerIndex(ucdConfig, setIndexFlag);
+ if(toAdd!=null) {
+ coll.getIndexes().add(toAdd);
+ }
+ }
+
+ if(!coll.getIndexes().isEmpty())
config.getAvailableCollections().put(coll.getUcd().getId(), coll);
} catch (Throwable t) {
@@ -504,6 +526,27 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
}.execute().getResult();
}
+
+
+ private IndexLayerDV getLayerIndex(Configuration ucdConfig, CENTROID_LAYER_INDEX_FLAG flag) {
+
+ for (Index index : ucdConfig.getIndexes()) {
+ try {
+ IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
+ LOG.trace("Discovered index: "+toAdd);
+ if (toAdd.getFlag().compareToIgnoreCase(flag.getId())==0) {
+ LOG.debug("Layer index found for flag: "+flag + ", returning");
+ return toAdd;
+ }
+ } catch (Exception e) {
+ LOG.debug("Skipping invalid index ", e);
+ } catch (Throwable t) {
+ LOG.error("Unable to check index ", t);
+ }
+ }
+
+ return null;
+ }
/**
* Gets the config list of fields for searching.
@@ -657,7 +700,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
filter.setProjection(projectionForIDs);
ResultSetPaginatedDataIDs searchedDataIDs = new ResultSetPaginatedDataIDs();
-
+
Integer totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(),
theProfileID);