Integrated with spatialReference. Setting the IndexFlag according to
user logged-in or not
This commit is contained in:
parent
56f3c29d6d
commit
b3345a4b5f
1
pom.xml
1
pom.xml
|
@ -198,7 +198,6 @@
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.Set;
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
@ -403,8 +404,24 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
if (record != null) {
|
if (record != null) {
|
||||||
this.cancel();
|
this.cancel();
|
||||||
GWT.log("cancelled timer");
|
GWT.log("cancelled timer");
|
||||||
performWFSQueryOnCentroid(record.getTheProjectDV().getId(),
|
GeoJSON spatialReference = record.getTheProjectDV().getSpatialReference();
|
||||||
record.getCentroidLong(), record.getCentroidLat());
|
if (spatialReference == null) {
|
||||||
|
GWT.log("No spatial reference found, cancelling timer");
|
||||||
|
this.cancel();
|
||||||
|
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
|
||||||
|
spatialReference.getBbox().getMinY(),
|
||||||
|
spatialReference.getBbox().getMaxX(),
|
||||||
|
spatialReference.getBbox().getMaxY());
|
||||||
|
|
||||||
|
Coordinate centerCoordinate = ew.getCenter();
|
||||||
|
performWFSQueryOnCentroid(record.getTheProjectDV().getId(),
|
||||||
|
centerCoordinate.getX(), centerCoordinate.getY());
|
||||||
|
} catch (Exception e) {
|
||||||
|
GWT.log("Error on calculating center of the extent " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attempt > MAX_RETRY) {
|
if (attempt > MAX_RETRY) {
|
||||||
|
@ -562,7 +579,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
List<? extends DocumentDV> result = searchPerformedEvent.getData();
|
List<? extends DocumentDV> result = searchPerformedEvent.getData();
|
||||||
|
|
||||||
if (result != null && result.size() > 0) {
|
if (result != null && result.size() > 0) {
|
||||||
String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE+" IN(";
|
String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN(";
|
||||||
for (DocumentDV documentDV : result) {
|
for (DocumentDV documentDV : result) {
|
||||||
cqlFilter += "'" + documentDV.getProjectID() + "',";
|
cqlFilter += "'" + documentDV.getProjectID() + "',";
|
||||||
}
|
}
|
||||||
|
@ -602,7 +619,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
// }-*/;
|
// }-*/;
|
||||||
|
|
||||||
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) {
|
||||||
GWT.log("Perform performWFSQueryOnCentroid: "+projectID+ " long: "+centroidLong + ", lat: "+centroidLat);
|
GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat);
|
||||||
if (projectID != null) {
|
if (projectID != null) {
|
||||||
Double x = centroidLong;
|
Double x = centroidLong;
|
||||||
Double y = centroidLat;
|
Double y = centroidLat;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
import ol.Collection;
|
import ol.Collection;
|
||||||
import ol.Coordinate;
|
import ol.Coordinate;
|
||||||
import ol.control.Attribution;
|
import ol.control.Attribution;
|
||||||
|
@ -10,50 +14,46 @@ import ol.control.ZoomSlider;
|
||||||
import ol.geom.LineString;
|
import ol.geom.LineString;
|
||||||
import ol.proj.Projection;
|
import ol.proj.Projection;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class MapUtils.
|
* The Class MapUtils.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||||
*
|
*
|
||||||
* Nov 12, 2020
|
* Nov 12, 2020
|
||||||
*/
|
*/
|
||||||
public final class MapUtils {
|
public final class MapUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates some default controls and adds it to the collection.
|
||||||
|
*
|
||||||
|
* @param controls collection with controls
|
||||||
|
*/
|
||||||
|
public static void addDefaultControls(final Collection<Control> controls) {
|
||||||
|
|
||||||
/**
|
controls.push(new FullScreen());
|
||||||
* Creates some default controls and adds it to the collection.
|
controls.push(new ZoomSlider());
|
||||||
*
|
MousePosition mousePosition = new MousePosition();
|
||||||
* @param controls collection with controls
|
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
|
||||||
*/
|
controls.push(mousePosition);
|
||||||
public static void addDefaultControls(final Collection<Control> controls) {
|
|
||||||
|
|
||||||
controls.push(new FullScreen());
|
|
||||||
controls.push(new ZoomSlider());
|
|
||||||
MousePosition mousePosition = new MousePosition();
|
|
||||||
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
|
|
||||||
controls.push(mousePosition);
|
|
||||||
|
|
||||||
Attribution attribution = new Attribution();
|
Attribution attribution = new Attribution();
|
||||||
attribution.setCollapsed(true);
|
attribution.setCollapsed(true);
|
||||||
controls.push(attribution);
|
controls.push(attribution);
|
||||||
//controls.push(new ZoomToExtent());
|
// controls.push(new ZoomToExtent());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transform coordiante.
|
* Transform coordiante.
|
||||||
*
|
*
|
||||||
* @param centerCoordinate the center coordinate
|
* @param centerCoordinate the center coordinate
|
||||||
* @param source the source
|
* @param source the source
|
||||||
* @param target the target
|
* @param target the target
|
||||||
* @return the coordinate
|
* @return the coordinate
|
||||||
*/
|
*/
|
||||||
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
|
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
|
||||||
return Projection.transform(centerCoordinate, source, target);
|
return Projection.transform(centerCoordinate, source, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distance between centroid.
|
* Distance between centroid.
|
||||||
|
@ -63,10 +63,9 @@ public final class MapUtils {
|
||||||
* @return the long
|
* @return the long
|
||||||
*/
|
*/
|
||||||
public static long distanceBetweenCentroid(ExtentWrapped ex1, ExtentWrapped ex2) {
|
public static long distanceBetweenCentroid(ExtentWrapped ex1, ExtentWrapped ex2) {
|
||||||
return distanceBetween(ex1.getCenter(),ex2.getCenter());
|
return distanceBetween(ex1.getCenter(), ex2.getCenter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distance between.
|
* Distance between.
|
||||||
*
|
*
|
||||||
|
@ -84,15 +83,43 @@ public final class MapUtils {
|
||||||
// GWT.log("Line length is: "+ls);
|
// GWT.log("Line length is: "+ls);
|
||||||
return Math.round(ls.getLength() * 100) / 100;
|
return Math.round(ls.getLength() * 100) / 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse coordinate.
|
* Reverse coordinate.
|
||||||
*
|
*
|
||||||
* @param coord the coord
|
* @param coord the coord
|
||||||
* @return the coordinate
|
* @return the coordinate
|
||||||
*/
|
*/
|
||||||
public static Coordinate reverseCoordinate(Coordinate coord){
|
public static Coordinate reverseCoordinate(Coordinate coord) {
|
||||||
return new Coordinate(coord.getY(), coord.getX());
|
return new Coordinate(coord.getY(), coord.getX());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Geo JSONT to B box center.
|
||||||
|
*
|
||||||
|
* @param spatialReference the spatial reference
|
||||||
|
* @param transforFrom the transfor from
|
||||||
|
* @param transformTo the transform to
|
||||||
|
* @return the coordinate
|
||||||
|
*/
|
||||||
|
public static Coordinate geoJSONTToBBoxCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (spatialReference != null) {
|
||||||
|
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
|
||||||
|
spatialReference.getBbox().getMinY(), spatialReference.getBbox().getMaxX(),
|
||||||
|
spatialReference.getBbox().getMaxY());
|
||||||
|
|
||||||
|
Coordinate center = ew.getCenter();
|
||||||
|
if (transforFrom != null && transformTo != null)
|
||||||
|
center = transformCoordiante(center, transforFrom, transformTo);
|
||||||
|
|
||||||
|
return center;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
GWT.log("geoJSONTToBBoxCenter error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,13 +196,18 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
//navLink.setText(ucd.getName());
|
//navLink.setText(ucd.getName());
|
||||||
navLink.addClickHandler(new ClickHandler() {
|
navLink.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
private SearchFacilityUI currentSearchFacility;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
if(this.currentSearchFacility!=null)
|
||||||
|
this.currentSearchFacility.resetCurrentSearch();
|
||||||
|
|
||||||
searchFacilityPanel.clear();
|
searchFacilityPanel.clear();
|
||||||
SearchFacilityUI searchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, sortByFields, searchByFields,
|
this.currentSearchFacility = new SearchFacilityUI(ucd.getProfileID(), applicationBus, sortByFields, searchByFields,
|
||||||
initialSortFilter);
|
initialSortFilter);
|
||||||
searchFacilityPanel.add(searchFacility);
|
searchFacilityPanel.add(currentSearchFacility);
|
||||||
searchFacility.setSearchButton(searchFacilityButton);
|
currentSearchFacility.setSearchButton(searchFacilityButton);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,15 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.OLUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
|
||||||
|
@ -56,7 +59,7 @@ public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button expandButton;
|
Button expandButton;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button relationshipsButton;
|
Button relationshipsButton;
|
||||||
|
|
||||||
|
@ -81,8 +84,8 @@ public class ProjectViewer extends Composite {
|
||||||
this(geoportalItemRefs, projectView, true, true);
|
this(geoportalItemRefs, projectView, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectViewer(GeoportalItemReferences geoportalItemRefs, final ProjectView projectView, boolean viewImageButtonVisible,
|
public ProjectViewer(GeoportalItemReferences geoportalItemRefs, final ProjectView projectView,
|
||||||
boolean openImageButtonVisible) {
|
boolean viewImageButtonVisible, boolean openImageButtonVisible) {
|
||||||
this();
|
this();
|
||||||
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
|
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
|
||||||
this.theProjectView = projectView;
|
this.theProjectView = projectView;
|
||||||
|
@ -92,7 +95,7 @@ public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
|
||||||
? projectView.getTheProjectDV().getProfileName()
|
? projectView.getTheProjectDV().getProfileName()
|
||||||
: "Project ID: "+projectView.getTheProjectDV().getId();
|
: "Project ID: " + projectView.getTheProjectDV().getId();
|
||||||
|
|
||||||
headerPanel.add(new HTML(theTitle));
|
headerPanel.add(new HTML(theTitle));
|
||||||
|
|
||||||
|
@ -118,7 +121,8 @@ public class ProjectViewer extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
ProjectViewer cv = new ProjectViewer(geoportalItemReferences, theProjectView, false, openImageButtonVisible);
|
ProjectViewer cv = new ProjectViewer(geoportalItemReferences, theProjectView, false,
|
||||||
|
openImageButtonVisible);
|
||||||
cv.setExpandViewButtonVisible(false);
|
cv.setExpandViewButtonVisible(false);
|
||||||
int width = Window.getClientWidth() * 75 / 100;
|
int width = Window.getClientWidth() * 75 / 100;
|
||||||
int height = Window.getClientHeight() * 70 / 100;
|
int height = Window.getClientHeight() * 70 / 100;
|
||||||
|
@ -130,17 +134,16 @@ public class ProjectViewer extends Composite {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
relationshipsButton.setType(ButtonType.LINK);
|
relationshipsButton.setType(ButtonType.LINK);
|
||||||
relationshipsButton.setIcon(IconType.LINK);
|
relationshipsButton.setIcon(IconType.LINK);
|
||||||
relationshipsButton.setTitle("Show Relationships of this Project");
|
relationshipsButton.setTitle("Show Relationships of this Project");
|
||||||
|
|
||||||
List<RelationshipDV> relationships = projectView.getTheProjectDV().getRelationships();
|
List<RelationshipDV> relationships = projectView.getTheProjectDV().getRelationships();
|
||||||
if(relationships!=null && relationships.size()>0) {
|
if (relationships != null && relationships.size() > 0) {
|
||||||
relationshipsButton.setVisible(true);
|
relationshipsButton.setVisible(true);
|
||||||
}else
|
} else
|
||||||
relationshipsButton.setVisible(false);
|
relationshipsButton.setVisible(false);
|
||||||
|
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
@ -170,19 +173,21 @@ public class ProjectViewer extends Composite {
|
||||||
MapView mapView = new MapView(transformedCenterCoordinate,
|
MapView mapView = new MapView(transformedCenterCoordinate,
|
||||||
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
|
||||||
|
|
||||||
if (theProjectView != null && theProjectView.getCentroidLat() != null
|
if (theProjectView != null && theProjectView.getTheProjectDV() != null) {
|
||||||
&& theProjectView.getCentroidLong() != null) {
|
|
||||||
Coordinate coord = new Coordinate(theProjectView.getCentroidLong(), theProjectView.getCentroidLat());
|
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
|
||||||
Coordinate transfCoord = MapUtils.transformCoordiante(coord, MAP_PROJECTION.EPSG_4326.getName(),
|
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
|
||||||
MAP_PROJECTION.EPSG_3857.getName());
|
MAP_PROJECTION.EPSG_3857.getName());
|
||||||
// Coordinate invertedCoordinate = MapUtils.reverseCoordinate(coord);
|
|
||||||
boolean authenticatedUser = myLogin != null ? true : false;
|
if (transfCoord != null) {
|
||||||
mapView.addMarker(transfCoord, authenticatedUser);
|
boolean authenticatedUser = myLogin != null ? true : false;
|
||||||
centroidPanel.add(mapView);
|
mapView.addMarker(transfCoord, authenticatedUser);
|
||||||
|
centroidPanel.add(mapView);
|
||||||
|
}
|
||||||
} else if (theProjectView != null) {
|
} else if (theProjectView != null) {
|
||||||
GeoportalDataViewerConstants
|
GeoportalDataViewerConstants
|
||||||
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: "
|
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " + theProjectView
|
||||||
+ theProjectView.getCentroidLong() + ", Long:" + theProjectView.getCentroidLat());
|
+ ", Long:" + theProjectView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,13 @@ import org.gcube.application.geoportalcommon.shared.WhereClause;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||||
|
|
||||||
|
@ -50,6 +53,8 @@ import com.google.gwt.user.client.ui.HTMLPanel;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
|
||||||
|
import ol.Coordinate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SearchFacilityUI.
|
* The Class SearchFacilityUI.
|
||||||
*
|
*
|
||||||
|
@ -224,17 +229,21 @@ public class SearchFacilityUI extends Composite {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
searchField.setText("");
|
resetCurrentSearch();
|
||||||
resetSearch.setVisible(false);
|
|
||||||
panelResults.clear();
|
|
||||||
latestResult = null;
|
|
||||||
appManagerBus.fireEvent(new SearchPerformedEvent(null, true));
|
|
||||||
setSearchEnabled(false);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resetCurrentSearch() {
|
||||||
|
searchField.setText("");
|
||||||
|
resetSearch.setVisible(false);
|
||||||
|
panelResults.clear();
|
||||||
|
latestResult = null;
|
||||||
|
appManagerBus.fireEvent(new SearchPerformedEvent(null, true));
|
||||||
|
setSearchEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the search enabled.
|
* Sets the search enabled.
|
||||||
*
|
*
|
||||||
|
@ -307,28 +316,42 @@ public class SearchFacilityUI extends Composite {
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
for (DocumentDV documentDV : result.getData()) {
|
for (DocumentDV documentDV : result.getData()) {
|
||||||
|
|
||||||
ResultDocumentDV resultDoc = (ResultDocumentDV) documentDV;
|
ResultDocumentDV resultDoc = (ResultDocumentDV) documentDV;
|
||||||
|
|
||||||
NavLink locateOnMap = new NavLink("Show");
|
NavLink locateOnMap = new NavLink("Show");
|
||||||
locateOnMap.setTitle("Open this project and show details");
|
locateOnMap.setTitle("Locate this project on Map and show details");
|
||||||
locateOnMap.setIcon(IconType.MAP_MARKER);
|
locateOnMap.setIcon(IconType.MAP_MARKER);
|
||||||
|
|
||||||
locateOnMap.addClickHandler(new ClickHandler() {
|
locateOnMap.addClickHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
GeoportalItemReferences gir = new GeoportalItemReferences(documentDV.getProjectID(),
|
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
|
||||||
profileID);
|
profileID);
|
||||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||||
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(documentDV, resultDoc.getCentroidLong(), resultDoc.getCentroidLat()));
|
|
||||||
|
GeoJSON spatialReference = resultDoc.getSpatialReference();
|
||||||
|
Coordinate transfCoord = MapUtils.geoJSONTToBBoxCenter(spatialReference, null,
|
||||||
|
null);
|
||||||
|
|
||||||
|
Double centerLong = null;
|
||||||
|
Double centerLat = null;
|
||||||
|
|
||||||
|
if (transfCoord != null) {
|
||||||
|
centerLong = transfCoord.getX();
|
||||||
|
centerLat = transfCoord.getY();
|
||||||
|
}
|
||||||
|
|
||||||
|
appManagerBus
|
||||||
|
.fireEvent(new ShowPopupOnCentroiEvent(resultDoc, centerLong, centerLat));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//First column
|
// First column
|
||||||
ft.setWidget(i, 0, locateOnMap);
|
ft.setWidget(i, 0, locateOnMap);
|
||||||
int j = 0;
|
int j = 0;
|
||||||
//Other columns
|
// Other columns
|
||||||
for (ItemFieldDV itemField : searchForFields) {
|
for (ItemFieldDV itemField : searchForFields) {
|
||||||
|
|
||||||
if (j > MAX_COLUMNS_RESULTS) {
|
if (j > MAX_COLUMNS_RESULTS) {
|
||||||
|
@ -336,7 +359,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
String firstJsonField = itemField.getJsonFields().get(0);
|
String firstJsonField = itemField.getJsonFields().get(0);
|
||||||
GWT.log("The json fields is: "+firstJsonField);
|
GWT.log("The json fields is: " + firstJsonField);
|
||||||
String key = firstJsonField.replace(DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
|
String key = firstJsonField.replace(DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
|
||||||
Object value = documentDV.getDocumentAsMap().get(key);
|
Object value = documentDV.getDocumentAsMap().get(key);
|
||||||
|
|
||||||
|
@ -357,7 +380,7 @@ public class SearchFacilityUI extends Composite {
|
||||||
toReturn += "</ul>";
|
toReturn += "</ul>";
|
||||||
GWT.log("Array returning: " + key + " is instance of: " + value.getClass()
|
GWT.log("Array returning: " + key + " is instance of: " + value.getClass()
|
||||||
+ " to return: " + toReturn);
|
+ " to return: " + toReturn);
|
||||||
|
|
||||||
toTitle = toDisplayTitle;
|
toTitle = toDisplayTitle;
|
||||||
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
|
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
|
||||||
} else {
|
} else {
|
||||||
|
@ -365,8 +388,8 @@ public class SearchFacilityUI extends Composite {
|
||||||
toTitle = valueStr;
|
toTitle = valueStr;
|
||||||
objectToRender = StringUtil.ellipsize(valueStr, MAX_TEXT_DIMENSION);
|
objectToRender = StringUtil.ellipsize(valueStr, MAX_TEXT_DIMENSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
GWT.log("The key is: "+key+" objectToRender is: "+objectToRender);
|
GWT.log("The key is: " + key + " objectToRender is: " + objectToRender);
|
||||||
HTML htmlValue = new HTML(objectToRender);
|
HTML htmlValue = new HTML(objectToRender);
|
||||||
htmlValue.setTitle(toTitle);
|
htmlValue.setTitle(toTitle);
|
||||||
ft.setWidget(i, ++j, htmlValue);
|
ft.setWidget(i, ++j, htmlValue);
|
||||||
|
|
|
@ -36,5 +36,8 @@ public class OGCUtils {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
import org.gcube.application.geoportal.common.model.configuration.Configuration;
|
||||||
import org.gcube.application.geoportal.common.model.configuration.Index;
|
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportal.common.rest.Projects;
|
import org.gcube.application.geoportal.common.rest.Projects;
|
||||||
|
@ -38,9 +39,11 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.IdentificationReferencesTYPE;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
|
||||||
|
@ -692,18 +695,27 @@ 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 toCheckFlag = "internal";
|
String indexFlag = "public"; //default
|
||||||
|
|
||||||
|
GeoportalServiceIdentityProxy gsp = getGeoportalServiceProxy();
|
||||||
|
if(gsp.isUser()) {
|
||||||
|
indexFlag = "internal";
|
||||||
|
LOG.info("user logged - using indexFlag: "+indexFlag);
|
||||||
|
}else if(gsp.isIAMClient()) {
|
||||||
|
indexFlag = "public";
|
||||||
|
LOG.info("user not logged - using indexFlag: "+indexFlag);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO constant
|
// TODO constant
|
||||||
coll.setIndexes(new ArrayList());
|
coll.setIndexes(new ArrayList());
|
||||||
|
|
||||||
LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is "
|
LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is "
|
||||||
+ toCheckFlag);
|
+ indexFlag);
|
||||||
|
|
||||||
for (Index index : ucdConfig.getIndexes()) {
|
for (Index index : ucdConfig.getIndexes()) {
|
||||||
try {
|
try {
|
||||||
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
|
IndexLayerDV toAdd = ConvertToDataValueObjectModel.convert(index);
|
||||||
if (toAdd.getFlag().equals(toCheckFlag)) {
|
if (toAdd.getFlag().equals(indexFlag)) {
|
||||||
coll.getIndexes().add(toAdd);
|
coll.getIndexes().add(toAdd);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -1109,7 +1121,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
* @param maxWFSFeature the max WFS feature
|
* @param maxWFSFeature the max WFS feature
|
||||||
* @param zoomLevel the zoom level
|
* @param zoomLevel the zoom level
|
||||||
* @return the data result
|
* @return the data result
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
public List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName,
|
||||||
|
@ -1120,7 +1132,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
", mapSrsName: " + mapSrsName + ", selectBBOX: " + selectBBOX + ", maxWFSFeature: " + maxWFSFeature
|
", mapSrsName: " + mapSrsName + ", selectBBOX: " + selectBBOX + ", maxWFSFeature: " + maxWFSFeature
|
||||||
+ ", zoomLevel: " + zoomLevel);
|
+ ", zoomLevel: " + zoomLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
List<GeoNaSpatialQueryResult> listDAO = new ArrayList<GeoNaSpatialQueryResult>(layerObjects.size());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1168,7 +1180,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
// Sets only profileID and profileName into ProjectDV
|
// Sets only profileID and profileName into ProjectDV
|
||||||
if (layerObject.getProjectDV() == null) {
|
if (layerObject.getProjectDV() == null) {
|
||||||
ProjectDV projectDV = minimaProjectDV(profileID, projectID);
|
ProjectDV projectDV = minimalProjectDV(profileID, projectID);
|
||||||
layerObject.setProjectDV(projectDV);
|
layerObject.setProjectDV(projectDV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1191,10 +1203,15 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
// Mininal set of info for displaying into popup
|
// Mininal set of info for displaying into popup
|
||||||
if (layerObject.getProjectDV() == null) {
|
if (layerObject.getProjectDV() == null) {
|
||||||
ProjectDV projectDV = minimaProjectDV(layerObject.getProfileID(),
|
ProjectDV projectDV = minimalProjectDV(layerObject.getProfileID(),
|
||||||
layerObject.getProjectID());
|
layerObject.getProjectID());
|
||||||
layerObject.setProjectDV(projectDV);
|
layerObject.setProjectDV(projectDV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(layerObject.getProjectDV().getSpatialReference()==null) {
|
||||||
|
GeoJSON geoJson = spatialReference(layerObject.getProfileID(), layerObject.getProjectID());
|
||||||
|
layerObject.getProjectDV().setSpatialReference(geoJson);
|
||||||
|
}
|
||||||
|
|
||||||
if (layerObject.getProjectDV().getTheDocument() == null) {
|
if (layerObject.getProjectDV().getTheDocument() == null) {
|
||||||
try {
|
try {
|
||||||
|
@ -1225,19 +1242,19 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
String erroMsg = "Error occurred on getting data results";
|
String erroMsg = "Error occurred on getting data results";
|
||||||
LOG.error(erroMsg, e);
|
LOG.error(erroMsg, e);
|
||||||
throw new Exception(erroMsg);
|
throw new Exception(erroMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.info("returning " + listDAO + " geona data objects");
|
LOG.info("returning " + listDAO + " geona data objects");
|
||||||
return listDAO;
|
return listDAO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ProjectDV minimaProjectDV(String profileID, String projectID) {
|
private ProjectDV minimalProjectDV(String profileID, String projectID) {
|
||||||
|
LOG.trace("minimalProjectDV for profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||||
|
|
||||||
QueryRequest request = new QueryRequest();
|
QueryRequest request = new QueryRequest();
|
||||||
request.setFilter(
|
request.setFilter(
|
||||||
|
@ -1264,6 +1281,23 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return projectDV;
|
return projectDV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private GeoJSON spatialReference(String profileID, String projectID) {
|
||||||
|
LOG.trace("spatialReference for profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||||
|
try {
|
||||||
|
|
||||||
|
List<IdentificationReference> listIR = projects(profileID).build().getById(projectID)
|
||||||
|
.getIdentificationReferenceByType(IdentificationReferencesTYPE.SPATIAL_REFERENCE.getType());
|
||||||
|
if (listIR != null && !listIR.isEmpty()) {
|
||||||
|
String _identificationReferenceString = listIR.get(0).toJson(); // one expected
|
||||||
|
LOG.debug("converting for profileID: " + profileID + ", projectID: " + projectID + "called");
|
||||||
|
return ConvertToDataValueObjectModel.toSpatialReference(_identificationReferenceString);
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
// silent
|
||||||
|
}
|
||||||
|
return new GeoJSON();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the entry sets document for project ID.
|
* Gets the entry sets document for project ID.
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,6 +22,10 @@ public class GeoportalServiceIdentityProxy {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalServiceIdentityProxy.class);
|
private static final Logger LOG = LoggerFactory.getLogger(GeoportalServiceIdentityProxy.class);
|
||||||
|
|
||||||
private GcubeIdentity gCubeIdentity;
|
private GcubeIdentity gCubeIdentity;
|
||||||
|
|
||||||
|
private boolean isUser = false;
|
||||||
|
|
||||||
|
private boolean isIAMClient = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new concessioni mongo service proxy.
|
* Instantiates a new concessioni mongo service proxy.
|
||||||
|
@ -42,48 +46,23 @@ public class GeoportalServiceIdentityProxy {
|
||||||
username = null; // to be sure that is null and not empty string
|
username = null; // to be sure that is null and not empty string
|
||||||
}
|
}
|
||||||
if (username != null) {
|
if (username != null) {
|
||||||
|
isUser = true;
|
||||||
LOG.info("User detected, using its identity");
|
LOG.info("User detected, using its identity");
|
||||||
gCubeIdentity = new UserIdentity();
|
gCubeIdentity = new UserIdentity();
|
||||||
} else {
|
} else {
|
||||||
|
isIAMClient = true;
|
||||||
LOG.info("User not detected, using IAM Client identity");
|
LOG.info("User not detected, using IAM Client identity");
|
||||||
gCubeIdentity = new IAMClientIdentity();
|
gCubeIdentity = new IAMClientIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
gCubeIdentity.setIdentity(request);
|
gCubeIdentity.setIdentity(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
public boolean isUser() {
|
||||||
// * Gets the project by ID.
|
return isUser;
|
||||||
// *
|
}
|
||||||
// * @param profileID the profile ID
|
|
||||||
// * @param projectID the project ID
|
public boolean isIAMClient() {
|
||||||
// * @return the project by ID
|
return isIAMClient;
|
||||||
// * @throws Exception the exception
|
}
|
||||||
// */
|
|
||||||
// public ProjectDV getProjectByID(String profileID, String projectID) throws Exception {
|
|
||||||
// ProjectsCaller clientPrj = GeoportalClientCaller.projects();
|
|
||||||
// Project theProject = clientPrj.getProjectByID(profileID, projectID);
|
|
||||||
// ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
|
||||||
// return ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
|
||||||
// /*
|
|
||||||
// * try { // Obtain the client ConcessioniMongoService concessioniManager = new
|
|
||||||
// * ConcessioniMongoService(); // Returning item by Id return
|
|
||||||
// * concessioniManager.getItemById(mongoItemId); }catch(Exception e) {
|
|
||||||
// * LOG.error("Error on reading itemById: "+mongoItemId, e); throw(e); }finally {
|
|
||||||
// * gCubeIdentity.resetIdentity(); }
|
|
||||||
// */
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Gets the UCD by ID.
|
|
||||||
// *
|
|
||||||
// * @param profileID the profile ID
|
|
||||||
// * @return the UCD by ID
|
|
||||||
// * @throws Exception the exception
|
|
||||||
// */
|
|
||||||
// public UseCaseDescriptorDV getUCDByID(String profileID) throws Exception {
|
|
||||||
// UseCaseDescriptorCaller ucdCaller = GeoportalClientCaller.useCaseDescriptors();
|
|
||||||
// UseCaseDescriptor ucd = ucdCaller.getUCDForId(profileID);
|
|
||||||
// return ConvertToDataValueObjectModel.toUseCaseDescriptorDV(ucd, null);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ public abstract class ContextRequest<T> {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ContextRequest.class);
|
private static final Logger LOG = LoggerFactory.getLogger(ContextRequest.class);
|
||||||
|
|
||||||
private static List<Runnable> preoperations = new ArrayList<>();
|
private static List<Runnable> preoperations = new ArrayList<>();
|
||||||
|
private GeoportalServiceIdentityProxy geoportalServiceProxy;
|
||||||
|
|
||||||
public static void addPreoperation(Runnable preoperation) {
|
public static void addPreoperation(Runnable preoperation) {
|
||||||
preoperations.add(preoperation);
|
preoperations.add(preoperation);
|
||||||
|
@ -35,7 +36,7 @@ public abstract class ContextRequest<T> {
|
||||||
r.run();
|
r.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
new GeoportalServiceIdentityProxy(request);
|
geoportalServiceProxy = new GeoportalServiceIdentityProxy(request);
|
||||||
LOG.debug("Context is " + SessionUtil.getCurrentContext(request, true));
|
LOG.debug("Context is " + SessionUtil.getCurrentContext(request, true));
|
||||||
LOG.debug("Context is " + SessionUtil.getCurrentToken(request, true) == null ? null : "***");
|
LOG.debug("Context is " + SessionUtil.getCurrentToken(request, true) == null ? null : "***");
|
||||||
LOG.trace("Executing actual method..");
|
LOG.trace("Executing actual method..");
|
||||||
|
@ -53,6 +54,10 @@ public abstract class ContextRequest<T> {
|
||||||
public T getResult() {
|
public T getResult() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GeoportalServiceIdentityProxy getGeoportalServiceProxy() {
|
||||||
|
return geoportalServiceProxy;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract T run() throws Exception, ControlledError;
|
protected abstract T run() throws Exception, ControlledError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,11 +37,4 @@ public class ViewerConfiguration implements Serializable {
|
||||||
public void setAvailableCollections(Map<String, GCubeCollection> availableCollections) {
|
public void setAvailableCollections(Map<String, GCubeCollection> availableCollections) {
|
||||||
this.availableCollections = availableCollections;
|
this.availableCollections = availableCollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
// public List<String> displayedCollections;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// public Map<String,String> selectedProjects;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
||||||
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.common.model.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
import org.gcube.application.geoportal.common.model.document.identification.IdentificationReference;
|
||||||
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
|
||||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
|
@ -13,6 +14,9 @@ import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
|
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.util.GisUtil;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.Crs;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
@ -20,7 +24,9 @@ import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.Geoportal_JSON_Mapper;
|
import org.gcube.portlets.user.geoportaldataviewer.server.Geoportal_JSON_Mapper;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class GeoportalViewer_Tests.
|
* The Class GeoportalViewer_Tests.
|
||||||
|
@ -39,10 +45,10 @@ public class GeoportalViewer_Tests {
|
||||||
// private static String TOKEN = ""; //preVRE
|
// private static String TOKEN = ""; //preVRE
|
||||||
|
|
||||||
private static String CONTEXT = "/gcube/devsec/devVRE";
|
private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||||
private static String TOKEN = ""; // devVRE
|
private static String TOKEN = "c41a00c0-7897-48d2-a67a-05190d6ce5e6-98187548"; // devVRE
|
||||||
|
|
||||||
private static String PROFILE_ID = "profiledConcessioni";
|
private static String PROFILE_ID = "profiledConcessioni";
|
||||||
private static String PROJECT_ID = "634fc41ecd343e6571ed3db0";
|
private static String PROJECT_ID = "6356ad1dde985906377eef3f";
|
||||||
|
|
||||||
private static String USERNAME = "francesco.mangiacrapa";
|
private static String USERNAME = "francesco.mangiacrapa";
|
||||||
|
|
||||||
|
@ -110,7 +116,42 @@ public class GeoportalViewer_Tests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
@Test
|
||||||
|
public void getSpatialReference() {
|
||||||
|
System.out.println("getSpatialReference [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called");
|
||||||
|
try {
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
Project project = clientProjects.getProjectByID(PROFILE_ID, PROJECT_ID);
|
||||||
|
|
||||||
|
List<IdentificationReference> itentificationReference = project.getIdentificationReferences();
|
||||||
|
|
||||||
|
for (IdentificationReference identificationReference : itentificationReference) {
|
||||||
|
String geoJSON = identificationReference.get("geoJSON").toString();
|
||||||
|
JSONObject jsonObject = new JSONObject(geoJSON);
|
||||||
|
|
||||||
|
GeoJSON geoJson = new GeoJSON();
|
||||||
|
geoJson.setType(jsonObject.getString("type"));
|
||||||
|
geoJson.setBbox(GisUtil.fromJSONArray(jsonObject.getJSONArray("bbox")));
|
||||||
|
Crs crs = org.gcube.application.geoportal.client.utils.Serialization
|
||||||
|
.convert(jsonObject.getJSONObject("crs").toString(), Crs.class);
|
||||||
|
geoJson.setCrs(crs);
|
||||||
|
geoJson.setGeoJSON(geoJSON);
|
||||||
|
|
||||||
|
System.out.println(geoJson);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
String erroMsg = "getSpatialReference not available for profileID " + PROFILE_ID + " with projectID "
|
||||||
|
+ PROJECT_ID;
|
||||||
|
System.out.println(erroMsg);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
public void getImagesForId() {
|
public void getImagesForId() {
|
||||||
System.out.println("getImagesForId [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called");
|
System.out.println("getImagesForId [profileID: " + PROFILE_ID + ", projectID: " + PROJECT_ID + "] called");
|
||||||
|
|
||||||
|
@ -137,8 +178,8 @@ public class GeoportalViewer_Tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
// @Test
|
||||||
public void testUCDQuery() {
|
public void testUCDQuery() {
|
||||||
QueryRequest request = new QueryRequest();
|
QueryRequest request = new QueryRequest();
|
||||||
request.setFilter(
|
request.setFilter(
|
||||||
|
|
Loading…
Reference in New Issue