bug fixed the search facility [#25265]

This commit is contained in:
Francesco Mangiacrapa 2023-06-16 15:14:15 +02:00
parent c32af933df
commit 869b13d5fe
9 changed files with 83 additions and 66 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/geoportal-data-entry-app-3.2.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
jarsExcludedFromWebInfLib= 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 warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -111,8 +111,14 @@
<wb-module deploy-name="geoportal-data-entry-app-3.2.0-SNAPSHOT">
<wb-module deploy-name="geoportal-data-entry-app-3.2.0">
@ -225,7 +231,10 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -338,7 +347,10 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -451,7 +463,10 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -516,7 +531,10 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
@ -629,7 +647,10 @@
<property name="context-root" value="geoportal-data-entry-app"/> <property name="context-root" value="geoportal-data-entry-app"/>
@ -742,7 +763,10 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -855,7 +879,10 @@
</wb-module> </wb-module>

View File

@ -4,7 +4,11 @@
All notable changes to this project will be documented in this file. 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). 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] - Implemented the Update facility [#24166]
- Integrated with the geoportal-data-mapper library [#24244] - Integrated with the geoportal-data-mapper library [#24244]

View File

@ -7,14 +7,14 @@
<parent> <parent>
<artifactId>maven-parent</artifactId> <artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId> <groupId>org.gcube.tools</groupId>
<version>1.1.0</version> <version>1.2.0</version>
<relativePath /> <relativePath />
</parent> </parent>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId> <artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>3.2.0</version> <version>3.2.1-SNAPSHOT</version>
<name>GeoPortal Data Entry App</name> <name>GeoPortal Data Entry App</name>
<description>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</description> <description>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</description>
<scm> <scm>

View File

@ -837,14 +837,10 @@ public class GeoPortalDataEntryApp implements EntryPoint {
} }
} }
// TODO MUST MANAGE getListOfRecordsEvent.isReloadFilteringParameters()
searchingFilter.setProjection(seachingFilterParameters.getProjection()); searchingFilter.setProjection(seachingFilterParameters.getProjection());
List<ItemFieldDV> displayFields = seachingFilterParameters.getDisplayFields(); List<ItemFieldDV> displayFields = seachingFilterParameters.getDisplayFields();
grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter); grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter);
mainTabPanel.showListOfProjectsView(grpw); mainTabPanel.showListOfProjectsView(grpw);
// The Project Type is changed // The Project Type is changed

View File

@ -15,7 +15,7 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
/** The type. */ /** The type. */
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>(); public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
private SearchingFilter sortFilter; private SearchingFilter searchingFilter;
private String profileID; private String profileID;
private String projectName; private String projectName;
private Boolean reloadFilteringParameters = false; private Boolean reloadFilteringParameters = false;
@ -26,13 +26,13 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
* *
* @param onApplicationInit the on application init * @param onApplicationInit the on application init
* @param profileID the profile ID * @param profileID the profile ID
* @param sortFilter the sort filter * @param searchingFilter the searching filter
* @param reloadFilteringParameters the reload filtering parameters * @param reloadFilteringParameters the reload filtering parameters
*/ */
public GetListOfRecordsEvent(boolean onApplicationInit, String profileID, SearchingFilter sortFilter, public GetListOfRecordsEvent(boolean onApplicationInit, String profileID, SearchingFilter searchingFilter,
Boolean reloadFilteringParameters) { Boolean reloadFilteringParameters) {
this.onApplicationInit = onApplicationInit; this.onApplicationInit = onApplicationInit;
this.sortFilter = sortFilter; this.searchingFilter = searchingFilter;
this.profileID = profileID; this.profileID = profileID;
this.reloadFilteringParameters = reloadFilteringParameters; this.reloadFilteringParameters = reloadFilteringParameters;
} }
@ -75,7 +75,7 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
* @return the searching filter * @return the searching filter
*/ */
public SearchingFilter getSearchingFilter() { public SearchingFilter getSearchingFilter() {
return sortFilter; return searchingFilter;
} }
/** /**
@ -113,8 +113,8 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("GetListOfRecordsEvent [sortFilter="); builder.append("GetListOfRecordsEvent [searchingFilter=");
builder.append(sortFilter); builder.append(searchingFilter);
builder.append(", profileID="); builder.append(", profileID=");
builder.append(profileID); builder.append(profileID);
builder.append(", projectName="); builder.append(", projectName=");

View File

@ -50,7 +50,6 @@ public class GeonaRecordsPaginatedView {
private MyCustomDataProvider<DocumentDV> dataProvider = new MyCustomDataProvider<DocumentDV>(); private MyCustomDataProvider<DocumentDV> dataProvider = new MyCustomDataProvider<DocumentDV>();
protected Widget orginalLoadingIndicator = null; protected Widget orginalLoadingIndicator = null;
private LoaderIcon loadingPanel = new LoaderIcon("Loading data..."); private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
// private int serverStartIndex;
private HandlerManager eventBus; private HandlerManager eventBus;
private SearchingFilter currentSearchingFilter; private SearchingFilter currentSearchingFilter;
private String profileID; private String profileID;
@ -74,7 +73,6 @@ public class GeonaRecordsPaginatedView {
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator(); orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
initPagination(ITEMS_PER_PAGE); initPagination(ITEMS_PER_PAGE);
// loadNewPage(ITEM_START_INDEX, ITEMS_PER_PAGE, false);
loadItemsForType(profileID); loadItemsForType(profileID);
} }
@ -117,31 +115,27 @@ public class GeonaRecordsPaginatedView {
/** /**
* Load new page. * Load new page.
* *
* @param profileID the profile ID * @param profileID the profile ID
* @param startIdx the start idx * @param startIdx the start idx
* @param limit the limit * @param limit the limit
* @param resetStore the reset store * @param resetStore the reset store
* @param currentSortFilter the current sort filter * @param currentSearchFilter the current search filter
* @param invalidCache the invalid cache * @param invalidCache the invalid cache
*/ */
private void loadNewPage(String profileID, final int startIdx, final int limit, final boolean resetStore, private void loadNewPage(String profileID, final int startIdx, final int limit, final boolean resetStore,
final SearchingFilter currentSortFilter, final boolean invalidCache) { final SearchingFilter currentSearchFilter, final boolean invalidCache) {
// initFirstRangeChanged = resetStore;
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:" GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
+ resetStore + "]"); + resetStore + "]");
// showLoading(true);
int newStartIndex = startIdx; int newStartIndex = startIdx;
if (resetStore) { if (resetStore) {
GWT.log("Cleaning all data..."); GWT.log("Cleaning all data...");
newStartIndex = 0; newStartIndex = 0;
// serverStartIndex = 0;
GWT.log("Store reset performed start index is: " + newStartIndex); GWT.log("Store reset performed start index is: " + newStartIndex);
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false); getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
} }
loadProjects(profileID, newStartIndex, limit, currentSortFilter, invalidCache); loadProjects(profileID, newStartIndex, limit, currentSearchFilter, invalidCache);
} }
/** /**
@ -221,17 +215,17 @@ public class GeonaRecordsPaginatedView {
* @param theProfileID the the profile ID * @param theProfileID the the profile ID
* @param newStartIndex the new start index * @param newStartIndex the new start index
* @param limit the limit * @param limit the limit
* @param sortFilter the sort filter * @param searchFilter the search filter
* @param invalidCache the invalid cache * @param invalidCache the invalid cache
*/ */
private <T> void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter sortFilter, private <T> void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter searchFilter,
boolean invalidCache) { boolean invalidCache) {
showLoading(true); showLoading(true);
GWT.log("calling loadItemsForStatus with parameters [theProfileID: " + theProfileID + ", startIndex: " GWT.log("calling loadItemsForStatus with parameters [theProfileID: " + theProfileID + ", startIndex: "
+ newStartIndex + ", limit: " + limit + ", sortFilter: " + sortFilter + "]"); + newStartIndex + ", limit: " + limit + ", searchFilter: " + searchFilter + "]");
GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit, sortFilter, GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit,
invalidCache, new AsyncCallback<ResultSetPaginatedData>() { searchFilter, invalidCache, new AsyncCallback<ResultSetPaginatedData>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -265,11 +259,16 @@ public class GeonaRecordsPaginatedView {
itemsTable.getSelectionModel().setSelected(item, select); itemsTable.getSelectionModel().setSelected(item, select);
} }
} }
/**
* Removes the column.
*
* @param columnName the column name
*/
public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) { public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) {
try { try {
itemsTable.removeColumn(columnName); itemsTable.removeColumn(columnName);
}catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
} }
@ -283,9 +282,6 @@ public class GeonaRecordsPaginatedView {
return itemsTable.getSelectedItems(); return itemsTable.getSelectedItems();
} }
// int latestRangeStart = -1;
// int latestRangeLenght = -1;
/** /**
* A custom {@link AsyncDataProvider}. * A custom {@link AsyncDataProvider}.
* *
@ -310,15 +306,6 @@ public class GeonaRecordsPaginatedView {
int start = range.getStart(); int start = range.getStart();
int length = range.getLength(); 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) { if (initClassFirstRangeChanged) {
GWT.log("initClassFirstRangeChanged is true.. returning"); GWT.log("initClassFirstRangeChanged is true.. returning");
initClassFirstRangeChanged = false; initClassFirstRangeChanged = false;
@ -326,8 +313,6 @@ public class GeonaRecordsPaginatedView {
} }
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount()); GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
loadNewPage(profileID, start, length, false, currentSearchingFilter, false); loadNewPage(profileID, start, length, false, currentSearchingFilter, false);
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
} }
} }

View File

@ -1,5 +1,6 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.projects; package org.gcube.portlets.user.geoportaldataentry.client.ui.projects;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -346,21 +347,25 @@ public class ListOfProjectTablePanel extends Composite {
if (searchText != null && !searchText.isEmpty()) { if (searchText != null && !searchText.isEmpty()) {
Map<String, Object> searchInto = new HashMap<String, Object>(); Map<String, Object> searchInto = new HashMap<String, Object>();
String searchForField = ""; List<String> listOfSeachingFields = new ArrayList<String>();
for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) { for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) {
if (recordField.getDisplayName().equals(alertSearchFor.getText())) { if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
searchForField = recordField.getJsonFields().get(0); listOfSeachingFields = recordField.getJsonFields();
continue; continue;
} }
} }
searchInto.put(searchForField, searchText);
for (String fieldname : listOfSeachingFields) {
searchInto.put(fieldname, searchText);
}
WhereClause where = new WhereClause(); WhereClause where = new WhereClause();
where.setSearchInto(searchInto); where.setSearchInto(searchInto);
where.setOperator(LOGICAL_OP.OR); where.setOperator(LOGICAL_OP.OR);
searchingFilter.setConditions(Arrays.asList(where)); searchingFilter.setConditions(Arrays.asList(where));
} }
return searchingFilter; return searchingFilter;
} }