Merge pull request 'task_24567' (!10) from task_24567 into master

Reviewed-on: #10
This commit is contained in:
Francesco Mangiacrapa 2023-03-06 14:49:35 +01:00
commit dcc6ca6828
8 changed files with 127 additions and 35 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.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.1.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.0.2-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/geoportal-data-entry-app-3.1.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.0.2-SNAPSHOT
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.1.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">
@ -80,8 +80,18 @@
<wb-module deploy-name="geoportal-data-entry-app-3.0.2-SNAPSHOT">
<wb-module deploy-name="geoportal-data-entry-app-3.1.0-SNAPSHOT">
@ -163,7 +173,12 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -245,7 +260,12 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -327,7 +347,12 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -361,10 +386,12 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="geoportal-data-common-2.0.2.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -446,7 +473,12 @@
<property name="context-root" value="geoportal-data-entry-app"/>
@ -528,7 +560,12 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -610,7 +647,12 @@
</wb-module>

View File

@ -4,6 +4,13 @@
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.1.0-SNAPSHOT] - 2023-02-09
#### Enhancements
- [#24569] The Edit operation is available only in the "DRAFT" phase
- [#24571] The "Create Relation" operation is available only in the "DRAFT" phase
## [v3.0.2] - 2023-02-02
#### Fixes

View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging>
<version>3.0.2</version>
<version>3.1.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>

View File

@ -3,6 +3,7 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.util.Arrays;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.WORKFLOW_PHASE;
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.UseCaseDescriptorDV;
@ -44,11 +45,21 @@ public class ConstantsGeoPortalDataEntryApp {
public static final RootPanel ROOT_PANEL_DIV_PORTLET = RootPanel.get(ConstantsGeoPortalDataEntryApp.DIV_PORTLET_ID);
public static final String CSS_CLASS_GEOPORTAL_LOADERS_CENTER = "geoportal-loaders-center";
public static final String WORKFLOW_ACTION_POST_CREATION_ACTION_ID = "post_creation_action";
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
public static final String ALERT_MESSAGE_PROJECT_NOT_EDITABLE = "A Project can only be edited/updated in "
+ WORKFLOW_PHASE.DRAFT.name()
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
public static final String ALERT_MESSAGE_CREATE_RELATION_FORBIDDEN = "The Create Relation operation can be performed only in "
+ WORKFLOW_PHASE.DRAFT.name()
+ " phase. You need to perform the step 'Reject' or 'UnPublish' to take back the project in "
+ WORKFLOW_PHASE.DRAFT.name() + " phase.";
/**
* The Enum ACTION_PERFORMED_ON_ITEM.
*

View File

@ -1514,6 +1514,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
case EDIT_PROJECT: {
final Modal modal3 = new Modal(true, true);
modal3.setTitle(
"<span style='font-size:20px;'>Edit: <span style='color:#555; font-size:20px;'>"
@ -1523,35 +1524,60 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal3.setCloseVisible(true);
((Element) modal3.getElement().getChildNodes().getItem(1))
.addClassName("modal-body-custom");
boolean isPublishedProject = false;
if(resultDocumentDV.getLifecycleInfo()!=null) {
//#24569
boolean isNotInDRAFT = false;
if (resultDocumentDV.getLifecycleInfo() != null) {
String phase = resultDocumentDV.getLifecycleInfo().getPhase();
if(phase!=null && phase.compareToIgnoreCase(WORKFLOW_PHASE.PUBLISHED.getLabel())==0) {
Alert alert = new Alert("A '"+WORKFLOW_PHASE.PUBLISHED.getLabel()+"' project cannot be updated.");
// IF the project is not in DRAFT phase, showing an alert and no Update Mode will
// be activated
if (phase != null && phase.compareToIgnoreCase(WORKFLOW_PHASE.DRAFT.getLabel()) != 0) {
Alert alert = new Alert(
ConstantsGeoPortalDataEntryApp.ALERT_MESSAGE_PROJECT_NOT_EDITABLE);
alert.setType(AlertType.WARNING);
alert.setClose(false);
modal3.add(alert);
isPublishedProject = true;
isNotInDRAFT = true;
}
}
EditModeRecord emr = new EditModeRecord(appManagerBus, resultDocumentDV);
modal3.add(emr);
modal3.show();
if(isPublishedProject) {
if (isNotInDRAFT) {
emr.noUpdateMode();
}
break;
}
case CREATE_RELATION: {
mainTabPanel.showCreateRelationPanel(true, resultDocumentDV);
//#24571
boolean isNotInDRAFT = false;
if (resultDocumentDV.getLifecycleInfo() != null) {
String phase = resultDocumentDV.getLifecycleInfo().getPhase();
// IF the project is not in DRAFT, showing an alert and the no Update Mode will
// be activated
if (phase != null && phase.compareToIgnoreCase(WORKFLOW_PHASE.DRAFT.getLabel()) != 0) {
String msg = ConstantsGeoPortalDataEntryApp.ALERT_MESSAGE_CREATE_RELATION_FORBIDDEN;
ModalWindow modalW = new ModalWindow(new Image(Images.ICONS.accessDenied()),
"Forbidden: " + action, msg, AlertType.WARNING);
modalW.show();
isNotInDRAFT = true;
}
}
//Allowing the Create Relation only in DRAFT phase
if (!isNotInDRAFT) {
mainTabPanel.showCreateRelationPanel(true, resultDocumentDV);
}
break;
}

View File

@ -561,9 +561,15 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
ResultSetPaginatedData searchedData = new ResultSetPaginatedData();
Integer totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(),
theProfileID);
//If reloadFromService = true, loads the document from the service
Integer totalProjectForProfile = null;
//Loading total documents from the session
if(!reloadFromService) {
totalProjectForProfile = SessionUtil.getTotalDocumentForProfileID(getThreadLocalRequest(),
theProfileID);
}
if (totalProjectForProfile == null) {
totalProjectForProfile = client.getTotalDocument(theProfileID);
SessionUtil.setTotalDocumentForProfileID(getThreadLocalRequest(), theProfileID, totalProjectForProfile);