Implementing the init facility to resolve a public link on an item
#27120
This commit is contained in:
parent
50a688a820
commit
fb7a80bb2f
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -114,7 +114,53 @@
|
|||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-3.2.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-3.3.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -325,6 +371,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -441,6 +510,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -509,6 +601,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -531,6 +646,32 @@
|
|||
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -741,6 +882,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -857,6 +1021,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -973,6 +1160,29 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
5
pom.xml
5
pom.xml
|
@ -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>
|
||||
|
|
|
@ -26,6 +26,10 @@ public class ConstantsGeoPortalDataEntryApp {
|
|||
|
||||
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;
|
||||
|
||||
public static final String TIME_FORMAT = ConstantsMPFormBuilder.TIME_FORMAT;
|
||||
|
|
|
@ -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,13 +189,22 @@ 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 execute() {
|
||||
GWT.log("Execute commandGeonaInitConfig...");
|
||||
GeoportalDataEntryServiceAsync.Util.getInstance()
|
||||
.getGeonaInitConfig(new AsyncCallback<GeoportalISConfig>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -218,6 +218,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
ConstantsGeoPortalDataEntryApp.ROOT_PANEL_DIV_PORTLET.add(alert);
|
||||
Window.alert(errorMsg);
|
||||
initExecutor.execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -230,9 +231,19 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
} 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>() {
|
||||
|
@ -244,14 +255,16 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
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);
|
||||
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
|
||||
|
@ -274,7 +287,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
mainTabPanel.setGUIPresentation(gNADataEntryConfig.getDataEntryGUIPresentation());
|
||||
|
||||
RoleRights roleRights = myRights.getRoleRights();
|
||||
boolean canCreateNewItem = roleRights.getListPermessions().keySet()
|
||||
canCreateNewItem = roleRights.getListPermessions().keySet()
|
||||
.contains(OPERATION_ON_ITEM.CREATE_NEW_PROJECT);
|
||||
|
||||
if (!canCreateNewItem) {
|
||||
|
@ -284,10 +297,118 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
initExecutor.putCommand(commandGeonaInitConfig);
|
||||
initExecutor.putCommand(commandReadDataViewerConfig);
|
||||
if (commandInitOnItem != null) {
|
||||
initExecutor.putCommand(commandInitOnItem);
|
||||
}
|
||||
initExecutor.execute();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initGUI() {
|
||||
bindEvents();
|
||||
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
@ -66,6 +67,10 @@ public class OperationOnItemEvent<T extends DocumentDV> extends GwtEvent<Operati
|
|||
handler.onDoActionFired(this);
|
||||
}
|
||||
|
||||
public String getUcdName() {
|
||||
return ucdName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the select items.
|
||||
*
|
||||
|
|
|
@ -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
|
||||
|
@ -695,4 +696,12 @@ public class GeonaMainTabPanel extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
public ListOfProjectTablePanel getListOfProjectTablePanel() {
|
||||
return listOfProjectTablePanel;
|
||||
}
|
||||
|
||||
public List<UseCaseDescriptorDV> getUcdProjectTypesForListingDataView() {
|
||||
return ucdProjectTypesForListingDataView;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -324,11 +324,9 @@ 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -336,6 +334,16 @@ public class ListOfProjectTablePanel extends Composite {
|
|||
|
||||
}
|
||||
|
||||
public void setSearchTypeAndFire(String ucdName, GetListOfRecordsEvent event) {
|
||||
alertProjectType.setText(ucdName);
|
||||
|
||||
// if(event.getSearchingFilter().getProfileID()!=null && event.getSearchingFilter().getProjectID()) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
appManagerBus.fireEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Built searching filter.
|
||||
*
|
||||
|
@ -472,4 +480,9 @@ public class ListOfProjectTablePanel extends Composite {
|
|||
|
||||
}
|
||||
|
||||
|
||||
public String getSelectedProjectType() {
|
||||
return alertProjectType.getText();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -903,6 +903,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();
|
||||
int totalItems = totalProjectForProfile;
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue