diff --git a/CHANGELOG.md b/CHANGELOG.md index f9b5eb2..ddf49a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Moved to maven-portal-bom 3.6.3 [#21856] Implementing new user feedback [#21890] Passed to mongoID [#20599] Get List of Records +[#22002] Integrated with ValidationReport and status ## [v1.2.0] - 2020-12-18 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 08e58b4..8eb2bf2 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 @@ -38,7 +38,7 @@ public class ConstantsGeoPortalDataEntryApp { * Aug 6, 2021 */ public enum ACTION_ON_ITEM { - SHOW_ON_MAP, SHOW_METADATA, REMOVE + SHOW_ON_MAP, SHOW_METADATA, SHOW_REPORT, REMOVE } /** @@ -50,7 +50,7 @@ public class ConstantsGeoPortalDataEntryApp { */ public static enum RECORD_FIELD { NAME("name", "Name"), INTRODUCTION("introduction", "Introduction"), AUTHOR("author", "Author/s"), - PROJECT_START_END_DATE("", "Project Start/End Date"), CREATED("created", "Created"), + PROJECT_START_END_DATE("", "Project Start/End Date"), PUBLISHING_STATUS("publishingStatus", "Publishing Status"), CREATED("created", "Created"), CREATED_BY("createdBy", "Created by"); String jsonFieldName; @@ -60,17 +60,17 @@ public class ConstantsGeoPortalDataEntryApp { * Instantiates a new record field. * * @param jsonFieldName the json field name - * @param displayName the display name + * @param displayName the display name */ RECORD_FIELD(String jsonFieldName, String displayName) { this.jsonFieldName = jsonFieldName; this.displayName = displayName; } - + public String getJsonFieldName() { return jsonFieldName; } - + public String getDisplayName() { return displayName; } 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 8533789..6282481 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 @@ -9,6 +9,7 @@ import java.util.TreeMap; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; +import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; @@ -24,6 +25,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaMainTabPanel; import org.gcube.portlets.user.geoportaldataentry.client.ui.GeonaRecordsPaginatedView; import org.gcube.portlets.user.geoportaldataentry.client.ui.card.GeoNaFormCardModel; import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm; +import org.gcube.portlets.user.geoportaldataentry.client.ui.report.BuildValidationReport; import org.gcube.portlets.user.geoportaldataentry.client.ui.report.ReportTemplateToHTML; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.DialogConfirm; import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil; @@ -278,18 +280,18 @@ public class GeoPortalDataEntryApp implements EntryPoint { modalContainerPanel.clear(); modal.setCloseVisible(true); HTML recordPublished = new HTML(); - switch (result.getState()) { - case OK: + ValidationReportDV vr = result.getValidationReportDV(); + switch (vr.getStatus()) { + case PASSED: String success = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null, "SUCCESS"); recordPublished.setHTML("Record Published with " + success); projectSavedWithSuccess = true; - String msg = result.getMsg() != null ? result.getMsg() - : "Record published with success"; + String msg = "Record published with success"; geoNaMainForm.showAlertOnSaveAction(msg, AlertType.SUCCESS, true); purgeFileUploaded(); break; - case WARN: + case WARNING: String warning = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null, "WARNING"); recordPublished.setHTML("Record Published with " + warning); @@ -349,8 +351,8 @@ public class GeoPortalDataEntryApp implements EntryPoint { // geoNaMainForm.enableButtonSave(true); // resetUI(); - if (result.getReport() != null) { - modalContainerPanel.add(new ReportTemplateToHTML(result.getReport())); + if (vr.getAsJSONString() != null) { + modalContainerPanel.add(new ReportTemplateToHTML(vr.getAsJSONString())); } } @@ -426,9 +428,10 @@ public class GeoPortalDataEntryApp implements EntryPoint { final Modal modal = new Modal(true, true); modal.setCloseVisible(true); final HorizontalPanel hpGetLink = new HorizontalPanel(); - final LoaderIcon lc = new LoaderIcon("Get link..."); + final LoaderIcon lc = new LoaderIcon("Just moment getting link..."); hpGetLink.add(lc); modal.add(hpGetLink); + final NewBrowserWindow newBrowserWindow = NewBrowserWindow.open("", "_blank", ""); GeoportalDataEntryServiceAsync.Util.getInstance().getLinksFor(concessione.getItemId(), @@ -454,6 +457,21 @@ public class GeoPortalDataEntryApp implements EntryPoint { modal.show(); + break; + + case SHOW_REPORT: + final Modal modal2 = new Modal(true, true); + modal2.setWidth(800); + modal2.setCloseVisible(true); + if (concessione.getValidationReport() == null) { + modal2.add(new HTML("No report available for: "+concessione.getNome())); + } else { + BuildValidationReport buildValidationReport = new BuildValidationReport( + concessione.getValidationReport()); + modal2.add(buildValidationReport); + } + modal2.show(); + break; case REMOVE: diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/BuildValidationReport.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/BuildValidationReport.java new file mode 100644 index 0000000..f1aa06d --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/BuildValidationReport.java @@ -0,0 +1,57 @@ +package org.gcube.portlets.user.geoportaldataentry.client.ui.report; + +import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; +import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus; +import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil; +import org.gcube.portlets.user.geoportaldataentry.client.ui.utils.HTMLUtil.HTML_TAG; + +import com.google.gwt.user.client.ui.FlowPanel; +import com.google.gwt.user.client.ui.HTML; + +/** + * The Class BuildValidationReport. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Sep 14, 2021 + */ +public class BuildValidationReport extends FlowPanel { + private HTML recordPublished = new HTML(); + private ReportTemplateToHTML rTToHTML; + + /** + * Instantiates a new builds the validation report. + * + * @param validationReport the validation report + */ + public BuildValidationReport(ValidationReportDV validationReport) { + + if(validationReport==null) + return; + + ValidationStatus status = validationReport.getStatus(); + switch (status) { + case PASSED: + String success = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "32CD32", null, "SUCCESS"); + recordPublished.setHTML("Record Published with " + success); + break; + case WARNING: + String warning = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF8000", null, "WARNING"); + recordPublished.setHTML("Record Published with " + warning); + + break; + case ERROR: + String error = HTMLUtil.getHTMLElement(HTML_TAG.span, 14, "FF0000", "bold", "ERROR"); + recordPublished.setHTML(error + " on publishing the Record"); + break; + default: + break; + } + + rTToHTML = new ReportTemplateToHTML(validationReport.getAsJSONString()); + + add(recordPublished); + add(rTToHTML); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java index fb017d1..61b8afa 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.java @@ -13,13 +13,12 @@ import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; - /** * The Class ReportTemplateToHTML. * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * - * Jan 25, 2021 + * Jan 25, 2021 */ public class ReportTemplateToHTML extends Composite { @@ -30,7 +29,7 @@ public class ReportTemplateToHTML extends Composite { * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * - * Jan 25, 2021 + * Jan 25, 2021 */ interface ReportTemplateToHTMLUiBinder extends UiBinder { } @@ -43,66 +42,54 @@ public class ReportTemplateToHTML extends Composite { @UiField Paragraph reportJSON; - + boolean toJSONERROR = false; /** * Instantiates a new report template to HTML. * - * @param report the report + * @param reportAsJSON the report as JSON */ - public ReportTemplateToHTML(String report) { + public ReportTemplateToHTML(String reportAsJSON) { initWidget(uiBinder.createAndBindUi(this)); vpContainer.setVisible(false); - if (report != null) { - GWT.log("report is: " + report); + if (reportAsJSON != null) { + GWT.log("report is: " + reportAsJSON); vpContainer.setVisible(true); try { - JSONValue jsonObj = JSONParser.parse(report); + JSONValue jsonObj = JSONParser.parse(reportAsJSON); JSONObject json = (JSONObject) jsonObj; JSONValue valueChildren = json.get("children"); JSONArray jsonChildren = (JSONArray) valueChildren; - /*JSONObject jsonChildrenObject = (JSONObject) jsonChildren.get(0); - if (jsonChildrenObject.containsKey("objectName")) { - JSONValue validationReportON = jsonChildrenObject.get("objectName"); - String titleValue = HTMLUtil.getHTMLElement(HTML_TAG.div, 14, "000", "bold", validationReportON.toString()); - htmlContainer.add(new HTML(titleValue)); - } - - String toTableHTML = jsonToHTML(jsonChildrenObject.get("children").toString()); - GWT.log("toJSONERROR is: " + toJSONERROR); - GWT.log("toTableHTML is: " + toTableHTML); - - Set keySet = jsonChildrenObject.keySet();*/ - String toTableHTML = null; - for (int i=0; i" + toPrettyPrintJSON(reportAsJSON) + "")); } } + public static native String toPrettyPrintJSON(String jsonData)/*-{ + console.log(jsonData); + var objJSON = JSON.parse(jsonData); + return $wnd.prettyPrintJson.toHtml(objJSON); + }-*/; + /** * Json to HTML. * @@ -147,16 +134,15 @@ public class ReportTemplateToHTML extends Composite { var tabCell = tr.insertCell(-1); var theValue = jsonObj[j][col[i]]; //console.log("the value: "+theValue); - if(Object.prototype.toString.call(theValue) === '[object Array]'){ + if (Object.prototype.toString.call(theValue) === '[object Array]') { var formattedValueArray = ""; - for(var k = 0; k < theValue.length; k++) { - var theValueArray = theValue[k]; - //console.log(theValueArray); - formattedValueArray += theValueArray+"
"; + for (var k = 0; k < theValue.length; k++) { + var theValueArray = theValue[k]; + //console.log(theValueArray); + formattedValueArray += theValueArray + "
"; } tabCell.innerHTML = formattedValueArray; - } - else{ + } else { tabCell.innerHTML = theValue; } } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml index 38beaaa..0081bcb 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/report/ReportTemplateToHTML.ui.xml @@ -15,7 +15,8 @@ Publication Report: - + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java index cb30087..40566d0 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java @@ -12,6 +12,7 @@ import java.util.Set; import org.gcube.application.geoportalcommon.ConvertToDataViewModel; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; +import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent; @@ -62,6 +63,7 @@ public class ItemsTable extends AbstractItemsCellTable< private List displayFields; private TextColumn startEndProjectColumn; + private TextColumn statusColumn; // private Column startProjectDateColumn; // private Column endProjectDateColumn; private boolean isAsyncronusTable; @@ -219,7 +221,8 @@ public class ItemsTable extends AbstractItemsCellTable< } }; - sortedCellTable.addColumn(startEndProjectColumn, RECORD_FIELD.PROJECT_START_END_DATE.getDisplayName(), false); + sortedCellTable.addColumn(startEndProjectColumn, RECORD_FIELD.PROJECT_START_END_DATE.getDisplayName(), + false); sortedCellTable.setColumnWidth(startEndProjectColumn, 180, Unit.PX); } @@ -295,6 +298,26 @@ public class ItemsTable extends AbstractItemsCellTable< sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX); } + if (this.displayFields.contains(RECORD_FIELD.PUBLISHING_STATUS)) { + + statusColumn = new TextColumn() { + @Override + public String getValue(T object) { + if (object == null) + return ""; + + ValidationReportDV vd = ((ConcessioneDV) object).getValidationReport(); + if (vd != null) + return vd.getStatus().getLabel(); + return ""; + } + }; + + sortedCellTable.addColumn(statusColumn, RECORD_FIELD.PUBLISHING_STATUS.getDisplayName(), false); + sortedCellTable.setColumnWidth(statusColumn, 120, Unit.PX); + + } + ButtonCell showOnMapButton = new ButtonCell(); Column showOnMapColumn = new Column(showOnMapButton) { public String getValue(T object) { @@ -310,7 +333,24 @@ public class ItemsTable extends AbstractItemsCellTable< } }); sortedCellTable.addColumn(showOnMapColumn); - sortedCellTable.setColumnWidth(showOnMapColumn, 120, Unit.PX); + sortedCellTable.setColumnWidth(showOnMapColumn, 110, Unit.PX); + + ButtonCell showReportRecordButton = new ButtonCell(); + Column showReportRecordColumn = new Column(showReportRecordButton) { + public String getValue(T object) { + return "P. Report"; + } + }; + + showReportRecordColumn.setFieldUpdater(new FieldUpdater() { + @Override + public void update(int index, T object, String value) { + + eventBus.fireEvent(new ActionOnItemEvent(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT)); + } + }); + sortedCellTable.addColumn(showReportRecordColumn); + sortedCellTable.setColumnWidth(showReportRecordColumn, 80, Unit.PX); ButtonCell deleteRecordButton = new ButtonCell(); Column deleteRecordColumn = new Column(deleteRecordButton) { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/NewBrowserWindow.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/NewBrowserWindow.java index 6cc3d1f..b164e74 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/NewBrowserWindow.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/utils/NewBrowserWindow.java @@ -4,7 +4,7 @@ import com.google.gwt.core.client.JavaScriptObject; /** * @author Francesco Mangiacrapa francesco.mangiacrapa{@literal @}isti.cnr.it - * Sep 4, 2013 + * Sep 4, 2013 * */ public final class NewBrowserWindow extends JavaScriptObject { @@ -13,9 +13,8 @@ public final class NewBrowserWindow extends JavaScriptObject { protected NewBrowserWindow() { } - public static native NewBrowserWindow open(String url, String target, - String options) /*-{ - return $wnd.open(url, target, options); + public static native NewBrowserWindow open(String url, String target, String options) /*-{ + return $wnd.open(url, target, options) }-*/; public native void close() /*-{ 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 f13752c..8d574ca 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 @@ -20,12 +20,12 @@ import org.gcube.application.geoportalcommon.GeoportalCommon; import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; +import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService; import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport; -import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport.STATE; import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject; import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig; import org.gcube.portlets.user.geoportaldataentry.shared.ResultSetPaginatedData; @@ -228,7 +228,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen if (ardsFiles != null && ardsFiles.size() > 0) { // saving into back-end AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.RELAZIONE, ardsFiles); - clientMongo.registerFile(mongoId, request); + clientMongo.registerFileSet(mongoId, request); LOG.info("Registered the mongoId " + mongoId + " request " + Paths.RELAZIONE + "with " + ardsFiles.size() + " file/s"); } @@ -240,7 +240,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen if (files != null && files.size() > 0) { // saving into back-end AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.RELAZIONE, files); - clientMongo.registerFile(mongoId, request); + clientMongo.registerFileSet(mongoId, request); LOG.info("Registered the mongoId " + mongoId + " request " + Paths.RELAZIONE + "with " + files.size() + " file/s"); } @@ -258,7 +258,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen // saving into back-end AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.imgByIndex(i), files); - clientMongo.registerFile(mongoId, request); + clientMongo.registerFileSet(mongoId, request); LOG.info("Registered the mongoId " + mongoId + " request " + Paths.IMMAGINI + "with " + files.size() + " file/s"); } @@ -274,7 +274,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen // saving into back-end AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.POSIZIONAMENTO, files); - clientMongo.registerFile(mongoId, request); + clientMongo.registerFileSet(mongoId, request); LOG.info("Registered the mongoId " + mongoId + " request " + Paths.POSIZIONAMENTO + "with " + files.size() + " file/s"); } @@ -291,7 +291,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen // saving into back-end AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest( Paths.piantaByIndex(i), files); - clientMongo.registerFile(mongoId, request); + clientMongo.registerFileSet(mongoId, request); LOG.info("Registered the mongoId " + mongoId + " request " + Paths.PIANTE + "with " + files.size() + " file/s"); } @@ -314,34 +314,31 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen // server report ValidationReport report = concessione.getReport(); LOG.info("ValidationReport: " + report); + // to client CommitReport cRep = new CommitReport(); // 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.getMongoId() == null) { - LOG.error("The mongo id is null!!!"); - throw new Exception("Invalid identifier (mongoId is null) for the concessione"); - } - break; - case WARNING: - cRep.setState(STATE.WARN); - cRep.setMsg(report.getWarningMessages().toString()); - break; - case ERROR: - cRep.setState(STATE.ERROR); - cRep.setMsg(report.getErrorMessages().toString()); - break; - - default: - cRep.setState(STATE.UNKNOWN); - break; - } + ValidationReportDV vr = ConvertToDataViewModel.toValidationReport(report); + cRep.setValidationReportDV(vr); +// switch (report.getStatus()) { +// case PASSED: +// if (cRep.getMongoId() == null) { +// LOG.error("The mongo id is null!!!"); +// throw new Exception("Invalid identifier (mongoId is null) for the concessione"); +// } +// cRep.setMsg("OK"); +// break; +// case WARNING: +// cRep.setMsg(report.getWarningMessages().toString()); +// break; +// case ERROR: +// cRep.setMsg(report.getErrorMessages().toString()); +// break; +// +// default: +// break; +// } return cRep; } else @@ -405,7 +402,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen GeoNaDataViewerProfile grViewerProfile = SessionUtil.getGeportalViewerResourceProfile(getThreadLocalRequest()); GeoportalCommon gc = new GeoportalCommon(grViewerProfile); GeoNaItemRef item = new GeoNaItemRef(itemId, recordType.toString().toLowerCase()); - item = gc.getPublicLinksFor(item); + item = gc.getPublicLinksFor(item, false); LOG.info("Returning: " + item); return item; } @@ -599,7 +596,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen } break; - //TODO is buggy must be performed by service + // TODO is buggy must be performed by service case PROJECT_START_END_DATE: if (order.equals(ORDER.ASC)) { comparator = Comparator.comparing(Concessione::getDataInizioProgetto, @@ -625,7 +622,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen List toReturnList = new ArrayList(toReturn.size()); for (Concessione concessione : toReturn) { - ConcessioneDV concessioneDV = ConvertToDataViewModel.toBaseConcessione(concessione); + ConcessioneDV concessioneDV = ConvertToDataViewModel.toMetadataConcessione(concessione, true); toReturnList.add(concessioneDV); } 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 e2db0ce..0750f2f 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,6 +2,8 @@ package org.gcube.portlets.user.geoportaldataentry.shared; import java.io.Serializable; +import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; + /** * The Class CommitReport. * @@ -16,22 +18,9 @@ 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 - */ - public enum STATE { - ERROR, WARN, OK, UNKNOWN - } - - public STATE state = STATE.UNKNOWN; public Long recordId; public String mongoId; - public String msg; - public String report; + public ValidationReportDV validationReportDV; /** * Instantiates a new commit report. @@ -40,120 +29,48 @@ public class CommitReport implements Serializable { } - /** - * Instantiates a new commit report. - * - * @param state the state - * @param recordId the record id - * @param mongoId the mongo id - * @param msg the msg - * @param report the report - */ - public CommitReport(STATE state, long recordId, String mongoId, String msg, String report) { + public CommitReport(Long recordId, String mongoId, ValidationReportDV validationReportDV) { super(); - this.state = state; + this.recordId = recordId; this.mongoId = mongoId; - this.msg = msg; - this.report = report; + this.validationReportDV = validationReportDV; } - /** - * Gets the state. - * - * @return the state - */ - public STATE getState() { - return state; - } - - /** - * Sets the state. - * - * @param state the new state - */ - public void setState(STATE state) { - this.state = state; - } - -// /** -// * Gets the record id. -// * -// * @return the record id -// */ -// public Long getRecordId() { -// 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. -// * -// * @param recordId the new record id -// */ -// public void setRecordId(long recordId) { -// this.recordId = recordId; -// } - - /** - * Gets the msg. - * - * @return the msg - */ - public String getMsg() { - return msg; + public Long getRecordId() { + return recordId; } public String getMongoId() { return mongoId; } + public ValidationReportDV getValidationReportDV() { + return validationReportDV; + } + + public void setRecordId(Long recordId) { + this.recordId = recordId; + } + public void setMongoId(String mongoId) { this.mongoId = mongoId; } - /** - * Sets the msg. - * - * @param msg the new msg - */ - public void setMsg(String msg) { - this.msg = msg; + public void setValidationReportDV(ValidationReportDV validationReportDV) { + this.validationReportDV = validationReportDV; } @Override public String toString() { StringBuilder builder = new StringBuilder(); - builder.append("CommitReport [state="); - builder.append(state); - builder.append(", recordId="); + builder.append("CommitReport [recordId="); builder.append(recordId); builder.append(", mongoId="); builder.append(mongoId); - builder.append(", msg="); - builder.append(msg); - builder.append(", report="); - builder.append(report); + builder.append(", validationReportDV="); + builder.append(validationReportDV); builder.append("]"); return builder.toString(); } - - } diff --git a/src/main/webapp/GeoPortalDataEntryApp.html b/src/main/webapp/GeoPortalDataEntryApp.html index dd319ab..0558c96 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.html +++ b/src/main/webapp/GeoPortalDataEntryApp.html @@ -14,6 +14,15 @@ + + + + +