Merge pull request 'feature_27120' (!13) from feature_27120 into master

Reviewed-on: #13
This commit is contained in:
Francesco Mangiacrapa 2024-06-28 15:56:13 +02:00
commit 3aa1712faf
31 changed files with 1361 additions and 207 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,108 @@
<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 +331,57 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -347,7 +497,57 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -463,7 +663,57 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -531,7 +781,63 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="metadata-profile-form-builder-widget-2.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/metadata-profile-form-builder-widget/metadata-profile-form-builder-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="geoportal-common-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-common/geoportal-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -647,7 +953,57 @@
<property name="context-root" value="geoportal-data-entry-app"/>
@ -763,7 +1119,57 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -879,7 +1285,57 @@
</wb-module>

View File

@ -4,6 +4,14 @@
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-04-05
- Implemented the init facility to resolve a public link on an item [#27120]
- Integrated new Uri-Resolver-Manager [#27160]
- Added Get Shareable Link facility [#27120]
- Added optional message when performing lifecycle step [#27192]
- Enforced deleteProject method/UX
## [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,12 @@ 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_PARAMETER_ITEM_TYPE = "git";
public static final String GET_PARAMETER_ITEM_ID = "gid";
public static final String GET_PARAMETER_ACTION = "act";
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;

View File

@ -28,8 +28,6 @@ public class GeoPortalClientCaches {
private TreeMap<String, List<GeoNaFormCardModel>> mapGcubeProfilePerItemType;
//private Map<String, List<HandlerDeclarationDV>> mapHandlersConfigurationsForProfileId;
private Map<String, UseCaseDescriptorDV> mapUseCaseDescriptor;
private Map<String, CacheSearchingFilterParametersFromConfig> mapSearchingFilterParametersForProfileId;

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;
@ -20,8 +21,9 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfil
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.BasicLifecycleInformationDV.Status;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclarationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
@ -55,12 +57,14 @@ import org.gcube.portlets.user.geoportaldataentry.client.resource.Images;
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainTabPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView;
import org.gcube.portlets.user.geoportaldataentry.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataentry.client.ui.action.DeleteViewPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.action.StepViewPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel;
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;
import org.gcube.portlets.user.geoportaldataentry.client.ui.tree.TreeItemPanel;
import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogInform;
@ -72,6 +76,7 @@ import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.ProjectNotFoundException;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.user.geoportaldataentry.shared.UserRights;
import org.gcube.portlets.widgets.gdvw.client.GeoportalDataViewerWidget;
@ -103,9 +108,12 @@ 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;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
@ -162,32 +170,21 @@ public class GeoPortalDataEntryApp implements EntryPoint {
private GeoPortalClientCaches geoportalCaches;
private String paramGeonaItemType;
private String paramGeonaItemID;
private boolean canCreateNewItem = false;
private GNADataEntryExtendedConfigProfile gNADataEntryPresentationConfig = null;
/**
* 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 +195,271 @@ public class GeoPortalDataEntryApp implements EntryPoint {
geoNaMainForm = new GeonaDataEntryMainForm(appManagerBus);
mainTabPanel.addFormPanel(geoNaMainForm);
paramGeonaItemType = Window.Location.getParameter(ConstantsGeoPortalDataEntryApp.GET_PARAMETER_ITEM_TYPE);
paramGeonaItemID = Window.Location.getParameter(ConstantsGeoPortalDataEntryApp.GET_PARAMETER_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>() {
// Loads Geoportal init configurations
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();
}
});
}
};
// Loads data entry presetentation configurations
Command commandReadDataViewerConfig = new Command() {
@Override
public void execute() {
GWT.log("Execute commandReadDataViewerConfig...");
// Loading Geoportal Configurations from IS
GeoportalDataEntryServiceAsync.Util.getInstance()
.readDataEntryPresentationConfig(new AsyncCallback<GNADataEntryExtendedConfigProfile>() {
@Override
public void onFailure(Throwable caught) {
String errorMsg = "Sorry, an error occurred on instancing the application. Please, contact the support. Error is: "
+ caught.getMessage();
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);
gNADataEntryPresentationConfig = 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;
// Resolves the gid={ITEM_ID}&git={PROFILE_ID}
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) {
if (caught instanceof ProjectNotFoundException) {
Modal errorModal = new Modal(true, true);
errorModal.setCloseVisible(true);
errorModal.setTitle("Oops...");
Image geoportalError = new Image(Images.ICONS.warningError());
FlowPanel errorPanelMsg = new FlowPanel();
errorPanelMsg.getElement().addClassName("general_warning");
errorPanelMsg.add(geoportalError);
errorPanelMsg.add(new HTML("D4S GeoPortal"));
HTML erroMessage = new HTML(
"Oops something went wrong, either the project does not exist or you are not authorized to access it");
errorPanelMsg.add(erroMessage);
errorModal.add(errorPanelMsg);
errorModal.show();
} else {
Window.alert("Error " + caught.getMessage());
}
initExecutor.execute();
}
@Override
public void onSuccess(final ResultDocumentDV result) {
GWT.log("commandInitOnItem success: " + result);
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);
Modal errorModal = new Modal(true, true);
// errorModal.setWidth("800px");
errorModal.setCloseVisible(true);
errorModal.setTitle("Information...");
Image geoportalError = new Image(Images.ICONS.info());
geoportalError.setWidth("128px");
FlowPanel errorPanelMsg = new FlowPanel();
errorPanelMsg.getElement().addClassName("general_info");
errorPanelMsg.add(geoportalError);
errorPanelMsg.add(new HTML(gNADataEntryPresentationConfig
.getDataEntryGUIPresentation().getHeader()
.getTitle()));
HTML erroMessage = new HTML(
"The <span class='general_info_facility'>List of Projects</span> only shows the <br/><br/><b>\""
+ result.getFirstEntryOfMap().getValue()
+ "\"</b><br/><br/>project resolved by shareable link<br/><br/>To view all projects select <span class='general_info_facility'>Reload Projects</span> button");
errorPanelMsg.add(erroMessage);
errorModal.add(errorPanelMsg);
errorModal.show();
}
if (attempts > 20) {
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 +964,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 +983,6 @@ 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 +1008,10 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
});
}
if (searchingFilter == null) {
searchingFilter = mainTabPanel.getCurrentProjectsSearchingFilter();
}
}
searchingFilter.setProjection(seachingFilterParameters.getProjection());
@ -1163,21 +1340,11 @@ public class GeoPortalDataEntryApp implements EntryPoint {
final ResultDocumentDV resultDocumentDV = (ResultDocumentDV) item;
String htmlMsg = "Going to perform the step/s <i><b>" + wActionOnItem.getAction().getCallSteps()
+ "</b></i> on the project with:";
htmlMsg += "<ul>";
htmlMsg += "<li>id: " + resultDocumentDV.getId() + "</li>";
htmlMsg += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
htmlMsg += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
htmlMsg += "</ul>";
htmlMsg += "<br>";
htmlMsg += "Would you like to proceed?";
final ModalConfirm dialog = new ModalConfirm(null,
"Step/s " + wActionOnItem.getAction().getTitle() + ", Confirm?", htmlMsg);
dialog.addToCenterPanel(
new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false));
"Step/s " + wActionOnItem.getAction().getTitle() + ", Confirm?", null);
final StepViewPanel stvp = new StepViewPanel(resultDocumentDV, wActionOnItem.getAction());
dialog.addToCenterPanel(stvp);
dialog.getYesButton().addClickHandler(new ClickHandler() {
@ -1187,7 +1354,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
final Modal modal = new Modal(true, true);
modal.setCloseVisible(false);
modal.setTitle("Perfoming Steps...");
modal.setTitle("Performing Steps...");
modal.hide(false);
modal.setWidth(800);
modal.setMaxHeigth("650px");
@ -1200,7 +1367,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
GeoportalDataEntryServiceAsync.Util.getInstance().performActionSteps(
resultDocumentDV.getProfileID(), resultDocumentDV.getId(),
wActionOnItem.getAction(), new AsyncCallback<ProjectDV>() {
stvp.getOptionalMessage(), wActionOnItem.getAction(),
new AsyncCallback<StepPerformedResultDV>() {
@Override
public void onFailure(Throwable caught) {
@ -1216,7 +1384,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
@Override
public void onSuccess(final ProjectDV result) {
public void onSuccess(final StepPerformedResultDV result) {
modal.setTitle("Step/s performed");
modal.setCloseVisible(true);
try {
@ -1230,22 +1398,53 @@ public class GeoPortalDataEntryApp implements EntryPoint {
String stepsToString = "";
for (String step : wActionOnItem.getAction().getCallSteps()) {
stepsToString += step + ", ";
stepsToString += step + " ";
}
Status status = Status.NOT_SPECIFIED;
AlertType alertType = AlertType.INFO;
String statusMsg = "status " + status.getLabel();
try {
status = result.getLifecycleInfoDV().getLastOperationStatus();
switch (status) {
case OK:
alertType = AlertType.SUCCESS;
statusMsg = "performed with " + status.getLabel().toUpperCase()
+ "!";
break;
case WARNING:
alertType = AlertType.WARNING;
statusMsg = "performed with " + status.getLabel().toUpperCase()
+ "!";
break;
case ERROR:
alertType = AlertType.ERROR;
statusMsg = "performed with " + status.getLabel().toUpperCase()
+ "!";
break;
default:
alertType = AlertType.INFO;
statusMsg = "performed. Current status " + status.getLabel();
break;
}
} catch (Exception e) {
// silent
}
Alert alert = new Alert(
stepString + " " + stepsToString + "performed correclty!");
alert.setType(AlertType.INFO);
stepString + " " + stepsToString + " " + statusMsg);
alert.setType(alertType);
alert.setClose(false);
modal.add(alert);
GeoportalDataEntryServiceAsync.Util.getInstance()
.getResultDocumentFoProjectByID(result.getProfileID(),
result.getId(), new AsyncCallback<ResultDocumentDV>() {
result.getProjectId(),
new AsyncCallback<ResultDocumentDV>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
Window.alert("Error: " + caught.getMessage());
}
@ -1465,7 +1664,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal.add(hpGetLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(resultDocumentDV.getId(),
resultDocumentDV.getProfileID(), new AsyncCallback<GeoportalItemReferences>() {
resultDocumentDV.getProfileID(), GeoportalItemReferences.SHARE_LINK_TO.DATA_VIEWER,
new AsyncCallback<GeoportalItemReferences>() {
@Override
public void onFailure(Throwable caught) {
try {
@ -1476,7 +1676,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
Alert alert = new Alert(caught.getMessage(), AlertType.ERROR);
alert.setClose(false);
hpGetLink.add(alert);
modal.add(alert);
// newBrowserWindow.close();
}
@ -1514,6 +1714,67 @@ public class GeoPortalDataEntryApp implements EntryPoint {
break;
}
case GET_SHAREABLE_LINK: {
final Modal modal = new Modal(true, true);
modal.setTitle("Share the Project by link...");
modal.setCloseVisible(true);
final HorizontalPanel hpGetLink = new HorizontalPanel();
final LoaderIcon lc = new LoaderIcon("Just moment getting link...");
hpGetLink.add(lc);
modal.add(hpGetLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(resultDocumentDV.getId(),
resultDocumentDV.getProfileID(), GeoportalItemReferences.SHARE_LINK_TO.DATA_ENTRY,
new AsyncCallback<GeoportalItemReferences>() {
@Override
public void onFailure(Throwable caught) {
try {
hpGetLink.setVisible(false);
modal.remove(hpGetLink);
} catch (Exception e) {
// TODO: handle exception
}
Alert alert = new Alert(caught.getMessage(), AlertType.ERROR);
alert.setClose(false);
modal.add(alert);
// newBrowserWindow.close();
}
@Override
public void onSuccess(GeoportalItemReferences result) {
try {
hpGetLink.setVisible(false);
modal.remove(hpGetLink);
} catch (Exception e) {
// TODO: handle exception
}
String theURL = result.getRestrictedLink().getShortURL() != null
? result.getRestrictedLink().getShortURL()
: result.getRestrictedLink().getCompleteURL();
// newBrowserWindow.setUrl(theURL);
Anchor anchor = new Anchor(theURL);
anchor.setHref(theURL);
anchor.setTarget("_blank");
anchor.setTitle("Shareable link of the project with id: "
+ resultDocumentDV.getId());
com.github.gwtbootstrap.client.ui.Label label = new com.github.gwtbootstrap.client.ui.Label(
"Shareable link");
label.setType(LabelType.SUCCESS);
modal.add(label);
modal.add(new HTML("<br>"));
modal.add(anchor);
}
});
modal.show();
break;
}
case VIEW_REPORT: {
final Modal modal2 = new Modal(true, true);
@ -1710,19 +1971,10 @@ public class GeoPortalDataEntryApp implements EntryPoint {
case DELETE_PROJECT: {
String htmlMsg = "Going to delete the project with:";
htmlMsg += "<ul>";
htmlMsg += "<li>id: " + resultDocumentDV.getId() + "</li>";
htmlMsg += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
htmlMsg += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
htmlMsg += "</ul>";
htmlMsg += "<br>";
htmlMsg += "This operation cannot be undone. Would you like to proceed?";
DeleteViewPanel dvp = new DeleteViewPanel(resultDocumentDV);
final ModalConfirm dialog = new ModalConfirm(null, "Delete Confirm?", htmlMsg);
dialog.addToCenterPanel(
new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false));
final ModalConfirm dialog = new ModalConfirm(null, "Delete Confirm?", null);
dialog.addToCenterPanel(dvp);
dialog.show();
dialog.getYesButton().addClickHandler(new ClickHandler() {
@ -1754,6 +2006,32 @@ public class GeoPortalDataEntryApp implements EntryPoint {
alert.setClose(false);
hp.add(alert);
VerticalPanel vp = new VerticalPanel();
vp.getElement().getStyle().setMarginTop(20, Unit.PX);
vp.add(new Label("Check outcome in the Publication Report"));
Button buttonShowPublicationReport = new Button(
"Show Publication Report");
buttonShowPublicationReport.setType(ButtonType.INFO);
buttonShowPublicationReport.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
modal.hide();
appManagerBus
.fireEvent(new OperationOnItemEvent<DocumentDV>(
Arrays.asList(resultDocumentDV),
OPERATION_ON_ITEM.VIEW_REPORT));
}
});
buttonShowPublicationReport.getElement().getStyle().setMarginTop(10,
Unit.PX);
buttonShowPublicationReport.getElement().getStyle()
.setMarginBottom(20, Unit.PX);
vp.add(buttonShowPublicationReport);
modal.add(vp);
}
@Override

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences.SHARE_LINK_TO;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
@ -11,6 +12,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
@ -56,12 +58,13 @@ public interface GeoportalDataEntryService extends RemoteService {
/**
* Gets the links for.
*
* @param itemId the item id
* @param itemId the item id is the mongoId
* @param profileID the profile ID
* @param shareLinkTo the share link to
* @return the links for
* @throws Exception the exception
*/
GeoportalItemReferences getLinksFor(String itemId, String profileID) throws Exception;
GeoportalItemReferences getLinksFor(String itemId, String profileID, SHARE_LINK_TO shareLinkTo) throws Exception;
/**
* Gets the list projects.
@ -104,7 +107,7 @@ public interface GeoportalDataEntryService extends RemoteService {
* @return the GNA data entry ext config profile
* @throws Exception the exception
*/
GNADataEntryExtendedConfigProfile readDataViewerConfig() throws Exception;
GNADataEntryExtendedConfigProfile readDataEntryPresentationConfig() throws Exception;
/**
* Gets the list use case descriptors.
@ -140,11 +143,11 @@ public interface GeoportalDataEntryService extends RemoteService {
*
* @param profileID the profile ID
* @param projectID the project ID
* @param action the action
* @param optionalMessage the optional message
* @param action the action
* @return the project DV
* @throws Exception the exception
*/
ProjectDV performActionSteps(String profileID, String projectID, ActionDefinitionDV action) throws Exception;
StepPerformedResultDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action) throws Exception;
/**
* Gets the relationships definition.
@ -235,6 +238,14 @@ public interface GeoportalDataEntryService extends RemoteService {
CommitReport updateGeportalDataForm(String profileID, String projectID, GeoNaFormDataObject section,
String sectionPath, List<FilePathDV> listFilePaths) throws Exception;
/**
* Gets the project view.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project view
* @throws Exception the exception
*/
ProjectView getProjectView(String profileID, String projectID) throws Exception;
}

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences.SHARE_LINK_TO;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
@ -11,6 +12,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.FilePathDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
@ -59,7 +61,8 @@ public interface GeoportalDataEntryServiceAsync {
void getGeonaInitConfig(AsyncCallback<GeoportalISConfig> callback);
void getLinksFor(String itemId, String profileID, AsyncCallback<GeoportalItemReferences> callback);
void getLinksFor(String itemId, String profileID, SHARE_LINK_TO shareLinkTo,
AsyncCallback<GeoportalItemReferences> callback);
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService, AsyncCallback<ResultSetPaginatedData> callback);
@ -70,15 +73,15 @@ public interface GeoportalDataEntryServiceAsync {
void updateRecord(String profileID, String projectID, String jsonUpdate, AsyncCallback<ProjectDV> callback);
void readDataViewerConfig(AsyncCallback<GNADataEntryExtendedConfigProfile> asyncCallback);
void readDataEntryPresentationConfig(AsyncCallback<GNADataEntryExtendedConfigProfile> asyncCallback);
void getListUseCaseDescriptors(List<String> handlersIds, AsyncCallback<List<UseCaseDescriptorDV>> callback);
void getLifecycleInfoForProjectId(String profileID, String projectID,
AsyncCallback<LifecycleInformationDV> callback);
void performActionSteps(String profileID, String projectID, ActionDefinitionDV action,
AsyncCallback<ProjectDV> callback);
void performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action,
AsyncCallback<StepPerformedResultDV> callback);
void getRelationshipsDefinition(String profileID, AsyncCallback<List<RelationshipDefinitionDV>> callback);

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

@ -16,4 +16,10 @@ public interface Images extends ClientBundle {
@Source("one-finger-icon.png")
ImageResource oneFingerIcon();
@Source("information_icon.png")
ImageResource info();
@Source("warning_error.png")
ImageResource warningError();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -106,6 +106,9 @@ public class GeonaMainTabPanel extends Composite {
@UiField
NavLink navShowOnMap;
@UiField
NavLink navShareLink;
@UiField
NavLink navShowReport;
@ -249,6 +252,21 @@ public class GeonaMainTabPanel extends Composite {
}
});
navShareLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<DocumentDV> listDocuments = null;
if (grpw != null && grpw.getSelectItems() != null) {
listDocuments = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new OperationOnItemEvent<DocumentDV>(listDocuments, OPERATION_ON_ITEM.GET_SHAREABLE_LINK));
}
});
navViewAsDocument.addClickHandler(new ClickHandler() {
@ -432,6 +450,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 +713,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

@ -107,6 +107,8 @@
<b:Divider addStyleNames="{style.divider-border-right}" />
<b:NavLink ui:field="navShowOnMap" title="Show on Map"
icon="MAP_MARKER">Show on Map</b:NavLink>
<b:NavLink ui:field="navShareLink" title="Get Shareable Link"
icon="SHARE">Get Shareable link</b:NavLink>
<b:Divider addStyleNames="{style.divider-border-right}" />
<b:NavLink ui:field="navShowReport"
title="Show Publication Report" icon="FILE_TEXT_ALT">Publication Report</b:NavLink>

View File

@ -0,0 +1,60 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class DeleteViewPanel extends Composite {
private static DeleteViewPanelUiBinder uiBinder = GWT.create(DeleteViewPanelUiBinder.class);
interface DeleteViewPanelUiBinder extends UiBinder<Widget, DeleteViewPanel> {
}
@UiField
FlowPanel principalPanel;
@UiField
AccordionGroup accordionProjectDetails;
@UiField
FlowPanel confirmProceedPanel;
private ResultDocumentDV resultDocumentDV;
public DeleteViewPanel(ResultDocumentDV resultDocumentDV) {
initWidget(uiBinder.createAndBindUi(this));
this.resultDocumentDV = resultDocumentDV;
builtUI();
}
private void builtUI() {
String htmlMsg = "<p style='font-size: 18px'>Going to permanently delete the:</p>";
// TODO Auto-generated method stub
principalPanel.add(new HTML(htmlMsg));
ReportTemplateToHTML rt = new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false);
rt.showAsJSON(false);
principalPanel.add(rt);
String projectDetails = "<ul>";
projectDetails += "<li>id: " + resultDocumentDV.getId() + "</li>";
projectDetails += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
projectDetails += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
projectDetails += "</ul>";
accordionProjectDetails.add(new HTML(projectDetails));
String confirmMessage = "<b>This operation cannot be undone. Would you like to proceed?</b>";
confirmProceedPanel.add(new HTML(confirmMessage));
}
}

View File

@ -0,0 +1,33 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.accordion-no-border {
border: 0px !important;
}
.text-are-size {
width: 80%;
height: 50px;
}
</ui:style>
<g:HTMLPanel>
<g:FlowPanel ui:field="principalPanel">
</g:FlowPanel>
<g:HTMLPanel>
<b:Accordion>
<b:AccordionGroup icon="GEAR"
heading="Project details" ui:field="accordionProjectDetails"
addStyleNames="{style.accordion-no-border}">
</b:AccordionGroup>
</b:Accordion>
</g:HTMLPanel>
<g:FlowPanel ui:field="confirmProceedPanel">
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -0,0 +1,72 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.action;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ActionDefinitionDV;
import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML;
import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.github.gwtbootstrap.client.ui.TextArea;
import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Widget;
public class StepViewPanel extends Composite {
private static StepViewPanelUiBinder uiBinder = GWT.create(StepViewPanelUiBinder.class);
interface StepViewPanelUiBinder extends UiBinder<Widget, StepViewPanel> {
}
@UiField
FlowPanel principalPanel;
@UiField
AccordionGroup accordionProjectDetails;
@UiField
FlowPanel confirmProceedPanel;
@UiField
TextArea txtOptionalMessage;
private ResultDocumentDV resultDocumentDV;
private ActionDefinitionDV actionDefinitionDV;
public StepViewPanel(ResultDocumentDV resultDocumentDV, ActionDefinitionDV actionDefinitionDV) {
initWidget(uiBinder.createAndBindUi(this));
this.resultDocumentDV = resultDocumentDV;
this.actionDefinitionDV = actionDefinitionDV;
builtUI();
}
private void builtUI() {
String htmlMsg = "<p style='font-size: 18px'>Going to perform the step/s <i><b>" + actionDefinitionDV.getCallSteps() + "</b></i> on the: </p>";
// TODO Auto-generated method stub
principalPanel.add(new HTML(htmlMsg));
ReportTemplateToHTML rt = new ReportTemplateToHTML("Project", resultDocumentDV.getDocumentAsJSON(), false);
rt.showAsJSON(false);
principalPanel.add(rt);
String projectDetails = "<ul>";
projectDetails += "<li>id: " + resultDocumentDV.getId() + "</li>";
projectDetails += "<li>profile: " + resultDocumentDV.getProfileID() + "</li>";
projectDetails += "<li>" + resultDocumentDV.getFirstEntryOfMap().getKey() + ": "
+ resultDocumentDV.getFirstEntryOfMap().getValue() + "</li>";
projectDetails += "</ul>";
accordionProjectDetails.add(new HTML(projectDetails));
String confirmMessage = "<b>Would you like to proceed?</b>";
confirmProceedPanel.add(new HTML(confirmMessage));
}
public String getOptionalMessage() {
return txtOptionalMessage.getText();
}
}

View File

@ -0,0 +1,46 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style>
.important {
font-weight: bold;
}
.accordion-no-border {
border: 0px !important;
}
.text-are-size {
width: 80% !important;
height: 70px !important;
}
</ui:style>
<g:HTMLPanel>
<g:FlowPanel ui:field="principalPanel">
</g:FlowPanel>
<g:HTMLPanel>
<b:Accordion>
<b:AccordionGroup icon="GEAR"
heading="Project details" ui:field="accordionProjectDetails"
addStyleNames="{style.accordion-no-border}">
</b:AccordionGroup>
</b:Accordion>
</g:HTMLPanel>
<g:FlowPanel ui:field="confirmProceedPanel">
<b:Form type="HORIZONTAL">
<b:Fieldset>
<b:ControlGroup>
<b:ControlLabel>Message</b:ControlLabel>
<b:Controls>
<!-- If you add id attribute to element,You should use b:id attribute. -->
<b:TextArea addStyleNames="{style.text-are-size}"
ui:field="txtOptionalMessage"></b:TextArea>
<b:HelpBlock>You can optionally add a message...</b:HelpBlock>
</b:Controls>
</b:ControlGroup>
</b:Fieldset>
</b:Form>
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -248,7 +248,7 @@ public class GeonaDataEntryMainForm extends Composite {
appManagerBus.fireEvent(new SaveGeonaDataFormsEvent(treeItemPanel.getProfileID(), treeNode));
TreeVisitUtil.preOrderVisit(treeNode);
showAlertOnSaveAction("Andiamo a salvare", AlertType.INFO, true);
//showAlertOnSaveAction("Andiamo a salvare", AlertType.INFO, true);
} else {
showAlertOnSaveAction("Detected errors, please fix it/them", AlertType.ERROR, true);

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

@ -78,7 +78,7 @@ public class LifecycleInformationPanel extends FlowPanel {
final LoaderIcon lc = new LoaderIcon("Get link...");
hpGetLink.add(lc);
add(hpGetLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(projectID, profileID,
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(projectID, profileID, GeoportalItemReferences.SHARE_LINK_TO.DATA_VIEWER,
new AsyncCallback<GeoportalItemReferences>() {
@Override

View File

@ -76,6 +76,7 @@ public class ReportTemplateToHTML extends Composite {
boolean openJSONReport) {
initWidget(uiBinder.createAndBindUi(this));
vpContainer.setVisible(false);
vpContainer.setWidth("95%");
showReportAsJSON.setDefaultOpen(openJSONReport);
showReportAsTable.setDefaultOpen(openTableReport);

View File

@ -10,13 +10,17 @@
.margin-top-10 {
margin-top: 10px;
}
.table-style {
margin-top: 10px;
width: 95%;
}
</ui:style>
<g:HTMLPanel>
<g:VerticalPanel ui:field="vpContainer"
addStyleNames="{style.margin-top-10}">
addStyleNames="{style.table-style}">
<b:Label ui:field="labelToReport">Report: </b:Label>
<g:VerticalPanel ui:field="htmlContainer"
addStyleNames="{style.margin-top-10}"></g:VerticalPanel>
addStyleNames="{style.table-style}"></g:VerticalPanel>
<b:AccordionGroup heading="Show as Table"
ui:field="showReportAsTable">
<b:Paragraph ui:field="reportTable"></b:Paragraph>

View File

@ -29,6 +29,7 @@ import com.google.gwt.user.client.ui.Widget;
*/
public class ModalConfirm extends Modal implements ClickHandler {
private static final int modal_width = 800;
private DockPanel dock = new DockPanel();
private Button yesButton;
private VerticalPanel vpContainer;
@ -44,7 +45,7 @@ public class ModalConfirm extends Modal implements ClickHandler {
* @param text the text
*/
public ModalConfirm(Image img, String caption, String text) {
setWidth(800);
setWidth(modal_width);
setAnimation(true);
// getElement().setClassName("gwt-DialogBoxNew");
dock.setSpacing(4);
@ -65,7 +66,9 @@ public class ModalConfirm extends Modal implements ClickHandler {
vpContainer = new VerticalPanel();
vpContainer.getElement().getStyle().setMargin(20.0, Unit.PX);
vpContainer.add(new HTML(text));
vpContainer.setWidth((modal_width - 70) + "px");
if (text != null)
vpContainer.add(new HTML(text));
hpButtons = new HorizontalPanel();
hpButtons.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
// hpButtons.getElement().getStyle().setMarginTop(20.0, Unit.PX);

View File

@ -55,6 +55,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.config.GcubeProfil
import org.gcube.application.geoportalcommon.shared.geoportal.project.LifecycleInformationDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.application.geoportalcommon.shared.geoportal.step.StepPerformedResultDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.RelationshipDefinitionDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
@ -71,6 +72,7 @@ import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GNADataEntryExtendedConfigProfile;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoportalISConfig;
import org.gcube.portlets.user.geoportaldataentry.shared.ProjectNotFoundException;
import org.gcube.portlets.user.geoportaldataentry.shared.Tree_Node;
import org.gcube.portlets.user.geoportaldataentry.shared.UserRights;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
@ -135,6 +137,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
* Save geona data forms.
*
* @param profileID the profile ID
* @param optionalMessage the optional message
* @param tree_Node the tree node
* @param stepsOnPostCreation the steps on post creation
* @return the commit report
@ -194,7 +197,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.info("stepsOnPostCreation are {}", stepsOnPostCreation);
for (String stepID : stepsOnPostCreation) {
LOG.info("calling step OnPostCreation are {}", stepID);
theProject = client.performStep(theProject.getProfileID(), theProject.getId(), stepID, null);
theProject = client.performStep(theProject.getProfileID(), theProject.getId(), stepID, null, null);
}
} catch (Exception e) {
@ -361,7 +364,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
}
// Registering fileset in the section according to mapFilesToRegistrer
if (mapFilesToRegistrer != null && mapFilesToRegistrer.size()>0) {
if (mapFilesToRegistrer != null && mapFilesToRegistrer.size() > 0) {
LOG.info("Cluster of fileset per fieldDefinition is: " + mapFilesToRegistrer);
String theJSONDocument = currentProject.getTheDocument().toJson();
MongoServiceUtil mongoService = new MongoServiceUtil();
@ -821,7 +824,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
*/
@Override
public GeoportalISConfig getGeonaInitConfig() {
LOG.info("getConfig called");
LOG.info("getGeonaInitConfig called");
String scope = SessionUtil.getCurrentContext(this.getThreadLocalRequest(), false);
String theSecondaryType;
@ -844,19 +847,22 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
/**
* Gets the links for.
*
* @param itemId the item id is the mongoId
* @param profileID the profile ID
* @param itemId the item id is the mongoId
* @param profileID the profile ID
* @param shareLinkTo the share link to
* @return the links for
* @throws Exception the exception
*/
@Override
public GeoportalItemReferences getLinksFor(String itemId, String profileID) throws Exception {
public GeoportalItemReferences getLinksFor(String itemId, String profileID,
GeoportalItemReferences.SHARE_LINK_TO shareLinkTo) throws Exception {
LOG.info("getLinksFor called");
String scope = SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
//GNADataViewerConfigProfile grViewerProfile = SessionUtil.getGeportalViewerResourceProfile(getThreadLocalRequest());
// GNADataViewerConfigProfile grViewerProfile =
// SessionUtil.getGeportalViewerResourceProfile(getThreadLocalRequest());
GeoportalCommon gc = new GeoportalCommon();
GeoportalItemReferences item = new GeoportalItemReferences(itemId, profileID);
GeoportalItemReferences item = new GeoportalItemReferences(itemId, profileID, shareLinkTo);
item = gc.getPublicLinksFor(scope, item, true);
LOG.info("Returning: " + item);
return item;
@ -903,6 +909,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 +936,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);
@ -992,6 +1010,18 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
client.deleteProject(profileID, projectID, true);
try {
Project deletedP = client.getProjectByID(profileID, projectID);
if(deletedP!=null) {
String error = "The project with id "+projectID+" still exists";
LOG.error(error +". Sending exception..");
throw new Exception(error);
}
}catch (Exception e) {
throw e;
}
// Updating count of Documents in session per profileID
Integer totalProjectForProfile = client.getTotalDocument(profileID);
SessionUtil.setTotalDocumentForProfileID(getThreadLocalRequest(), profileID, totalProjectForProfile);
@ -999,8 +1029,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
} catch (Exception e) {
LOG.error("Error on deleting the project with id: " + projectID, e);
throw new Exception(
"Error occurred on deleting the project with id: " + projectID + ". Error: " + e.getMessage());
throw new Exception("Error occurred on the server side when deleting the project");
}
}
@ -1076,8 +1105,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
* @throws Exception the exception
*/
@Override
public GNADataEntryExtendedConfigProfile readDataViewerConfig() throws Exception {
LOG.info("readDataViewerConfig called");
public GNADataEntryExtendedConfigProfile readDataEntryPresentationConfig() throws Exception {
LOG.info("readDataEntryPresentationConfig called");
GCubeUser user = null;
GNADataEntryExtendedConfigProfile gnaDEExtConfig = new GNADataEntryExtendedConfigProfile();
@ -1109,7 +1138,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
long groupId = pContext.getCurrentGroupId(this.getThreadLocalRequest());
if (user == null || scope == null) {
LOG.warn("called getMyRightsInTheContext with invalid parameter user: " + user + ", in the scope: "
LOG.warn("called readDataEntryPresentationConfig with invalid parameter user: " + user + ", in the scope: "
+ scope, ", returning null");
return null;
}
@ -1154,7 +1183,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
gnaDEExtConfig.setUserRights(userRights);
return gnaDEExtConfig;
} catch (UserRetrievalFault | GroupRetrievalFault | GNAConfigException e) {
LOG.error("An error occurred during getMyRightsInTheContext: " + user, e);
LOG.error("An error occurred during readDataEntryPresentationConfig: " + user, e);
Map<OPERATION_ON_ITEM, OPERATION_TYPE> permissions = new HashMap<OPERATION_ON_ITEM, RoleRights.OPERATION_TYPE>();
RoleRights roleRights = new RoleRights(permissions, GcubeUserRole.DATA_MEMBER);
@ -1249,12 +1278,13 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
*
* @param profileID the profile ID
* @param projectID the project ID
* @param optionalMessage the optional message
* @param action the action
* @return the project DV
* @throws Exception the exception
*/
@Override
public ProjectDV performActionSteps(String profileID, String projectID, ActionDefinitionDV action)
public StepPerformedResultDV performActionSteps(String profileID, String projectID, String optionalMessage, ActionDefinitionDV action)
throws Exception {
LOG.info("performActionSteps called for profileID {}, projectID {}, action: " + action, profileID, projectID);
@ -1269,13 +1299,18 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
Project project = null;
for (String stepID : action.getCallSteps()) {
LOG.info("calling stepID {} on projectID {}", stepID, projectID);
project = client.performStep(profileID, projectID, stepID, null);
project = client.performStep(profileID, projectID, stepID, optionalMessage, null);
}
LifecycleInformationDV lifecycleInfo = getLifecycleInfoForProjectId(profileID, projectID);
lifecycleInfo.getLastOperationStatus();
ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
ProjectDV theProject = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
LOG.info("performActionSteps returning theProject with ID {}", projectID);
return theProject;
StepPerformedResultDV sprv = new StepPerformedResultDV(profileID, projectID, lifecycleInfo);
// ProjectDVBuilder projectBuilder = ProjectDVBuilder.newBuilder().fullDocumentMap(true);
// ProjectDV theProject = ConvertToDataValueObjectModel.toProjectDV(project, projectBuilder);
LOG.info("performActionSteps returning theProject with ID {}", sprv);
return sprv;
} catch (Exception e) {
String error = "Error occurred on performing the workflow step/s on the project id " + projectID;
LOG.error(error, e);
@ -1406,7 +1441,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) {
@ -1434,14 +1469,21 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
ProjectsCaller projects = GeoportalClientCaller.projects();
Project project = projects.getProjectByID(profileID, projectID);
if (project == null) {
throw new ProjectNotFoundException(
"Project with coordinates id: " + projectID + " and type: " + profileID + " not found");
}
ResultDocumentDV documentDV = ConvertToDataValueObjectModel.toResultDocumentDV(project);
LOG.info("returning: " + documentDV.getId());
return documentDV;
} catch (ProjectNotFoundException e) {
LOG.error(ProjectNotFoundException.class.getSimpleName(), e);
throw e;
} catch (Exception e) {
String error = "Error occurred on reading the project with id: " + projectID;
LOG.error(error, e);
throw new Exception(
throw new ProjectNotFoundException(
error + ". Error: " + e.getMessage() + ". Refresh and try again or contact the support");
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.geoportaldataentry.shared;
public class ProjectNotFoundException extends Exception {
/**
*
*/
private static final long serialVersionUID = 4918313646452701634L;
public ProjectNotFoundException() {
}
public ProjectNotFoundException(String error){
super(error);
}
public ProjectNotFoundException(Throwable error){
super(error);
}
}

View File

@ -49,6 +49,7 @@ h1 {
margin-left: 10px;
margin-bottom: 10px;
margin-right: 5px;
width: 100%;
}
.my-html-table td {
@ -315,4 +316,21 @@ h1 {
font-size: 12px !important;
}
/** END OVERRDING legend-style into 'metadata-profile-form-builder-widget' */
/** END OVERRDING legend-style into 'metadata-profile-form-builder-widget' */
.general_info {
text-align: center;
font-size: 20px;
}
.general_info div {
padding: 20px;
}
.general_info_facility {
font-style: italic;
font-weight: bold;
color: #3e6eac;
font-family: Helvetica, Arial;
}