diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index a4ce841..52dec35 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,31 +1,46 @@ - - - - - - - - - - - - - - - - - uses - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 92b8602..734f6c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 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 4aae924..7d8448e 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 @@ -69,7 +69,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { private GeonaMainPanel mainPanel; - private LinkedHashMap> savedMap = new LinkedHashMap>(); + private LinkedHashMap> savedMap = new LinkedHashMap>(); 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() { + GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(result.getMongoId(), "concessione", new AsyncCallback() { @Override public void onFailure(Throwable caught) { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java index 1bc9224..32fc1c1 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryService.java @@ -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; } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java index 99830aa..0a01544 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoportalDataEntryServiceAsync.java @@ -42,5 +42,5 @@ public interface GeoportalDataEntryServiceAsync void getGeonaInitConfig(AsyncCallback callback); - void getLinksFor(Long itemId, String recordType, AsyncCallback callback); + void getLinksFor(String itemId, String recordType, AsyncCallback callback); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java index 55e6846..86ccaca 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ConvertToServiceModel.java @@ -52,11 +52,18 @@ public class ConvertToServiceModel { Concessione concessione = new Concessione(); - List authors = mapFields.get("Autore"); + +// List authors = mapFields.get("Autore"); +// if(authors!=null) { +// concessione.setAuthors(authors); +// } + + + List authors = mapFields.get("Nome Autore, Email, Ruolo"); if(authors!=null) { concessione.setAuthors(authors); } - + List contributors = mapFields.get("Contributore"); if(contributors!=null) { for (String contributor : contributors) { @@ -222,6 +229,16 @@ public class ConvertToServiceModel { relazioneScavo.setLicenseID(licenzaIdList.get(0)); } + //TODO + List 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 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 licenzaIdList = mapFields.get("ID Licenza"); if(licenzaIdList!=null && licenzaIdList.size()>0) { layerConcessione.setLicenseID(licenzaIdList.get(0)); 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 6a140c1..f23328c 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 @@ -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 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 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); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java index 9e0b07c..e2db0ce 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/shared/CommitReport.java @@ -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="); @@ -148,5 +154,6 @@ public class CommitReport implements Serializable { return builder.toString(); } + } diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java b/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java index 0422679..3fefedf 100644 --- a/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java +++ b/src/test/java/org/gcube/portlets/user/geoportaldataentry/client/TestClass.java @@ -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"); + }