merged in part with the branch cms-projects-support
This commit is contained in:
parent
8e51d51460
commit
1a7ecf78fc
1
pom.xml
1
pom.xml
|
@ -234,6 +234,7 @@
|
||||||
<version>4.11</version>
|
<version>4.11</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||||
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.view.ProjectView;
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
|
@ -38,14 +37,19 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCent
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
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.gis.OpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack;
|
||||||
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.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
|
@ -111,9 +115,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
private static List<BaseMapLayer> listBaseMapLayers = null;
|
private static List<BaseMapLayer> listBaseMapLayers = null;
|
||||||
|
|
||||||
private List<ItemFieldDV> displayFields = new ArrayList<ItemFieldDV>();
|
private static ViewerStatus viewerStatus = new ViewerStatus();
|
||||||
private List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
|
|
||||||
private List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the entry point method.
|
* This is the entry point method.
|
||||||
|
@ -134,7 +136,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(loaderApp);
|
RootPanel.get(APP_DIV).add(loaderApp);
|
||||||
|
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().listOfFieldsForSearching(new AsyncCallback<Map<String, List<ItemFieldDV>>>() {
|
GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||||
|
.listOfFieldsForSearching(new AsyncCallback<Map<String, List<ItemFieldDV>>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -144,37 +147,15 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Map<String, List<ItemFieldDV>> mapOfSearchingFilterForUCD) {
|
public void onSuccess(Map<String, List<ItemFieldDV>> mapOfSearchingFilterForUCD) {
|
||||||
GWT.log("listOfFieldsForSearching: "+mapOfSearchingFilterForUCD);
|
GWT.log("listOfFieldsForSearching: " + mapOfSearchingFilterForUCD);
|
||||||
|
|
||||||
// for (ItemFieldDV itemField : result) {
|
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),
|
||||||
// if(itemField.isDisplayAsResult()) {
|
mapOfSearchingFilterForUCD);
|
||||||
// displayFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(itemField.isSearchable()) {
|
|
||||||
// searchByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if(itemField.isSortable()) {
|
|
||||||
// sortByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// GWT.log("List display fields: "+result);
|
|
||||||
// SearchingFilter initialSortFilter = new SearchingFilter();
|
|
||||||
// initialSortFilter.setOrder(ORDER.ASC);
|
|
||||||
|
|
||||||
//TODO MUST BE REVISITED
|
|
||||||
//initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
|
||||||
|
|
||||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),mapOfSearchingFilterForUCD);
|
|
||||||
RootPanel.get(APP_DIV).add(mainPanel);
|
RootPanel.get(APP_DIV).add(mainPanel);
|
||||||
|
|
||||||
initApplication();
|
initApplication();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -182,33 +163,36 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
private void initApplication() {
|
private void initApplication() {
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
|
||||||
//LOADING THE BASE MAP LAYERS
|
GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListBaseLayers(new AsyncCallback<List<BaseMapLayer>>() {
|
.getInitialConfiguration(new ControlledCallBack<ViewerConfiguration>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
Window.alert(caught.getMessage());
|
||||||
Window.alert("Sorry, an error occurred on instancing the GeoPortale Viewer. Please, contact the support");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<BaseMapLayer> listBaseMapLayers) {
|
public void after() {
|
||||||
try {
|
|
||||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
RootPanel.get(APP_DIV).remove(loaderApp);
|
||||||
}catch (Exception e) {
|
|
||||||
loaderApp.setVisible(false);
|
|
||||||
}
|
}
|
||||||
GeoportalDataViewer.listBaseMapLayers = listBaseMapLayers;
|
|
||||||
//now the map is loaded and I'm sure that I can load the GeonaDataViewer Profile
|
|
||||||
loadGeonaDataViewerProfile();
|
|
||||||
mainPanel.setBaseLayers(listBaseMapLayers);
|
|
||||||
|
|
||||||
BaseMapLayer firstBaseLayer = listBaseMapLayers.get(0);
|
@Override
|
||||||
//Passing the first base map layer that will be applied as first base layer
|
public void onSuccess(ViewerConfiguration result) {
|
||||||
|
super.onSuccess(result);
|
||||||
|
|
||||||
|
GWT.log("Received init config : " + result);
|
||||||
|
GWT.log("Loading base layers, count : " + result.getBaseLayers().size());
|
||||||
|
|
||||||
|
GeoportalDataViewer.getStatus().setConfig(result);
|
||||||
|
|
||||||
|
listBaseMapLayers = result.getBaseLayers();
|
||||||
|
mainPanel.setBaseLayers(result.getBaseLayers());
|
||||||
|
|
||||||
|
BaseMapLayer firstBaseLayer = result.getBaseLayers().get(0);
|
||||||
|
// Passing the first base map layer that will be applied as first base layer
|
||||||
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),
|
||||||
layerManager.getLayerManagerBus(), firstBaseLayer);
|
layerManager.getLayerManagerBus(), firstBaseLayer);
|
||||||
OpenLayerMap olMap = olMapMng.getOLMap();
|
OpenLayerMap olMap = olMapMng.getOLMap();
|
||||||
|
@ -216,14 +200,33 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
mainPanel.setMap(olMap);
|
mainPanel.setMap(olMap);
|
||||||
|
|
||||||
updateSize();
|
updateSize();
|
||||||
ScriptInjector.fromUrl("//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
|
||||||
|
ScriptInjector.fromUrl(
|
||||||
|
"//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js")
|
||||||
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
.setWindow(ScriptInjector.TOP_WINDOW).inject();
|
||||||
|
|
||||||
|
GWT.log("Loading collections, count " + result.getAvailableCollections().size());
|
||||||
|
|
||||||
|
mainPanel.setAvailableCollections(result.getAvailableCollections().values());
|
||||||
|
|
||||||
|
if (paramGeonaItemID != null) {
|
||||||
|
if (paramGeonaItemType == null) {
|
||||||
|
Window.alert(
|
||||||
|
"Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
|
||||||
|
+ " (GeoNa Data Type) where to search the item id: "
|
||||||
|
+ paramGeonaItemID);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
|
||||||
|
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO LOAD INITIAL LAYERS
|
||||||
|
|
||||||
|
GWT.log("DONE INIT LOAD");
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -240,72 +243,76 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ViewerStatus getStatus() {
|
||||||
|
return viewerStatus;
|
||||||
|
}
|
||||||
|
|
||||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||||
return listBaseMapLayers;
|
return listBaseMapLayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadGeonaDataViewerProfile() {
|
// private void loadGeonaDataViewerProfile() {
|
||||||
|
//
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void execute() {
|
// public void execute() {
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance()
|
// GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||||
.getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
// .getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onFailure(Throwable caught) {
|
// public void onFailure(Throwable caught) {
|
||||||
Window.alert(caught.getMessage());
|
// Window.alert(caught.getMessage());
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public void onSuccess(GNADataViewerConfigProfile profile) {
|
// public void onSuccess(GNADataViewerConfigProfile profile) {
|
||||||
geonaDataViewerProfile = profile;
|
// geonaDataViewerProfile = profile;
|
||||||
GWT.log("Profile: " + geonaDataViewerProfile);
|
// GWT.log("Profile: " + geonaDataViewerProfile);
|
||||||
Iterator<String> it;
|
// Iterator<String> it;
|
||||||
|
//
|
||||||
|
// String theItemType = null;
|
||||||
|
// if (theItemType == null) {
|
||||||
String theItemType = null;
|
// it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
||||||
if (theItemType == null) {
|
// it.hasNext();
|
||||||
it = geonaDataViewerProfile.getMapLayers().keySet().iterator();
|
// theItemType = it.next();
|
||||||
it.hasNext();
|
// }
|
||||||
theItemType = it.next();
|
//
|
||||||
}
|
// GWT.log("getGeoNaDataViewProfile theItemType is: " + theItemType);
|
||||||
|
//
|
||||||
LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
// LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType);
|
||||||
|
//
|
||||||
// if (layerItem == null) {
|
//// if (layerItem == null) {
|
||||||
// Window.alert("Not detected any layer with type: " + theItemType);
|
//// Window.alert("Not detected any layer with type: " + theItemType);
|
||||||
|
//// return;
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// GWT.log("ON module load The layerItem is: " + layerItem);
|
||||||
|
// String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink());
|
||||||
|
// layerItem.setName(layerName);
|
||||||
|
// layerManager.setBaseLayerFromIsProfile(layerItem);
|
||||||
|
// layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
||||||
|
// null, false, null, null, null);
|
||||||
|
//
|
||||||
|
// if (paramGeonaItemID != null) {
|
||||||
|
// if (paramGeonaItemType == null) {
|
||||||
|
// Window.alert(
|
||||||
|
// "Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
|
||||||
|
// + " (GeoNa Data Type) where to search the item id: "
|
||||||
|
// + paramGeonaItemID);
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
// GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
|
||||||
GWT.log("ON module load The layerItem is: " + layerItem);
|
// applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||||
String layerName = URLUtil.getValueOfParameter("layers", layerItem.getWmsLink());
|
// }
|
||||||
layerItem.setName(layerName);
|
//
|
||||||
layerManager.setBaseLayerFromIsProfile(layerItem);
|
// }
|
||||||
layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false,
|
// });
|
||||||
null, false, null, null, null);
|
// }
|
||||||
|
// });
|
||||||
if (paramGeonaItemID != null) {
|
//
|
||||||
if (paramGeonaItemType == null) {
|
// }
|
||||||
Window.alert(
|
|
||||||
"Missing parameter " + GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE
|
|
||||||
+ " (GeoNa Data Type) where to search the item id: "
|
|
||||||
+ paramGeonaItemID);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
GeoNaItemRef gir = new GeoNaItemRef(paramGeonaItemID, paramGeonaItemType);
|
|
||||||
applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update window size.
|
* Update window size.
|
||||||
|
@ -331,14 +338,75 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
*/
|
*/
|
||||||
private void bindEvents() {
|
private void bindEvents() {
|
||||||
|
|
||||||
|
applicationBus.addHandler(OpenCollectionEvent.TYPE, new OpenCollectionEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onOpenCollection(OpenCollectionEvent openCollectionEvent) {
|
||||||
|
GWT.log("Fired event: " + openCollectionEvent);
|
||||||
|
// Check if ID is available
|
||||||
|
String collId = openCollectionEvent.getCollectionId();
|
||||||
|
ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
||||||
|
|
||||||
|
Set<String> ucdIds = theConfig.getAvailableCollections().keySet();
|
||||||
|
|
||||||
|
if (!ucdIds.contains(collId)) {
|
||||||
|
GWT.log("!! Collection " + collId + " is not available");
|
||||||
|
Window.alert("Collection " + collId + " is not found.");
|
||||||
|
} else {
|
||||||
|
GCubeCollection toOpen = theConfig.getAvailableCollections().get(collId);
|
||||||
|
|
||||||
|
// Check if indexes is empty
|
||||||
|
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
|
||||||
|
GWT.log("Unexpected empty indexes in collection " + toOpen);
|
||||||
|
Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
|
||||||
|
}
|
||||||
|
// TODO Get Default Index Layer
|
||||||
|
// For now we just take the first - only 1 is expected
|
||||||
|
IndexLayer layer = toOpen.getIndexes().get(0);
|
||||||
|
// Open Index Layer
|
||||||
|
|
||||||
|
layerManager.addIndexLayer(layer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// applicationBus.addHandler(OpenCollectionEvent.TYPE, openCollectionEvent -> {
|
||||||
|
// GWT.log("Fired event: " + openCollectionEvent);
|
||||||
|
// // Check if ID is available
|
||||||
|
// String collId = openCollectionEvent.getCollectionId();
|
||||||
|
// ViewerConfiguration theConfig = GeoportalDataViewer.getStatus().getViewerConfig();
|
||||||
|
//
|
||||||
|
// Set<String> ucdIds = theConfig.getAvailableCollections().keySet();
|
||||||
|
//
|
||||||
|
// if (!ucdIds.contains(collId)) {
|
||||||
|
// GWT.log("!! Collection " + collId + " is not available");
|
||||||
|
// Window.alert("Collection " + collId + " is not found.");
|
||||||
|
// } else {
|
||||||
|
// GCubeCollection toOpen = theConfig.getAvailableCollections().get(collId);
|
||||||
|
//
|
||||||
|
// // Check if indexes is empty
|
||||||
|
// if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
|
||||||
|
// GWT.log("Unexpected empty indexes in collection " + toOpen);
|
||||||
|
// Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
|
||||||
|
// }
|
||||||
|
// // TODO Get Default Index Layer
|
||||||
|
// // For now we just take the first - only 1 is expected
|
||||||
|
// IndexLayer layer = toOpen.getIndexes().get(0);
|
||||||
|
// // Open Index Layer
|
||||||
|
//
|
||||||
|
// layerManager.addIndexLayer(layer);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
applicationBus.addHandler(ShowDetailsEvent.TYPE, new ShowDetailsEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
public void onShowDetails(ShowDetailsEvent showDetailsEvent) {
|
||||||
GWT.log("Fired event: " + showDetailsEvent);
|
GWT.log("Fired event: " + showDetailsEvent);
|
||||||
|
|
||||||
String projectID = showDetailsEvent.getGeonaMongoID();
|
String projectID = showDetailsEvent.getProjectID();
|
||||||
String profileID = showDetailsEvent.getGeonaItemType();
|
String profileID = showDetailsEvent.getProfileID();
|
||||||
|
|
||||||
if (projectID == null) {
|
if (projectID == null) {
|
||||||
Window.alert("Item Id not found");
|
Window.alert("Item Id not found");
|
||||||
|
@ -349,8 +417,8 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
GWT.log("Product with id: " + projectID + " found? " + found);
|
GWT.log("Product with id: " + projectID + " found? " + found);
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getProjectViewForId(profileID, projectID,
|
||||||
GeoportalDataViewerServiceAsync.Util.getInstance().getProjectViewForId(profileID, projectID, new AsyncCallback<ProjectView>() {
|
new AsyncCallback<ProjectView>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -394,43 +462,35 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
public void onLayerRendered(AddedLayerToMapEvent addedLayerToMapEvent) {
|
||||||
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "+addedLayerToMapEvent.getLayerType());
|
GWT.log("Fired AddedLayerToMapEvent " + addedLayerToMapEvent.getLayerItem() + "layer type: "
|
||||||
|
+ addedLayerToMapEvent.getLayerType());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
GWT.log("onLayerRendered Timer PART MUST BE REVISITED");
|
GWT.log("onLayerRendered Timer PART MUST BE REVISITED");
|
||||||
/*
|
/*
|
||||||
attempt = 0;
|
* attempt = 0;
|
||||||
|
*
|
||||||
if (paramGeonaItemID != null) {
|
* if (paramGeonaItemID != null) { // waiting for record retrieved by service
|
||||||
// waiting for record retrieved by service before calling the WFS
|
* before calling the WFS final int MAX_RETRY = 15; Timer timer = new
|
||||||
final int MAX_RETRY = 15;
|
* com.google.gwt.user.client.Timer() {
|
||||||
Timer timer = new com.google.gwt.user.client.Timer() {
|
*
|
||||||
@Override
|
* @Override public void run() { attempt++; GWT.log("waiting get record: " +
|
||||||
public void run() {
|
* attempt);
|
||||||
attempt++;
|
*
|
||||||
GWT.log("waiting get record: " + attempt);
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* RecordDV record = mainPanel.getDisplayedRecord(); if (record != null) {
|
||||||
|
* this.cancel(); GWT.log("cancelled timer"); performWFSQueryOnCentroid(record);
|
||||||
RecordDV record = mainPanel.getDisplayedRecord();
|
* }
|
||||||
if (record != null) {
|
*
|
||||||
this.cancel();
|
* if (attempt > MAX_RETRY) { GWT.log("MAX_RETRY reached, cancelled timer");
|
||||||
GWT.log("cancelled timer");
|
* this.cancel(); }
|
||||||
performWFSQueryOnCentroid(record);
|
*
|
||||||
}
|
* } }; timer.scheduleRepeating(1000);
|
||||||
|
*
|
||||||
if (attempt > MAX_RETRY) {
|
* }
|
||||||
GWT.log("MAX_RETRY reached, cancelled timer");
|
|
||||||
this.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
timer.scheduleRepeating(1000);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
|
@ -497,26 +557,26 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doLayerActionEvent) {
|
public void onDoActionOnDetailLayers(DoActionOnDetailLayersEvent doLayerActionEvent) {
|
||||||
|
|
||||||
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
DO_LAYER_ACTION doAction = doLayerActionEvent.getDoAction();
|
||||||
GWT.log("event: "+doAction);
|
GWT.log("event: " + doAction);
|
||||||
GWT.log("layer source: "+doLayerActionEvent.getLayerItem().getName());
|
GWT.log("layer source: " + doLayerActionEvent.getLayerItem().getName());
|
||||||
OpenLayerMap olMap = olMapMng.getOLMap();
|
OpenLayerMap olMap = olMapMng.getOLMap();
|
||||||
|
|
||||||
switch (doAction) {
|
switch (doAction) {
|
||||||
case OPACITY:
|
case OPACITY:
|
||||||
GWT.log("opacity: "+doLayerActionEvent.getOpacity());
|
GWT.log("opacity: " + doLayerActionEvent.getOpacity());
|
||||||
olMap.setWMSDetailLayerOpacity(doLayerActionEvent.getLayerItem(),
|
olMap.setWMSDetailLayerOpacity(doLayerActionEvent.getLayerItem(), doLayerActionEvent.getOpacity());
|
||||||
doLayerActionEvent.getOpacity());
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SWAP:
|
case SWAP:
|
||||||
SwapLayer swLS = doLayerActionEvent.getSourceLayerSwap();
|
SwapLayer swLS = doLayerActionEvent.getSourceLayerSwap();
|
||||||
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
|
SwapLayer swLT = doLayerActionEvent.getTargetLayerSwap();
|
||||||
GWT.log("SWAPPING source "+swLS.getLayerItem().getName() +", target: "+swLT.getLayerItem().getName());
|
GWT.log("SWAPPING source " + swLS.getLayerItem().getName() + ", target: "
|
||||||
|
+ swLT.getLayerItem().getName());
|
||||||
olMap.swapDetailsLayers(swLS, swLT);
|
olMap.swapDetailsLayers(swLS, swLT);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VISIBILITY:
|
case VISIBILITY:
|
||||||
GWT.log("visibility: "+doLayerActionEvent.getVisibility());
|
GWT.log("visibility: " + doLayerActionEvent.getVisibility());
|
||||||
olMap.setWMSDetailLayerVisible(doLayerActionEvent.getLayerItem(),
|
olMap.setWMSDetailLayerVisible(doLayerActionEvent.getLayerItem(),
|
||||||
doLayerActionEvent.getVisibility());
|
doLayerActionEvent.getVisibility());
|
||||||
|
|
||||||
|
@ -529,7 +589,6 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
applicationBus.addHandler(ChangeMapLayerEvent.TYPE, new ChangeMapLayerEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -558,7 +617,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
||||||
|
|
||||||
if(showPopupOnCentroiEvent.getRecord()!=null)
|
if (showPopupOnCentroiEvent.getRecord() != null)
|
||||||
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
|
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -569,31 +628,30 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
@Override
|
@Override
|
||||||
public void onSearchDone(SearchPerformedEvent searchPerformedEvent) {
|
public void onSearchDone(SearchPerformedEvent searchPerformedEvent) {
|
||||||
|
|
||||||
if(searchPerformedEvent!=null) {
|
if (searchPerformedEvent != null) {
|
||||||
|
|
||||||
LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
|
LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
|
||||||
String firstWMSKey = wmsMap.keySet().iterator().next();
|
String firstWMSKey = wmsMap.keySet().iterator().next();
|
||||||
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 = "product_id IN(";
|
String cqlFilter = "product_id IN(";
|
||||||
for (DocumentDV documentDV : result) {
|
for (DocumentDV documentDV : result) {
|
||||||
cqlFilter+="'"+documentDV.getProjectID()+"',";
|
cqlFilter += "'" + documentDV.getProjectID() + "',";
|
||||||
}
|
}
|
||||||
cqlFilter = cqlFilter.substring(0,cqlFilter.length()-1)+")";
|
cqlFilter = cqlFilter.substring(0, cqlFilter.length() - 1) + ")";
|
||||||
|
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
|
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
|
||||||
}else {
|
} else {
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(searchPerformedEvent.isSearchReset()) {
|
if (searchPerformedEvent.isSearchReset()) {
|
||||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -177,4 +178,37 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
ResultSetPaginatedData getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
|
ResultSetPaginatedData getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
|
||||||
boolean reloadFromService) throws Exception;
|
boolean reloadFromService) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* NEW CODE HERE
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
ViewerConfiguration getInitialConfiguration() throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -75,4 +76,6 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
|
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
|
||||||
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
|
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
|
||||||
|
|
||||||
|
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,10 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
||||||
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.GeoportalDataViewerConstants.MapEventType;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEventHandler;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||||
|
@ -32,22 +29,20 @@ import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.GeoQuery;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObjectType;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
import com.github.gwtbootstrap.client.ui.Heading;
|
|
||||||
import com.github.gwtbootstrap.client.ui.Label;
|
|
||||||
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
|
||||||
import com.google.gwt.event.dom.client.ClickEvent;
|
import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.shared.HandlerManager;
|
import com.google.gwt.event.shared.HandlerManager;
|
||||||
|
@ -57,7 +52,6 @@ import com.google.gwt.user.client.DOM;
|
||||||
import com.google.gwt.user.client.Element;
|
import com.google.gwt.user.client.Element;
|
||||||
import com.google.gwt.user.client.Event;
|
import com.google.gwt.user.client.Event;
|
||||||
import com.google.gwt.user.client.EventListener;
|
import com.google.gwt.user.client.EventListener;
|
||||||
import com.google.gwt.user.client.Random;
|
|
||||||
import com.google.gwt.user.client.Window;
|
import com.google.gwt.user.client.Window;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.FlexTable;
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
|
@ -196,9 +190,13 @@ public class LayerManager {
|
||||||
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
|
public void onSuccess(List<GeoNaSpatialQueryResult> listGeonaDataObjects) {
|
||||||
|
|
||||||
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
|
GWT.log("GeoNaDataObject's is/are " + listGeonaDataObjects.size());
|
||||||
|
|
||||||
// GWT.log("GeoNaDataObject's: " + listGeonaDataObjects);
|
// GWT.log("GeoNaDataObject's: " + listGeonaDataObjects);
|
||||||
// GeoportalDataViewerConstants.print("GeoNaDataObject's:
|
// GeoportalDataViewerConstants.print("GeoNaDataObject's:
|
||||||
// "+listGeonaDataObjects);
|
// "+listGeonaDataObjects);
|
||||||
|
GWT.log("GeoNaDataObject's must be revisited");
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
if (listGeonaDataObjects == null || listGeonaDataObjects.isEmpty())
|
if (listGeonaDataObjects == null || listGeonaDataObjects.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -350,6 +348,9 @@ public class LayerManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -388,11 +389,11 @@ public class LayerManager {
|
||||||
/**
|
/**
|
||||||
* Parses the geona references.
|
* Parses the geona references.
|
||||||
*
|
*
|
||||||
* @param itemType the item type
|
* @param layerObject the layer object
|
||||||
* @param fRow the f row
|
* @param fRow the f row
|
||||||
* @return the show details event
|
* @return the show details event
|
||||||
*/
|
*/
|
||||||
private ShowDetailsEvent parseGeonaReferences(String itemType, FeatureRow fRow) {
|
private ShowDetailsEvent parseGeonaReferences(LayerObject layerObject, FeatureRow fRow) {
|
||||||
if (fRow == null)
|
if (fRow == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -405,16 +406,50 @@ public class LayerManager {
|
||||||
itemName = listName.get(0);
|
itemName = listName.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ShowDetailsEvent(itemType, productId, itemName, fRow);
|
LayerObjectType layerObjectType = layerObject.getType();
|
||||||
|
return new ShowDetailsEvent(layerObjectType != null ? layerObjectType.name() : null, layerObject.getUcid(),
|
||||||
|
productId, itemName, fRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ******************************** LAYERS Management
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the layer.
|
* Adds the layer.
|
||||||
*
|
*
|
||||||
* @param geonaItemType the geona item type
|
* @param object the object
|
||||||
|
*/
|
||||||
|
public void addLayer(LayerObject object) {
|
||||||
|
GWT.log("Layers management : Add layer " + object);
|
||||||
|
|
||||||
|
switch (object.getType()) {
|
||||||
|
case BASE_LAYER: {
|
||||||
|
GWT.log("ERROR : cannot add base layers ");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GENERIC_LAYER: {
|
||||||
|
GWT.log("SUPPORT TO EXTERNAL LAYERS TO BE IMPLEMENTED");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PROJECT_LAYER: {
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case INDEX_LAYER: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the layer.
|
||||||
|
*
|
||||||
|
* @param lot the lot
|
||||||
* @param layerTitle the layer title
|
* @param layerTitle the layer title
|
||||||
* @param layerName the layer name
|
* @param layerName the layer name
|
||||||
* @param wmsLink the wms link
|
* @param wmsLink the wms link
|
||||||
|
@ -424,12 +459,13 @@ public class LayerManager {
|
||||||
* @param asDetailLayer the as detail layer
|
* @param asDetailLayer the as detail layer
|
||||||
* @param minResolution the min resolution
|
* @param minResolution the min resolution
|
||||||
* @param maxResolution the max resolution
|
* @param maxResolution the max resolution
|
||||||
* @param refersToBaseConcessione the refers to base concessione
|
* @param profileID the profile ID
|
||||||
|
* @param projectID the project ID
|
||||||
*/
|
*/
|
||||||
public void addLayer(final String geonaItemType, final String layerTitle, final String layerName,
|
public void addLayer(final LayerObjectType lot, final String layerTitle, final String layerName,
|
||||||
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
final String wmsLink, final boolean isBase, final boolean displayInLayerSwitcher, final String UUID,
|
||||||
final boolean asDetailLayer, Double minResolution, Double maxResolution,
|
final boolean asDetailLayer, Double minResolution, Double maxResolution,
|
||||||
BaseConcessioneDV refersToBaseConcessione) {
|
String profileID, String projectID) {
|
||||||
|
|
||||||
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
|
// final LayoutContainer westPanel = (LayoutContainer) layersPanel.getParent();
|
||||||
//
|
//
|
||||||
|
@ -473,14 +509,13 @@ public class LayerManager {
|
||||||
|
|
||||||
LayerObject lo = new LayerObject();
|
LayerObject lo = new LayerObject();
|
||||||
lo.setLayerItem(layerItem);
|
lo.setLayerItem(layerItem);
|
||||||
lo.setItemType(geonaItemType);
|
lo.setType(lot);
|
||||||
lo.setSourceConcessione(refersToBaseConcessione);
|
lo.setProjectId(projectID);
|
||||||
|
|
||||||
String key = layerItem.getName(); // should be unique
|
String key = layerItem.getName(); // should be unique //
|
||||||
// layerObjects.put(key, lo);
|
//layerObjects.put(key, lo);
|
||||||
|
|
||||||
if (!asDetailLayer) {
|
if (!asDetailLayer) { // is a base layer LayerObject blo =
|
||||||
// is a base layer
|
|
||||||
LayerObject blo = mapBaseLayerObjects.get(key);
|
LayerObject blo = mapBaseLayerObjects.get(key);
|
||||||
if (blo == null) {
|
if (blo == null) {
|
||||||
olMap.addWMSLayer(layerItem);
|
olMap.addWMSLayer(layerItem);
|
||||||
|
@ -493,16 +528,30 @@ public class LayerManager {
|
||||||
if (dlo == null) {
|
if (dlo == null) {
|
||||||
mapDetailLayerObjects.put(key, lo);
|
mapDetailLayerObjects.put(key, lo);
|
||||||
olMap.addWMSDetailLayer(layerItem);
|
olMap.addWMSDetailLayer(layerItem);
|
||||||
overlayLayerManager.addLayerItem(lo);
|
overlayLayerManager.addLayerItem(lo); // overlayLayerManager.show(); } else {
|
||||||
// overlayLayerManager.show();
|
|
||||||
} else {
|
|
||||||
GWT.log("Skipping detail layer " + key + " already added to Map");
|
GWT.log("Skipping detail layer " + key + " already added to Map");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the index layer.
|
||||||
|
*
|
||||||
|
* @param layer the layer
|
||||||
|
*/
|
||||||
|
public void addIndexLayer(IndexLayer layer) {
|
||||||
|
|
||||||
|
addLayer(LayerObjectType.INDEX_LAYER, null, null, layer.getLayer().getOgcLinks().get("wms"), false, false, null, false,
|
||||||
|
null, null, null, null);
|
||||||
|
|
||||||
|
// toLayerItem(null, null, null, null, null, false, false, false, null, null,
|
||||||
|
// false, null, false, null, null, null, null)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To layer item.
|
* To layer item.
|
||||||
*
|
*
|
||||||
|
@ -663,106 +712,82 @@ public class LayerManager {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String nomeConcessione = lo.getSourceConcessione().getNome();
|
GWT.log("showPopupInfoForLayer must be REVISITED");
|
||||||
if (prevConcessioneName.compareTo(nomeConcessione) != 0) {
|
/*
|
||||||
String concessioneIntro = nomeConcessione.length() > 100
|
* String nomeConcessione = lo.getSourceConcessione().getNome(); if
|
||||||
? StringUtil.ellipsize(nomeConcessione, 100)
|
* (prevConcessioneName.compareTo(nomeConcessione) != 0) { String
|
||||||
: nomeConcessione;
|
* concessioneIntro = nomeConcessione.length() > 100 ?
|
||||||
Heading heading = new Heading(4, concessioneIntro);
|
* StringUtil.ellipsize(nomeConcessione, 100) : nomeConcessione; Heading heading
|
||||||
heading.setTitle(nomeConcessione);
|
* = new Heading(4, concessioneIntro); heading.setTitle(nomeConcessione);
|
||||||
heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
* heading.getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
flowPanel.add(heading);
|
* flowPanel.add(heading);
|
||||||
|
*
|
||||||
|
* Button buttOpenProject = new Button("Open Project"); final String buttId =
|
||||||
|
* "open-details-" + Random.nextInt(); Element bEl =
|
||||||
|
* buttOpenProject.getElement(); bEl.setId(buttId);
|
||||||
|
* bEl.getStyle().setPaddingLeft(0, Unit.PX);
|
||||||
|
* buttOpenProject.setType(ButtonType.LINK);
|
||||||
|
*
|
||||||
|
* if (buttOpenProject != null) { flowPanel.add(buttOpenProject);
|
||||||
|
* buttOpenProject.setType(ButtonType.LINK);
|
||||||
|
* Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
*
|
||||||
|
* @Override public void execute() { Element buttonElement =
|
||||||
|
* DOM.getElementById(buttId); Event.sinkEvents(buttonElement, Event.ONCLICK);
|
||||||
|
* Event.setEventListener(buttonElement, new EventListener() {
|
||||||
|
*
|
||||||
|
* @Override public void onBrowserEvent(Event event) { if (Event.ONCLICK ==
|
||||||
|
* event.getTypeInt()) { applicationBus.fireEvent(new
|
||||||
|
* ShowDetailsEvent("concessione", lo.getSourceConcessione().getItemId(),
|
||||||
|
* nomeConcessione, null));
|
||||||
|
*
|
||||||
|
* } } }); } }); } listOpenProject.add(buttOpenProject);
|
||||||
|
*
|
||||||
|
* HTML subText = new HTML(
|
||||||
|
* "<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>"
|
||||||
|
* ); flowPanel.add(subText); }
|
||||||
|
*
|
||||||
|
* prevConcessioneName = nomeConcessione;
|
||||||
|
*
|
||||||
|
* Label layerLabel = new Label(); layerLabel.setType(LabelType.INFO);
|
||||||
|
*
|
||||||
|
* String layerName = StringUtil.fullNameToLayerName(layerSourceName, ":");
|
||||||
|
* layerLabel.setText(layerName); layerLabel.setTitle(layerSourceName);
|
||||||
|
* layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
||||||
|
* layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
||||||
|
* flowPanel.add(layerLabel);
|
||||||
|
*
|
||||||
|
* GWT.log("Displaying " + features.size() + " features"); FlexTable intFlex =
|
||||||
|
* new FlexTable(); intFlex.setCellPadding(1); intFlex.setCellSpacing(1);
|
||||||
|
* intFlex.getElement().addClassName("table-feature"); intFlex.setHTML(0, 0, new
|
||||||
|
* HTML("Feature Id").toString());
|
||||||
|
*
|
||||||
|
* int i = 0; for (FeatureRow feature : features) {
|
||||||
|
*
|
||||||
|
* intFlex.setHTML(i + 1, 0, new HTML(feature.getId()).toString());
|
||||||
|
*
|
||||||
|
* // Showing properties belonging to concessioni layer Map<String,
|
||||||
|
* List<String>> entries = feature.getMapProperties();
|
||||||
|
*
|
||||||
|
* if (entries.size() == 0) { // Adding this row to show "no property" for
|
||||||
|
* feature // intFlex.setHTML(i + 1, 1, new
|
||||||
|
* HTML("<i>No property</i>").toString()); } int j = 0; for (String key :
|
||||||
|
* entries.keySet()) { List<String> theValues = entries.get(key); String
|
||||||
|
* valueToDisplay = ""; for (String value : theValues) { valueToDisplay += value
|
||||||
|
* + ", ";
|
||||||
|
*
|
||||||
|
* } valueToDisplay = valueToDisplay.substring(0, valueToDisplay.length() - 2);
|
||||||
|
*
|
||||||
|
* // adding the keys only of first feature row. They are equal for all features
|
||||||
|
* // (beloning to same layer). if (i == 0) intFlex.setHTML(0, j + 1, new
|
||||||
|
* HTML(key).toString());
|
||||||
|
*
|
||||||
|
* intFlex.setHTML(i + 1, j + 1, new HTML(valueToDisplay).toString()); j++;
|
||||||
|
*
|
||||||
|
* } i++; } flowPanel.add(intFlex);
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
Button buttOpenProject = new Button("Open Project");
|
|
||||||
final String buttId = "open-details-" + Random.nextInt();
|
|
||||||
Element bEl = buttOpenProject.getElement();
|
|
||||||
bEl.setId(buttId);
|
|
||||||
bEl.getStyle().setPaddingLeft(0, Unit.PX);
|
|
||||||
buttOpenProject.setType(ButtonType.LINK);
|
|
||||||
|
|
||||||
if (buttOpenProject != null) {
|
|
||||||
flowPanel.add(buttOpenProject);
|
|
||||||
buttOpenProject.setType(ButtonType.LINK);
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute() {
|
|
||||||
Element buttonElement = DOM.getElementById(buttId);
|
|
||||||
Event.sinkEvents(buttonElement, Event.ONCLICK);
|
|
||||||
Event.setEventListener(buttonElement, new EventListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBrowserEvent(Event event) {
|
|
||||||
if (Event.ONCLICK == event.getTypeInt()) {
|
|
||||||
applicationBus.fireEvent(new ShowDetailsEvent("concessione",
|
|
||||||
lo.getSourceConcessione().getItemId(), nomeConcessione, null));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
listOpenProject.add(buttOpenProject);
|
|
||||||
|
|
||||||
HTML subText = new HTML(
|
|
||||||
"<p style=\"color:#999; font-size:14px; margin:5px 0 5px 0;\">Layers and Properties</p>");
|
|
||||||
flowPanel.add(subText);
|
|
||||||
}
|
|
||||||
|
|
||||||
prevConcessioneName = nomeConcessione;
|
|
||||||
|
|
||||||
Label layerLabel = new Label();
|
|
||||||
layerLabel.setType(LabelType.INFO);
|
|
||||||
|
|
||||||
String layerName = StringUtil.fullNameToLayerName(layerSourceName, ":");
|
|
||||||
layerLabel.setText(layerName);
|
|
||||||
layerLabel.setTitle(layerSourceName);
|
|
||||||
layerLabel.getElement().getStyle().setMarginTop(10, Unit.PX);
|
|
||||||
layerLabel.getElement().getStyle().setMarginBottom(5, Unit.PX);
|
|
||||||
flowPanel.add(layerLabel);
|
|
||||||
|
|
||||||
GWT.log("Displaying " + features.size() + " features");
|
|
||||||
FlexTable intFlex = new FlexTable();
|
|
||||||
intFlex.setCellPadding(1);
|
|
||||||
intFlex.setCellSpacing(1);
|
|
||||||
intFlex.getElement().addClassName("table-feature");
|
|
||||||
intFlex.setHTML(0, 0, new HTML("Feature Id").toString());
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for (FeatureRow feature : features) {
|
|
||||||
|
|
||||||
intFlex.setHTML(i + 1, 0, new HTML(feature.getId()).toString());
|
|
||||||
|
|
||||||
// Showing properties belonging to concessioni layer
|
|
||||||
Map<String, List<String>> entries = feature.getMapProperties();
|
|
||||||
|
|
||||||
if (entries.size() == 0) {
|
|
||||||
// Adding this row to show "no property" for feature
|
|
||||||
// intFlex.setHTML(i + 1, 1, new HTML("<i>No property</i>").toString());
|
|
||||||
}
|
|
||||||
int j = 0;
|
|
||||||
for (String key : entries.keySet()) {
|
|
||||||
List<String> theValues = entries.get(key);
|
|
||||||
String valueToDisplay = "";
|
|
||||||
for (String value : theValues) {
|
|
||||||
valueToDisplay += value + ", ";
|
|
||||||
|
|
||||||
}
|
|
||||||
valueToDisplay = valueToDisplay.substring(0, valueToDisplay.length() - 2);
|
|
||||||
|
|
||||||
// adding the keys only of first feature row. They are equal for all features
|
|
||||||
// (beloning to same layer).
|
|
||||||
if (i == 0)
|
|
||||||
intFlex.setHTML(0, j + 1, new HTML(key).toString());
|
|
||||||
|
|
||||||
intFlex.setHTML(i + 1, j + 1, new HTML(valueToDisplay).toString());
|
|
||||||
j++;
|
|
||||||
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
flowPanel.add(intFlex);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
GeoportalDataViewerConstants.printJs("Error: " + e.getMessage());
|
GeoportalDataViewerConstants.printJs("Error: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -859,8 +884,7 @@ public class LayerManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
ShowDetailsEvent toEvent = parseGeonaReferences(
|
ShowDetailsEvent toEvent = parseGeonaReferences(geoNaDataObject.getSourceLayerObject(), theFeature);
|
||||||
geoNaDataObject.getSourceLayerObject().getItemType(), theFeature);
|
|
||||||
applicationBus.fireEvent(toEvent);
|
applicationBus.fireEvent(toEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -934,8 +958,8 @@ public class LayerManager {
|
||||||
@Override
|
@Override
|
||||||
public void onBrowserEvent(Event event) {
|
public void onBrowserEvent(Event event) {
|
||||||
if (Event.ONCLICK == event.getTypeInt()) {
|
if (Event.ONCLICK == event.getTypeInt()) {
|
||||||
ShowDetailsEvent toEvent = parseGeonaReferences(
|
ShowDetailsEvent toEvent = parseGeonaReferences(geoNaDataObject.getSourceLayerObject(),
|
||||||
geoNaDataObject.getSourceLayerObject().getItemType(), theFeature);
|
theFeature);
|
||||||
applicationBus.fireEvent(toEvent);
|
applicationBus.fireEvent(toEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
|
||||||
|
public class ViewerStatus {
|
||||||
|
|
||||||
|
private ViewerConfiguration viewerConfig;
|
||||||
|
|
||||||
|
public void setConfig(ViewerConfiguration result) {
|
||||||
|
this.viewerConfig = result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ViewerConfiguration getViewerConfig() {
|
||||||
|
return viewerConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,7 +5,6 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class ShowDetailsEvent.
|
* The Class ShowDetailsEvent.
|
||||||
*
|
*
|
||||||
|
@ -15,29 +14,30 @@ import com.google.gwt.event.shared.GwtEvent;
|
||||||
*/
|
*/
|
||||||
public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
|
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
|
||||||
private String geonaItemType;
|
private String layerObjectType;
|
||||||
private FeatureRow featureRow;
|
private FeatureRow featureRow;
|
||||||
private String geonaMongoID;
|
|
||||||
private String itemName;
|
private String itemName;
|
||||||
|
private String profileID;
|
||||||
|
private String projectID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new show details event.
|
* Instantiates a new show details event.
|
||||||
*
|
*
|
||||||
* @param geonaItemType the geona item type
|
* @param layerObjectType the geona item type
|
||||||
* @param geonaMongoID the geona mongo ID
|
* @param geonaMongoID the geona mongo ID
|
||||||
* @param itemName the item name
|
* @param itemName the item name
|
||||||
* @param featureRow the feature row
|
* @param featureRow the feature row
|
||||||
*/
|
*/
|
||||||
public ShowDetailsEvent(String geonaItemType, String geonaMongoID, String itemName, FeatureRow featureRow) {
|
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, String itemName,
|
||||||
this.geonaItemType = geonaItemType;
|
FeatureRow featureRow) {
|
||||||
this.geonaMongoID = geonaMongoID;
|
this.layerObjectType = layerObjectType;
|
||||||
|
this.profileID = profileID;
|
||||||
|
this.projectID = projectID;
|
||||||
this.itemName = itemName;
|
this.itemName = itemName;
|
||||||
this.featureRow = featureRow;
|
this.featureRow = featureRow;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new show details event.
|
* Instantiates a new show details event.
|
||||||
*
|
*
|
||||||
|
@ -46,12 +46,29 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
* @param featureRow the feature row
|
* @param featureRow the feature row
|
||||||
*/
|
*/
|
||||||
public ShowDetailsEvent(GeoNaItemRef gir, String itemName, FeatureRow featureRow) {
|
public ShowDetailsEvent(GeoNaItemRef gir, String itemName, FeatureRow featureRow) {
|
||||||
this.geonaItemType = gir.getItemType();
|
this.layerObjectType = gir.getLayerObjectType();
|
||||||
this.geonaMongoID = gir.getItemId();
|
this.profileID = gir.getProfileID();
|
||||||
|
this.projectID = gir.getProjectID();
|
||||||
this.itemName = itemName;
|
this.itemName = itemName;
|
||||||
this.featureRow = featureRow;
|
this.featureRow = featureRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Type<ShowDetailsEventHandler> getTYPE() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLayerObjectType() {
|
||||||
|
return layerObjectType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProfileID() {
|
||||||
|
return profileID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProjectID() {
|
||||||
|
return projectID;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the associated type.
|
* Gets the associated type.
|
||||||
*
|
*
|
||||||
|
@ -73,15 +90,6 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the geona item type.
|
|
||||||
*
|
|
||||||
* @return the geona item type
|
|
||||||
*/
|
|
||||||
public String getGeonaItemType() {
|
|
||||||
return geonaItemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the feature row.
|
* Gets the feature row.
|
||||||
*
|
*
|
||||||
|
@ -91,15 +99,6 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
return featureRow;
|
return featureRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the geona mongo ID.
|
|
||||||
*
|
|
||||||
* @return the geona mongo ID
|
|
||||||
*/
|
|
||||||
public String getGeonaMongoID() {
|
|
||||||
return geonaMongoID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the item name.
|
* Gets the item name.
|
||||||
*
|
*
|
||||||
|
@ -118,17 +117,13 @@ public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
|
||||||
this.itemName = itemName;
|
this.itemName = itemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the geona item ref.
|
* Gets the geona item ref.
|
||||||
*
|
*
|
||||||
* @return the geona item ref
|
* @return the geona item ref
|
||||||
*/
|
*/
|
||||||
public GeoNaItemRef getGeonaItemRef() {
|
public GeoNaItemRef getGeonaItemRef() {
|
||||||
return new GeoNaItemRef(geonaMongoID, geonaItemType);
|
return new GeoNaItemRef(projectID, profileID, layerObjectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler> {
|
||||||
|
|
||||||
|
|
||||||
|
private String collectionId = null;
|
||||||
|
|
||||||
|
public static Type<CloseCollectionEventHandler> TYPE = new Type<CloseCollectionEventHandler>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<CloseCollectionEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(CloseCollectionEventHandler h) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public CloseCollectionEvent(String collectionId) {
|
||||||
|
this.collectionId=collectionId;
|
||||||
|
}
|
||||||
|
public String getCollectionId() {
|
||||||
|
return collectionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
public interface CloseCollectionEventHandler extends EventHandler{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
public class OpenCollectionEvent extends GwtEvent<OpenCollectionEventHandler> {
|
||||||
|
|
||||||
|
private String collectionId = null;
|
||||||
|
|
||||||
|
public static Type<OpenCollectionEventHandler> TYPE = new Type<OpenCollectionEventHandler>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<OpenCollectionEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(OpenCollectionEventHandler handler) {
|
||||||
|
handler.onOpenCollection(this);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public OpenCollectionEvent(String collectionId) {
|
||||||
|
this.collectionId = collectionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCollectionId() {
|
||||||
|
return collectionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
public interface OpenCollectionEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
|
||||||
|
void onOpenCollection(OpenCollectionEvent event);
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -12,15 +13,19 @@ 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;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.ChangeMapLayerEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search.SearchFacilityUI;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search.SearchFacilityUI;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Button;
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||||
import com.github.gwtbootstrap.client.ui.NavList;
|
import com.github.gwtbootstrap.client.ui.NavList;
|
||||||
|
@ -96,6 +101,12 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
@UiField
|
@UiField
|
||||||
Button linkLayers;
|
Button linkLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton openCollectionDropDown;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
HTMLPanel openCollectionPanel;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
DropdownButton searchFacilityButton;
|
DropdownButton searchFacilityButton;
|
||||||
|
|
||||||
|
@ -126,77 +137,6 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Instantiates a new geona data view main panel.
|
|
||||||
// *
|
|
||||||
// * @param applicationBus the application bus
|
|
||||||
// * @param mapHeight the map height
|
|
||||||
// * @param sortByFields the sort by fields
|
|
||||||
// * @param searchForFields the search for fields
|
|
||||||
// * @param initialSortFilter the initial sort filter
|
|
||||||
// */
|
|
||||||
// public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight, List<ItemFieldDV> sortByFields,
|
|
||||||
// List<ItemFieldDV> searchForFields, SearchingFilter initialSortFilter) {
|
|
||||||
// initWidget(uiBinder.createAndBindUi(this));
|
|
||||||
// this.applicationBus = applicationBus;
|
|
||||||
// mapPanel = new MapPanel(mapHeight + "px");
|
|
||||||
// detailsPanel.setHeight(mapHeight + "px");
|
|
||||||
// detailsPanel.setApplicationBus(applicationBus);
|
|
||||||
// mainContainerPanel.add(mapPanel);
|
|
||||||
// bindHandlers();
|
|
||||||
// dataPointSelection.setIcon(IconType.SCREENSHOT);
|
|
||||||
// dataBoxSelection.setIcon(IconType.BOOKMARK);
|
|
||||||
// removeQuery.setIcon(IconType.REMOVE);
|
|
||||||
//
|
|
||||||
// Image italyImg = new Image(GNAImages.ICONS.italyIcon());
|
|
||||||
// italyImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
|
||||||
// extentToItaly.getElement().appendChild(italyImg.getElement());
|
|
||||||
// extentToItaly.setWidth("140px");
|
|
||||||
//
|
|
||||||
// Image worldImg = new Image(GNAImages.ICONS.worldIcon());
|
|
||||||
// worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
|
|
||||||
// extentToEarth.getElement().appendChild(worldImg.getElement());
|
|
||||||
// extentToEarth.setWidth("140px");
|
|
||||||
//
|
|
||||||
// linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
|
||||||
// linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
|
||||||
// linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
|
||||||
//
|
|
||||||
// SearchingFilter initialSortFilter = new SearchingFilter();
|
|
||||||
// initialSortFilter.setOrder(ORDER.ASC);
|
|
||||||
//
|
|
||||||
// for (ItemFieldDV itemField : result) {
|
|
||||||
// if (itemField.isDisplayAsResult()) {
|
|
||||||
// displayFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (itemField.isSearchable()) {
|
|
||||||
// searchByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (itemField.isSortable()) {
|
|
||||||
// sortByFields.add(itemField);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
|
||||||
// searchFacility.setSearchButton(searchFacilityButton);
|
|
||||||
// searchFacilityButton.setIcon(IconType.SEARCH);
|
|
||||||
// searchFacilityPanel.add(searchFacility);
|
|
||||||
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void execute() {
|
|
||||||
// searchFacilityPanel.getElement().getParentElement().getStyle().setOpacity(0.9);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
//
|
|
||||||
// // layersDDB.setToggle(true);
|
|
||||||
// bindEvents();
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
|
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
|
||||||
Map<String, List<ItemFieldDV>> mapOfSearchingFilterForUCD) {
|
Map<String, List<ItemFieldDV>> mapOfSearchingFilterForUCD) {
|
||||||
|
@ -225,6 +165,8 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
|
openCollectionDropDown.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
|
||||||
|
|
||||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||||
initialSortFilter.setOrder(ORDER.ASC);
|
initialSortFilter.setOrder(ORDER.ASC);
|
||||||
|
|
||||||
|
@ -528,6 +470,48 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
*
|
*
|
||||||
* @param listBaseLayers the new base layers
|
* @param listBaseLayers the new base layers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public void setAvailableCollections(Collection<GCubeCollection> collection) {
|
||||||
|
GWT.log("Init Available collections menu");
|
||||||
|
if(collection == null || collection.isEmpty())
|
||||||
|
GWT.log("!!! No Available collections");
|
||||||
|
|
||||||
|
|
||||||
|
for(GCubeCollection coll : collection) {
|
||||||
|
GWT.log("Found available collection "+coll);
|
||||||
|
String label = coll.getUcd().getName();
|
||||||
|
String id=coll.getUcd().getId();
|
||||||
|
|
||||||
|
CheckBox checkbox = new CheckBox(label);
|
||||||
|
checkbox.setId("gcubeCollectionSelector_"+id);
|
||||||
|
|
||||||
|
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
|
GWT.log("Collection selector flag changed to value : "+event.toDebugString());
|
||||||
|
|
||||||
|
String collectionID = ((CheckBox)event.getSource()).getId().replace("gcubeCollectionSelector_", "");
|
||||||
|
|
||||||
|
GWT.log("Collection ID is : "+collectionID + ", event value: "+event.getValue());
|
||||||
|
if(event.getValue()) {
|
||||||
|
// OPEN COLLECTION
|
||||||
|
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
|
||||||
|
}else {
|
||||||
|
// CLOSE COLLECTION
|
||||||
|
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
openCollectionPanel.add(checkbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
|
||||||
|
|
||||||
if (listBaseLayers == null)
|
if (listBaseLayers == null)
|
||||||
|
|
|
@ -35,17 +35,22 @@
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK" text="Search"
|
<b:DropdownButton type="LINK"
|
||||||
ui:field="searchFacilityButton">
|
text="Open Collection" ui:field="openCollectionDropDown">
|
||||||
<b:NavList ui:field="navListSearch"></b:NavList>
|
<g:HTMLPanel ui:field="openCollectionPanel">
|
||||||
<g:ScrollPanel ui:field="searchFacilityPanel"
|
</g:HTMLPanel>
|
||||||
addStyleNames="search-facility"></g:ScrollPanel>
|
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
title="Select the Map" text="Map" ui:field="linkMap">
|
title="Select the Map" text="Map" ui:field="linkMap">
|
||||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
|
<b:DropdownButton type="LINK" text="Search"
|
||||||
|
ui:field="searchFacilityButton">
|
||||||
|
<b:NavList ui:field="navListSearch"></b:NavList>
|
||||||
|
<g:ScrollPanel ui:field="searchFacilityPanel"
|
||||||
|
addStyleNames="search-facility"></g:ScrollPanel>
|
||||||
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<b:DropdownButton type="LINK"
|
||||||
title="Center Map to Location" text="Preset Location"
|
title="Center Map to Location" text="Preset Location"
|
||||||
ui:field="linkPresetLocation">
|
ui:field="linkPresetLocation">
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||||
|
@ -60,10 +59,10 @@ public class DragDropLayer extends FlowPanel {
|
||||||
this.labelLayerName.setTitle(layerItem.getName());
|
this.labelLayerName.setTitle(layerItem.getName());
|
||||||
this.labelLayerName.setType(LabelType.INFO);
|
this.labelLayerName.setType(LabelType.INFO);
|
||||||
|
|
||||||
BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
|
LayerItem refConcessione = layerObject.getLayerItem();
|
||||||
String nameConcessione = StringUtil.ellipsize(refConcessione.getNome(), 40);
|
String nameConcessione = StringUtil.ellipsize(refConcessione.getName(), 40);
|
||||||
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
|
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
|
||||||
labelConcessione.setTitle(refConcessione.getNome());
|
labelConcessione.setTitle(refConcessione.getName());
|
||||||
|
|
||||||
getElement().getStyle().setMarginTop(5, Unit.PX);
|
getElement().getStyle().setMarginTop(5, Unit.PX);
|
||||||
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
getElement().getStyle().setMarginBottom(10, Unit.PX);
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.Window;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
public abstract class ControlledCallBack<T> implements AsyncCallback<T> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
before();
|
||||||
|
if(caught instanceof ControlledError) {
|
||||||
|
GWT.log("Controlled error "+caught);
|
||||||
|
Window.alert(caught.getMessage());
|
||||||
|
}else {
|
||||||
|
GWT.log("Uncontrolled failure, check server log.", caught);
|
||||||
|
Window.alert("Sorry, an unexpected error occurred. Please, contact the support");
|
||||||
|
}
|
||||||
|
after();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void before() {}
|
||||||
|
|
||||||
|
public void after() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(T result) {
|
||||||
|
before();
|
||||||
|
after();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.util;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
|
public class OGCUtils {
|
||||||
|
|
||||||
|
public static void performWFSQueryOnCentroid(RecordDV record) {
|
||||||
|
GWT.log("WFS Query for : "+record);
|
||||||
|
|
||||||
|
if (record != null) {
|
||||||
|
// GWT.log("record instanceof ConcessioneDV: " + (record instanceof ConcessioneDV) + " with mongo item id: "
|
||||||
|
// + record.getItemId());
|
||||||
|
// GeoportalDataViewerConstants.print("record instanceof ConcessioneDV: "
|
||||||
|
// +(record instanceof ConcessioneDV));
|
||||||
|
// if (record instanceof ConcessioneDV) {
|
||||||
|
// ConcessioneDV concessioneDV = (ConcessioneDV) record;
|
||||||
|
// Double x = concessioneDV.getCentroidLong();
|
||||||
|
// Double y = concessioneDV.getCentroidLat();
|
||||||
|
// GWT.log("X: " + x + ", Y:" + y);
|
||||||
|
// if (x != null && y != null) {
|
||||||
|
// Coordinate transfCoord = MapUtils.transformCoordiante(new Coordinate(x, y),
|
||||||
|
// GeoportalDataViewerConstants.MAP_PROJECTION.EPSG_4326.getName(), GeoportalDataViewerConstants.MAP_PROJECTION.EPSG_3857.getName());
|
||||||
|
// GeoQuery select = olMapMng.toDataPointQuery(transfCoord, false);
|
||||||
|
// GWT.log("GeoQuery: " + select);
|
||||||
|
// // GeoportalDataViewerConstants.print("fireEvent QueryDataEvent");
|
||||||
|
// ExtentWrapped toExt = new ExtentWrapped(transfCoord.getX(), transfCoord.getY(), transfCoord.getX(),
|
||||||
|
// transfCoord.getY());
|
||||||
|
// layerManager.getLayerManagerBus().fireEvent(new QueryDataEvent(select, toExt, record.getItemId(),
|
||||||
|
// true, GeoportalDataViewerConstants.MapEventType.ADDED_CENTROID_LAYER_TO_MAP));
|
||||||
|
// } else {
|
||||||
|
// GeoportalDataViewerConstants.printJs(
|
||||||
|
// "I cannot select the point one or both coordiantes are null. X: " + x + ", Y:" + y);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
|
||||||
|
|
||||||
import javax.servlet.annotation.WebListener;
|
|
||||||
import javax.servlet.http.HttpSessionEvent;
|
|
||||||
import javax.servlet.http.HttpSessionListener;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
@WebListener
|
|
||||||
public class GeoportalDataViewerHttpSessionListener implements HttpSessionListener {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(GeoportalDataViewerHttpSessionListener.class);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sessionDestroyed(HttpSessionEvent event) {
|
|
||||||
LOG.info("sessionDestroyed called");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sessionCreated(HttpSessionEvent arg0) {
|
|
||||||
LOG.info("sessionCreated called. Session id is: "+arg0.getSession().getId());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server;
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
||||||
|
|
||||||
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.projects;
|
||||||
|
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -15,8 +18,12 @@ import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.bson.Document;
|
import org.bson.Document;
|
||||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
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.document.Project;
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
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.geoportalcommon.ConvertToDataValueObjectModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
|
@ -51,12 +58,19 @@ import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessi
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
|
||||||
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
import org.gcube.application.geoportalcommon.util.URLParserUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerService;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.faults.InvalidObjectException;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.FeatureParser;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
import org.gcube.portlets.user.geoportaldataviewer.server.gis.WMSUrlValidator;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.GeoportalServiceIdentityProxy;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.ContextRequest;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.DVConversion;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
import org.gcube.portlets.user.geoportaldataviewer.server.util.SessionUtil;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
|
||||||
|
@ -493,11 +507,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
if (item == null)
|
if (item == null)
|
||||||
throw new Exception("Bad request, the item is null");
|
throw new Exception("Bad request, the item is null");
|
||||||
|
|
||||||
if (item.getItemId() == null)
|
if (item.getProjectID() == null)
|
||||||
throw new Exception("Bad request, the item id is null");
|
throw new Exception("Bad request, the projectID is null");
|
||||||
|
|
||||||
if (item.getItemType() == null)
|
if (item.getProfileID() == null)
|
||||||
throw new Exception("Bad request, the item type is null");
|
throw new Exception("Bad request, the profileID is null");
|
||||||
|
|
||||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||||
GeoportalCommon gc = new GeoportalCommon();
|
GeoportalCommon gc = new GeoportalCommon();
|
||||||
|
@ -701,6 +715,97 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ViewerConfiguration getInitialConfiguration() throws Exception {
|
||||||
|
LOG.debug("getInitialConfiguration called");
|
||||||
|
|
||||||
|
return new ContextRequest<ViewerConfiguration>(this.getThreadLocalRequest()) {
|
||||||
|
@Override
|
||||||
|
protected ViewerConfiguration run() throws Exception, ControlledError {
|
||||||
|
try {
|
||||||
|
|
||||||
|
// ************* LOAD BASE LAYERS
|
||||||
|
|
||||||
|
final ViewerConfiguration config = new ViewerConfiguration();
|
||||||
|
LOG.info("Getting initial configuration ");
|
||||||
|
LOG.debug("Loading base layers..");
|
||||||
|
List<BaseMapLayer> listBL = SessionUtil.getGNABaseMaps(request);
|
||||||
|
|
||||||
|
LOG.debug("getListBaseLayers returning " + listBL.size() + " base maps");
|
||||||
|
config.setBaseLayers(listBL);
|
||||||
|
|
||||||
|
// ************** LOAD AVAILABLE COLLECTIONS
|
||||||
|
|
||||||
|
LOG.debug("Loading available collections.. ");
|
||||||
|
config.setAvailableCollections(new HashMap<String, GCubeCollection>());
|
||||||
|
|
||||||
|
// TODO filter by
|
||||||
|
// configured ?
|
||||||
|
// gis indexed
|
||||||
|
QueryRequest request = new QueryRequest();
|
||||||
|
|
||||||
|
// TODO Constant
|
||||||
|
String Id = "org.gcube.portlets.user.geoportaldataviewer";
|
||||||
|
request.setFilter(Document.parse("{\"" + UseCaseDescriptor.HANDLERS + "."
|
||||||
|
+ org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration.ID
|
||||||
|
+ "\" : " + "{\"$eq\" : \"" + Id + "\"}}"));
|
||||||
|
|
||||||
|
useCaseDescriptors().build().query(new QueryRequest()).forEachRemaining(u -> {
|
||||||
|
try {
|
||||||
|
LOG.debug("Checking configuration for collection " + u.getId());
|
||||||
|
|
||||||
|
Projects<Project> p = projects(u.getId()).build();
|
||||||
|
UseCaseDescriptorDV ucd = ConvertToDataValueObjectModel.toUseCaseDescriptorDV(u, null);
|
||||||
|
Configuration ucdConfig = p.getConfiguration();
|
||||||
|
GCubeCollection coll = new GCubeCollection();
|
||||||
|
coll.setUcd(ucd);
|
||||||
|
|
||||||
|
// TODO TO Check index flag should be in configuration or evaluated according to
|
||||||
|
// user credentials
|
||||||
|
|
||||||
|
String toCheckFlag = "internal";
|
||||||
|
|
||||||
|
// TODO constant
|
||||||
|
coll.setIndexes(new ArrayList());
|
||||||
|
|
||||||
|
LOG.debug("Checking if " + u.getId() + " is GIS Indexed. Index flag needed is "
|
||||||
|
+ toCheckFlag);
|
||||||
|
|
||||||
|
for (Index index : ucdConfig.getIndexes()) {
|
||||||
|
try {
|
||||||
|
IndexLayer toAdd = DVConversion.convert(index);
|
||||||
|
if (toAdd.getFlag().equals(toCheckFlag))
|
||||||
|
coll.getIndexes().add(toAdd);
|
||||||
|
} catch (InvalidObjectException e) {
|
||||||
|
LOG.debug("Skipping invalid index ", e);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.error("Unable to check index ", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return only if gis indexed
|
||||||
|
if (coll.getIndexes().isEmpty())
|
||||||
|
LOG.info("No available GIS Index for collection " + coll.getUcd().getName());
|
||||||
|
else
|
||||||
|
config.getAvailableCollections().put(coll.getUcd().getId(), coll);
|
||||||
|
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.warn("Invalid UCD, can't translate to DV. UCID : " + u.getId(), t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// TODO load initial layers from query parameters
|
||||||
|
LOG.debug("Found " + config.getAvailableCollections().size() + " collections");
|
||||||
|
|
||||||
|
return config;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.error("Unexpected exception while loading initial config", t);
|
||||||
|
throw new ControlledError("Unable to configure viewer. Please retry in a few minutes.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}.execute().getResult();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<ItemFieldDV>> listOfFieldsForSearching() throws Exception {
|
public Map<String, List<ItemFieldDV>> listOfFieldsForSearching() throws Exception {
|
||||||
LOG.info("listOfFieldsForSearching called");
|
LOG.info("listOfFieldsForSearching called");
|
||||||
|
@ -1021,6 +1126,24 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
GeoportalServiceIdentityProxy cms = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
GeoportalServiceIdentityProxy cms = new GeoportalServiceIdentityProxy(this.getThreadLocalRequest());
|
||||||
ProjectDV theProjectDV = cms.getProjectByID(profileID, projectID);
|
ProjectDV theProjectDV = cms.getProjectByID(profileID, projectID);
|
||||||
|
|
||||||
|
ProjectView projectView = loadProjectView(theProjectDV, scope, userName);
|
||||||
|
|
||||||
|
if(LOG.isDebugEnabled())
|
||||||
|
prettyPrintProjectView(projectView);
|
||||||
|
|
||||||
|
LOG.info("returning project view for id: " + projectView.getTheProjectDV().getId());
|
||||||
|
return projectView;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
String erroMsg = "Error occurred on creating projectView for id: " + projectID;
|
||||||
|
LOG.error(erroMsg, e);
|
||||||
|
throw new Exception(erroMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectView loadProjectView(ProjectDV theProjectDV, String scope, String username) throws Exception {
|
||||||
|
|
||||||
String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON();
|
String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON();
|
||||||
|
|
||||||
LOG.debug("theProjectDV as JSON: " + theWholeProjectAsJSON);
|
LOG.debug("theProjectDV as JSON: " + theWholeProjectAsJSON);
|
||||||
|
@ -1032,7 +1155,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> linkedMap_UCDId_gCubeProfiles = GcubeProfilesPerUCDIdCache
|
LinkedHashMap<String, List<GcubeProfilesMetadataForUCD>> linkedMap_UCDId_gCubeProfiles = GcubeProfilesPerUCDIdCache
|
||||||
.get(scope);
|
.get(scope);
|
||||||
|
|
||||||
// NO UCD defined, applyong default
|
// NO UCD defined, applying default
|
||||||
if (linkedMap_UCDId_gCubeProfiles.size() == 0) {
|
if (linkedMap_UCDId_gCubeProfiles.size() == 0) {
|
||||||
LOG.warn("No " + GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles + " found in the UCD");
|
LOG.warn("No " + GEOPORTAL_CONFIGURATION_TYPE.gcube_profiles + " found in the UCD");
|
||||||
LOG.info("Applying default business logic to display the project");
|
LOG.info("Applying default business logic to display the project");
|
||||||
|
@ -1041,8 +1164,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
SubDocumentView subDocumentView = new SubDocumentView();
|
SubDocumentView subDocumentView = new SubDocumentView();
|
||||||
|
|
||||||
Document sectionDoc = Document.parse(theProjectDV.getTheDocument().getDocumentAsJSON());
|
Document sectionDoc = Document.parse(theProjectDV.getTheDocument().getDocumentAsJSON());
|
||||||
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, JSON_$_POINTER,
|
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, JSON_$_POINTER, username);
|
||||||
userName);
|
|
||||||
|
|
||||||
// If is accessible
|
// If is accessible
|
||||||
if (isAccessibleSection) {
|
if (isAccessibleSection) {
|
||||||
|
@ -1079,7 +1201,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<GcubeProfilesMetadataForUCD> listProfilesBean = linkedMap_UCDId_gCubeProfiles.get(profileID);
|
List<GcubeProfilesMetadataForUCD> listProfilesBean = linkedMap_UCDId_gCubeProfiles
|
||||||
|
.get(theProjectDV.getProfileID());
|
||||||
|
|
||||||
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();
|
||||||
|
@ -1093,12 +1216,10 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.debug("\n\nThe profile is: " + gcubeProfileDV);
|
LOG.debug("\n\nThe profile is: " + gcubeProfileDV);
|
||||||
// Building JSON/section full PATH and section name
|
// Building JSON/section full PATH and section name
|
||||||
String sectionJSONPath = "";
|
String sectionJSONPath = "";
|
||||||
String parentPathFromProfile = gcubeProfileDV.getParentName() == null ? ""
|
String parentPathFromProfile = gcubeProfileDV.getParentName() == null ? "" : gcubeProfileDV.getParentName();
|
||||||
: gcubeProfileDV.getParentName();
|
|
||||||
String theSectionName = gcubeProfileDV.getSectionName();
|
String theSectionName = gcubeProfileDV.getSectionName();
|
||||||
|
|
||||||
if (theSectionName.compareTo(JSON_$_POINTER) == 0
|
if (theSectionName.compareTo(JSON_$_POINTER) == 0 || theSectionName.compareTo(JSON_$_POINTER + ".") == 0) {
|
||||||
|| theSectionName.compareTo(JSON_$_POINTER + ".") == 0) {
|
|
||||||
sectionJSONPath = JSON_$_POINTER;
|
sectionJSONPath = JSON_$_POINTER;
|
||||||
theSectionName = "";
|
theSectionName = "";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1109,8 +1230,15 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
LOG.debug("The sectionJSONPath is: " + sectionJSONPath);
|
LOG.debug("The sectionJSONPath is: " + sectionJSONPath);
|
||||||
|
|
||||||
JsonPath theSectionJsonPath = JsonPath.compile(sectionJSONPath);
|
JsonPath theSectionJsonPath = null;
|
||||||
Object data = theSectionJsonPath.read(theWholeProjectAsJSON, configuration);
|
Object data = null;
|
||||||
|
try {
|
||||||
|
theSectionJsonPath = JsonPath.compile(sectionJSONPath);
|
||||||
|
data = theSectionJsonPath.read(theWholeProjectAsJSON, configuration);
|
||||||
|
}catch (Exception e) {
|
||||||
|
LOG.warn("Error on searching the section " + sectionJSONPath +" in the JSON Project: "+theWholeProjectAsJSON);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
LOG.debug("Data is instace of: " + data.getClass());
|
LOG.debug("Data is instace of: " + data.getClass());
|
||||||
LOG.debug("data to string: " + data.toString());
|
LOG.debug("data to string: " + data.toString());
|
||||||
|
@ -1123,7 +1251,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.debug("the JSON to string: " + jsonString);
|
LOG.debug("the JSON to string: " + jsonString);
|
||||||
Document sectionDoc = Document.parse(jsonString);
|
Document sectionDoc = Document.parse(jsonString);
|
||||||
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, sectionJSONPath,
|
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, sectionJSONPath,
|
||||||
userName);
|
username);
|
||||||
if (isAccessibleSection) {
|
if (isAccessibleSection) {
|
||||||
listBSONDocument.add(sectionDoc);
|
listBSONDocument.add(sectionDoc);
|
||||||
}
|
}
|
||||||
|
@ -1135,7 +1263,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
LOG.debug("the array " + i + " JSON to string: " + jsonString);
|
LOG.debug("the array " + i + " JSON to string: " + jsonString);
|
||||||
Document sectionDoc = Document.parse(jsonString);
|
Document sectionDoc = Document.parse(jsonString);
|
||||||
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, sectionJSONPath,
|
boolean isAccessibleSection = isAccessibleSectionAccordingToPolicy(sectionDoc, sectionJSONPath,
|
||||||
userName);
|
username);
|
||||||
if (isAccessibleSection) {
|
if (isAccessibleSection) {
|
||||||
listBSONDocument.add(sectionDoc);
|
listBSONDocument.add(sectionDoc);
|
||||||
}
|
}
|
||||||
|
@ -1162,8 +1290,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
Object theOBJFieldValue = fromSectionDoc.get(theFieldName);
|
Object theOBJFieldValue = fromSectionDoc.get(theFieldName);
|
||||||
|
|
||||||
// NB: Using ALWAYS THE metadataField.getFieldName() as LABEL
|
// NB: Using ALWAYS THE metadataField.getFieldName() as LABEL
|
||||||
toSectionDoc = sanitizeDocumentValue(toSectionDoc, metadataField.getFieldName(),
|
toSectionDoc = sanitizeDocumentValue(toSectionDoc, metadataField.getFieldName(), theOBJFieldValue);
|
||||||
theOBJFieldValue);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
String subToJSON = toSectionDoc.toJson();
|
String subToJSON = toSectionDoc.toJson();
|
||||||
|
@ -1208,43 +1335,40 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
projectView.addSectionView(sectionView);
|
projectView.addSectionView(sectionView);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (SectionView section : projectView.getListSections()) {
|
|
||||||
// System.out.println("\n\n###### Section Title: " + section.getSectionTitle() + " ######");
|
|
||||||
// int i = 1;
|
|
||||||
// for (SubDocumentView subDocument : section.getListSubDocuments()) {
|
|
||||||
// System.out.println("## " + SubDocumentView.class.getSimpleName() + " n." + i);
|
|
||||||
// System.out.println("***** Metadata");
|
|
||||||
// System.out.println(prettyPrintJSON(subDocument.getMetadataAsJSON()));
|
|
||||||
// System.out.println("***** Files");
|
|
||||||
// if (subDocument.getListFiles() != null) {
|
|
||||||
// for (FilesetDV filesetDV : subDocument.getListFiles()) {
|
|
||||||
// System.out.println("******* File Fileset name: " + filesetDV.getName());
|
|
||||||
// for (PayloadDV payload : filesetDV.getListPayload()) {
|
|
||||||
// System.out.println("********* Payload: " + payload);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// System.out.println("***** Images");
|
|
||||||
// if (subDocument.getListImages() != null) {
|
|
||||||
// for (FilesetDV filesetDV : subDocument.getListImages()) {
|
|
||||||
// System.out.println("******* Image Fileset name: " + filesetDV.getName());
|
|
||||||
// for (PayloadDV payload : filesetDV.getListPayload()) {
|
|
||||||
// System.out.println("********* Payload: " + payload);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
return projectView;
|
return projectView;
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
String erroMsg = "Error occurred on creating projectView for id: " + projectID;
|
|
||||||
LOG.error(erroMsg, e);
|
|
||||||
throw new Exception(erroMsg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void prettyPrintProjectView(ProjectView projectView) {
|
||||||
|
|
||||||
|
for (SectionView section : projectView.getListSections()) {
|
||||||
|
System.out.println("\n\n###### Section Title: " + section.getSectionTitle() + " ######");
|
||||||
|
int i = 1;
|
||||||
|
for (SubDocumentView subDocument : section.getListSubDocuments()) {
|
||||||
|
System.out.println("## " + SubDocumentView.class.getSimpleName() + " n." + i);
|
||||||
|
System.out.println("***** Metadata");
|
||||||
|
System.out.println(prettyPrintJSON(subDocument.getMetadataAsJSON()));
|
||||||
|
System.out.println("***** Files");
|
||||||
|
if (subDocument.getListFiles() != null) {
|
||||||
|
for (FilesetDV filesetDV : subDocument.getListFiles()) {
|
||||||
|
System.out.println("******* File Fileset name: " + filesetDV.getName());
|
||||||
|
for (PayloadDV payload : filesetDV.getListPayload()) {
|
||||||
|
System.out.println("********* Payload: " + payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("***** Images");
|
||||||
|
if (subDocument.getListImages() != null) {
|
||||||
|
for (FilesetDV filesetDV : subDocument.getListImages()) {
|
||||||
|
System.out.println("******* Image Fileset name: " + filesetDV.getName());
|
||||||
|
for (PayloadDV payload : filesetDV.getListPayload()) {
|
||||||
|
System.out.println("********* Payload: " + payload);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1279,8 +1403,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
LOG.info("returning list of payloads {}", listPayloads);
|
LOG.info("returning list of payloads {}", listPayloads);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error on reading the JSON Path {} in the doc {} ", _payloadsJSONPath, sectionJSONDocument);
|
LOG.warn("Error on reading the JSON Path "+_payloadsJSONPath+" in the doc "+sectionJSONDocument, e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return listPayloads;
|
return listPayloads;
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.faults;
|
||||||
|
|
||||||
|
public class InvalidObjectException extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 7577708930172470038L;
|
||||||
|
|
||||||
|
public InvalidObjectException() {
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(String message) {
|
||||||
|
super(message);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public InvalidObjectException(String message, Throwable cause, boolean enableSuppression,
|
||||||
|
boolean writableStackTrace) {
|
||||||
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public abstract class ContextRequest<T> {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(ContextRequest.class);
|
||||||
|
|
||||||
|
private static List<Runnable> preoperations = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void addPreoperation(Runnable preoperation) {
|
||||||
|
preoperations.add(preoperation);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected HttpServletRequest request;
|
||||||
|
private T result = null;
|
||||||
|
|
||||||
|
public ContextRequest(HttpServletRequest httpRequest) {
|
||||||
|
this.request = httpRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContextRequest<T> execute() throws Exception, ControlledError {
|
||||||
|
try {
|
||||||
|
if (!preoperations.isEmpty()) {
|
||||||
|
LOG.trace("Running preops (size : {} )", preoperations.size());
|
||||||
|
for (Runnable r : preoperations)
|
||||||
|
r.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("Context is " + SessionUtil.getCurrentContext(request, true));
|
||||||
|
LOG.debug("Context is " + SessionUtil.getCurrentToken(request, true) == null ? null : "***");
|
||||||
|
LOG.trace("Executing actual method..");
|
||||||
|
result = run();
|
||||||
|
return this;
|
||||||
|
} catch (ControlledError e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable t) {
|
||||||
|
LOG.error("Unexpected error ", t);
|
||||||
|
throw new Exception("Unexpected error contacting the infrastructure", t);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getResult() {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract T run() throws Exception, ControlledError;
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||||
|
import org.gcube.application.geoportal.common.model.configuration.Index;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.faults.InvalidObjectException;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
|
|
||||||
|
public class DVConversion {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
"_type": "GIS-CENTROIDS",
|
||||||
|
"layer": {
|
||||||
|
"_type": "gcube-sdi-layer",
|
||||||
|
"_platformInfo": [
|
||||||
|
{
|
||||||
|
"_type": "Geoserver",
|
||||||
|
"workspace": "profiledconcessioni_devvre",
|
||||||
|
"storeName": "profiledconcessioni_devvre_centroids",
|
||||||
|
"_host": "geoserver-218.dev.d4science.org"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_bbox": {
|
||||||
|
"_maxX": 180.0,
|
||||||
|
"_minX": -180.0,
|
||||||
|
"_maxY": 90.0,
|
||||||
|
"_minY": -90.0
|
||||||
|
},
|
||||||
|
"_ogcLinks": {
|
||||||
|
"wms": {
|
||||||
|
"wms": "https://geoserver-218.dev.d4science.org/geoserver/profiledconcessioni_devvre/wms?service=WMS&version=1.1.0&request=GetMap&layers=profiledconcessioni_devvre:null&styles=&bbox=-180.000000,-90.000000,180.000000,90.000000&srs=EPSG:4326&format=application/openlayers&width=400&height=400"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"indexName": "profiledconcessioni_devvre_centroids",
|
||||||
|
"records": 4,
|
||||||
|
"crossReferencedLayers": {},
|
||||||
|
"flag": "public"
|
||||||
|
}
|
||||||
|
* @throws InvalidObjectException
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static IndexLayer convert(Index toConvert) throws InvalidObjectException {
|
||||||
|
IndexLayer toReturn = null;
|
||||||
|
|
||||||
|
|
||||||
|
switch(toConvert.getType()) {
|
||||||
|
case "GIS-CENTROIDS" : {
|
||||||
|
toReturn = Serialization.convert(toConvert,IndexLayer.class);
|
||||||
|
// toReturn.setLayer(Serialization.read(toConvert.get("layer"), GCubeSDILayer.class));
|
||||||
|
// toReturn.setFlag(toConvert.getString("flag"));
|
||||||
|
// toReturn.setIndexName(toConvert.getString());
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
default:{
|
||||||
|
throw new InvalidObjectException("Unable to convert Index. Unknown type : "+toConvert.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.IndexLayer;
|
||||||
|
|
||||||
|
|
||||||
|
public class GCubeCollection implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -3915546050671671465L;
|
||||||
|
|
||||||
|
private UseCaseDescriptorDV ucd;
|
||||||
|
private List<IndexLayer> indexes;
|
||||||
|
|
||||||
|
public GCubeCollection() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public UseCaseDescriptorDV getUcd() {
|
||||||
|
return ucd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IndexLayer> getIndexes() {
|
||||||
|
return indexes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setUcd(UseCaseDescriptorDV ucd) {
|
||||||
|
this.ucd = ucd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexes(List<IndexLayer> indexes) {
|
||||||
|
this.indexes = indexes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "GCubeCollection [ucd=" + ucd + ", indexes=" + indexes + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||||
|
|
||||||
|
public class ViewerConfiguration implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 7838513808590351819L;
|
||||||
|
|
||||||
|
public ViewerConfiguration() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO BaseLayers
|
||||||
|
public List<BaseMapLayer> baseLayers;
|
||||||
|
|
||||||
|
public Map<String, GCubeCollection> availableCollections;
|
||||||
|
|
||||||
|
public List<BaseMapLayer> getBaseLayers() {
|
||||||
|
return baseLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseLayers(List<BaseMapLayer> baseLayers) {
|
||||||
|
this.baseLayers = baseLayers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, GCubeCollection> getAvailableCollections() {
|
||||||
|
return availableCollections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAvailableCollections(Map<String, GCubeCollection> availableCollections) {
|
||||||
|
this.availableCollections = availableCollections;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// public List<String> displayedCollections;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public Map<String,String> selectedProjects;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public class BBOXDV extends HashMap<String,Double>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -160255589938251081L;
|
||||||
|
|
||||||
|
public BBOXDV() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public final String asGeoJSONBBox(){
|
||||||
|
StringBuilder builder = new StringBuilder("[");
|
||||||
|
builder.append(getMaxX()+","); // W
|
||||||
|
builder.append(getMinY()+","); // S
|
||||||
|
if(is3d()) builder.append(getMinZ()+","); // Z
|
||||||
|
|
||||||
|
builder.append(getMinX()+","); // E
|
||||||
|
builder.append(getMaxY()+","); // N
|
||||||
|
if(is3d()) builder.append(getMaxZ()+","); // Z
|
||||||
|
|
||||||
|
|
||||||
|
builder.deleteCharAt(builder.length());
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
public double[] asGeoJSONArray(){
|
||||||
|
if(is3d()){
|
||||||
|
return new double[]{getMaxX(),getMinY(),getMinZ(),getMinX(),getMaxY(),getMaxZ()};
|
||||||
|
}else return new double[]{getMaxX(),getMinY(),getMinX(),getMaxY()};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final BBOXDV fromGeoJSON(double[] coords){
|
||||||
|
BBOXDV toReturn = new BBOXDV();
|
||||||
|
toReturn.setMaxX(coords[0]);
|
||||||
|
toReturn.setMinY(coords[1]);
|
||||||
|
|
||||||
|
if(coords.length == 6){
|
||||||
|
// 3D
|
||||||
|
toReturn.setMinZ(coords[2]);
|
||||||
|
toReturn.setMinX(coords[3]);
|
||||||
|
toReturn.setMaxY(coords[4]);
|
||||||
|
toReturn.setMaxZ(coords[5]);
|
||||||
|
}else {
|
||||||
|
toReturn.setMinX(coords[2]);
|
||||||
|
toReturn.setMaxY(coords[3]);
|
||||||
|
}
|
||||||
|
return toReturn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final BBOXDV WORLD=new BBOXDV(180d,-180d,90d,-90d);
|
||||||
|
|
||||||
|
public static final BBOXDV WORLD_3D=new BBOXDV(180d,-180d,90d,-90d);
|
||||||
|
|
||||||
|
public static final String MAX_X="_maxX";
|
||||||
|
public static final String MAX_Y="_maxY";
|
||||||
|
public static final String MAX_Z="_maxZ";
|
||||||
|
public static final String MIN_X="_minX";
|
||||||
|
public static final String MIN_Y="_minY";
|
||||||
|
public static final String MIN_Z="_minZ";
|
||||||
|
|
||||||
|
|
||||||
|
public BBOXDV(Double maxX,Double minX,Double maxY,Double minY,Double maxZ,Double minZ){
|
||||||
|
this(maxX,minX,maxY,minY);
|
||||||
|
setMaxZ(maxZ);
|
||||||
|
setMinZ(minZ);
|
||||||
|
}
|
||||||
|
public BBOXDV(Double maxX,Double minX,Double maxY,Double minY){
|
||||||
|
setMaxX(maxX);
|
||||||
|
setMinX(minX);
|
||||||
|
setMaxY(maxY);
|
||||||
|
setMinY(minY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public BBOXDV setMaxX(Double d){this.put(MAX_X,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMaxY(Double d){this.put(MAX_Y,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMaxZ(Double d){this.put(MAX_Z,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMinX(Double d){this.put(MIN_X,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMinY(Double d){this.put(MIN_Y,d);return this;}
|
||||||
|
|
||||||
|
public BBOXDV setMinZ(Double d){this.put(MIN_Z,d);return this;}
|
||||||
|
|
||||||
|
public Double getMinY(){return (Double) this.getOrDefault(MIN_Y,-90d);}
|
||||||
|
|
||||||
|
public Double getMaxY(){return (Double) this.getOrDefault(MAX_Y,90d);}
|
||||||
|
|
||||||
|
public Double getMinX(){return (Double) this.getOrDefault(MIN_X,-180d);}
|
||||||
|
|
||||||
|
public Double getMaxX(){return (Double) this.getOrDefault(MAX_X,180d);}
|
||||||
|
|
||||||
|
public Double getMinZ(){return (Double) this.getOrDefault(MIN_Z,null);}
|
||||||
|
|
||||||
|
public Double getMaxZ(){return (Double) this.getOrDefault(MAX_Z,null);}
|
||||||
|
|
||||||
|
|
||||||
|
public Boolean is3d(){
|
||||||
|
return getMinZ()!=null && getMaxZ() !=null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class GCubeSDILayerDV implements Serializable {
|
||||||
|
|
||||||
|
// TODO manage heterogeneus collection
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 5317964084778336268L;
|
||||||
|
@JsonProperty(value = "_type")
|
||||||
|
private String type;
|
||||||
|
@JsonProperty(value = "_platformInfo")
|
||||||
|
private List<GeoServerPlatformInfoDV> platformInfos;
|
||||||
|
@JsonProperty(value = "_bbox")
|
||||||
|
private BBOXDV bbox;
|
||||||
|
@JsonProperty(value = "_ogcLinks")
|
||||||
|
private HashMap<String, String> ogcLinks;
|
||||||
|
|
||||||
|
public GCubeSDILayerDV() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GeoServerPlatformInfoDV> getPlatformInfos() {
|
||||||
|
return platformInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BBOXDV getBbox() {
|
||||||
|
return bbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<String, String> getOgcLinks() {
|
||||||
|
return ogcLinks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatformInfos(List<GeoServerPlatformInfoDV> platformInfos) {
|
||||||
|
this.platformInfos = platformInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBbox(BBOXDV bbox) {
|
||||||
|
this.bbox = bbox;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOgcLinks(HashMap<String, String> ogcLinks) {
|
||||||
|
this.ogcLinks = ogcLinks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("GCubeSDILayerDV [type=");
|
||||||
|
builder.append(type);
|
||||||
|
builder.append(", platformInfos=");
|
||||||
|
builder.append(platformInfos);
|
||||||
|
builder.append(", bbox=");
|
||||||
|
builder.append(bbox);
|
||||||
|
builder.append(", ogcLinks=");
|
||||||
|
builder.append(ogcLinks);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class GeoServerPlatformInfoDV implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -2630467451758269625L;
|
||||||
|
|
||||||
|
@JsonProperty(value = "_type")
|
||||||
|
private String type;
|
||||||
|
private String workspace;
|
||||||
|
private String storeName;
|
||||||
|
|
||||||
|
public GeoServerPlatformInfoDV() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonProperty(value = "_host")
|
||||||
|
private String host;
|
||||||
|
|
||||||
|
private Map<String, String> ogcLinks;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorkspace() {
|
||||||
|
return workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkspace(String workspace) {
|
||||||
|
this.workspace = workspace;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStoreName() {
|
||||||
|
return storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStoreName(String storeName) {
|
||||||
|
this.storeName = storeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHost(String host) {
|
||||||
|
this.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getOgcLinks() {
|
||||||
|
return ogcLinks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOgcLinks(Map<String, String> ogcLinks) {
|
||||||
|
this.ogcLinks = ogcLinks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("GeoServerPlatformInfoDV [type=");
|
||||||
|
builder.append(type);
|
||||||
|
builder.append(", workspace=");
|
||||||
|
builder.append(workspace);
|
||||||
|
builder.append(", storeName=");
|
||||||
|
builder.append(storeName);
|
||||||
|
builder.append(", host=");
|
||||||
|
builder.append(host);
|
||||||
|
builder.append(", ogcLinks=");
|
||||||
|
builder.append(ogcLinks);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.faults;
|
||||||
|
|
||||||
|
public class ControlledError extends Exception {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 3471094758439575063L;
|
||||||
|
|
||||||
|
public ControlledError() {
|
||||||
|
super();
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||||
|
super(message, cause, enableSuppression, writableStackTrace);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(String message) {
|
||||||
|
super(message);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
public ControlledError(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,85 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GCubeSDILayerDV;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class IndexLayer implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 5352754312327975329L;
|
||||||
|
|
||||||
|
@JsonProperty(value = "_type")
|
||||||
|
private String type;
|
||||||
|
private GCubeSDILayerDV layer;
|
||||||
|
private String indexName;
|
||||||
|
private int records;
|
||||||
|
private String flag;
|
||||||
|
|
||||||
|
public IndexLayer() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GCubeSDILayerDV getLayer() {
|
||||||
|
return layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLayer(GCubeSDILayerDV layer) {
|
||||||
|
this.layer = layer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIndexName() {
|
||||||
|
return indexName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndexName(String indexName) {
|
||||||
|
this.indexName = indexName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRecords() {
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecords(int records) {
|
||||||
|
this.records = records;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlag() {
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlag(String flag) {
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("IndexLayer [type=");
|
||||||
|
builder.append(type);
|
||||||
|
builder.append(", layer=");
|
||||||
|
builder.append(layer);
|
||||||
|
builder.append(", indexName=");
|
||||||
|
builder.append(indexName);
|
||||||
|
builder.append(", records=");
|
||||||
|
builder.append(records);
|
||||||
|
builder.append(", flag=");
|
||||||
|
builder.append(flag);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,13 +2,18 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.LayerType;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.Property;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LayerItem.
|
* The Class LayerItem.
|
||||||
*
|
*
|
||||||
|
@ -18,6 +23,7 @@ import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.ZAxis;
|
||||||
*/
|
*/
|
||||||
public class LayerItem implements Serializable, Cloneable {
|
public class LayerItem implements Serializable, Cloneable {
|
||||||
|
|
||||||
|
|
||||||
/** The Constant serialVersionUID. */
|
/** The Constant serialVersionUID. */
|
||||||
private static final long serialVersionUID = 1664082688635256899L;
|
private static final long serialVersionUID = 1664082688635256899L;
|
||||||
|
|
||||||
|
@ -962,4 +968,92 @@ public class LayerItem implements Serializable, Cloneable {
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To layer item.
|
||||||
|
*
|
||||||
|
* @param layerType the layer type
|
||||||
|
* @param layerTitle the layer title
|
||||||
|
* @param layerName the layer name
|
||||||
|
* @param layerURL the layer URL
|
||||||
|
* @param mapServerHost the map server host
|
||||||
|
* @param isExternal the is external
|
||||||
|
* @param isBase the is base
|
||||||
|
* @param displayInLayerSwitcher the display in layer switcher
|
||||||
|
* @param styles the styles
|
||||||
|
* @param wmsLink the wms link
|
||||||
|
* @param onTop the on top
|
||||||
|
* @param wmsNotStandardParams the wms not standard params
|
||||||
|
* @param isNcWms the is nc wms
|
||||||
|
* @param UUID the uuid
|
||||||
|
* @param zAxis the z axis
|
||||||
|
* @param minResolution the min resolution
|
||||||
|
* @param maxResolution the max resolution
|
||||||
|
* @return the layer item
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// TODO Constructor from IndexLayer, GCUBESDILAeryDV or direct info
|
||||||
|
private LayerItem toLayerItem(LayerType layerType, String layerTitle, String layerName, String layerURL,
|
||||||
|
String mapServerHost, boolean isExternal, boolean isBase, boolean displayInLayerSwitcher,
|
||||||
|
ArrayList<String> styles, String wmsLink, boolean onTop, HashMap<String, String> wmsNotStandardParams,
|
||||||
|
boolean isNcWms, String UUID, ZAxis zAxis, Double minResolution, Double maxResolution) {
|
||||||
|
|
||||||
|
// GWT.log("Add addLayerByWms 1");
|
||||||
|
LayerItem layerItem = new LayerItem();
|
||||||
|
layerItem.setBaseLayer(isBase);
|
||||||
|
layerItem.setTitle(layerTitle);
|
||||||
|
layerItem.setName(layerName);
|
||||||
|
layerItem.setUrl(layerURL);
|
||||||
|
layerItem.setMapServerHost(mapServerHost);
|
||||||
|
// l.setExternal(isExternal);
|
||||||
|
layerItem.setOpacity(1d);
|
||||||
|
layerItem.setBuffer(2);
|
||||||
|
layerItem.setWmsLink(wmsLink);
|
||||||
|
layerItem.setWmsNotStandardParams(wmsNotStandardParams);
|
||||||
|
layerItem.setNcWms(isNcWms);
|
||||||
|
layerItem.setUUID(UUID);
|
||||||
|
layerItem.setZAxis(zAxis);
|
||||||
|
layerItem.setMinResolution(minResolution);
|
||||||
|
layerItem.setMaxResolution(maxResolution);
|
||||||
|
|
||||||
|
switch (layerType) {
|
||||||
|
|
||||||
|
// TODO IMPLEMENT THIS CASE
|
||||||
|
case RASTER_BASELAYER:
|
||||||
|
|
||||||
|
// l.setHasLegend(false);
|
||||||
|
layerItem.setBaseLayer(true);
|
||||||
|
layerItem.setTrasparent(false);
|
||||||
|
layerItem.setClickData(false);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FEATURE_TYPE:
|
||||||
|
|
||||||
|
// CASE FEATURE TYPE
|
||||||
|
layerItem.setBaseLayer(false);
|
||||||
|
layerItem.setClickData(true);
|
||||||
|
layerItem.setTrasparent(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GWT.log("styles " + styles);
|
||||||
|
|
||||||
|
if (styles != null && styles.size() > 0) {
|
||||||
|
layerItem.setHasLegend(true);
|
||||||
|
layerItem.setDefaultStyle(styles.get(0));
|
||||||
|
layerItem.setStyle(styles.get(0));
|
||||||
|
layerItem.setStyles(styles);
|
||||||
|
} else {
|
||||||
|
String style = URLUtil.getValueOfParameter("styles", wmsLink);
|
||||||
|
if (style != null) { // CASE OF STYLE ="";
|
||||||
|
// TENTATIVE TO GET LEGEND
|
||||||
|
layerItem.setHasLegend(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
GWT.log("Built layer: " + layerItem);
|
||||||
|
return layerItem;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,14 @@ package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
import org.gcube.portlets.user.geoportaldataviewer.shared.cl.document.materialization.GCubeSDILayerDV;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class LayerObject.
|
* Represents a layer,
|
||||||
|
* holds the layer item and the related Collection info if existing
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
||||||
*
|
*
|
||||||
* Sep 9, 2021
|
|
||||||
*/
|
*/
|
||||||
public class LayerObject implements Serializable {
|
public class LayerObject implements Serializable {
|
||||||
|
|
||||||
|
@ -18,101 +17,107 @@ public class LayerObject implements Serializable {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2282478701630148774L;
|
private static final long serialVersionUID = -2282478701630148774L;
|
||||||
/* This is the layer/product type. E.g. Concessione */
|
|
||||||
private String itemType;
|
|
||||||
|
private LayerObjectType type;
|
||||||
|
|
||||||
|
private IndexLayer indexLayer; // expected for INDEX_LAYER type
|
||||||
|
private String ucid; // expected for collection layers
|
||||||
|
private GCubeSDILayerDV projectLayer; // expected for PROJECT_LAYER
|
||||||
|
private String projectId; // expected for PROJECT_LAYER
|
||||||
|
|
||||||
private LayerItem layerItem;
|
private LayerItem layerItem;
|
||||||
private BaseConcessioneDV sourceConcessione;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new layer object.
|
|
||||||
*/
|
|
||||||
public LayerObject() {
|
public LayerObject() {
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new layer object.
|
|
||||||
*
|
|
||||||
* @param itemType the item type
|
|
||||||
* @param layerItem the layer item
|
|
||||||
* @param sourceConcessione the source concessione
|
|
||||||
*/
|
|
||||||
public LayerObject(String itemType, LayerItem layerItem, BaseConcessioneDV sourceConcessione) {
|
|
||||||
super();
|
super();
|
||||||
this.itemType = itemType;
|
|
||||||
this.layerItem = layerItem;
|
|
||||||
this.sourceConcessione = sourceConcessione;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public LayerObject(LayerObjectType type,LayerItem item) {
|
||||||
* Gets the item type.
|
this.setType(type);
|
||||||
*
|
this.setLayerItem(item);
|
||||||
* @return the item type
|
|
||||||
*/
|
|
||||||
public String getItemType() {
|
|
||||||
return itemType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the layer item.
|
public LayerObject(String ucid, IndexLayer indexLayer, LayerItem item) {
|
||||||
*
|
this(LayerObjectType.INDEX_LAYER,item);
|
||||||
* @return the layer item
|
this.ucid=ucid;
|
||||||
*/
|
this.indexLayer=indexLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerObject(String ucid, String projectId, GCubeSDILayerDV projectLayer, LayerItem item) {
|
||||||
|
this(LayerObjectType.PROJECT_LAYER,item);
|
||||||
|
this.ucid=ucid;
|
||||||
|
this.projectId=projectId;
|
||||||
|
this.projectLayer = projectLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LayerObjectType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setType(LayerObjectType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IndexLayer getIndexLayer() {
|
||||||
|
return indexLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setIndexLayer(IndexLayer indexLayer) {
|
||||||
|
this.indexLayer = indexLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getUcid() {
|
||||||
|
return ucid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setUcid(String ucid) {
|
||||||
|
this.ucid = ucid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public GCubeSDILayerDV getProjectLayer() {
|
||||||
|
return projectLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setProjectLayer(GCubeSDILayerDV projectLayer) {
|
||||||
|
this.projectLayer = projectLayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getProjectId() {
|
||||||
|
return projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setProjectId(String projectId) {
|
||||||
|
this.projectId = projectId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public LayerItem getLayerItem() {
|
public LayerItem getLayerItem() {
|
||||||
return layerItem;
|
return layerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the source concessione.
|
|
||||||
*
|
|
||||||
* @return the source concessione
|
|
||||||
*/
|
|
||||||
public BaseConcessioneDV getSourceConcessione() {
|
|
||||||
return sourceConcessione;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the item type.
|
|
||||||
*
|
|
||||||
* @param itemType the new item type
|
|
||||||
*/
|
|
||||||
public void setItemType(String itemType) {
|
|
||||||
this.itemType = itemType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the layer item.
|
|
||||||
*
|
|
||||||
* @param layerItem the new layer item
|
|
||||||
*/
|
|
||||||
public void setLayerItem(LayerItem layerItem) {
|
public void setLayerItem(LayerItem layerItem) {
|
||||||
this.layerItem = layerItem;
|
this.layerItem = layerItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the source concessione.
|
public static long getSerialversionuid() {
|
||||||
*
|
return serialVersionUID;
|
||||||
* @param sourceConcessione the new source concessione
|
|
||||||
*/
|
|
||||||
public void setSourceConcessione(BaseConcessioneDV sourceConcessione) {
|
|
||||||
this.sourceConcessione = sourceConcessione;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* To string.
|
|
||||||
*
|
|
||||||
* @return the string
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append("LayerObject [itemType=");
|
|
||||||
builder.append(itemType);
|
|
||||||
builder.append(", layerItem=");
|
|
||||||
builder.append(layerItem);
|
|
||||||
builder.append(", sourceConcessione=");
|
|
||||||
builder.append(sourceConcessione);
|
|
||||||
builder.append("]");
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.shared.gis;
|
||||||
|
|
||||||
|
public enum LayerObjectType {
|
||||||
|
BASE_LAYER, PROJECT_LAYER, INDEX_LAYER, GENERIC_LAYER
|
||||||
|
}
|
|
@ -32,9 +32,4 @@
|
||||||
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
|
<url-pattern>/GeoportalDataViewer/geoportaldataviewerservice</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
<listener>
|
|
||||||
<listener-class>org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerHttpSessionListener</listener-class>
|
|
||||||
</listener>
|
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer;
|
||||||
|
|
||||||
|
import org.gcube.application.geoportal.common.model.document.Project;
|
||||||
|
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||||
|
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
|
||||||
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.server.GeoportalDataViewerServiceImpl;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class GeoportalViewer_Tests.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Sep 9, 2022
|
||||||
|
*/
|
||||||
|
public class GeoportalViewer_Tests {
|
||||||
|
|
||||||
|
private UseCaseDescriptorCaller clientUCD;
|
||||||
|
|
||||||
|
private ProjectsCaller clientProjects;
|
||||||
|
|
||||||
|
// private static String CONTEXT = "/pred4s/preprod/preVRE";
|
||||||
|
// private static String TOKEN = ""; //preVRE
|
||||||
|
|
||||||
|
private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||||
|
private static String TOKEN = "c41a00c0-7897-48d2-a67a-05190d6ce5e6-98187548"; // devVRE
|
||||||
|
|
||||||
|
private static String PROFILE_ID = "profiledConcessioni";
|
||||||
|
private static String PROJECT_ID = "6311d408900dde90e44d9265";
|
||||||
|
|
||||||
|
private static String USERNAME = "francesco.mangiacrapa";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the client.
|
||||||
|
*
|
||||||
|
* @return the client
|
||||||
|
*/
|
||||||
|
@Before
|
||||||
|
public void getClient() {
|
||||||
|
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
clientUCD = GeoportalClientCaller.useCaseDescriptors();
|
||||||
|
clientProjects = GeoportalClientCaller.projects();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void getPreviewObjectForID() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
Project project = clientProjects.getProjectByID(PROFILE_ID, PROJECT_ID);
|
||||||
|
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
||||||
|
ProjectDV projectDV = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
|
||||||
|
|
||||||
|
ScopeProvider.instance.set(CONTEXT);
|
||||||
|
SecurityTokenProvider.instance.set(TOKEN);
|
||||||
|
GeoportalDataViewerServiceImpl gdvsi = new GeoportalDataViewerServiceImpl();
|
||||||
|
|
||||||
|
ProjectView projectView = gdvsi.loadProjectView(projectDV, CONTEXT, USERNAME);
|
||||||
|
System.out.println(projectView);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue