diff --git a/.classpath b/.classpath
index 7822be0..1e1ce66 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,6 @@
-
+
@@ -31,5 +31,5 @@
-
+
diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
index cddf7a1..2e9a5c6 100644
--- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs
+++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs
@@ -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
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 3361a1c..38b16fb 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,5 +1,5 @@
-
+
@@ -80,8 +80,18 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -163,7 +173,12 @@
-
+
+
+
+
+
+
@@ -245,7 +260,12 @@
-
+
+
+
+
+
+
@@ -327,7 +347,12 @@
-
+
+
+
+
+
+
@@ -361,10 +386,12 @@
-
- uses
-
-
+
+
+
+
+
+
@@ -446,7 +473,12 @@
-
+
+
+
+
+
+
@@ -528,7 +560,12 @@
-
+
+
+
+
+
+
@@ -610,7 +647,12 @@
-
+
+
+
+
+
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 859a7ea..575d8c7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/pom.xml b/pom.xml
index 6dc0eb5..3f4f595 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
org.gcube.portlets.user
geoportal-data-entry-app
war
- 3.0.2
+ 3.1.0-SNAPSHOT
GeoPortal Data Entry App
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
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
index 7dde208..5fdcf17 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java
@@ -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.
*
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
index 76549f6..2d5afad 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java
@@ -1514,6 +1514,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
case EDIT_PROJECT: {
+
final Modal modal3 = new Modal(true, true);
modal3.setTitle(
"Edit: "
@@ -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;
}
diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java
index 6816c84..3c44517 100644
--- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java
+++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java
@@ -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);