fixing issues #24632

pull/14/head
parent 2b6272dd60
commit 9581d3ce73

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</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>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</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>

@ -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

@ -1,5 +1,5 @@
<?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"/>
@ -158,7 +161,8 @@
<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"/>
@ -264,7 +269,8 @@
<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"/>
<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"/>
@ -426,7 +431,8 @@
<property name="context-root" value="geoportal-data-viewer-app"/>
@ -479,7 +485,8 @@
</wb-module>

@ -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

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-viewer-app</artifactId>
<packaging>war</packaging>
<version>3.2.1</version>
<version>3.3.0-SNAPSHOT</version>
<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>

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

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

@ -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);
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);
}
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);
// 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);
}
}
// Return only if gis indexed
if (coll.getIndexes().isEmpty())
LOG.info("No available GIS Index for collection " + coll.getUcd().getName());
else
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);

Loading…
Cancel
Save