bug fixing issue on displaying automatically the layers

This commit is contained in:
Francesco Mangiacrapa 2022-12-15 17:47:44 +01:00
parent 143e79388d
commit 7211ddaeaf
6 changed files with 27 additions and 20 deletions

View File

@ -497,6 +497,10 @@ public class LayerManager {
lo.setProjectID(projectID); lo.setProjectID(projectID);
lo.setProfileID(profileID); lo.setProfileID(profileID);
lo.setProjectDV(projectDV); lo.setProjectDV(projectDV);
GWT.log("LayerObject ID is: "+lo.getProjectID());
if(lo.getProjectDV()!=null)
GWT.log("LayerObject into ProjectDV is: "+lo.getProjectDV().getId());
String layerNameKey = layerItem.getName(); String layerNameKey = layerItem.getName();

View File

@ -26,8 +26,9 @@ public class OverlayLayerManager {
this.applicationBus = applicationBus; this.applicationBus = applicationBus;
} }
void addLayerItem(LayerObject lo) { public void addLayerItem(LayerObject lo) {
GWT.log("Adding LayerObject having project: "+lo.getProjectDV()); GWT.log("Adding LayerObject having project: "+lo.getProjectDV());
GWT.log("Adding LayerObject having project id: "+lo.getProjectDV().getId());
ArrayList<DragDropLayer> listDDLayers = mapCollectionsPerProfileID.get(lo.getProfileID()); ArrayList<DragDropLayer> listDDLayers = mapCollectionsPerProfileID.get(lo.getProfileID());

View File

@ -462,7 +462,7 @@ public abstract class OpenLayerMap {
* *
* @param layerItem the layer item * @param layerItem the layer item
*/ */
public synchronized void addWMSDetailLayer(LayerItem layerItem) { public void addWMSDetailLayer(LayerItem layerItem) {
if (wmsDetailsLayerMap == null) if (wmsDetailsLayerMap == null)
wmsDetailsLayerMap = new LinkedHashMap<String, Image>(); wmsDetailsLayerMap = new LinkedHashMap<String, Image>();

View File

@ -61,35 +61,34 @@ public class DragDropLayer extends FlowPanel {
this.layerItem = layerObject.getLayerItem(); this.layerItem = layerObject.getLayerItem();
GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV()); GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV());
String referProject = "Project ID: " + layerObject.getProjectDV().getId(); String referProjectID = "Project ID: " + layerObject.getProjectDV().getId();
labelProject = new com.google.gwt.user.client.ui.Label(""); labelProject = new com.google.gwt.user.client.ui.Label("");
labelProject.setTitle(referProject); labelProject.setTitle(referProjectID);
GeoportalDataViewerServiceAsync.Util.getInstance().getEntrySetsDocumentForProjectID( GeoportalDataViewerServiceAsync.Util.getInstance().getEntrySetsDocumentForProjectID(
layerObject.getProjectDV().getProfileID(), layerObject.getProjectDV().getId(), 1, layerObject.getProjectDV().getProfileID(), layerObject.getProjectDV().getId(), 1,
new AsyncCallback<LinkedHashMap<String, Object>>() { new AsyncCallback<LinkedHashMap<String, Object>>() {
@Override @Override
public void onSuccess(LinkedHashMap<String, Object> result) { public void onSuccess(LinkedHashMap<String, Object> result) {
String referProject = ""; String realProjectName = "";
if (result != null) { if (result != null) {
for (String key : result.keySet()) { for (String key : result.keySet()) {
result.get(key); result.get(key);
//referProject = key + ": " + result.get(key); //referProject = key + ": " + result.get(key);
referProject = result.get(key)+""; realProjectName = result.get(key)+"";
break; break;
} }
} }
if (referProject != null && !referProject.isEmpty()) { if (realProjectName != null && !realProjectName.isEmpty()) {
labelProject.setText(StringUtil.ellipsize(referProject, 40)); labelProject.setText(StringUtil.ellipsize(realProjectName, 40));
labelProject.setTitle(referProject); labelProject.setTitle(realProjectName);
} }
} }
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
labelProject.setText(StringUtil.ellipsize(referProject, 40)); labelProject.setTitle("Error on reading the project name");
labelProject.setTitle(referProject);
} }
}); });

View File

@ -1005,8 +1005,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
switch (layerObject.getType()) { switch (layerObject.getType()) {
case INDEX_LAYER: { case INDEX_LAYER: {
// Expected 1 feature // Expected more than 1 feature for the BBOX of the Map
FeatureRow fRow = features.get(0); FeatureRow fRow = features.get(0);
//using only the first feature returned from BBOX of the Map
//when querying the centroid layers
geoDAO.setFeatures(Arrays.asList(fRow));
if (fRow.getMapProperties() != null) { if (fRow.getMapProperties() != null) {
List<String> productIDs = fRow.getMapProperties() List<String> productIDs = fRow.getMapProperties()
.get(GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE); .get(GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE);

View File

@ -574,7 +574,7 @@ public class Geoportal_JSON_Mapper {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
LOG.info("Reading sectionPath at {} into section document {}", _payloadsJSONPath, sectionJSONDocument); LOG.debug("Reading sectionPath at {} into section document {}", _payloadsJSONPath, sectionJSONDocument);
JsonPath theSectionPolycJsonPath = JsonPath.compile(_payloadsJSONPath); JsonPath theSectionPolycJsonPath = JsonPath.compile(_payloadsJSONPath);
Object _payloads = theSectionPolycJsonPath.read(sectionJSONDocument, configuration).toString(); Object _payloads = theSectionPolycJsonPath.read(sectionJSONDocument, configuration).toString();
@ -607,14 +607,14 @@ public class Geoportal_JSON_Mapper {
*/ */
public static List<PayloadDV> readImagesForFileset(String parentJSONPath, String sectionJSONDocument, public static List<PayloadDV> readImagesForFileset(String parentJSONPath, String sectionJSONDocument,
boolean limitToFirstOneFound) { boolean limitToFirstOneFound) {
LOG.debug("readImagesForFileset called"); LOG.info("readImagesForFileset called");
List<PayloadDV> listImages = new ArrayList<PayloadDV>(); List<PayloadDV> listImages = new ArrayList<PayloadDV>();
com.jayway.jsonpath.Configuration config = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration config = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
// Reading Fileset _payloads // Reading Fileset _payloads
String filesetJSONPath = String.format("%s.%s", parentJSONPath, _PAYLOADS); String filesetJSONPath = String.format("%s.%s", parentJSONPath, _PAYLOADS);
LOG.info("Reading sectionPath {} into section document {}", filesetJSONPath, sectionJSONDocument); LOG.debug("Reading sectionPath {} into section document {}", filesetJSONPath, sectionJSONDocument);
JsonPath theSectionPolycJsonPath = JsonPath.compile(filesetJSONPath); JsonPath theSectionPolycJsonPath = JsonPath.compile(filesetJSONPath);
Object _filesets = theSectionPolycJsonPath.read(sectionJSONDocument, config); Object _filesets = theSectionPolycJsonPath.read(sectionJSONDocument, config);
@ -644,7 +644,7 @@ public class Geoportal_JSON_Mapper {
*/ */
public static List<GCubeSDIViewerLayerDV> readGcubeSDILayersForFileset(String materializationParentJSONPath, public static List<GCubeSDIViewerLayerDV> readGcubeSDILayersForFileset(String materializationParentJSONPath,
String sectionJSONDocument) { String sectionJSONDocument) {
LOG.debug("readGcubeSDILayersForFileset called"); LOG.info("readGcubeSDILayersForFileset called");
List<GCubeSDIViewerLayerDV> listSDILayers = new ArrayList<GCubeSDIViewerLayerDV>(); List<GCubeSDIViewerLayerDV> listSDILayers = new ArrayList<GCubeSDIViewerLayerDV>();
String _materializationsJSONPath = String.format("%s.%s", materializationParentJSONPath, _MATERIALIZATIONS); String _materializationsJSONPath = String.format("%s.%s", materializationParentJSONPath, _MATERIALIZATIONS);
@ -653,7 +653,7 @@ public class Geoportal_JSON_Mapper {
com.jayway.jsonpath.Configuration configurationJSONSmart = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configurationJSONSmart = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
LOG.info("Reading sectionPath {} into section document {}", _materializationsJSONPath, sectionJSONDocument); LOG.debug("Reading sectionPath {} into section document {}", _materializationsJSONPath, sectionJSONDocument);
JsonPath theSectionPolycJsonPath = JsonPath.compile(_materializationsJSONPath); JsonPath theSectionPolycJsonPath = JsonPath.compile(_materializationsJSONPath);
Object _materializations = theSectionPolycJsonPath.read(sectionJSONDocument, configurationJSONSmart); Object _materializations = theSectionPolycJsonPath.read(sectionJSONDocument, configurationJSONSmart);
@ -827,7 +827,7 @@ public class Geoportal_JSON_Mapper {
* @return true, if successful * @return true, if successful
*/ */
private static boolean checkAccessPolicy(String sectionDocumentJSON, String myLogin) { private static boolean checkAccessPolicy(String sectionDocumentJSON, String myLogin) {
LOG.debug("checkAccessPolicy called"); LOG.info("checkAccessPolicy called");
// CHECKING THE POLICY // CHECKING THE POLICY
String accessPolicyPath = JSON_$_POINTER + "._access._policy"; String accessPolicyPath = JSON_$_POINTER + "._access._policy";
boolean isAccessible = true; boolean isAccessible = true;
@ -835,10 +835,10 @@ public class Geoportal_JSON_Mapper {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
LOG.info("Reading access policy at {} into section document {}", accessPolicyPath, sectionDocumentJSON); LOG.debug("Reading access policy at {} into section document {}", accessPolicyPath, sectionDocumentJSON);
JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath); JsonPath theSectionPolycJsonPath = JsonPath.compile(accessPolicyPath);
String _policy = theSectionPolycJsonPath.read(sectionDocumentJSON, configuration).toString(); String _policy = theSectionPolycJsonPath.read(sectionDocumentJSON, configuration).toString();
LOG.info("The section {} has policy {}", accessPolicyPath, _policy); LOG.debug("The section {} has policy {}", accessPolicyPath, _policy);
isAccessible = GeportalCheckAccessPolicy.isAccessible(_policy, myLogin); isAccessible = GeportalCheckAccessPolicy.isAccessible(_policy, myLogin);
} catch (Exception e) { } catch (Exception e) {
LOG.error(accessPolicyPath + " not found. Check OK"); LOG.error(accessPolicyPath + " not found. Check OK");