Passed to mongoId. Passed to Nome Autore, Email, Ruolo

This commit is contained in:
Francesco Mangiacrapa 2021-07-30 11:53:12 +02:00
parent 7f8e9da1e2
commit a134c87b6d
9 changed files with 139 additions and 77 deletions

View File

@ -1,31 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="geoportal-data-entry-app-1.3.0-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<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>
</project-modules>

View File

@ -10,6 +10,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
[#20435] Client integration with MongoConcessioni
Moved to maven-portal-bom 3.6.3
[#21856] Implementing new user feedback
[#21890] Passed to mongoID
## [v1.2.0] - 2020-12-18

View File

@ -69,7 +69,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
private GeonaMainPanel mainPanel;
private LinkedHashMap<Long, List<GeoNaFormDataObject>> savedMap = new LinkedHashMap<Long, List<GeoNaFormDataObject>>();
private LinkedHashMap<String, List<GeoNaFormDataObject>> savedMap = new LinkedHashMap<String, List<GeoNaFormDataObject>>();
private boolean projectSavedWithSuccess;
@ -276,11 +276,11 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modalContainerPanel.add(recordPublished);
if(result.getRecordId()!=null) {
modalContainerPanel.add(new HTML("Record id: "+(result.getRecordId())));
if(result.getMongoId()!=null) {
modalContainerPanel.add(new HTML("Record id: "+(result.getMongoId())));
try {
savedMap.put(result.getRecordId(), saveGeonaDataFormsEvent.getListGeonaDataForms());
savedMap.put(result.getMongoId(), saveGeonaDataFormsEvent.getListGeonaDataForms());
}catch (Exception e) {
// TODO: handle exception
}
@ -289,7 +289,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
final LoaderIcon lc = new LoaderIcon("Get link...");
hpGetLink.add(lc);
modalContainerPanel.add(hpGetLink);
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(result.getRecordId(), "concessione", new AsyncCallback<GeoNaItemRef>() {
GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(result.getMongoId(), "concessione", new AsyncCallback<GeoNaItemRef>() {
@Override
public void onFailure(Throwable caught) {

View File

@ -20,13 +20,5 @@ public interface GeoportalDataEntryService extends RemoteService {
GeonaISConfig getGeonaInitConfig();
/**
* Gets the links for.
*
* @param itemId the item id
* @param recordType the record type
* @return the links for
* @throws Exception the exception
*/
GeoNaItemRef getLinksFor(Long itemId, String recordType) throws Exception;
GeoNaItemRef getLinksFor(String itemId, String recordType) throws Exception;
}

View File

@ -42,5 +42,5 @@ public interface GeoportalDataEntryServiceAsync
void getGeonaInitConfig(AsyncCallback<GeonaISConfig> callback);
void getLinksFor(Long itemId, String recordType, AsyncCallback<GeoNaItemRef> callback);
void getLinksFor(String itemId, String recordType, AsyncCallback<GeoNaItemRef> callback);
}

View File

@ -52,7 +52,14 @@ public class ConvertToServiceModel {
Concessione concessione = new Concessione();
List<String> authors = mapFields.get("Autore");
// List<String> authors = mapFields.get("Autore");
// if(authors!=null) {
// concessione.setAuthors(authors);
// }
List<String> authors = mapFields.get("Nome Autore, Email, Ruolo");
if(authors!=null) {
concessione.setAuthors(authors);
}
@ -222,6 +229,16 @@ public class ConvertToServiceModel {
relazioneScavo.setLicenseID(licenzaIdList.get(0));
}
//TODO
List<String> periodoDiEmbargo = mapFields.get("Periodo di embargo");
if(periodoDiEmbargo!=null && periodoDiEmbargo.size()>0) {
String dateFromTo = periodoDiEmbargo.get(0);
String[] dates = dateFromTo.split(",");
String dateFrom = dates[0];
String dateTo = dates[0];
//TODO MUST BE INTENGRATED IN THE SERVICE
}
return relazioneScavo;
}
@ -354,6 +371,17 @@ public class ConvertToServiceModel {
layerConcessione.setScalaAcquisizione(scalaAcquisizioneLst.get(0));
}
//TODO
List<String> periodoDiEmbargo = mapFields.get("Periodo di embargo");
if(periodoDiEmbargo!=null && periodoDiEmbargo.size()>0) {
String dateFromTo = periodoDiEmbargo.get(0);
String[] dates = dateFromTo.split(",");
String dateFrom = dates[0];
String dateTo = dates[0];
//TODO MUST BE INTENGRATED IN THE SERVICE
}
List<String> licenzaIdList = mapFields.get("ID Licenza");
if(licenzaIdList!=null && licenzaIdList.size()>0) {
layerConcessione.setLicenseID(licenzaIdList.get(0));

View File

@ -211,7 +211,18 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
//UPLOADING FILES
LOG.info("Now uploading the files...");
// Building TempFile for Relazione
//Building TempFile for ABSTRACT DELLA RELAZIONE DI SCAVO
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
List<TempFile> ardsFiles = serviceUtil.toTemFiles(ards.getFilesUploaded());
//TODO MUST BE UNIFIED WITH RELAZIONE OPPURE BISOGNA PREVEDERE UN ABSTRACT_RELAZIONE???
if (ardsFiles!=null && ardsFiles.size() > 0) {
// saving into back-end
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.RELAZIONE, ardsFiles);
clientMongo.registerFile(mongoId, request);
LOG.info("Registered the mongoId "+mongoId+" request " + Paths.RELAZIONE + "with "+ardsFiles.size()+" file/s");
}
// Building TempFile for RELAZIONE DI SCAVO
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
List<TempFile> files = serviceUtil.toTemFiles(rds.getFilesUploaded());
// Upload file to Concessione. Should be one file.
@ -286,16 +297,17 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
LOG.info("ValidationReport: " + report);
//to client
CommitReport cRep = new CommitReport();
cRep.setRecordId(concessione.getId());
//cRep.setRecordId(concessione.getId());
cRep.setMongoId(concessione.getMongo_id());
String theJSON = serviceUtil.toJSON(report);
cRep.setReport(theJSON);
switch (report.getStatus()) {
case PASSED:
cRep.setState(STATE.OK);
if(cRep.getRecordId()==null) {
LOG.error("The record id is null!!!");
throw new Exception("Invalid record id");
if(cRep.getMongoId()==null) {
LOG.error("The mongo id is null!!!");
throw new Exception("Invalid identifier (mongoId is null) for the concessione");
}
break;
case WARNING:
@ -362,13 +374,13 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
/**
* Gets the links for.
*
* @param itemId the item id
* @param itemId the item id is the mongoId
* @param recordType the record type
* @return the links for
* @throws Exception the exception
*/
@Override
public GeoNaItemRef getLinksFor(Long itemId, String recordType) throws Exception {
public GeoNaItemRef getLinksFor(String itemId, String recordType) throws Exception {
LOG.info("getLinksFor called");
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);

View File

@ -2,13 +2,12 @@ package org.gcube.portlets.user.geoportaldataentry.shared;
import java.io.Serializable;
/**
* The Class CommitReport.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 30, 2020
* Jul 30, 2021
*/
public class CommitReport implements Serializable {
@ -30,6 +29,7 @@ public class CommitReport implements Serializable {
public STATE state = STATE.UNKNOWN;
public Long recordId;
public String mongoId;
public String msg;
public String report;
@ -45,13 +45,14 @@ public class CommitReport implements Serializable {
*
* @param state the state
* @param recordId the record id
* @param mongoId the mongo id
* @param msg the msg
* @param report the report
* @param report the report
*/
public CommitReport(STATE state, long recordId, String msg, String report) {
public CommitReport(STATE state, long recordId, String mongoId, String msg, String report) {
super();
this.state = state;
this.recordId = recordId;
this.mongoId = mongoId;
this.msg = msg;
this.report = report;
}
@ -74,14 +75,14 @@ public class CommitReport implements Serializable {
this.state = state;
}
/**
* Gets the record id.
*
* @return the record id
*/
public Long getRecordId() {
return recordId;
}
// /**
// * Gets the record id.
// *
// * @return the record id
// */
// public Long getRecordId() {
// return recordId;
// }
/**
* Gets the report.
@ -101,14 +102,14 @@ public class CommitReport implements Serializable {
this.report = report;
}
/**
* Sets the record id.
*
* @param recordId the new record id
*/
public void setRecordId(long recordId) {
this.recordId = recordId;
}
// /**
// * Sets the record id.
// *
// * @param recordId the new record id
// */
// public void setRecordId(long recordId) {
// this.recordId = recordId;
// }
/**
* Gets the msg.
@ -119,6 +120,14 @@ public class CommitReport implements Serializable {
return msg;
}
public String getMongoId() {
return mongoId;
}
public void setMongoId(String mongoId) {
this.mongoId = mongoId;
}
/**
* Sets the msg.
*
@ -128,11 +137,6 @@ public class CommitReport implements Serializable {
this.msg = msg;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
@ -140,6 +144,8 @@ public class CommitReport implements Serializable {
builder.append(state);
builder.append(", recordId=");
builder.append(recordId);
builder.append(", mongoId=");
builder.append(mongoId);
builder.append(", msg=");
builder.append(msg);
builder.append(", report=");
@ -149,4 +155,5 @@ public class CommitReport implements Serializable {
}
}

View File

@ -3,11 +3,12 @@ package org.gcube.portlets.user.geoportaldataentry.client;
import java.time.LocalDateTime;
import org.gcube.portlets.user.geoportaldataentry.server.ConvertToServiceModel;
import org.gcube.portlets.user.geoportaldataentry.server.GeoportalDataEntryServiceImpl;
public class TestClass {
public static void main(String[] args) {
public static void main(String[] args) throws Exception {
LocalDateTime ldt = ConvertToServiceModel.toLocalDateTime("2020-10-01 10:20");
System.out.println(ldt.toString());
@ -19,6 +20,11 @@ public class TestClass {
String longitude = "0";
System.out.println(longitude.matches("\\s*[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"));
GeoportalDataEntryServiceImpl g = new GeoportalDataEntryServiceImpl();
g.getLinksFor("", "concessione");
}