Integrated temporal query for YEAR
This commit is contained in:
parent
c4ebdcf003
commit
0764d0770c
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -34,7 +38,11 @@
|
|||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-viewer-app-3.0.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -69,7 +77,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -104,7 +116,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -139,7 +155,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -174,7 +194,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -209,7 +233,14 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
|
||||
<dependent-module archiveName="geoportal-data-common-2.0.0.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -244,7 +275,11 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -279,7 +314,11 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -314,7 +353,11 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
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.materialization.IndexLayerDV;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
|
||||
|
@ -71,12 +70,13 @@ import com.google.gwt.event.shared.HandlerManager;
|
|||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.Window;
|
||||
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.Image;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.layer.Image;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
|
@ -163,8 +163,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -193,7 +194,9 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
RootPanel.get(APP_DIV).remove(loaderApp);
|
||||
Window.alert(caught.getMessage());
|
||||
RootPanel.get(APP_DIV).add(getGeneralErrorPanel());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -615,7 +618,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
||||
|
||||
if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) {
|
||||
GWT.log("ShowPopupOnCentroiEvent: "+showPopupOnCentroiEvent);
|
||||
GWT.log("ShowPopupOnCentroiEvent: " + showPopupOnCentroiEvent);
|
||||
Coordinate transfCoord = MapUtils
|
||||
.geoJSONTToBBoxCenter(showPopupOnCentroiEvent.getSpatialReference(), null, null);
|
||||
|
||||
|
@ -633,14 +636,14 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
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();
|
||||
List<? extends DocumentDV> result = searchPerformedEvent.getData();
|
||||
List<String> result = searchPerformedEvent.getListProjectIDs();
|
||||
|
||||
if (result != null && result.size() > 0) {
|
||||
String cqlFilter = GeoportalDataViewerConstants.PROJECT_ID_KEY_FEATURE + " IN(";
|
||||
for (DocumentDV documentDV : result) {
|
||||
cqlFilter += "'" + documentDV.getProjectID() + "',";
|
||||
for (String projectId : result) {
|
||||
cqlFilter += "'" + projectId + "',";
|
||||
}
|
||||
cqlFilter = cqlFilter.substring(0, cqlFilter.length() - 1) + ")";
|
||||
|
||||
|
@ -722,4 +725,16 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
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.geoportal.geojson.GeoJSON;
|
||||
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.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||
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.gis.BaseMapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
@ -138,7 +138,7 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
* @return the list projects
|
||||
* @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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.util.List;
|
|||
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
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.geoportal.geojson.GeoJSON;
|
||||
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.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
|
||||
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.gis.BaseMapLayer;
|
||||
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 getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
|
||||
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
|
||||
boolean reloadFromService, AsyncCallback<ResultSetPaginatedDataIDs> callback);
|
||||
|
||||
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
|
@ -15,17 +13,17 @@ import com.google.gwt.event.shared.GwtEvent;
|
|||
*/
|
||||
public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler> {
|
||||
public static Type<SearchPerformedEventHandler> TYPE = new Type<SearchPerformedEventHandler>();
|
||||
private List<? extends DocumentDV> data;
|
||||
private List<String> listProjectIDs;
|
||||
private boolean searchReset;
|
||||
|
||||
/**
|
||||
* Instantiates a new search performed event.
|
||||
*
|
||||
* @param data the data
|
||||
* @param searchReset the search reset
|
||||
* @param listProjectIds the list project ids
|
||||
* @param searchReset the search reset
|
||||
*/
|
||||
public SearchPerformedEvent(List<? extends DocumentDV> data, boolean searchReset) {
|
||||
this.data = data;
|
||||
public SearchPerformedEvent(List<String> listProjectIds, boolean searchReset) {
|
||||
this.listProjectIDs = listProjectIds;
|
||||
this.searchReset = searchReset;
|
||||
}
|
||||
|
||||
|
@ -51,12 +49,12 @@ public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler>
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the data.
|
||||
* Gets the list project Ids.
|
||||
*
|
||||
* @return the data
|
||||
* @return the list project Ids
|
||||
*/
|
||||
public List<? extends DocumentDV> getData() {
|
||||
return data;
|
||||
public List<String> getListProjectIDs() {
|
||||
return listProjectIDs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -52,5 +52,8 @@ public interface GNAImages extends ClientBundle {
|
|||
|
||||
@Source("spinner_clock.gif")
|
||||
ImageResource spinnerClock();
|
||||
|
||||
@Source("geoporta_error.png")
|
||||
ImageResource geoportaServiceError();
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
|
@ -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.config.ItemFieldDV;
|
||||
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.ShowDetailsEvent;
|
||||
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.StringUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
|
@ -59,6 +61,8 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
*/
|
||||
public class SearchFacilityUI extends Composite {
|
||||
|
||||
private static final int SEARCHING_LIMIT_RESULTS_TO = 50;
|
||||
|
||||
private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class);
|
||||
|
||||
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
||||
|
@ -140,7 +144,7 @@ public class SearchFacilityUI extends Composite {
|
|||
resetSearch.setType(ButtonType.LINK);
|
||||
|
||||
listBoxSortBy.setWidth("180px");
|
||||
listBoxSearchFor.setWidth("140px");
|
||||
// listBoxSearchFor.setWidth("140px");
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
@ -264,8 +268,8 @@ public class SearchFacilityUI extends Composite {
|
|||
panelResults.clear();
|
||||
panelResults.add(new HTML("<hr>"));
|
||||
panelResults.add(new LoaderIcon("Searching..."));
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0, 30, filter, false,
|
||||
new AsyncCallback<ResultSetPaginatedData>() {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0, SEARCHING_LIMIT_RESULTS_TO,
|
||||
filter, false, new AsyncCallback<ResultSetPaginatedDataIDs>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -280,9 +284,9 @@ public class SearchFacilityUI extends Composite {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResultSetPaginatedData result) {
|
||||
public void onSuccess(ResultSetPaginatedDataIDs result) {
|
||||
|
||||
appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(), false));
|
||||
appManagerBus.fireEvent(new SearchPerformedEvent(result.getResultSetProjectIDs(), false));
|
||||
|
||||
setSearchEnabled(true);
|
||||
latestResult = result;
|
||||
|
@ -295,6 +299,23 @@ public class SearchFacilityUI extends Composite {
|
|||
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. Projects (with a centroid) matching your search are shown on the Map";
|
||||
} else {
|
||||
message = "Found " + returnedItems;
|
||||
message += returnedItems > 0 ? " items" : " item";
|
||||
}
|
||||
|
||||
HTML resultMessage = new HTML(message);
|
||||
resultMessage.getElement().addClassName("search_result_msg");
|
||||
|
||||
panelResults.add(resultMessage);
|
||||
|
||||
FlexTable ft = new FlexTable();
|
||||
ft.getElement().setClassName("table-results");
|
||||
int i = 0;
|
||||
|
@ -327,9 +348,11 @@ public class SearchFacilityUI extends Composite {
|
|||
public void onClick(ClickEvent event) {
|
||||
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
|
||||
profileID);
|
||||
//here
|
||||
appManagerBus.fireEvent(new ClosedViewDetailsEvent());
|
||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, true));
|
||||
appManagerBus
|
||||
.fireEvent(new ShowPopupOnCentroiEvent(profileID, resultDoc.getProjectID(), resultDoc.getSpatialReference()));
|
||||
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(profileID,
|
||||
resultDoc.getProjectID(), resultDoc.getSpatialReference()));
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
margin-right: 23px;
|
||||
}
|
||||
|
||||
.listBoxSearchForStyle {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.margin-top-5 {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
@ -35,7 +39,7 @@
|
|||
<g:Label addStyleNames="{style.add-margin-right}">Search for: </g:Label>
|
||||
<b:ListBox title="Search for"
|
||||
ui:field="listBoxSearchFor"
|
||||
addStyleNames="{style.add-margin-right}">
|
||||
addStyleNames="{style.listBoxSearchForStyle}">
|
||||
</b:ListBox>
|
||||
<b:TextBox ui:field="searchField"
|
||||
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>
|
||||
|
|
|
@ -12,6 +12,9 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
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.ServletException;
|
||||
|
@ -34,7 +37,6 @@ import org.gcube.application.geoportalcommon.geoportal.ProjectsCaller;
|
|||
import org.gcube.application.geoportalcommon.geoportal.UseCaseDescriptorCaller;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
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.geoportal.ConfigurationDV;
|
||||
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.GeoNaSpatialQueryResult;
|
||||
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.faults.ControlledError;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
|
||||
|
@ -516,7 +519,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
listUseCaseDescriptor = client.getListForHandlerIds(handlersIds);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on reading handlerIds: " + handlersIds + ", in the UCDs", e);
|
||||
return null;
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (listUseCaseDescriptor == null) {
|
||||
|
@ -627,7 +630,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@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 {
|
||||
LOG.info("getListProjects called with profileID: " + theProfileID + ", start: " + start + ", limit: " + limit
|
||||
+ ", filter: " + filter);
|
||||
|
@ -637,6 +640,16 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
ProjectsCaller client = GeoportalClientCaller.projects();
|
||||
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(),
|
||||
theProfileID);
|
||||
|
||||
|
@ -645,45 +658,65 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
SessionUtil.setTotalDocumentForProfileID(getThreadLocalRequest(), theProfileID, totalProjectForProfile);
|
||||
}
|
||||
|
||||
searchedDataIDs.setTotalItems(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);
|
||||
|
||||
ResultSetPaginatedData searchedData = new ResultSetPaginatedData(start, limit, false);
|
||||
searchedData.setTotalItems(totalProjectForProfile);
|
||||
//Getting the Project IDs from the Iterable
|
||||
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);
|
||||
|
||||
//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);
|
||||
|
||||
searchedData.setData(toReturnList);
|
||||
searchedDataIDs.setData(toReturnList);
|
||||
|
||||
// TODO BUGGY WORKAROUND. BLOCKED BY #22487 IT MUST BE REMOVE AFTER THE QUERY
|
||||
// COUNT
|
||||
// AND LIST.SIZE BY QUERY WILL BE AVAILABLE IN THE SERVICE
|
||||
if (filter.getConditions() != null) {
|
||||
searchedData.setTotalItems(toReturnList.size());
|
||||
int totalItems = toReturnList.size();
|
||||
searchedData.setTotalItems(totalItems);
|
||||
}
|
||||
// if (filter.getConditions() != null) {
|
||||
// searchedDataIDs.setTotalItems(toReturnList.size());
|
||||
// int totalItems = searchedDataIDs.getResultSetProjectIDs().size();
|
||||
// searchedDataIDs.setTotalItems(totalItems);
|
||||
// }
|
||||
|
||||
if (totalProjectForProfile == limit || totalProjectForProfile == 0) {
|
||||
LOG.debug("Page completed returning " + totalProjectForProfile + " projects");
|
||||
int newOffset = start + limit;
|
||||
searchedData.setServerSearchFinished(newOffset > totalProjectForProfile || totalProjectForProfile == 0);
|
||||
LOG.debug("is Search finished: " + searchedData.isServerSearchFinished());
|
||||
searchedDataIDs
|
||||
.setServerSearchFinished(newOffset > totalProjectForProfile || totalProjectForProfile == 0);
|
||||
LOG.debug("is Search finished: " + searchedDataIDs.isServerSearchFinished());
|
||||
|
||||
}
|
||||
|
||||
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) {
|
||||
LOG.info("returning {} project/s", data.size());
|
||||
}
|
||||
|
||||
return searchedData;
|
||||
return searchedDataIDs;
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on loading paginated and filtered list of projects for id: ", e);
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
|
@ -67,7 +68,7 @@ public class Geoportal_JSON_Mapper {
|
|||
public static final String JSON_$_POINTER = "$";
|
||||
|
||||
public static final String _THEDOCUMENT = "_theDocument";
|
||||
|
||||
|
||||
public static ProjectEdit loadProjectEdit(ProjectDV theProjectDV, String scope, String username) throws Exception {
|
||||
|
||||
String theWholeProjectAsJSON = theProjectDV.getTheDocument().getDocumentAsJSON();
|
||||
|
@ -112,14 +113,18 @@ public class Geoportal_JSON_Mapper {
|
|||
com.jayway.jsonpath.Configuration configuration = com.jayway.jsonpath.Configuration.builder()
|
||||
.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
|
||||
for (GcubeProfilesMetadataForUCD gcubeProfileMetaForUCD : listProfilesBean) {
|
||||
|
||||
|
||||
GcubeProfileDV gcubeProfileDV = gcubeProfileMetaForUCD.getGcubeProfile();
|
||||
SectionView sectionView = new SectionView();
|
||||
sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle());
|
||||
// SectionView sectionView = new SectionView();
|
||||
// sectionView.setSectionTitle(gcubeProfileDV.getSectionTitle());
|
||||
|
||||
System.out.println("\n\n##### Sto creando la sezione: "+gcubeProfileDV.getSectionTitle());
|
||||
LOG.debug("\n\nThe profile is: " + gcubeProfileDV);
|
||||
// Building JSON/section full PATH and section name
|
||||
String sectionJSONPath = "";
|
||||
|
@ -174,17 +179,31 @@ public class Geoportal_JSON_Mapper {
|
|||
List<MetaDataProfileBean> theProfileBeans = gcubeProfileMetaForUCD.getListMetadataProfileBean();
|
||||
MetaDataProfileBean theProfileBean = theProfileBeans.get(0);
|
||||
|
||||
//Creating the corresponding MetaDataProfileBeanExt
|
||||
MetaDataProfileBeanExt theProfileBeanExt = new MetaDataProfileBeanExt();
|
||||
theProfileBeanExt.setCategories(theProfileBean.getCategories());
|
||||
theProfileBeanExt.setTitle(theProfileBean.getTitle());
|
||||
theProfileBeanExt.setType(theProfileBean.getType());
|
||||
|
||||
// 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();
|
||||
theProfileBeanExt.setCategories(theProfileBean.getCategories());
|
||||
theProfileBeanExt.setTitle(theProfileBean.getTitle());
|
||||
theProfileBeanExt.setType(theProfileBean.getType());
|
||||
|
||||
// System.out.println("\nPRINTING PROJECT VIEW ON START: ");
|
||||
// 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);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
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
|
||||
//eg. "_access":{"_policy":"OPEN","_license":"CC0-1.0"}}
|
||||
Document docAccess = null;
|
||||
|
@ -202,12 +221,12 @@ public class Geoportal_JSON_Mapper {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
// SubDocumentView subDocumentView = new SubDocumentView();
|
||||
// Document toSectionDoc = new Document();
|
||||
// Filling the MetadataFieldWrapper metadata with the
|
||||
// metadataField.getFieldName() as currentValue
|
||||
for (MetadataFieldWrapper metadataField : theProfileBean.getMetadataFields()) {
|
||||
//List<MetadataFieldWrapper> copyOfMetadataFields = new ArrayList<MetadataFieldWrapper>(theProfileBean.getMetadataFields());
|
||||
//int forIndex = 0;
|
||||
|
||||
List<MetadataFieldWrapper> cloneListOfMFW = cloneList(theProfileBean.getMetadataFields());
|
||||
|
||||
for (MetadataFieldWrapper metadataField : cloneListOfMFW) {
|
||||
|
||||
String theFieldName = metadataField.getFieldId() != null ? metadataField.getFieldId()
|
||||
: metadataField.getFieldName();
|
||||
|
@ -222,13 +241,17 @@ public class Geoportal_JSON_Mapper {
|
|||
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
|
||||
List<FilePathDV> filePaths = gcubeProfileDV.getFilePaths();
|
||||
List<GCubeSDIViewerLayerDV> listLayers = new ArrayList<GCubeSDIViewerLayerDV>();
|
||||
|
||||
// READING fileset* field ACCORDING TO filePaths OF THE 'gcubeProfiles' CONFIG
|
||||
if (filePaths != null) {
|
||||
|
@ -249,24 +272,73 @@ public class Geoportal_JSON_Mapper {
|
|||
}
|
||||
|
||||
// Reading Fileset _materializations
|
||||
// listLayers = readGcubeSDILayersForFileset(filesetJSONPath,
|
||||
// fromSectionDocJSON);
|
||||
//listLayers = readGcubeSDILayersForFileset(filesetJSONPath, fromSectionDocJSON);
|
||||
//theProfileBeanExt.set
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
|
@ -879,11 +951,12 @@ public class Geoportal_JSON_Mapper {
|
|||
for (MetaDataProfileBeanExt mpb : projectEdit.getTheProfileBeans()) {
|
||||
System.out.println("\n\n###### Title: " + mpb.getTitle() + " - Type: " + mpb.getType() + " ######");
|
||||
int i = 1;
|
||||
for (MetadataFieldWrapper mfw : mpb.getMetadataFields()) {
|
||||
for (MetadataFieldWrapper fieldWrapper : mpb.getMetadataFields()) {
|
||||
System.out.println("## " + MetadataFieldWrapper.class.getSimpleName() + " n." + i);
|
||||
System.out.println("***** Metadata");
|
||||
//System.out.println(mfw);
|
||||
System.out.println("\tfieldId: " + mfw.getFieldId() +", fieldName: "+mfw.getFieldName() +", CurrentValue: "+mfw.getCurrentValue());
|
||||
// System.out.println(mfw);
|
||||
System.out.println("\tfieldId: " + fieldWrapper.getFieldId() + ", fieldName: "
|
||||
+ fieldWrapper.getFieldName() + ", CurrentValue: " + fieldWrapper.getCurrentValue());
|
||||
i++;
|
||||
}
|
||||
i = 1;
|
||||
|
@ -891,6 +964,7 @@ public class Geoportal_JSON_Mapper {
|
|||
for (FilesetDV fileSet : mpb.getListFileset()) {
|
||||
System.out.println("## " + FilesetDV.class.getSimpleName() + " n." + i);
|
||||
System.out.println(fileSet);
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,42 +4,126 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
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.MetaDataProfileBean;
|
||||
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() {
|
||||
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,
|
||||
List<CategoryWrapper> categories) {
|
||||
super(type, title, metadataFields, categories);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list fileset.
|
||||
*
|
||||
* @return the list fileset
|
||||
*/
|
||||
public List<FilesetDV> getListFileset() {
|
||||
if(listFileset==null)
|
||||
if (listFileset == null)
|
||||
listFileset = new ArrayList<FilesetDV>();
|
||||
return listFileset;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the list fileset.
|
||||
*
|
||||
* @param listFileset the new list fileset
|
||||
*/
|
||||
public void setListFileset(List<FilesetDV> 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
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("MetaDataProfileBeanExt [listFileset=");
|
||||
builder.append(listFileset);
|
||||
builder.append("MetaDataProfileBeanExt [getType()=");
|
||||
builder.append(getType());
|
||||
builder.append(", getTitle()=");
|
||||
builder.append(getTitle());
|
||||
builder.append(", getMetadataFields()=");
|
||||
builder.append(getMetadataFields());
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -550,6 +550,12 @@ body {
|
|||
text-align: justify;
|
||||
}
|
||||
|
||||
.search_result_msg {
|
||||
font-size: 12px;
|
||||
color: gray;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
VIS TIMELINE CSS
|
||||
|
@ -690,6 +696,22 @@ Table Of Contents (TOC)
|
|||
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
|
||||
|
|
|
@ -2,7 +2,15 @@ package org.gcube.portlets.user.geoportaldataviewer;
|
|||
|
||||
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.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.bson.Document;
|
||||
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.UseCaseDescriptorCaller;
|
||||
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.GeoJSON;
|
||||
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
|
||||
|
@ -43,14 +55,14 @@ public class GeoportalViewer_Tests {
|
|||
|
||||
private ProjectsCaller clientProjects;
|
||||
|
||||
// private static String CONTEXT = "/pred4s/preprod/preVRE";
|
||||
// private static String TOKEN = ""; //preVRE
|
||||
private static String CONTEXT = "/pred4s/preprod/preVRE";
|
||||
private static String TOKEN = "5c3c7551-870d-4259-bd77-a7e603fe4949-980114272"; //preVRE
|
||||
|
||||
private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||
private static String TOKEN = ""; // devVRE
|
||||
//private static String CONTEXT = "/gcube/devsec/devVRE";
|
||||
//private static String TOKEN = ""; // devVRE
|
||||
|
||||
private static String PROFILE_ID = "profiledConcessioni";
|
||||
private static String PROJECT_ID = "6372470aa7b910781daaa8bc";
|
||||
private static String PROJECT_ID = "637ceb4d21dd0d6fb9f24706";
|
||||
|
||||
private static String USERNAME = "francesco.mangiacrapa";
|
||||
|
||||
|
@ -59,7 +71,7 @@ public class GeoportalViewer_Tests {
|
|||
*
|
||||
* @return the client
|
||||
*/
|
||||
//@Before
|
||||
@Before
|
||||
public void getClient() {
|
||||
// assumeTrue(GCubeTest.isTestInfrastructureEnabled());
|
||||
ScopeProvider.instance.set(CONTEXT);
|
||||
|
@ -207,7 +219,7 @@ public class GeoportalViewer_Tests {
|
|||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
@Test
|
||||
public void testReadProjectEdit() {
|
||||
|
||||
try {
|
||||
|
@ -217,13 +229,15 @@ public class GeoportalViewer_Tests {
|
|||
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
|
||||
projectBuilder.relationships(true);
|
||||
ProjectDV theProjectDV = ConvertToDataValueObjectModel.toProjectDV(theProject, projectBuilder);
|
||||
Geoportal_JSON_Mapper geojsonM = new Geoportal_JSON_Mapper();
|
||||
ProjectEdit projectEdit = Geoportal_JSON_Mapper.loadProjectEdit(theProjectDV, CONTEXT, USERNAME);
|
||||
Geoportal_JSON_Mapper.prettyPrintProjectEdit(projectEdit);
|
||||
|
||||
// ProjectView projectView = Geoportal_JSON_Mapper.loadProjectView(theProjectDV, CONTEXT, USERNAME);
|
||||
// Geoportal_JSON_Mapper.prettyPrintProjectView(projectView);
|
||||
|
||||
System.out.println("testReadProjectEdit terminated");
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -258,5 +272,83 @@ public class GeoportalViewer_Tests {
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue