fixing issues #24632

This commit is contained in:
Francesco Mangiacrapa 2023-02-20 15:22:51 +01:00
parent 2b6272dd60
commit 9581d3ce73
8 changed files with 109 additions and 50 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.2.1/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/geoportal-data-viewer-app-3.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.2.1/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-3.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.2.1/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-viewer-app-3.3.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,4 +1,4 @@
eclipse.preferences.version=1 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 warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -51,8 +51,10 @@
<wb-module deploy-name="geoportal-data-viewer-app-3.2.1">
<wb-module deploy-name="geoportal-data-viewer-app-3.3.0-SNAPSHOT">
@ -105,7 +107,8 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -158,7 +161,8 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -211,7 +215,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
@ -264,7 +269,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -317,10 +323,8 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.0.2.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -373,7 +377,8 @@
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
@ -426,7 +431,8 @@
<property name="context-root" value="geoportal-data-viewer-app"/> <property name="context-root" value="geoportal-data-viewer-app"/>
@ -479,7 +485,8 @@
</wb-module> </wb-module>

View File

@ -4,6 +4,13 @@
All notable changes to this project will be documented in this file. 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). 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 ## [v3.2.1] - 2023-02-03
#### Fixes #### Fixes

View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-viewer-app</artifactId> <artifactId>geoportal-data-viewer-app</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>3.2.1</version> <version>3.3.0-SNAPSHOT</version>
<name>GeoPortal Data Viewer App</name> <name>GeoPortal Data Viewer App</name>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description> <description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents by a Web-Map Interface</description>

View File

@ -806,7 +806,8 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference(); TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) { 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"); Button buttOpenProject = new Button("Open Project");
@ -956,8 +957,9 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference(); TemporalReferenceDV tempRef = projectDV.getTemporalReference();
GWT.log("Temporal reference is: "+tempRef); GWT.log("Temporal reference is: "+tempRef);
if (tempRef != null) { 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<SectionView> selections = projectView.getListSections(); List<SectionView> selections = projectView.getListSections();
@ -1162,8 +1164,8 @@ public class LayerManager {
TemporalReferenceDV tempRef = projectDV.getTemporalReference(); TemporalReferenceDV tempRef = projectDV.getTemporalReference();
if (tempRef != null) { if (tempRef != null) {
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef)); flex.setHTML(flex.getRowCount() + 1, 0, ProjectUtil.toHTMLCode(tempRef));
} }
} }

View File

@ -189,8 +189,8 @@ public class DragDropLayer extends FlowPanel {
if(layerObject.getProjectDV().getTemporalReference()!=null) { if(layerObject.getProjectDV().getTemporalReference()!=null) {
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference(); TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
// ft.setWidget(ft.getRowCount() + 1, 2, new HTML(ProjectUtil.toHTMLCode(tempRef))); if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef))); vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
} }
vpInner.add(labelLayerName); vpInner.add(labelLayerName);

View File

@ -117,6 +117,30 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
public static enum COMMON_IMAGES_FORMAT { public static enum COMMON_IMAGES_FORMAT {
gif, png, jpeg, jpg, bmp, tif, tiff, svg, avif, webp 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. * 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 // TODO TO Check index flag should be in configuration or evaluated according to
// user credentials // user credentials
String indexFlag = "public"; // default CENTROID_LAYER_INDEX_FLAG setIndexFlag = null;
GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy(); GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy();
if (gsp.isUser()) { if (gsp.isUser()) {
indexFlag = "internal"; setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PRIVATE;
LOG.info("user logged - using indexFlag: " + indexFlag); LOG.info("user logged - using indexFlag: " + setIndexFlag);
} else if (gsp.isIAMClient()) { } else if (gsp.isIAMClient()) {
indexFlag = "public"; setIndexFlag = CENTROID_LAYER_INDEX_FLAG.PUBLIC;
LOG.info("user not logged - using indexFlag: " + indexFlag); LOG.info("user not logged - using indexFlag: " + setIndexFlag);
} }
// TODO constant // TODO constant
coll.setIndexes(new ArrayList()); coll.setIndexes(new ArrayList());
LOG.debug( LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is '" + setIndexFlag+"'");
"Checking if " + u.getId() + " is GIS Indexed. Index flag needed is " + indexFlag); IndexLayerDV toAdd = getLayerIndex(ucdConfig, setIndexFlag);
if(toAdd!=null) {
for (Index index : ucdConfig.getIndexes()) { coll.getIndexes().add(toAdd);
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);
}
} }
// Return only if gis indexed // Using the public centroid layer as default
if (coll.getIndexes().isEmpty()) if (coll.getIndexes().isEmpty()) {
LOG.info("No available GIS Index for collection " + coll.getUcd().getName()); LOG.info("No available GIS Index for collection " + coll.getUcd().getName() +" with flag "+setIndexFlag.getId());
else 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); config.getAvailableCollections().put(coll.getUcd().getId(), coll);
} catch (Throwable t) { } catch (Throwable t) {
@ -504,6 +526,27 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
}.execute().getResult(); }.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. * Gets the config list of fields for searching.
@ -657,7 +700,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
filter.setProjection(projectionForIDs); filter.setProjection(projectionForIDs);
ResultSetPaginatedDataIDs searchedDataIDs = new ResultSetPaginatedDataIDs(); ResultSetPaginatedDataIDs searchedDataIDs = new ResultSetPaginatedDataIDs();
Integer totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(), Integer totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(),
theProfileID); theProfileID);