task_20210 #1

Closed
francesco.mangiacrapa wants to merge 11 commits from task_20210 into master
8 changed files with 118 additions and 79 deletions
Showing only changes of commit 660b2606cc - Show all commits

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/geoportal-data-entry-app-1.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/geoportal-data-entry-app-1.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-1.0.1-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<classpathentry excluding="**" kind="src" output="target/geoportal-data-entry-app-1.0.2-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.0.1-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/geoportal-data-entry-app-1.0.2-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-1.0.1-SNAPSHOT
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.2-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -4,9 +4,6 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="metadata-profile-form-builder-widget-1.0.1-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>
<property name="context-root" value="geoportal-data-entry-app"/>
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</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).
## [v1.0.3-SNAPSHOT] - 2020-11-30
#### Enhancements
[#20210] Updating required for data entry facility after the first feedback by domain experts
## [v1.0.2-SNAPSHOT] - 2020-11-09
#### Bug fixes

25
pom.xml
View File

@ -14,7 +14,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging>
<version>1.0.2-SNAPSHOT</version>
<version>1.0.3-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 GeoNa project</description>
<scm>
@ -115,15 +115,32 @@
<scope>compile</scope>
</dependency>
<!-- END FWS -->
<!-- <dependency> -->
<!-- <groupId>org.gcube.application</groupId> -->
<!-- <artifactId>geoportal-logic</artifactId> -->
<!-- <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version> -->
<!-- <scope>compile</scope> -->
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <groupId>javax.servlet</groupId> -->
<!-- <artifactId>servlet-api</artifactId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-logic</artifactId>
<artifactId>geoportal-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
</exclusion>
<exclusion>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>discovery-client</artifactId>
</exclusion>
</exclusions>
</dependency>

View File

@ -8,11 +8,11 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportal.model.AccessPolicy;
import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.application.geoportal.model.concessioni.LayerConcessione;
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp;
import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
@ -140,13 +140,13 @@ public class ConvertToServiceModel {
}
List<String> titolareCopyrightLst = mapFields.get("Titolare Copyright");
if(titolareCopyrightLst!=null && titolareCopyrightLst.size()>0){
concessione.setTitolareCopyright(titolareCopyrightLst.get(0));
if(titolareCopyrightLst!=null){
concessione.setTitolareCopyright(titolareCopyrightLst);
}
List<String> titolareLicenzaLst = mapFields.get("Titolare Licenza");
if(titolareLicenzaLst!=null && titolareLicenzaLst.size()>0){
concessione.setTitolareLicenza(titolareLicenzaLst.get(0));
if(titolareLicenzaLst!=null){
concessione.setTitolareLicenza(titolareLicenzaLst);
}
List<String> titolareDatiLst = mapFields.get("Titolare dei dati");

View File

@ -6,17 +6,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportal.managers.ConcessioneManager;
import org.gcube.application.geoportal.managers.ManagerFactory;
import org.gcube.application.geoportal.model.InputStreamDescriptor;
import org.gcube.application.geoportal.model.concessioni.Concessione;
import org.gcube.application.geoportal.model.concessioni.LayerConcessione;
import org.gcube.application.geoportal.model.concessioni.RelazioneScavo;
import org.gcube.application.geoportal.model.content.UploadedImage;
import org.gcube.application.geoportal.model.content.WorkspaceContent;
import org.gcube.application.geoportal.model.fault.PublishException;
import org.gcube.application.geoportal.model.fault.ValidationException;
import org.gcube.application.geoportal.utils.Serialization;
import javax.validation.ValidationException;
import org.gcube.application.geoportal.client.legacy.ConcessioniManager;
import org.gcube.application.geoportal.common.model.legacy.Concessione;
import org.gcube.application.geoportal.common.model.legacy.InputStreamDescriptor;
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
import org.gcube.application.geoportal.common.model.legacy.RelazioneScavo;
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
import org.gcube.application.geoportal.common.model.legacy.report.PublicationReport;
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService;
import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport;
@ -66,7 +64,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
GCubeUser user = SessionUtil.getCurrentUser(this.getThreadLocalRequest());
ConcessioneManager manager;
ConcessioniManager manager = new ConcessioniManager();
Concessione concessione = null;
boolean registered = false;
try {
//Saving Data
@ -79,11 +79,12 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
GenericDatasetBean idp = listGDB.get(0);
LOG.debug("\n\n");
LOG.debug(ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO+" building with client obj: "+idp);
Concessione concessione = ConvertToServiceModel.toConcessione(idp, user);
concessione = ConvertToServiceModel.toConcessione(idp, user);
LOG.debug("Built "+ConcessioniFormCardTitle.INFORMAZIONI_DI_PROGETTO+" as server obj: "+concessione);
//saving into back-end
manager = ManagerFactory.registerNew(concessione);
concessione = manager.registerNew(concessione);
registered = true;
//RELAZIONE_DI_SCAVO
list = toMap.get(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO);
@ -160,7 +161,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
FileInputStream fis = new FileInputStream(fileUploaded.getTempSystemPath());
InputStreamDescriptor isd = new InputStreamDescriptor(fis, fileUploaded.getFileName());
//saving into back-end
manager.addPiantaFineScavo(layerPfs, isd);
manager.addPiantaScavo(layerPfs, isd);
}
}catch (Exception e) {
LOG.error("Error on converting form data: ",e);
@ -169,36 +170,31 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
try {
//If true -> data are published into the SDI
Boolean publish=true;
Concessione registered=manager.commit(publish);
LOG.info("Registered: "+registered);
String link = null;
try {
link = ((WorkspaceContent)registered.getRelazioneScavo().getActualContent().get(0)).getLink();
}catch (Exception e) {
LOG.warn("Not able to check public link ",e);
}
//String link = "toTest";
CommitReport cRep = new CommitReport();
cRep.setRecordId(registered.getId());
if(link!=null) {
cRep.setState(STATE.OK);
cRep.setMsg("Project saved successfully");
}
else {
cRep.setState(STATE.WARN);
cRep.setMsg("Project saved with errors");
}
CommitReport cRep = null;
if(registered) {
PublicationReport report = manager.commitRegistered();
LOG.info("Registered: "+report);
cRep = new CommitReport();
cRep.setRecordId(report.getTheRecord().getId());
cRep.setReport(report.toString());
if(report.getTheRecord()!=null ) {
cRep.setState(STATE.OK);
cRep.setMsg("Project saved successfully");
}
else {
cRep.setState(STATE.ERROR);
cRep.setMsg("Project not saved correctly");
}
}else
throw new Exception("Sorry, the record has not been registred correclty. Try again");
return cRep;
}catch (ValidationException e1){
LOG.error("Error on validating data: ",e1);
throw new Exception("Error on validating data: "+Serialization.prettyPrint(e1.getReport()));
}catch (PublishException e2) {
LOG.error("Error on publishing data: ",e2);
throw new Exception("Error on publishing data: "+e2.getMessage());
throw new Exception("Error on validating data: ", e1);
}catch (Exception e) {
LOG.error("Error on commiting data: ",e);
throw new Exception("Error occurred on saving data, try again or contact the support. Error: "+e.getMessage());

View File

@ -8,53 +8,54 @@ import java.io.Serializable;
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 21, 2020
* Nov 30, 2020
*/
public class CommitReport implements Serializable{
public class CommitReport implements Serializable {
/**
*
*/
private static final long serialVersionUID = -9519707669761939L;
/**
* The Enum STATE.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Oct 21, 2020
* Oct 21, 2020
*/
public enum STATE{ERROR, WARN, OK, UNKNOWN}
public enum STATE {
ERROR, WARN, OK, UNKNOWN
}
public STATE state = STATE.UNKNOWN;
public long recordId;
public String msg;
public String report;
/**
* Instantiates a new commit report.
*/
public CommitReport() {
}
/**
* Instantiates a new commit report.
*
* @param state the state
* @param state the state
* @param recordId the record id
* @param msg the msg
* @param msg the msg
* @param report the report
*/
public CommitReport(STATE state, long recordId, String msg) {
public CommitReport(STATE state, long recordId, String msg, String report) {
super();
this.state = state;
this.recordId = recordId;
this.msg = msg;
this.report = report;
}
/**
* Gets the state.
*
@ -82,6 +83,24 @@ public class CommitReport implements Serializable{
return recordId;
}
/**
* Gets the report.
*
* @return the report
*/
public String getReport() {
return report;
}
/**
* Sets the report.
*
* @param report the new report
*/
public void setReport(String report) {
this.report = report;
}
/**
* Sets the record id.
*
@ -109,10 +128,10 @@ public class CommitReport implements Serializable{
this.msg = msg;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
@ -123,8 +142,11 @@ public class CommitReport implements Serializable{
builder.append(recordId);
builder.append(", msg=");
builder.append(msg);
builder.append(", report=");
builder.append(report);
builder.append("]");
return builder.toString();
}
}