This commit is contained in:
Francesco Mangiacrapa 2023-02-09 14:12:44 +01:00
parent ed93d7ab43
commit a596e180e5
7 changed files with 110 additions and 30 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

@ -80,7 +80,15 @@
<wb-module deploy-name="geoportal-data-entry-app-3.0.2-SNAPSHOT">
<wb-module deploy-name="geoportal-data-entry-app-3.1.0-SNAPSHOT">
@ -223,6 +231,10 @@
@ -305,6 +317,10 @@
@ -343,6 +359,10 @@
@ -361,7 +381,7 @@
<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">
<dependent-module archiveName="geoportal-data-common-2.0.3-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
<dependency-type>uses</dependency-type>
</dependent-module>
@ -424,6 +444,10 @@
@ -506,6 +530,10 @@
@ -588,6 +616,10 @@
@ -670,6 +702,10 @@

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;
@ -49,6 +50,16 @@ public class ConstantsGeoPortalDataEntryApp {
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;'>"
@ -1524,18 +1525,22 @@ public class GeoPortalDataEntryApp implements EntryPoint {
((Element) modal3.getElement().getChildNodes().getItem(1))
.addClassName("modal-body-custom");
boolean isPublishedProject = false;
//#24569
boolean isNotInDRAFT = false;
if (resultDocumentDV.getLifecycleInfo() != null) {
String phase = resultDocumentDV.getLifecycleInfo().getPhase();
if(phase!=null && phase.compareToIgnoreCase(WORKFLOW_PHASE.PUBLISHED.getLabel())==0) {
// 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("A '"+WORKFLOW_PHASE.PUBLISHED.getLabel()+"' project cannot be updated.");
Alert alert = new Alert(
ConstantsGeoPortalDataEntryApp.ALERT_MESSAGE_PROJECT_NOT_EDITABLE);
alert.setType(AlertType.WARNING);
alert.setClose(false);
modal3.add(alert);
isPublishedProject = true;
isNotInDRAFT = true;
}
}
@ -1543,7 +1548,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal3.add(emr);
modal3.show();
if(isPublishedProject) {
if (isNotInDRAFT) {
emr.noUpdateMode();
}
@ -1551,7 +1556,28 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
case CREATE_RELATION: {
//#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;
}