From 869b13d5fe8d44e2cd6d6426b8dabc5ac4342fd6 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 16 Jun 2023 15:14:15 +0200 Subject: [PATCH] bug fixed the search facility [#25265] --- .classpath | 4 +- .../com.gwtplugins.gdt.eclipse.core.prefs | 2 +- .settings/org.eclipse.wst.common.component | 47 ++++++++++++---- CHANGELOG.md | 6 +- pom.xml | 4 +- .../client/GeoPortalDataEntryApp.java | 4 -- .../client/events/GetListOfRecordsEvent.java | 14 ++--- .../client/ui/GeonaRecordsPaginatedView.java | 55 +++++++------------ .../ui/projects/ListOfProjectTablePanel.java | 13 +++-- 9 files changed, 83 insertions(+), 66 deletions(-) diff --git a/.classpath b/.classpath index e47c68b..59c98da 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + @@ -31,5 +31,5 @@ - + diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index 45cbadf..a6efe72 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,5 +1,5 @@ eclipse.preferences.version=1 jarsExcludedFromWebInfLib= -lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.2.0-SNAPSHOT +lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.2.0 warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 5301ad2..35cb89c 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,5 @@ - + @@ -111,8 +111,14 @@ - - + + + + + + + + @@ -225,7 +231,10 @@ - + + + + @@ -338,7 +347,10 @@ - + + + + @@ -451,7 +463,10 @@ - + + + + @@ -516,7 +531,10 @@ - + + + + @@ -629,7 +647,10 @@ - + + + + @@ -742,7 +763,10 @@ - + + + + @@ -855,7 +879,10 @@ - + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index a7fe906..c4e4ebb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [v3.2.0] - 2022-05-12 +## [v3.2.1-SNAPSHOT] - 2023-06-16 + +- Fixed the issue in the Search facility [#25265] + +## [v3.2.0] - 2023-05-12 - Implemented the Update facility [#24166] - Integrated with the geoportal-data-mapper library [#24244] diff --git a/pom.xml b/pom.xml index dfb0aed..ce1acdd 100644 --- a/pom.xml +++ b/pom.xml @@ -7,14 +7,14 @@ maven-parent org.gcube.tools - 1.1.0 + 1.2.0 org.gcube.portlets.user geoportal-data-entry-app war - 3.2.0 + 3.2.1-SNAPSHOT GeoPortal Data Entry App The GeoPortal Data Entry App is an application to build the web forms for data entries needed to create projects/documents (based on UCD) in the D4Science Geoportal service diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java index ab9c6d5..2d5e469 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java @@ -837,14 +837,10 @@ public class GeoPortalDataEntryApp implements EntryPoint { } } - // TODO MUST MANAGE getListOfRecordsEvent.isReloadFilteringParameters() - searchingFilter.setProjection(seachingFilterParameters.getProjection()); - List displayFields = seachingFilterParameters.getDisplayFields(); grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter); - mainTabPanel.showListOfProjectsView(grpw); // The Project Type is changed diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/GetListOfRecordsEvent.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/GetListOfRecordsEvent.java index f9c9291..3659853 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/GetListOfRecordsEvent.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/GetListOfRecordsEvent.java @@ -15,7 +15,7 @@ public class GetListOfRecordsEvent extends GwtEvent TYPE = new Type(); - private SearchingFilter sortFilter; + private SearchingFilter searchingFilter; private String profileID; private String projectName; private Boolean reloadFilteringParameters = false; @@ -26,13 +26,13 @@ public class GetListOfRecordsEvent extends GwtEvent void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter sortFilter, + private void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter searchFilter, boolean invalidCache) { showLoading(true); GWT.log("calling loadItemsForStatus with parameters [theProfileID: " + theProfileID + ", startIndex: " - + newStartIndex + ", limit: " + limit + ", sortFilter: " + sortFilter + "]"); - GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit, sortFilter, - invalidCache, new AsyncCallback() { + + newStartIndex + ", limit: " + limit + ", searchFilter: " + searchFilter + "]"); + GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit, + searchFilter, invalidCache, new AsyncCallback() { @Override public void onFailure(Throwable caught) { @@ -265,11 +259,16 @@ public class GeonaRecordsPaginatedView { itemsTable.getSelectionModel().setSelected(item, select); } } - + + /** + * Removes the column. + * + * @param columnName the column name + */ public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) { try { itemsTable.removeColumn(columnName); - }catch (Exception e) { + } catch (Exception e) { // TODO: handle exception } } @@ -283,9 +282,6 @@ public class GeonaRecordsPaginatedView { return itemsTable.getSelectedItems(); } -// int latestRangeStart = -1; -// int latestRangeLenght = -1; - /** * A custom {@link AsyncDataProvider}. * @@ -310,15 +306,6 @@ public class GeonaRecordsPaginatedView { int start = range.getStart(); int length = range.getLength(); -// if(latestRangeStart!=start || latestRangeLenght!=length) { -// GWT.log("ranges really changed"); -// latestRangeStart = start; -// latestRangeLenght = length; -// }else { -// GWT.log("ranges DO NOT changed"); -// return; -// } - if (initClassFirstRangeChanged) { GWT.log("initClassFirstRangeChanged is true.. returning"); initClassFirstRangeChanged = false; @@ -326,8 +313,6 @@ public class GeonaRecordsPaginatedView { } GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount()); loadNewPage(profileID, start, length, false, currentSearchingFilter, false); - // eventBus.fireEvent(new TableRangeViewChangedEvent(start, length)); - } } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java index f086d53..9747596 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/projects/ListOfProjectTablePanel.java @@ -1,5 +1,6 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui.projects; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -346,21 +347,25 @@ public class ListOfProjectTablePanel extends Composite { if (searchText != null && !searchText.isEmpty()) { Map searchInto = new HashMap(); - String searchForField = ""; + List listOfSeachingFields = new ArrayList(); for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) { if (recordField.getDisplayName().equals(alertSearchFor.getText())) { - searchForField = recordField.getJsonFields().get(0); + listOfSeachingFields = recordField.getJsonFields(); continue; } } - searchInto.put(searchForField, searchText); + + for (String fieldname : listOfSeachingFields) { + searchInto.put(fieldname, searchText); + } + WhereClause where = new WhereClause(); where.setSearchInto(searchInto); where.setOperator(LOGICAL_OP.OR); + searchingFilter.setConditions(Arrays.asList(where)); } - return searchingFilter; }