Merge pull request 'update_facility' (!9) from update_facility into master

Reviewed-on: #9
This commit is contained in:
Francesco Mangiacrapa 2022-11-28 17:45:17 +01:00
commit c9ac22c74e
23 changed files with 633 additions and 150 deletions

View File

@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- [#23955] Implemented the Temporal facility to navigate temporal relations among (JSON) Projects - [#23955] Implemented the Temporal facility to navigate temporal relations among (JSON) Projects
- [#24028] Passed the spatial dimension to CMS-Project model - [#24028] Passed the spatial dimension to CMS-Project model
- [#24136] Integrated the temporal dimension on the front-end side - [#24136] Integrated the temporal dimension on the front-end side
- [#24195] Integrated the temporal query
## [v2.4.1-SNAPSHOT] - 2022-09-28 ## [v2.4.1-SNAPSHOT] - 2022-09-28

View File

@ -6,7 +6,6 @@ import java.util.Set;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON; import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
@ -52,6 +51,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPa
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineManagerStatus; import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineManagerStatus;
import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack; 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.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse; import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration; import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
@ -71,12 +71,13 @@ import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Timer;
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.FlowPanel;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate; import ol.Coordinate;
import ol.layer.Image;
/** /**
* Entry point classes define <code>onModuleLoad()</code>. * Entry point classes define <code>onModuleLoad()</code>.
@ -163,8 +164,9 @@ public class GeoportalDataViewer implements EntryPoint {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
// TODO Auto-generated method stub RootPanel.get(APP_DIV).remove(loaderApp);
Window.alert(caught.getMessage());
RootPanel.get(APP_DIV).add(getGeneralErrorPanel());
} }
@Override @Override
@ -193,7 +195,9 @@ public class GeoportalDataViewer implements EntryPoint {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
RootPanel.get(APP_DIV).remove(loaderApp);
Window.alert(caught.getMessage()); Window.alert(caught.getMessage());
RootPanel.get(APP_DIV).add(getGeneralErrorPanel());
} }
@Override @Override
@ -320,6 +324,7 @@ public class GeoportalDataViewer implements EntryPoint {
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) { if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
GWT.log("Unexpected empty indexes in collection " + toOpen); GWT.log("Unexpected empty indexes in collection " + toOpen);
Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + "."); Window.alert("Cannot open collection index layer for " + toOpen.getUcd().getName() + ".");
return;
} }
// TODO Get Default Index Layer // TODO Get Default Index Layer
// For now we just take the first - only 1 is expected // For now we just take the first - only 1 is expected
@ -633,26 +638,55 @@ public class GeoportalDataViewer implements EntryPoint {
if (searchPerformedEvent != null) { if (searchPerformedEvent != null) {
LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap(); LinkedHashMap<String, ol.layer.Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
String firstWMSKey = wmsMap.keySet().iterator().next(); String firstWMSKey = wmsMap.keySet().iterator().next();
List<? extends DocumentDV> result = searchPerformedEvent.getData(); List<String> result = searchPerformedEvent.getListProjectIDs();
ViewerConfiguration viewerConfig = GeoportalDataViewer.getStatus().getViewerConfig();
String layerName = null;
try {
GCubeCollection toOpen = viewerConfig.getAvailableCollections().get(searchPerformedEvent.getProfileID());
// Check if indexes is empty
if (toOpen.getIndexes() == null || toOpen.getIndexes().isEmpty()) {
GWT.log("SearchPerformedEvent Unexpected empty indexes in collection " + toOpen);
return;
}
// TODO Get Default Index Layer
// For now we just take the first - only 1 is expected
IndexLayerDV layer = toOpen.getIndexes().get(0);
// Open Index Layer
String wmsLink = layer.getLayer().getOgcLinks().get("wms");
layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
}catch (Exception e) {
// TODO: handle exception
}
String setCqlFilter = null; //default
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN("; String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN(";
for (DocumentDV documentDV : result) { for (String projectId : result) {
cqlFilter += "'" + documentDV.getProjectID() + "',"; cqlFilter += "'" + projectId + "',";
} }
cqlFilter = cqlFilter.substring(0, cqlFilter.length() - 1) + ")"; cqlFilter = cqlFilter.substring(0, cqlFilter.length() - 1) + ")";
setCqlFilter = cqlFilter;
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter); olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
} else { } else {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null); olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
setCqlFilter = null; //is already null
} }
if (searchPerformedEvent.isSearchReset()) { if (searchPerformedEvent.isSearchReset()) {
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null); olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
setCqlFilter = null; //is already null
} }
if(layerName!=null)
layerManager.setCQLForLayerToIndexLayer(layerName, setCqlFilter);
} }
} }
@ -722,4 +756,16 @@ public class GeoportalDataViewer implements EntryPoint {
timer.schedule(3000); timer.schedule(3000);
} }
private FlowPanel getGeneralErrorPanel() {
Image geoportalError = new Image(GNAImages.ICONS.geoportaServiceError());
FlowPanel errorPanelMsg = new FlowPanel();
errorPanelMsg.getElement().addClassName("general_error");
errorPanelMsg.add(geoportalError);
errorPanelMsg.add(new HTML("D4S GeoPortal"));
HTML erroMessage = new HTML(
"Oops something went wrong, please refresh and try again. Feel free to contact us if the problem persists");
errorPanelMsg.add(erroMessage);
return errorPanelMsg;
}
} }

View File

@ -5,7 +5,6 @@ import java.util.List;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter; import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON; import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
@ -13,6 +12,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap; import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse; import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration; 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;
@ -138,7 +138,7 @@ public interface GeoportalDataViewerService extends RemoteService {
* @return the list projects * @return the list projects
* @throws Exception the exception * @throws Exception the exception
*/ */
ResultSetPaginatedData getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter, ResultSetPaginatedDataIDs getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService) throws Exception; boolean reloadFromService) throws Exception;
/** /**

View File

@ -5,7 +5,6 @@ import java.util.List;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter; import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON; import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
@ -13,6 +12,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap; import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult; import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse; import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration; 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;
@ -64,7 +64,7 @@ public interface GeoportalDataViewerServiceAsync {
void getProjectViewForId(String profileID, String projectID, AsyncCallback<ProjectView> callback); void getProjectViewForId(String profileID, String projectID, AsyncCallback<ProjectView> callback);
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<ResultSetPaginatedDataIDs> callback);
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback); void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);

View File

@ -537,6 +537,16 @@ public class LayerManager {
}); });
} }
public void setCQLForLayerToIndexLayer(String layerName, String cqlFilter) {
LayerObject theLo = mapIndexLayerObjects.get(layerName);
if(theLo!=null) {
boolean isCQLFilter = cqlFilter!=null;
theLo.getLayerItem().setCqlFilter(cqlFilter);
theLo.getLayerItem().setCqlFilterAvailable(isCQLFilter);
}
}
/** /**
* Adds the index layer. * Adds the index layer.
* *

View File

@ -2,8 +2,6 @@ package org.gcube.portlets.user.geoportaldataviewer.client.events;
import java.util.List; import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.event.shared.GwtEvent;
/** /**
@ -15,17 +13,20 @@ import com.google.gwt.event.shared.GwtEvent;
*/ */
public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler> { public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler> {
public static Type<SearchPerformedEventHandler> TYPE = new Type<SearchPerformedEventHandler>(); public static Type<SearchPerformedEventHandler> TYPE = new Type<SearchPerformedEventHandler>();
private List<? extends DocumentDV> data; private List<String> listProjectIDs;
private boolean searchReset; private boolean searchReset;
private String profileID;
/** /**
* Instantiates a new search performed event. * Instantiates a new search performed event.
* *
* @param data the data * @param profileID the profile ID
* @param listProjectIds the list project ids
* @param searchReset the search reset * @param searchReset the search reset
*/ */
public SearchPerformedEvent(List<? extends DocumentDV> data, boolean searchReset) { public SearchPerformedEvent(String profileID, List<String> listProjectIds, boolean searchReset) {
this.data = data; this.profileID = profileID;
this.listProjectIDs = listProjectIds;
this.searchReset = searchReset; this.searchReset = searchReset;
} }
@ -51,12 +52,21 @@ public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler>
} }
/** /**
* Gets the data. * Gets the profile ID. It is equal to collectionID
* *
* @return the data * @return the profile ID
*/ */
public List<? extends DocumentDV> getData() { public String getProfileID() {
return data; return profileID;
}
/**
* Gets the list project Ids.
*
* @return the list project Ids
*/
public List<String> getListProjectIDs() {
return listProjectIDs;
} }
/** /**

View File

@ -53,4 +53,7 @@ public interface GNAImages extends ClientBundle {
@Source("spinner_clock.gif") @Source("spinner_clock.gif")
ImageResource spinnerClock(); ImageResource spinnerClock();
@Source("geoporta_error.png")
ImageResource geoportaServiceError();
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -16,11 +16,13 @@ import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV; import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent; import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon; import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil; import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import com.github.gwtbootstrap.client.ui.Alert; import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
@ -59,6 +61,8 @@ import com.google.gwt.user.client.ui.Widget;
*/ */
public class SearchFacilityUI extends Composite { public class SearchFacilityUI extends Composite {
private static final int SEARCHING_LIMIT_RESULTS_TO = 50;
private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class); private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class);
protected static final int MIN_LENGHT_SERCHING_STRING = 3; protected static final int MIN_LENGHT_SERCHING_STRING = 3;
@ -140,7 +144,7 @@ public class SearchFacilityUI extends Composite {
resetSearch.setType(ButtonType.LINK); resetSearch.setType(ButtonType.LINK);
listBoxSortBy.setWidth("180px"); listBoxSortBy.setWidth("180px");
listBoxSearchFor.setWidth("140px"); // listBoxSearchFor.setWidth("140px");
bindEvents(); bindEvents();
} }
@ -238,7 +242,7 @@ public class SearchFacilityUI extends Composite {
resetSearch.setVisible(false); resetSearch.setVisible(false);
panelResults.clear(); panelResults.clear();
latestResult = null; latestResult = null;
appManagerBus.fireEvent(new SearchPerformedEvent(null, true)); appManagerBus.fireEvent(new SearchPerformedEvent(profileID, null, true));
setSearchEnabled(false); setSearchEnabled(false);
} }
@ -264,8 +268,8 @@ public class SearchFacilityUI extends Composite {
panelResults.clear(); panelResults.clear();
panelResults.add(new HTML("<hr>")); panelResults.add(new HTML("<hr>"));
panelResults.add(new LoaderIcon("Searching...")); panelResults.add(new LoaderIcon("Searching..."));
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0, 30, filter, false, GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0, SEARCHING_LIMIT_RESULTS_TO,
new AsyncCallback<ResultSetPaginatedData>() { filter, false, new AsyncCallback<ResultSetPaginatedDataIDs>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -280,9 +284,9 @@ public class SearchFacilityUI extends Composite {
} }
@Override @Override
public void onSuccess(ResultSetPaginatedData result) { public void onSuccess(ResultSetPaginatedDataIDs result) {
appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(), false)); appManagerBus.fireEvent(new SearchPerformedEvent(profileID, result.getResultSetProjectIDs(), false));
setSearchEnabled(true); setSearchEnabled(true);
latestResult = result; latestResult = result;
@ -295,6 +299,28 @@ public class SearchFacilityUI extends Composite {
return; return;
} }
int allItems = result.getResultSetProjectIDs().size();
int returnedItems = result.getData().size();
String message = "";
if (allItems > returnedItems) {
message = "Too many results found. Below are " + returnedItems + " out of " + allItems
+ " results";
} else if (returnedItems>0){
message = "Found " + returnedItems;
message += returnedItems > 0 ? " items" : " item";
}
if (returnedItems>0) {
message += ". Projects (with a centroid) matching your search are shown on the Map";
}
HTML resultMessage = new HTML(message);
resultMessage.getElement().addClassName("search_result_msg");
panelResults.add(resultMessage);
FlexTable ft = new FlexTable(); FlexTable ft = new FlexTable();
ft.getElement().setClassName("table-results"); ft.getElement().setClassName("table-results");
int i = 0; int i = 0;
@ -327,9 +353,11 @@ public class SearchFacilityUI extends Composite {
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(), GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
profileID); profileID);
//here
appManagerBus.fireEvent(new ClosedViewDetailsEvent());
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true)); appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true));
appManagerBus appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(profileID,
.fireEvent(new ShowPopupOnCentroiEvent(profileID, resultDoc.getProjectID(), resultDoc.getSpatialReference())); resultDoc.getProjectID(), resultDoc.getSpatialReference()));
} }
}); });

View File

@ -20,6 +20,10 @@
margin-right: 23px; margin-right: 23px;
} }
.listBoxSearchForStyle {
margin-right: 5px;
}
.margin-top-5 { .margin-top-5 {
margin-top: 5px; margin-top: 5px;
} }
@ -35,7 +39,7 @@
<g:Label addStyleNames="{style.add-margin-right}">Search for: </g:Label> <g:Label addStyleNames="{style.add-margin-right}">Search for: </g:Label>
<b:ListBox title="Search for" <b:ListBox title="Search for"
ui:field="listBoxSearchFor" ui:field="listBoxSearchFor"
addStyleNames="{style.add-margin-right}"> addStyleNames="{style.listBoxSearchForStyle}">
</b:ListBox> </b:ListBox>
<b:TextBox ui:field="searchField" <b:TextBox ui:field="searchField"
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox> addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>

View File

@ -1,12 +1,11 @@
package org.gcube.portlets.user.geoportaldataviewer.client.util; package org.gcube.portlets.user.geoportaldataviewer.client.util;
// TODO: Auto-generated Javadoc
/** /**
* The Class URLUtil. * The Class URLUtil.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Oct 29, 2020 * Nov 28, 2022
*/ */
public class URLUtil { public class URLUtil {
@ -19,7 +18,8 @@ public class URLUtil {
*/ */
public static String getValueOfParameter(String paramName, String url) { public static String getValueOfParameter(String paramName, String url) {
// logger.trace("finding: "+wmsParam +" into "+url); // logger.trace("finding: "+wmsParam +" into "+url);
int index = url.toLowerCase().indexOf(paramName.toLowerCase()+"="); //ADDING CHAR "=" IN TAIL TO BE SECURE IT IS A PARAMETER int index = url.toLowerCase().indexOf(paramName.toLowerCase() + "="); // ADDING CHAR "=" IN TAIL TO BE SECURE IT
// IS A PARAMETER
// logger.trace("start index of "+wmsParam+ " is: "+index); // logger.trace("start index of "+wmsParam+ " is: "+index);
String value = ""; String value = "";
if (index > -1) { if (index > -1) {
@ -35,7 +35,6 @@ public class URLUtil {
return value; return value;
} }
/** /**
* Adds the parameter to query string. * Adds the parameter to query string.
* *
@ -45,7 +44,8 @@ public class URLUtil {
* @param suffixAmpersand the suffix ampersand * @param suffixAmpersand the suffix ampersand
* @return the string * @return the string
*/ */
public static String addParameterToQueryString(String key, String value, boolean prefixAmpersand, boolean suffixAmpersand) { public static String addParameterToQueryString(String key, String value, boolean prefixAmpersand,
boolean suffixAmpersand) {
String queryParameter = ""; String queryParameter = "";
@ -61,7 +61,6 @@ public class URLUtil {
} }
/** /**
* Sets the value of parameter. * Sets the value of parameter.
* *
@ -75,14 +74,17 @@ public class URLUtil {
String toLowerWmsLink = wmsLink.toLowerCase(); String toLowerWmsLink = wmsLink.toLowerCase();
String toLowerWmsParam = wmsParam.toLowerCase(); String toLowerWmsParam = wmsParam.toLowerCase();
int index = toLowerWmsLink.indexOf(toLowerWmsParam+"="); //END WITH CHAR "=" TO BE SURE THAT IT IS A PARAMETER int index = toLowerWmsLink.indexOf(toLowerWmsParam + "="); // END WITH CHAR "=" TO BE SURE THAT IT IS A
// PARAMETER
if (index > -1) { if (index > -1) {
int indexStartValue = index + toLowerWmsParam.length() + 1; // add +1 for char '=' int indexStartValue = index + toLowerWmsParam.length() + 1; // add +1 for char '='
int indexOfSeparator = toLowerWmsLink.indexOf("&", indexStartValue); //GET THE FIRST "&" STARTING FROM INDEX VALUE int indexOfSeparator = toLowerWmsLink.indexOf("&", indexStartValue); // GET THE FIRST "&" STARTING FROM
// INDEX VALUE
// logger.trace("indexOfSeparator index of "+wmsParam+ " is: "+indexOfSeparator); // logger.trace("indexOfSeparator index of "+wmsParam+ " is: "+indexOfSeparator);
int indexEndValue = indexOfSeparator != -1 ? indexOfSeparator : toLowerWmsLink.length(); int indexEndValue = indexOfSeparator != -1 ? indexOfSeparator : toLowerWmsLink.length();
// logger.trace("end: "+indexEndValue); // logger.trace("end: "+indexEndValue);
return wmsLink.substring(0, indexStartValue) + newValue +wmsLink.substring(indexEndValue, wmsLink.length()); return wmsLink.substring(0, indexStartValue) + newValue
+ wmsLink.substring(indexEndValue, wmsLink.length());
} else if (addIfNotExists) { } else if (addIfNotExists) {
wmsLink += "&" + wmsParam + "=" + newValue; wmsLink += "&" + wmsParam + "=" + newValue;
} }
@ -98,7 +100,8 @@ public class URLUtil {
* @return the string * @return the string
*/ */
public static String extractValueOfParameterFromURL(String paramName, String url) { public static String extractValueOfParameterFromURL(String paramName, String url) {
int index = url.toLowerCase().indexOf(paramName.toLowerCase() + "="); // ADDING CHAR "=" IN TAIL TO BE SURE THAT IT int index = url.toLowerCase().indexOf(paramName.toLowerCase() + "="); // ADDING CHAR "=" IN TAIL TO BE SURE THAT
// IT
// IS A PARAMETER // IS A PARAMETER
String value = ""; String value = "";
if (index > -1) { if (index > -1) {
@ -114,5 +117,4 @@ public class URLUtil {
return value; return value;
} }
} }

View File

@ -12,6 +12,9 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import javax.servlet.ServletConfig; import javax.servlet.ServletConfig;
import javax.servlet.ServletException; import javax.servlet.ServletException;
@ -34,7 +37,6 @@ import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller; import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile; import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter; import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV; import org.gcube.application.geoportalcommon.shared.geoportal.ConfigurationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
@ -64,6 +66,7 @@ import org.gcube.portlets.user.geoportaldataviewer.server.util.TemporalComparato
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection; 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.ItemFieldsResponse; import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration; import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError; 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;
@ -516,7 +519,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds); listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error on reading handlerIds: " + handlersIds + ", in the UCDs", e); LOG.error("Error on reading handlerIds: " + handlersIds + ", in the UCDs", e);
return null; throw e;
} }
if (listUseCaseDescriptor == null) { if (listUseCaseDescriptor == null) {
@ -627,7 +630,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
* @throws Exception the exception * @throws Exception the exception
*/ */
@Override @Override
public ResultSetPaginatedData getListProjects(String theProfileID, Integer start, Integer limit, public ResultSetPaginatedDataIDs getListProjects(String theProfileID, Integer start, Integer limit,
SearchingFilter filter, boolean reloadFromService) throws Exception { SearchingFilter filter, boolean reloadFromService) throws Exception {
LOG.info("getListProjects called with profileID: " + theProfileID + ", start: " + start + ", limit: " + limit LOG.info("getListProjects called with profileID: " + theProfileID + ", start: " + start + ", limit: " + limit
+ ", filter: " + filter); + ", filter: " + filter);
@ -637,6 +640,16 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
ProjectsCaller client = GeoportalClientCaller.projects(); ProjectsCaller client = GeoportalClientCaller.projects();
SessionUtil.getCurrentContext(getThreadLocalRequest(), true); SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
// Saving client PROJECTION
LinkedHashMap<String, Object> originalProjection = filter.getProjection();
// Setting PROJECTION ONLY FOR PROEJCT ID
LinkedHashMap<String, Object> projectionForIDs = new LinkedHashMap<String, Object>();
projectionForIDs.put(Project.ID, 1);
filter.setProjection(projectionForIDs);
ResultSetPaginatedDataIDs searchedDataIDs = new ResultSetPaginatedDataIDs();
Integer totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(), Integer totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(),
theProfileID); theProfileID);
@ -645,45 +658,66 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
SessionUtil.setTotalDocumentForProfileID(getThreadLocalRequest(), theProfileID, totalProjectForProfile); SessionUtil.setTotalDocumentForProfileID(getThreadLocalRequest(), theProfileID, totalProjectForProfile);
} }
searchedDataIDs.setTotalItems(totalProjectForProfile);
LOG.info("Total Docs read from config: " + totalProjectForProfile); LOG.info("Total Docs read from config: " + totalProjectForProfile);
Iterator<Project> projects = client.queryOnMongo(theProfileID, totalProjectForProfile, start, limit, // FIRST QUERY TO RETRIEVE IDs
// LIMIT IS NULL MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS
final Iterator<Project> projectsIDs = client.queryOnMongo(theProfileID, totalProjectForProfile, start, null,
filter); filter);
ResultSetPaginatedData searchedData = new ResultSetPaginatedData(start, limit, false); //Getting the Project IDs from the Iterable
searchedData.setTotalItems(totalProjectForProfile); Iterable<Project> itP = () -> projectsIDs;
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
searchedDataIDs.setResultSetProjectIDs(listProjectIDs);
//Total number of Projects are exactly listProjectIDs.size()
int totalItems = listProjectIDs.size();
searchedDataIDs.setTotalItems(totalItems);
LOG.info("Total IDs read from query: " + totalItems);
//NOW PERFORMING THE (REAL) SECOND QUERY FROM CLIENT
// SETTING ORIGINAL PROJECTION FROM CLIENT
filter.setProjection(originalProjection);
// LIMIT IS FROM CLIENT
Iterator<Project> projects = client.queryOnMongo(theProfileID, totalItems, start, limit,
filter);
searchedDataIDs.setClientStartIndex(start);
searchedDataIDs.setLimit(limit);
searchedDataIDs.setServerSearchFinished(false);
List<ResultDocumentDV> toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects); List<ResultDocumentDV> toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects);
searchedDataIDs.setData(toReturnList);
searchedData.setData(toReturnList);
// TODO BUGGY WORKAROUND. BLOCKED BY #22487 IT MUST BE REMOVE AFTER THE QUERY // TODO BUGGY WORKAROUND. BLOCKED BY #22487 IT MUST BE REMOVE AFTER THE QUERY
// COUNT // COUNT
// AND LIST.SIZE BY QUERY WILL BE AVAILABLE IN THE SERVICE // AND LIST.SIZE BY QUERY WILL BE AVAILABLE IN THE SERVICE
if (filter.getConditions() != null) { // if (filter.getConditions() != null) {
searchedData.setTotalItems(toReturnList.size()); // searchedDataIDs.setTotalItems(toReturnList.size());
int totalItems = toReturnList.size(); // int totalItems = searchedDataIDs.getResultSetProjectIDs().size();
searchedData.setTotalItems(totalItems); // searchedDataIDs.setTotalItems(totalItems);
} // }
if (totalProjectForProfile == limit || totalProjectForProfile == 0) { if (totalProjectForProfile == limit || totalProjectForProfile == 0) {
LOG.debug("Page completed returning " + totalProjectForProfile + " projects"); LOG.debug("Page completed returning " + totalProjectForProfile + " projects");
int newOffset = start + limit; int newOffset = start + limit;
searchedData.setServerSearchFinished(newOffset > totalProjectForProfile || totalProjectForProfile == 0); searchedDataIDs
LOG.debug("is Search finished: " + searchedData.isServerSearchFinished()); .setServerSearchFinished(newOffset > totalProjectForProfile || totalProjectForProfile == 0);
LOG.debug("is Search finished: " + searchedDataIDs.isServerSearchFinished());
} }
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("returning {}", searchedData.getData()); LOG.debug("returning {}", searchedDataIDs.getData());
} }
List<? extends DocumentDV> data = searchedData.getData(); List<? extends DocumentDV> data = searchedDataIDs.getData();
if (data != null) { if (data != null) {
LOG.info("returning {} project/s", data.size()); LOG.info("returning {} project/s", data.size());
} }
return searchedData; return searchedDataIDs;
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error on loading paginated and filtered list of projects for id: ", e); LOG.error("Error on loading paginated and filtered list of projects for id: ", e);
@ -1094,7 +1128,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
throw new Exception(erroMsg); throw new Exception(erroMsg);
} }
LOG.info("returning " + listDAO.size() + " geona data objects");
if(LOG.isDebugEnabled())
LOG.info("returning " + listDAO + " geona data objects"); LOG.info("returning " + listDAO + " geona data objects");
return listDAO; return listDAO;
} }

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.function.Function;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.geoportal.client.utils.Serialization; import org.gcube.application.geoportal.client.utils.Serialization;
@ -112,14 +113,18 @@ public class Geoportal_JSON_Mapper {
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder() com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
.jsonProvider(new JsonOrgJsonProvider()).build(); .jsonProvider(new JsonOrgJsonProvider()).build();
List<MetaDataProfileBeanExt> listProfileBeansExt = new ArrayList<MetaDataProfileBeanExt>(); //LinkedHashMap<Integer, MetaDataProfileBeanExt> mapOfProfilesBeanExt = new LinkedHashMap<Integer, MetaDataProfileBeanExt>();
ArrayList<MetaDataProfileBeanExt> listOfProfilesBeanExt = new ArrayList<MetaDataProfileBeanExt>();
// Reading the Project according to list of Profile defined in the UCD // Reading the Project according to list of Profile defined in the UCD
for (GcubeProfilesMetadataForUCD gcubeProfileMetaForUCD : listProfilesBean) { for (GcubeProfilesMetadataForUCD gcubeProfileMetaForUCD : listProfilesBean) {
GcubeProfileDV gcubeProfileDV = gcubeProfileMetaForUCD.getGcubeProfile(); GcubeProfileDV gcubeProfileDV = gcubeProfileMetaForUCD.getGcubeProfile();
SectionView sectionView = new SectionView(); // SectionView sectionView = new SectionView();
sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle()); // sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle());
System.out.println("\n\n##### Sto creando la sezione: "+gcubeProfileDV.getSectionTitle());
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 = "";
@ -174,17 +179,31 @@ public class Geoportal_JSON_Mapper {
List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean(); List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean();
MetaDataProfileBean theProfileBean = theProfileBeans.get(0); MetaDataProfileBean theProfileBean = theProfileBeans.get(0);
//Creating the corresponding MetaDataProfileBeanExt
// For each bson.Document filling the MetaDataProfileBean and its file
for (int i = 0; i < listBSONDocument.size(); i++) {
System.out.println("DOCUMENT number "+i+ " of the section: "+theProfileBean.getTitle());
MetaDataProfileBeanExt theProfileBeanExt = new MetaDataProfileBeanExt(); MetaDataProfileBeanExt theProfileBeanExt = new MetaDataProfileBeanExt();
theProfileBeanExt.setCategories(theProfileBean.getCategories()); theProfileBeanExt.setCategories(theProfileBean.getCategories());
theProfileBeanExt.setTitle(theProfileBean.getTitle()); theProfileBeanExt.setTitle(theProfileBean.getTitle());
theProfileBeanExt.setType(theProfileBean.getType()); theProfileBeanExt.setType(theProfileBean.getType());
// For each bson.Document filling the MetaDataProfileBean and its file // System.out.println("\nPRINTING PROJECT VIEW ON START: ");
for (int i = 0; i < listBSONDocument.size(); i++) { // for (int j = 0; j < listOfProfilesBeanExt.size(); j++) {
Document fromSectionDoc = listBSONDocument.get(i); // MetaDataProfileBeanExt metaDataProfileBeanExt = listOfProfilesBeanExt.get(j);
// System.out.println("MetaDataProfileBeanExt index: " + j + " "+metaDataProfileBeanExt.getType() +" "+metaDataProfileBeanExt.hashCode());
// int z = 0;
// for (MetadataFieldWrapper mfw : metaDataProfileBeanExt.getMetadataFields()) {
// System.out.println("\t MetadataFieldWrapper index: " + z++ + " " + mfw);
// }
// }
Document fromSectionDoc = listBSONDocument.get(i);
LOG.debug("\n\nNew section DOC for index " + i + " is: " + new JSONObject(fromSectionDoc.toJson()).toString(2));
//Creating the corresponding MetaDataProfileBeanExt for each section
//Reading policy and license statically //Reading policy and license statically
//eg. "_access":{"_policy":"OPEN","_license":"CC0-1.0"}} //eg. "_access":{"_policy":"OPEN","_license":"CC0-1.0"}}
Document docAccess = null; Document docAccess = null;
@ -202,12 +221,12 @@ public class Geoportal_JSON_Mapper {
e.printStackTrace(); e.printStackTrace();
} }
//List<MetadataFieldWrapper> copyOfMetadataFields = new ArrayList<MetadataFieldWrapper>(theProfileBean.getMetadataFields());
//int forIndex = 0;
// SubDocumentView subDocumentView = new SubDocumentView(); List<MetadataFieldWrapper> cloneListOfMFW = cloneList(theProfileBean.getMetadataFields());
// Document toSectionDoc = new Document();
// Filling the MetadataFieldWrapper metadata with the for (MetadataFieldWrapper metadataField : cloneListOfMFW) {
// metadataField.getFieldName() as currentValue
for (MetadataFieldWrapper metadataField : theProfileBean.getMetadataFields()) {
String theFieldName = metadataField.getFieldId() != null ? metadataField.getFieldId() String theFieldName = metadataField.getFieldId() != null ? metadataField.getFieldId()
: metadataField.getFieldName(); : metadataField.getFieldName();
@ -222,13 +241,17 @@ public class Geoportal_JSON_Mapper {
metadataField.setCurrentValue(access.getLicense()); metadataField.setCurrentValue(access.getLicense());
} }
} }
//copyOfMetadataFields.set(forIndex++, metadataField);
} }
theProfileBeanExt.setMetadataFields(theProfileBean.getMetadataFields()); LOG.debug("Before assigning it Metadata fields are: "+cloneListOfMFW);
theProfileBeanExt.setMetadataFields(new ArrayList<MetadataFieldWrapper>(cloneListOfMFW));
LOG.debug("Metadata fields are: "+theProfileBeanExt.getMetadataFields());
// Reading filePaths // Reading filePaths
List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths(); List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths();
List<GCubeSDIViewerLayerDV> listLayers = new ArrayList<GCubeSDIViewerLayerDV>();
// READING fileset* field ACCORDING TO filePaths OF THE 'gcubeProfiles' CONFIG // READING fileset* field ACCORDING TO filePaths OF THE 'gcubeProfiles' CONFIG
if (filePaths != null) { if (filePaths != null) {
@ -249,24 +272,73 @@ public class Geoportal_JSON_Mapper {
} }
// Reading Fileset _materializations // Reading Fileset _materializations
// listLayers = readGcubeSDILayersForFileset(filesetJSONPath, //listLayers = readGcubeSDILayersForFileset(filesetJSONPath, fromSectionDocJSON);
// fromSectionDocJSON); //theProfileBeanExt.set
} }
theProfileBeanExt.setListFileset(listFiles); theProfileBeanExt.setListFileset(listFiles);
} }
listProfileBeansExt.add(theProfileBeanExt); System.out.println("\nputting theProfileBeanExt: "+theProfileBeanExt);
listOfProfilesBeanExt.add(theProfileBeanExt);
// System.out.println("\nPRINTING PROJECT VIEW ON END: ");
// for (int j = 0; j < listOfProfilesBeanExt.size(); j++) {
// MetaDataProfileBeanExt metaDataProfileBeanExt = listOfProfilesBeanExt.get(j);
// System.out.println("MetaDataProfileBeanExt index: " + j + " "+metaDataProfileBeanExt.getType() +" "+metaDataProfileBeanExt.hashCode());
// int z = 0;
// for (MetadataFieldWrapper mfw : metaDataProfileBeanExt.getMetadataFields()) {
// System.out.println("\t MetadataFieldWrapper index: " + z++ + " " + mfw);
// }
// }
//
// System.out.println(listProfileBeansExt.get(listProfileBeansExt.size()-1));
//Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView);
} }
} }
projectView.setTheProfileBeans(listProfileBeansExt); projectView.setTheProfileBeans(listOfProfilesBeanExt);
//Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectView);
return projectView; return projectView;
} }
public static List<MetadataFieldWrapper> cloneList(List<MetadataFieldWrapper> list) {
List<MetadataFieldWrapper> listCloned = new ArrayList<MetadataFieldWrapper>(list.size());
Function<MetadataFieldWrapper, MetadataFieldWrapper> cloneWrapper = (mfw) -> {
MetadataFieldWrapper newMfw = new MetadataFieldWrapper();
newMfw.setAsGroup(mfw.getAsGroup());
newMfw.setAsTag(mfw.getAsTag());
newMfw.setCurrentValue(mfw.getCurrentValue());
newMfw.setDefaultValue(mfw.getDefaultValue());
newMfw.setFieldId(mfw.getFieldId());
newMfw.setFieldName(mfw.getFieldName());
newMfw.setFieldNameFromCategory(mfw.getFieldNameFromCategory());
newMfw.setMandatory(mfw.getMandatory());
newMfw.setMaxOccurs(mfw.getMaxOccurs());
newMfw.setMultiSelection(mfw.isMultiSelection());
newMfw.setNote(mfw.getNote());
newMfw.setOwnerCategory(mfw.getOwnerCategory());
newMfw.setType(mfw.getType());
newMfw.setValidator(mfw.getValidator());
newMfw.setVocabulary(mfw.getVocabulary());
return newMfw;
};
for (MetadataFieldWrapper item : list) {
MetadataFieldWrapper cloned = cloneWrapper.apply(item);
listCloned.add(cloned);
}
return listCloned;
}
/** /**
* Load project view. * Load project view.
* *
@ -879,11 +951,12 @@ public class Geoportal_JSON_Mapper {
for (MetaDataProfileBeanExt mpb : projectEdit.getTheProfileBeans()) { for (MetaDataProfileBeanExt mpb : projectEdit.getTheProfileBeans()) {
System.out.println("\n\n###### Title: " + mpb.getTitle() + " - Type: " + mpb.getType() + " ######"); System.out.println("\n\n###### Title: " + mpb.getTitle() + " - Type: " + mpb.getType() + " ######");
int i = 1; int i = 1;
for (MetadataFieldWrapper mfw : mpb.getMetadataFields()) { for (MetadataFieldWrapper fieldWrapper : mpb.getMetadataFields()) {
System.out.println("## " + MetadataFieldWrapper.class.getSimpleName() + " n." + i); System.out.println("## " + MetadataFieldWrapper.class.getSimpleName() + " n." + i);
System.out.println("***** Metadata"); System.out.println("***** Metadata");
// System.out.println(mfw); // System.out.println(mfw);
System.out.println("\tfieldId: " + mfw.getFieldId() +", fieldName: "+mfw.getFieldName() +", CurrentValue: "+mfw.getCurrentValue()); System.out.println("\tfieldId: " + fieldWrapper.getFieldId() + ", fieldName: "
+ fieldWrapper.getFieldName() + ", CurrentValue: " + fieldWrapper.getCurrentValue());
i++; i++;
} }
i = 1; i = 1;
@ -891,6 +964,7 @@ public class Geoportal_JSON_Mapper {
for (FilesetDV fileSet : mpb.getListFileset()) { for (FilesetDV fileSet : mpb.getListFileset()) {
System.out.println("## " + FilesetDV.class.getSimpleName() + " n." + i); System.out.println("## " + FilesetDV.class.getSimpleName() + " n." + i);
System.out.println(fileSet); System.out.println(fileSet);
i++;
} }
} }

View File

@ -19,6 +19,8 @@ public class GisMakers {
public static final String CQL_FILTER_PARAMETER = "CQL_FILTER"; public static final String CQL_FILTER_PARAMETER = "CQL_FILTER";
public static final String GEOM_NAME_BOUNDED = "geom";
// MAP SERVER PIVOT // MAP SERVER PIVOT
public static final String WXS = "wxs"; public static final String WXS = "wxs";
// GEOSERVER PIVOT // GEOSERVER PIVOT
@ -107,12 +109,12 @@ public class GisMakers {
if (layerItem.getCqlFilter() != null && !layerItem.getCqlFilter().isEmpty()) { if (layerItem.getCqlFilter() != null && !layerItem.getCqlFilter().isEmpty()) {
if (layerItem.getCqlFilter().contains("BBOX(the_geom")) { if (layerItem.getCqlFilter().contains("BBOX("+GEOM_NAME_BOUNDED+"")) {
// THE BBOX IS ALREADY USED INTO CQL FILTERING, SO USING IT DIRECTLY // THE BBOX IS ALREADY USED INTO CQL FILTERING, SO USING IT DIRECTLY
link += "&" + CQL_FILTER_PARAMETER + "=" + layerItem.getCqlFilter(); link += "&" + CQL_FILTER_PARAMETER + "=" + layerItem.getCqlFilter();
} else { } else {
// I NEED TO ENCODE THE BBOX INTO CQL FILTERING, // I NEED TO ENCODE THE BBOX INTO CQL FILTERING,
String cqlFilterValue = "BBOX(the_geom," + boundingBox + ")" + " AND " + layerItem.getCqlFilter(); String cqlFilterValue = "BBOX("+GEOM_NAME_BOUNDED+"," + boundingBox + ")" + " AND " + layerItem.getCqlFilter();
link += "&" + CQL_FILTER_PARAMETER + "=" + cqlFilterValue; link += "&" + CQL_FILTER_PARAMETER + "=" + cqlFilterValue;
} }

View File

@ -4,42 +4,126 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
public class MetaDataProfileBeanExt extends MetaDataProfileBean { /**
* The Class MetaDataProfileBeanExt.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 23, 2022
*/
public class MetaDataProfileBeanExt extends MetaDataProfileBean implements Cloneable {
private List<FilesetDV> listFileset = null;
/** /**
* *
*/ */
private static final long serialVersionUID = -7201955007623188104L; private static final long serialVersionUID = 2518128223147908835L;
private List<FilesetDV> listFileset = null;
/**
* Instantiates a new meta data profile bean ext.
*/
public MetaDataProfileBeanExt() { public MetaDataProfileBeanExt() {
super(); super();
} }
/**
* Instantiates a new meta data profile bean ext.
*
* @param type the type
* @param title the title
* @param metadataFields the metadata fields
* @param categories the categories
*/
public MetaDataProfileBeanExt(String type, String title, List<MetadataFieldWrapper> metadataFields, public MetaDataProfileBeanExt(String type, String title, List<MetadataFieldWrapper> metadataFields,
List<CategoryWrapper> categories) { List<CategoryWrapper> categories) {
super(type, title, metadataFields, categories); super(type, title, metadataFields, categories);
} }
/**
* Gets the list fileset.
*
* @return the list fileset
*/
public List<FilesetDV> getListFileset() { public List<FilesetDV> getListFileset() {
if (listFileset == null) if (listFileset == null)
listFileset = new ArrayList<FilesetDV>(); listFileset = new ArrayList<FilesetDV>();
return listFileset; return listFileset;
} }
/**
* Sets the list fileset.
*
* @param listFileset the new list fileset
*/
public void setListFileset(List<FilesetDV> listFileset) { public void setListFileset(List<FilesetDV> listFileset) {
this.listFileset = listFileset; this.listFileset = listFileset;
} }
@Override
protected MetaDataProfileBeanExt clone() throws CloneNotSupportedException {
MetaDataProfileBeanExt clonedMDPBE = new MetaDataProfileBeanExt();
clonedMDPBE.setTitle(this.getTitle());
clonedMDPBE.setType(this.getType());
ArrayList<FilesetDV> newListFileset = new ArrayList<FilesetDV>();
for (FilesetDV filesetDV : this.getListFileset()) {
FilesetDV newFileset = new FilesetDV();
for (PayloadDV payloadDV : filesetDV.getListPayload()) {
PayloadDV newPayloadDV = new PayloadDV();
newPayloadDV.setLink(payloadDV.getLink());
newPayloadDV.setMimetype(payloadDV.getMimetype());
newPayloadDV.setName(payloadDV.getName());
newPayloadDV.setStorageID(payloadDV.getStorageID());
newFileset.addPayloadDV(newPayloadDV);
}
newListFileset.add(newFileset);
}
clonedMDPBE.setListFileset(newListFileset);
ArrayList<MetadataFieldWrapper> newListMetadataFieldWrapper = new ArrayList<MetadataFieldWrapper>();
for (MetadataFieldWrapper mfw : this.getMetadataFields()) {
MetadataFieldWrapper newMfw = new MetadataFieldWrapper();
newMfw.setAsGroup(mfw.getAsGroup());
newMfw.setAsTag(mfw.getAsTag());
newMfw.setCurrentValue(mfw.getCurrentValue());
newMfw.setDefaultValue(mfw.getDefaultValue());
newMfw.setFieldId(mfw.getFieldId());
newMfw.setFieldName(mfw.getFieldName());
newMfw.setFieldNameFromCategory(mfw.getFieldNameFromCategory());
newMfw.setMandatory(mfw.getMandatory());
newMfw.setMaxOccurs(mfw.getMaxOccurs());
newMfw.setMultiSelection(mfw.isMultiSelection());
newMfw.setNote(mfw.getNote());
newMfw.setOwnerCategory(mfw.getOwnerCategory());
newMfw.setType(mfw.getType());
newMfw.setValidator(mfw.getValidator());
newMfw.setVocabulary(mfw.getVocabulary());
newListMetadataFieldWrapper.add(newMfw);
}
clonedMDPBE.setMetadataFields(newListMetadataFieldWrapper);
return clonedMDPBE;
}
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("MetaDataProfileBeanExt [listFileset="); builder.append("MetaDataProfileBeanExt [getType()=");
builder.append(listFileset); builder.append(getType());
builder.append(", getTitle()=");
builder.append(getTitle());
builder.append(", getMetadataFields()=");
builder.append(getMetadataFields());
builder.append("]"); builder.append("]");
return builder.toString(); return builder.toString();
} }

View File

@ -0,0 +1,67 @@
package org.gcube.portlets.user.geoportaldataviewer.shared;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
/**
* The Class ResultSetPaginatedDataIDs.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 25, 2022
*/
public class ResultSetPaginatedDataIDs extends ResultSetPaginatedData {
/**
*
*/
private static final long serialVersionUID = -4847290903890912325L;
private List<String> resultSetProjectIDs;
/**
* Instantiates a new result set paginated data I ds.
*/
public ResultSetPaginatedDataIDs() {
}
public ResultSetPaginatedDataIDs(int offset, int limit, boolean isServerSearchFinished) {
super(offset,limit,isServerSearchFinished);
}
/**
* Gets the result set project I ds.
*
* @return the result set project I ds
*/
public List<String> getResultSetProjectIDs() {
return resultSetProjectIDs;
}
/**
* Sets the result set project I ds.
*
* @param resultSetProjectIDs the new result set project I ds
*/
public void setResultSetProjectIDs(List<String> resultSetProjectIDs) {
this.resultSetProjectIDs = resultSetProjectIDs;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ResultSetPaginatedDataIDs [resultSetProjectIDs=");
builder.append(resultSetProjectIDs);
builder.append("]");
return builder.toString();
}
}

View File

@ -550,6 +550,12 @@ body {
text-align: justify; text-align: justify;
} }
.search_result_msg {
font-size: 12px;
color: gray;
font-style: italic;
}
/** /**
VIS TIMELINE CSS VIS TIMELINE CSS
@ -690,6 +696,22 @@ Table Of Contents (TOC)
visibility: hidden; visibility: hidden;
} }
.general_error {
height: auto;
text-align: center;
font-size: 20px;
margin: 0;
position: absolute;
top: 50%;
width: 100%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.general_error div {
padding: 20px;
}
/****************************** /******************************
RESPONSIVE RESPONSIVE

View File

@ -1,5 +1,5 @@
<display> <display>
<category name="gCube Applications"> <category name="gCube Applications">
<portlet id="GeoPortalDataViewerAppPortlet" /> <portlet id="GeoPortalDataViewerApp" />
</category> </category>
</display> </display>

View File

@ -1,4 +1,4 @@
name=GeoPortalDataViewerAppPortlet name=GeoPortalDataViewerApp
module-group-id=liferay module-group-id=liferay
module-incremental-version=2 module-incremental-version=2
tags= tags=

View File

@ -3,7 +3,7 @@
<liferay-portlet-app> <liferay-portlet-app>
<portlet> <portlet>
<portlet-name>GeoPortalDataViewerAppPortlet</portlet-name> <portlet-name>GeoPortalDataViewerApp</portlet-name>
<layout-cacheable>false</layout-cacheable> <layout-cacheable>false</layout-cacheable>
<instanceable>false</instanceable> <instanceable>false</instanceable>
<ajaxable>false</ajaxable> <ajaxable>false</ajaxable>

View File

@ -1,9 +1,9 @@
<?xml version='1.0' encoding='UTF-8' ?> <?xml version='1.0' encoding='UTF-8' ?>
<portlet-app> <portlet-app>
<portlet> <portlet>
<description>GeoPortalDataViewerApp Portlet</description> <description>GeoPortalDataViewer Application</description>
<portlet-name>GeoPortalDataViewerAppPortlet</portlet-name> <portlet-name>GeoPortalDataViewerApp</portlet-name>
<display-name>GeoPortal-DataViewer-Portlet</display-name> <display-name>GeoPortal-DataViewer-App</display-name>
<portlet-class>org.gcube.portlets.user.geoportaldataviewer.portlet.GeoPortalDataViewerAppPortlet <portlet-class>org.gcube.portlets.user.geoportaldataviewer.portlet.GeoPortalDataViewerAppPortlet
</portlet-class> </portlet-class>
<expiration-cache>0</expiration-cache> <expiration-cache>0</expiration-cache>
@ -12,8 +12,8 @@
<portlet-mode>VIEW</portlet-mode> <portlet-mode>VIEW</portlet-mode>
</supports> </supports>
<portlet-info> <portlet-info>
<title>GeoPortal-DataViewerApp-Portlet</title> <title>GeoPortal DataViewer Application</title>
<short-title>GeoPortal-DataViewerApp-Portlet</short-title> <short-title>GeoPortal DataViewer App</short-title>
</portlet-info> </portlet-info>
<portlet-preferences> <portlet-preferences>
<preference> <preference>

View File

@ -2,7 +2,15 @@ package org.gcube.portlets.user.geoportaldataviewer;
import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors; import static org.gcube.application.geoportal.client.plugins.GeoportalAbstractPlugin.useCaseDescriptors;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.bson.Document; import org.bson.Document;
import org.gcube.application.geoportal.common.model.document.Project; import org.gcube.application.geoportal.common.model.document.Project;
@ -15,6 +23,10 @@ import org.gcube.application.geoportalcommon.geoportal.GeoportalClientCaller;
import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller; import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller; import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
import org.gcube.application.geoportalcommon.geoportal.util.GisUtil; import org.gcube.application.geoportalcommon.geoportal.util.GisUtil;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.WhereClause;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.Crs; import org.gcube.application.geoportalcommon.shared.geoportal.geojson.Crs;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON; import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
@ -43,14 +55,14 @@ public class GeoportalViewer_Tests {
private ProjectsCaller clientProjects; private ProjectsCaller clientProjects;
// private static String CONTEXT = "/pred4s/preprod/preVRE"; private static String CONTEXT = "/pred4s/preprod/preVRE";
// private static String TOKEN = ""; //preVRE private static String TOKEN = "5c3c7551-870d-4259-bd77-a7e603fe4949-980114272"; //preVRE
private static String CONTEXT = "/gcube/devsec/devVRE"; //private static String CONTEXT = "/gcube/devsec/devVRE";
private static String TOKEN = ""; // devVRE //private static String TOKEN = ""; // devVRE
private static String PROFILE_ID = "profiledConcessioni"; private static String PROFILE_ID = "profiledConcessioni";
private static String PROJECT_ID = "6372470aa7b910781daaa8bc"; private static String PROJECT_ID = "637ceb4d21dd0d6fb9f24706";
private static String USERNAME = "francesco.mangiacrapa"; private static String USERNAME = "francesco.mangiacrapa";
@ -59,7 +71,7 @@ public class GeoportalViewer_Tests {
* *
* @return the client * @return the client
*/ */
//@Before @Before
public void getClient() { public void getClient() {
// assumeTrue(GCubeTest.isTestInfrastructureEnabled()); // assumeTrue(GCubeTest.isTestInfrastructureEnabled());
ScopeProvider.instance.set(CONTEXT); ScopeProvider.instance.set(CONTEXT);
@ -207,7 +219,7 @@ public class GeoportalViewer_Tests {
} }
} }
// @Test @Test
public void testReadProjectEdit() { public void testReadProjectEdit() {
try { try {
@ -217,13 +229,15 @@ public class GeoportalViewer_Tests {
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true); ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
projectBuilder.relationships(true); projectBuilder.relationships(true);
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder); ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
Geoportal_JSON_Mapper geojsonM = new Geoportal_JSON_Mapper();
ProjectEdit projectEdit = Geoportal_JSON_Mapper.loadProjectEdit(theProjectDV, CONTEXT, USERNAME); ProjectEdit projectEdit = Geoportal_JSON_Mapper.loadProjectEdit(theProjectDV, CONTEXT, USERNAME);
Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectEdit); Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectEdit);
// ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, CONTEXT, USERNAME); // ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, CONTEXT, USERNAME);
// Geoportal_JSON_Mapper.prettyPrintProjectView(projectView); // Geoportal_JSON_Mapper.prettyPrintProjectView(projectView);
System.out.println("testReadProjectEdit terminated");
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error");
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -259,4 +273,82 @@ public class GeoportalViewer_Tests {
} }
} }
@Test
public void getResultsWithSize() throws Exception {
// List<Project> listOfProjects = client.getListForProfileID(PROFILE_ID);
long start = System.currentTimeMillis();
System.out.println("start at: "+start);
SearchingFilter filter = new SearchingFilter();
// Where Clause
List<WhereClause> conditions = new ArrayList<WhereClause>();
Map<String, Object> searchInto = new HashMap<String, Object>();
searchInto.put("_theDocument.dataInizioProgetto", "2021");
WhereClause whereClause = new WhereClause(LOGICAL_OP.OR, searchInto);
conditions.add(whereClause);
filter.setConditions(conditions);
//NEED TO GET projections
//SETTING PROJECTION ONLY FOR PROEJCT ID
LinkedHashMap<String, Object> projectionForIDs = new LinkedHashMap<String, Object>();
projectionForIDs.put(Project.ID, 1);
filter.setProjection(projectionForIDs);
//LIMIT IS NULL MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS
Integer totalDocs = clientProjects.getTotalDocument(PROFILE_ID);
Iterator<Project> projects = clientProjects.queryOnMongo(PROFILE_ID, totalDocs, 0, null, filter);
//CALCULATING SIZE OF THE ITERATOR OF PROJECT IDs
Iterable<Project> itP = () -> projects;
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
System.out.println("Total Ids are: "+listProjectIDs.size());
//listProjectIDs.stream().forEach(p -> System.out.println(p));
long end = System.currentTimeMillis();
System.out.println("IDS returned in ms: "+(end-start));
//RESETTIG FILTER AND PROJECT TO CLIENT QUERY
LinkedHashMap<String, Object> projection = new LinkedHashMap<String, Object>();
// default
//PROJECTION
projection.put(Project.ID, 1);
projection.put("_theDocument.nome", 1);
projection.put("_profileID", 1);
projection.put("_profileVersion", 1);
projection.put("_version", 1);
projection.put("_theDocument", 1);
projection.put("_theDocument.paroleChiaveLibere", 1);
projection.put("_theDocument.editore", 1);
projection.put("_theDocument.paroleChiaveICCD", 1);
projection.put("_theDocument.responsabile", 1);
projection.put("_theDocument.introduzione", 1);
projection.put("_theDocument.authors", 1);
projection.put("_theDocument.dataInizioProgetto", 1);
filter.setProjection(projection);
//Integer totalDocs = client.getTotalDocument(PROFILE_ID);
Iterator<Project> itProjects = clientProjects.queryOnMongo(PROFILE_ID, totalDocs, 0, 50, filter);
List<ResultDocumentDV> results = ConvertToDataValueObjectModel.toListResultDocument(itProjects);
int i = 0;
for (ResultDocumentDV projectDV : results) {
System.out.println(++i + ") " + projectDV.getId() + " dataInizioProgetto: "+projectDV.getDocumentAsMap().get("dataInizioProgetto"));
}
System.out.println("Result listed has size: "+results.size());
end = System.currentTimeMillis();
System.out.println("Result listed in ms: "+(end-start));
}
} }