Merged with version v3.0.2 and v3.1.0-SNAPSHOT. Branch task_24567
This commit is contained in:
parent
63102043a5
commit
126939574c
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -80,7 +81,8 @@
|
|||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-entry-app-3.1.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -161,7 +163,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -242,7 +245,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -323,7 +327,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -356,10 +361,11 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
<dependent-module archiveName="geoportal-data-mapper-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -440,7 +446,8 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-entry-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -521,7 +528,8 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -602,7 +610,8 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -4,11 +4,25 @@
|
|||
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] - 2022-11-30
|
||||
## [v3.2.0-SNAPSHOT] - 2022-02-09
|
||||
|
||||
- [#24166] Implemented the Update facility
|
||||
- [#24244] Integrated with the geoportal-data-mapper library
|
||||
|
||||
## [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
|
||||
|
||||
- [#24520] Added parameter "force=true" to Delete Project
|
||||
- [#24475] Propagated the Access Policy in the fileset
|
||||
|
||||
## [v3.0.1] - 2023-01-19
|
||||
|
||||
#### Fixes
|
||||
|
@ -16,7 +30,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|||
- [#24281] Fixed filtering selection label
|
||||
- [#24049] Fixed "Show on Map" facility vs Chrome browser
|
||||
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
|
||||
- [#24458] Published projects cannot be edited/updated
|
||||
|
||||
## [v3.0.0] - 2022-11-09
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-entry-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>3.1.0-SNAPSHOT</version>
|
||||
<version>3.2.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>
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -1530,18 +1530,22 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
modal3.setHeight(height + "px");
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1556,7 +1560,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
UpdateRecord ur = new UpdateRecord(appManagerBus, resultDocumentDV.getProfileID(),
|
||||
resultDocumentDV.getId());
|
||||
|
||||
if(isPublishedProject) {
|
||||
if(isNotInDRAFT) {
|
||||
ur.noUpdateMode();
|
||||
}
|
||||
|
||||
|
@ -1567,7 +1571,28 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public class ViewRelationshipPanel extends Composite {
|
|||
secondProjectPanelContainer.clear();
|
||||
this.fromTheProject = project;
|
||||
|
||||
Entry<String, String> firstEntrySet = project.getFirstEntryOfMap();
|
||||
Entry<String, Object> firstEntrySet = project.getFirstEntryOfMap();
|
||||
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
|
||||
+ ")";
|
||||
|
||||
|
@ -203,7 +203,7 @@ public class ViewRelationshipPanel extends Composite {
|
|||
@Override
|
||||
public void onSuccess(ResultDocumentDV result) {
|
||||
mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
|
||||
Entry<String, String> firstEntrySet = result.getFirstEntryOfMap();
|
||||
Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
|
||||
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
|
||||
+ "</b> (id: " + result.getId() + ")";
|
||||
|
||||
|
|
|
@ -21,11 +21,14 @@ import org.apache.commons.io.FileUtils;
|
|||
import org.bson.Document;
|
||||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
import org.gcube.application.geoportal.common.model.document.access.Access;
|
||||
import org.gcube.application.geoportal.common.model.document.access.AccessPolicy;
|
||||
import org.gcube.application.geoportal.common.model.document.lifecycle.LifecycleInformation;
|
||||
import org.gcube.application.geoportal.common.model.rest.TempFile;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.RelationshipDefinition;
|
||||
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
|
||||
import org.gcube.application.geoportal.common.utils.StorageUtils;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataServiceModel;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataValueObjectModel;
|
||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||
import org.gcube.application.geoportalcommon.ProjectDVBuilder;
|
||||
|
@ -78,6 +81,8 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import com.jayway.jsonpath.spi.json.JsonOrgJsonProvider;
|
||||
|
||||
/**
|
||||
* The server side implementation of the RPC service.
|
||||
|
@ -240,6 +245,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
sectionJSONPathIndexer = new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
String theJSONDocument = theProject.getTheDocument().toJson();
|
||||
|
||||
for (Tree_Node<GeoNaFormDataObject> treeNodeChild_GNA_DO : tree_Node.getChildren()) {
|
||||
LOG.debug("Going to upload the files of tree node: " + treeNodeChild_GNA_DO);
|
||||
|
||||
|
@ -332,20 +339,23 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
File[] fileset = uploadedFileset.getFileset();
|
||||
FilePathDV filePath = uploadedFileset.getFilePathDV();
|
||||
|
||||
Access access;
|
||||
// If the maxOccurs is not 1
|
||||
if (profile.getMaxOccurs() == 0 || profile.getMaxOccurs() > 1) {
|
||||
LOG.info("The gCube Profile with the section " + sectionJSONPath
|
||||
+ " has maxOccurs > 1 need to manage it as array, going to add the array index");
|
||||
String arraySectionJSONPAth = String.format("%s[%d]", sectionJSONPath, jpcV);
|
||||
LOG.debug("registering the fileset in the array section: " + sectionJSONPath);
|
||||
|
||||
access = ConvertToDataServiceModel.getAccessFromDocumentSection(theJSONDocument,arraySectionJSONPAth);
|
||||
mongoService.registerFileSet(profileID, theProject, arraySectionJSONPAth,
|
||||
filePath.getFieldName(), filePath.getFieldDefinition(), fileset);
|
||||
filePath.getFieldName(), filePath.getFieldDefinition(), access, fileset);
|
||||
} else {
|
||||
LOG.info("The gCube Profile with the section " + sectionJSONPath + " has maxOccurs = 1");
|
||||
LOG.debug("registering the fileset in the section: " + sectionJSONPath);
|
||||
|
||||
access = ConvertToDataServiceModel.getAccessFromDocumentSection(theJSONDocument,sectionJSONPath);
|
||||
mongoService.registerFileSet(profileID, theProject, sectionJSONPath, filePath.getFieldName(),
|
||||
filePath.getFieldDefinition(), fileset);
|
||||
filePath.getFieldDefinition(), access, fileset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -523,26 +533,26 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
|
||||
searchedData.setTotalItems(totalProjectForProfile);
|
||||
LOG.info("Total Docs read from config: " + totalProjectForProfile);
|
||||
|
||||
|
||||
// Saving client PROJECTION
|
||||
LinkedHashMap<String, Object> originalProjection = filter.getProjection();
|
||||
int totalItems = totalProjectForProfile;
|
||||
//PERFORMING FIRST QUERY FOR IDS IF AND ONLY IF WHERE CONDITIONS IN THE QUERY.
|
||||
//SEARCHING FACILITY IS ENACTING.
|
||||
if(filter.getConditions()!=null) {
|
||||
|
||||
// PERFORMING FIRST QUERY FOR IDS IF AND ONLY IF WHERE CONDITIONS IN THE QUERY.
|
||||
// SEARCHING FACILITY IS ENACTING.
|
||||
if (filter.getConditions() != null) {
|
||||
|
||||
// Setting PROJECTION ONLY FOR PROEJCT ID
|
||||
LinkedHashMap<String, Object> projectionForIDs = new LinkedHashMap<String, Object>();
|
||||
projectionForIDs.put(Project.ID, 1);
|
||||
filter.setProjection(projectionForIDs);
|
||||
|
||||
|
||||
// FIRST QUERY TO RETRIEVE IDs
|
||||
// LIMIT IS NULL MEANS THAT IT IS EQUAL TO NUMBER TOTAL OF DOCUMENTS
|
||||
//Calculating always the size starting from 0
|
||||
// Calculating always the size starting from 0
|
||||
final Iterator<Project> projectsIDs = client.queryOnMongo(theProfileID, totalProjectForProfile, 0, null,
|
||||
filter);
|
||||
|
||||
//Getting the Project IDs from the Iterable
|
||||
|
||||
// Getting the Project IDs from the Iterable
|
||||
Iterable<Project> itP = () -> projectsIDs;
|
||||
Stream<Project> targetStream = StreamSupport.stream(itP.spliterator(), false);
|
||||
List<String> listProjectIDs = targetStream.map(Project::getId).collect(Collectors.toList());
|
||||
|
@ -550,13 +560,12 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
searchedData.setTotalItems(totalItems);
|
||||
LOG.info("Total Docs read from query per ID: " + totalItems);
|
||||
}
|
||||
|
||||
//NOW PERFORMING THE (REAL) SECOND QUERY FROM CLIENT
|
||||
|
||||
// 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 = client.queryOnMongo(theProfileID, totalItems, start, limit, filter);
|
||||
|
||||
searchedData.setClientStartIndex(start);
|
||||
searchedData.setLimit(limit);
|
||||
|
@ -564,9 +573,10 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
|
||||
List<ResultDocumentDV> toReturnList = ConvertToDataValueObjectModel.toListResultDocument(projects);
|
||||
searchedData.setData(toReturnList);
|
||||
|
||||
LOG.info("Total Docs page size returned:" + toReturnList.size() + ", start: " + start + ", limit: " + limit);
|
||||
|
||||
|
||||
LOG.info(
|
||||
"Total Docs page size returned:" + toReturnList.size() + ", start: " + start + ", limit: " + limit);
|
||||
|
||||
if (totalProjectForProfile == limit || totalProjectForProfile == 0) {
|
||||
LOG.debug("Page completed returning " + totalProjectForProfile + " projects");
|
||||
int newOffset = start + limit;
|
||||
|
@ -612,7 +622,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
ProjectsCaller client = GeoportalClientCaller.projects();
|
||||
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||
|
||||
client.deleteProject(profileID, projectID, false);
|
||||
client.deleteProject(profileID, projectID, true);
|
||||
// Updating count of Documents in session per profileID
|
||||
Integer totalProjectForProfile = client.getTotalDocument(profileID);
|
||||
SessionUtil.setTotalDocumentForProfileID(getThreadLocalRequest(), profileID, totalProjectForProfile);
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.bson.Document;
|
|||
import org.gcube.application.geoportal.client.utils.Serialization;
|
||||
import org.gcube.application.geoportal.common.faults.InvalidRequestException;
|
||||
import org.gcube.application.geoportal.common.model.document.Project;
|
||||
import org.gcube.application.geoportal.common.model.document.access.Access;
|
||||
import org.gcube.application.geoportal.common.model.rest.RegisterFileSetRequest;
|
||||
import org.gcube.application.geoportal.common.model.rest.TempFile;
|
||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||
|
@ -63,7 +64,7 @@ public class MongoServiceUtil {
|
|||
}
|
||||
|
||||
public void registerFileSet(String profileID, Project project, String parentPath, String fieldName,
|
||||
String fieldDefinition, File... files)
|
||||
String fieldDefinition, Access access, File... files)
|
||||
throws RemoteException, FileNotFoundException, JsonProcessingException, InvalidRequestException {
|
||||
LOG.debug("registerFileSet called for profileID: " + profileID);
|
||||
|
||||
|
@ -71,6 +72,8 @@ public class MongoServiceUtil {
|
|||
// Prepare request
|
||||
RegisterFileSetRequest fsRequest = FileSets.prepareRequest(new StorageUtils(), parentPath, fieldName,
|
||||
fieldDefinition, files);
|
||||
fsRequest.setToSetAccess(access);
|
||||
|
||||
project = client.registerFileSet(project.getId(), fsRequest);
|
||||
LOG.trace("Resulting Project : " + project);
|
||||
LOG.debug("Resulting Project as JSON: " + Serialization.write(project));
|
||||
|
|
Loading…
Reference in New Issue