Implementing the init facility to resolve a public link on an item

#27120
This commit is contained in:
Francesco Mangiacrapa 2024-03-26 17:00:37 +01:00
parent 50a688a820
commit fb7a80bb2f
13 changed files with 552 additions and 129 deletions

View File

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

View File

@ -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
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.3.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -114,8 +114,54 @@
<wb-module deploy-name="geoportal-data-entry-app-3.2.0">
<wb-module deploy-name="geoportal-data-entry-app-3.3.0-SNAPSHOT">
@ -231,7 +277,30 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -347,7 +416,30 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -463,7 +555,30 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -531,7 +646,33 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -647,7 +788,30 @@
<property name="context-root" value="geoportal-data-entry-app"/>
@ -763,7 +927,30 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -879,7 +1066,30 @@
</wb-module>

View File

@ -4,6 +4,10 @@
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.3.0-SNAPSHOT] - 2024-03-26
- Implemented the init facility to resolve a public link on an item [#27120]
## [v3.2.2] - 2024-01-11
- Improved display of results on multiple fields (in the table) [#26372]

View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging>
<version>3.2.2</version>
<version>3.3.0-SNAPSHOT</version>
<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>
<scm>
@ -25,11 +25,12 @@
<properties>
<!-- Convenience property to set the GWT version -->
<gwt.version>2.9.0</gwt.version>
<gwt.version>2.10.0</gwt.version>
<!-- GWT needs at least java 1.6 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
@ -224,7 +225,7 @@
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- TESTS -->
<dependency>
<groupId>junit</groupId>

View File

@ -25,6 +25,10 @@ public class ConstantsGeoPortalDataEntryApp {
public static final String DIV_PORTLET_ID = "geoportal-data-entry";
public static final String DIV_LOADERS_ID = "geoportal-loaders";
public static final String GET_GEONA_ITEM_TYPE = "git";
public static final String GET_GEONA_ITEM_ID = "gid";
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;

View File

@ -6,6 +6,7 @@ import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.TreeMap;
import java.util.stream.Collectors;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
@ -59,6 +60,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardMo
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.EditModeRecord;
import org.gcube.portlets.user.geoportaldataentry.client.ui.edit.UpdateRecord;
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm;
import org.gcube.portlets.user.geoportaldataentry.client.ui.projects.ListOfProjectTablePanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.LifecycleInformationPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.NodeItem;
@ -103,6 +105,8 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Command;
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.Anchor;
@ -162,32 +166,19 @@ public class GeoPortalDataEntryApp implements EntryPoint {
private GeoPortalClientCaches geoportalCaches;
private String paramGeonaItemType;
private String paramGeonaItemID;
private boolean canCreateNewItem = false;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
/*
* ArrayList<GeoNaFormCardModel> gnaCardsModels = new
* ArrayList<GeoNaFormCardModel>(10); GcubeProfileDV gprofile = new
* GcubeProfileDV(); gprofile.setParentName("$.");
* gprofile.setSectionTitle("Istruzione"); GeoNaFormCardModel fcm = new
* GeoNaFormCardModel(); fcm.setGcubeProfile(gprofile); gnaCardsModels.add(fcm);
*
* for (int i = 0; i < 2; i++) { GcubeProfileDV gprofile1 = new
* GcubeProfileDV(); gprofile1.setParentName("$.livello1");
* gprofile1.setSectionTitle("Secondaria Superiore "+i); GeoNaFormCardModel fcm1
* = new GeoNaFormCardModel(); fcm1.setGcubeProfile(gprofile1);
* gnaCardsModels.add(fcm1); }
*
* for (int i = 0; i < 3; i++) { GcubeProfileDV gprofile2 = new
* GcubeProfileDV(); gprofile2.setParentName("$.livello1.livello2");
* gprofile2.setSectionTitle("Alberghiero di Pisa "+i); GeoNaFormCardModel fcm2
* = new GeoNaFormCardModel(); fcm2.setGcubeProfile(gprofile2);
* gnaCardsModels.add(fcm2); }
*
* TreeItemPanel tip = new TreeItemPanel("Concessione", gnaCardsModels);
* RootPanel.get(GeoPortalDataEntryApp.DIV_PORTLET_ID).add(tip.getTree());
*/
final InitExecutor initExecutor = new InitExecutor();
geoportalCaches = new GeoPortalClientCaches();
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.getElement()
@ -198,94 +189,224 @@ public class GeoPortalDataEntryApp implements EntryPoint {
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
mainTabPanel.addFormPanel(geoNaMainForm);
paramGeonaItemType = Window.Location.getParameter(ConstantsGeoPortalDataEntryApp.GET_GEONA_ITEM_TYPE);
paramGeonaItemID = Window.Location.getParameter(ConstantsGeoPortalDataEntryApp.GET_GEONA_ITEM_ID);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.add(mainTabPanel);
// ROOT_PANEL_DIV_PORTLET.getElement().getStyle().setOpacity(0.3);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement()
.addClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT);
GeoportalDataEntryServiceAsync.Util.getInstance().getGeonaInitConfig(new AsyncCallback<GeoportalISConfig>() {
Command commandGeonaInitConfig = new Command() {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurred when loading configurations. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
} catch (Exception e) {
public void execute() {
GWT.log("Execute commandGeonaInitConfig...");
GeoportalDataEntryServiceAsync.Util.getInstance()
.getGeonaInitConfig(new AsyncCallback<GeoportalISConfig>() {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurred when loading configurations. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
} catch (Exception e) {
}
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.add(alert);
Window.alert(errorMsg);
initExecutor.execute();
}
@Override
public void onSuccess(GeoportalISConfig geoportalISConfig) {
geoportalISConfigs = geoportalISConfig;
if (geoportalISConfig != null && geoportalISConfig.getScope() != null) {
loadGeoportalConfigs(geoportalISConfig.getScope());
} else
Window.alert("Sorry, no scope found in the session. Re-login and try again");
initExecutor.execute();
}
});
}
};
Command commandReadDataViewerConfig = new Command() {
@Override
public void execute() {
GWT.log("Execute commandReadDataViewerConfig...");
// Loading Geoportal Configurations from IS
GeoportalDataEntryServiceAsync.Util.getInstance()
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtendedConfigProfile>() {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurred on istancing the application. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement().removeClassName(
ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT);
} catch (Exception e) {
}
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(alert);
Window.alert(errorMsg);
initExecutor.execute();
}
@Override
public void onSuccess(GNADataEntryExtendedConfigProfile gNADataEntryConfig) {
GWT.log(GNADataEntryExtendedConfigProfile.class.getSimpleName() + " loaded: "
+ gNADataEntryConfig);
try {
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
} catch (Exception e) {
}
// PERMISSIONS
myRights = gNADataEntryConfig.getUserRights();
initGUI();
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
mainTabPanel.setRole(userRole);
// GUI Presentation
mainTabPanel.setGUIPresentation(gNADataEntryConfig.getDataEntryGUIPresentation());
RoleRights roleRights = myRights.getRoleRights();
canCreateNewItem = roleRights.getListPermessions().keySet()
.contains(OPERATION_ON_ITEM.CREATE_NEW_PROJECT);
if (!canCreateNewItem) {
// removing Tab "Create New Project"
mainTabPanel.removeTab(0);
// activating Tab "List of Project"
mainTabPanel.setTabActive(0);
// mainTabPanel.instanceAndShowListOfProjects();
}
initExecutor.execute();
}
});
}
};
Command commandInitOnItem = null;
if (paramGeonaItemType != null && paramGeonaItemID != null) {
commandInitOnItem = new Command() {
@Override
public void execute() {
GWT.log("Execute commandInitOnItem...");
GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(paramGeonaItemType,
paramGeonaItemID, new AsyncCallback<ResultDocumentDV>() {
@Override
public void onFailure(Throwable caught) {
Window.alert("Error " + caught.getMessage());
initExecutor.execute();
}
@Override
public void onSuccess(final ResultDocumentDV result) {
GWT.log("commandInitOnItem success: " + result);
Integer attempts = 0;
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
appManagerBus.fireEvent(new OperationOnItemEvent<DocumentDV>(
Arrays.asList(result), OPERATION_ON_ITEM.VIEW_PROJECT_AS_DOCUMENT));
Timer timer = new Timer() {
int attempts = 0;
@Override
public void run() {
attempts++;
GWT.log("commandInitOnItem run timer...");
List<UseCaseDescriptorDV> list = mainTabPanel
.getUcdProjectTypesForListingDataView();
if (list.size() > 0) {
this.cancel();
List<UseCaseDescriptorDV> filterUCD = mainTabPanel
.getUcdProjectTypesForListingDataView().stream()
.filter(u -> u.getId()
.contentEquals(paramGeonaItemType))
.collect(Collectors.toList());
if (filterUCD.size() == 1) {
GWT.log("FilterUCD");
UseCaseDescriptorDV ucd = filterUCD.get(0);
ListOfProjectTablePanel listProjectPanel = mainTabPanel.getListOfProjectTablePanel();
SearchingFilter searchingFilter = new SearchingFilter();
searchingFilter.setGetForIDs(result.getProfileID(), result.getProjectID());
//searchFilter.setConditions(null);
//searchFilter.setGetForIDs(result.getProfileID(), result.getProjectID());
GetListOfRecordsEvent event = new GetListOfRecordsEvent(true, ucd.getProfileID(),
searchingFilter, true);
listProjectPanel.setSearchTypeAndFire(filterUCD.get(0).getName(), event);
}
if(attempts>30) {
this.cancel();
}
}
}
};
timer.schedule(500);
initExecutor.execute();
}
});
if (canCreateNewItem) {
mainTabPanel.setTabActive(1);
} else
mainTabPanel.setTabActive(0);
}
});
}
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.add(alert);
Window.alert(errorMsg);
};
}
try {
initExecutor.putCommand(commandGeonaInitConfig);
initExecutor.putCommand(commandReadDataViewerConfig);
if (commandInitOnItem != null) {
initExecutor.putCommand(commandInitOnItem);
}
@Override
public void onSuccess(GeoportalISConfig geoportalISConfig) {
geoportalISConfigs = geoportalISConfig;
if (geoportalISConfig != null && geoportalISConfig.getScope() != null) {
loadGeoportalConfigs(geoportalISConfig.getScope());
} else
Window.alert("Sorry, no scope found in the session. Re-login and try again");
}
});
// Loading Geoportal Configurations from IS
GeoportalDataEntryServiceAsync.Util.getInstance()
.readDataViewerConfig(new AsyncCallback<GNADataEntryExtendedConfigProfile>() {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurred on istancing the application. Please, contact the support";
Alert alert = new Alert(errorMsg, AlertType.ERROR);
alert.setClose(false);
try {
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.getElement()
.removeClassName(ConstantsGeoPortalDataEntryApp.CSS_CLASS_ANIMATE_FADE_IN_OUT);
} catch (Exception e) {
}
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.add(alert);
Window.alert(errorMsg);
}
@Override
public void onSuccess(GNADataEntryExtendedConfigProfile gNADataEntryConfig) {
GWT.log(GNADataEntryExtendedConfigProfile.class.getSimpleName() + " loaded: "
+ gNADataEntryConfig);
try {
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_LOADERS.remove(loaderApplication);
} catch (Exception e) {
}
// PERMISSIONS
myRights = gNADataEntryConfig.getUserRights();
initGUI();
GcubeUserRole userRole = myRights.getRoleRights().getUserRole();
mainTabPanel.setRole(userRole);
// GUI Presentation
mainTabPanel.setGUIPresentation(gNADataEntryConfig.getDataEntryGUIPresentation());
RoleRights roleRights = myRights.getRoleRights();
boolean canCreateNewItem = roleRights.getListPermessions().keySet()
.contains(OPERATION_ON_ITEM.CREATE_NEW_PROJECT);
if (!canCreateNewItem) {
// removing Tab "Create New Project"
mainTabPanel.removeTab(0);
// activating Tab "List of Project"
mainTabPanel.setTabActive(0);
// mainTabPanel.instanceAndShowListOfProjects();
}
}
});
initExecutor.execute();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@ -790,7 +911,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
GWT.log("Fired: " + getListOfRecordsEvent);
GWT.log("Fired onGetList: " + getListOfRecordsEvent);
SearchingFilter searchingFilter = getListOfRecordsEvent.getSearchingFilter();
CacheSearchingFilterParametersFromConfig seachingFilterParameters = geoportalCaches
@ -809,7 +930,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
if (searchingFilter == null || getListOfRecordsEvent.isOnApplicationInit()
|| getListOfRecordsEvent.isReloadFilteringParameters()) {
mainTabPanel.setFilteringParameters(seachingFilterParameters);
searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter();
// Searching in the cache if the list of relationship definition is present
List<RelationshipDefinitionDV> listRelationshipsDef = geoportalCaches
@ -835,6 +956,10 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
});
}
if(searchingFilter == null ) {
searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter();
}
}
searchingFilter.setProjection(seachingFilterParameters.getProjection());

View File

@ -0,0 +1,43 @@
package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.LinkedHashMap;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
public class InitExecutor {
private LinkedHashMap<Integer, Command> queueInitStage = new LinkedHashMap<>();
public InitExecutor() {
}
public synchronized void putCommand(Command command) throws InterruptedException {
queueInitStage.put(queueInitStage.size(), command);
}
private synchronized Command pollCommand() throws InterruptedException {
for (Integer key : queueInitStage.keySet()) {
Command command = queueInitStage.get(key);
if(command!=null) {
queueInitStage.put(key, null);
return command;
}
}
return null;
}
protected void execute() {
try {
Command command = pollCommand();
if (command != null)
command.execute();
} catch (InterruptedException e) {
Window.alert("An error occurred while initializing the application. Please contact the support. Error is: "
+ e.getMessage());
}
}
}

View File

@ -105,11 +105,6 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
return reloadFilteringParameters;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@ -121,6 +116,8 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
builder.append(projectName);
builder.append(", reloadFilteringParameters=");
builder.append(reloadFilteringParameters);
builder.append(", onApplicationInit=");
builder.append(onApplicationInit);
builder.append("]");
return builder.toString();
}

View File

@ -21,6 +21,7 @@ public class OperationOnItemEvent<T extends DocumentDV> extends GwtEvent<Operati
private List<T> selectItems;
private OPERATION_ON_ITEM action;
private Element sourceElement;
private String ucdName;
/**
* Instantiates a new action on item event.
@ -65,6 +66,10 @@ public class OperationOnItemEvent<T extends DocumentDV> extends GwtEvent<Operati
protected void dispatch(OperationOnItemEventHandler handler) {
handler.onDoActionFired(this);
}
public String getUcdName() {
return ucdName;
}
/**
* Gets the select items.

View File

@ -432,6 +432,7 @@ public class GeonaMainTabPanel extends Composite {
tabPanel.selectTab(index);
}
/**
* Dirty solution. I created this one because I had problem on firing click
* event for Tab element
@ -694,5 +695,13 @@ public class GeonaMainTabPanel extends Composite {
grpw.removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS);
}
}
public ListOfProjectTablePanel getListOfProjectTablePanel() {
return listOfProjectTablePanel;
}
public List<UseCaseDescriptorDV> getUcdProjectTypesForListingDataView() {
return ucdProjectTypesForListingDataView;
}
}

View File

@ -324,17 +324,25 @@ public class ListOfProjectTablePanel extends Composite {
if (ucdProjectTypesForListingDataView.size() == 1) {
// noProjectSelectionMessage.setVisible(false);
UseCaseDescriptorDV singleUCD = ucdProjectTypesForListingDataView.get(0);
alertProjectType.setText(singleUCD.getName());
// setFilteringParameters(displayFields, sortByFields, searchForFields,
// currentSearchingFilter);
appManagerBus.fireEvent(new GetListOfRecordsEvent(true, singleUCD.getProfileID(),
getCurrentSearchingFilter(), true));
GetListOfRecordsEvent event = new GetListOfRecordsEvent(true, singleUCD.getProfileID(),
getCurrentSearchingFilter(), true);
setSearchTypeAndFire(singleUCD.getName(), event);
}
}
});
}
public void setSearchTypeAndFire(String ucdName, GetListOfRecordsEvent event) {
alertProjectType.setText(ucdName);
// if(event.getSearchingFilter().getProfileID()!=null && event.getSearchingFilter().getProjectID()) {
//
// }
//
appManagerBus.fireEvent(event);
}
/**
* Built searching filter.
@ -471,5 +479,10 @@ public class ListOfProjectTablePanel extends Composite {
ddProjectType.add(link);
}
public String getSelectedProjectType() {
return alertProjectType.getText();
}
}

View File

@ -902,6 +902,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
searchedData.setTotalItems(totalProjectForProfile);
LOG.info("Total Docs read from config: " + totalProjectForProfile);
boolean isSearchForIds = filter.getProfileID()!=null && filter.getProjectID()!=null;
// Saving client PROJECTION
LinkedHashMap<String, Object> originalProjection = filter.getProjection();
@ -928,13 +930,23 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
totalItems = listProjectIDs.size();
searchedData.setTotalItems(totalItems);
LOG.info("Total Docs read from query per ID: " + totalItems);
}else if(isSearchForIds) {
//searching one item for IDs
searchedData.setTotalItems(1);
}
// 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);
Iterator<Project> projects = null;
if(!isSearchForIds) {
projects = client.queryOnMongo(theProfileID, totalItems, start, limit, filter);
}else {
Project project = client.getProjectByID(filter.getProfileID(), filter.getProjectID());
projects = Arrays.asList(project).iterator();
}
searchedData.setClientStartIndex(start);
searchedData.setLimit(limit);
@ -1406,7 +1418,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
Project project = projects.getProjectByID(profileID, projectID);
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
ProjectDV projectDV = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
LOG.info("returning: " + projectDV.getId());
LOG.info("returning ProjectByID: " + projectDV.getId());
return projectDV;
} catch (Exception e) {