#22002 Integrated with ValidationReport and status
This commit is contained in:
parent
2208adec46
commit
296703f5fb
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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<Widget, ReportTemplateToHTML> {
|
||||
}
|
||||
|
@ -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<String> keySet = jsonChildrenObject.keySet();*/
|
||||
|
||||
String toTableHTML = null;
|
||||
for (int i=0; i<jsonChildren.size(); i++) {
|
||||
for (int i = 0; i < jsonChildren.size(); i++) {
|
||||
JSONObject jsO = (JSONObject) jsonChildren.get(i);
|
||||
|
||||
|
||||
if (jsO.containsKey("children")) {
|
||||
/*if (jsO.containsKey("objectName")) {
|
||||
JSONValue validationReportON = jsO.get("objectName");
|
||||
String titleValue = HTMLUtil.getHTMLElement(HTML_TAG.div, 14, "000", "bold", validationReportON.toString());
|
||||
htmlContainer.add(new HTML(titleValue));
|
||||
}*/
|
||||
toTableHTML = jsonToHTML(jsO.get("children").toString());
|
||||
}else {
|
||||
} else {
|
||||
toTableHTML = jsonToHTML(jsO.toString());
|
||||
}
|
||||
|
||||
|
||||
htmlContainer.add(new HTML(toTableHTML));
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
GWT.log("error: " + e.getMessage());
|
||||
}
|
||||
reportJSON.setText(report);
|
||||
reportJSON.add(new HTML("<pre>" + toPrettyPrintJSON(reportAsJSON) + "</pre>"));
|
||||
}
|
||||
}
|
||||
|
||||
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+"<br>";
|
||||
for (var k = 0; k < theValue.length; k++) {
|
||||
var theValueArray = theValue[k];
|
||||
//console.log(theValueArray);
|
||||
formattedValueArray += theValueArray + "<br>";
|
||||
}
|
||||
tabCell.innerHTML = formattedValueArray;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
tabCell.innerHTML = theValue;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
<g:VerticalPanel ui:field="vpContainer"
|
||||
addStyleNames="{style.margin-top-10}">
|
||||
<b:Label>Publication Report: </b:Label>
|
||||
<g:VerticalPanel ui:field="htmlContainer" addStyleNames="{style.margin-top-10}"></g:VerticalPanel>
|
||||
<g:VerticalPanel ui:field="htmlContainer"
|
||||
addStyleNames="{style.margin-top-10}"></g:VerticalPanel>
|
||||
<b:AccordionGroup heading="Show Report as JSON">
|
||||
<b:Paragraph ui:field="reportJSON"></b:Paragraph>
|
||||
</b:AccordionGroup>
|
||||
|
|
|
@ -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<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
|
||||
private List<RECORD_FIELD> displayFields;
|
||||
private TextColumn<T> startEndProjectColumn;
|
||||
private TextColumn<T> statusColumn;
|
||||
// private Column<T, Date> startProjectDateColumn;
|
||||
// private Column<T, Date> endProjectDateColumn;
|
||||
private boolean isAsyncronusTable;
|
||||
|
@ -219,7 +221,8 @@ public class ItemsTable<T extends ConcessioneDV> 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<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX);
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(RECORD_FIELD.PUBLISHING_STATUS)) {
|
||||
|
||||
statusColumn = new TextColumn<T>() {
|
||||
@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<T, String> showOnMapColumn = new Column<T, String>(showOnMapButton) {
|
||||
public String getValue(T object) {
|
||||
|
@ -310,7 +333,24 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
}
|
||||
});
|
||||
sortedCellTable.addColumn(showOnMapColumn);
|
||||
sortedCellTable.setColumnWidth(showOnMapColumn, 120, Unit.PX);
|
||||
sortedCellTable.setColumnWidth(showOnMapColumn, 110, Unit.PX);
|
||||
|
||||
ButtonCell showReportRecordButton = new ButtonCell();
|
||||
Column<T, String> showReportRecordColumn = new Column<T, String>(showReportRecordButton) {
|
||||
public String getValue(T object) {
|
||||
return "P. Report";
|
||||
}
|
||||
};
|
||||
|
||||
showReportRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
||||
@Override
|
||||
public void update(int index, T object, String value) {
|
||||
|
||||
eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT));
|
||||
}
|
||||
});
|
||||
sortedCellTable.addColumn(showReportRecordColumn);
|
||||
sortedCellTable.setColumnWidth(showReportRecordColumn, 80, Unit.PX);
|
||||
|
||||
ButtonCell deleteRecordButton = new ButtonCell();
|
||||
Column<T, String> deleteRecordColumn = new Column<T, String>(deleteRecordButton) {
|
||||
|
|
|
@ -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() /*-{
|
||||
|
|
|
@ -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<ConcessioneDV> toReturnList = new ArrayList<ConcessioneDV>(toReturn.size());
|
||||
|
||||
for (Concessione concessione : toReturn) {
|
||||
ConcessioneDV concessioneDV = ConvertToDataViewModel.toBaseConcessione(concessione);
|
||||
ConcessioneDV concessioneDV = ConvertToDataViewModel.toMetadataConcessione(concessione, true);
|
||||
toReturnList.add(concessioneDV);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,15 @@
|
|||
<!-- -->
|
||||
<link type="text/css" rel="stylesheet" href="GeoPortalDataEntryApp.css">
|
||||
|
||||
|
||||
<link
|
||||
href="//cdn.jsdelivr.net/npm/pretty-print-json@1.1/dist/pretty-print-json.css"
|
||||
rel="stylesheet" type="text/css">
|
||||
<script
|
||||
src="//cdn.jsdelivr.net/npm/pretty-print-json@1.1/dist/pretty-print-json.min.js"
|
||||
type="text/javascript"></script>
|
||||
|
||||
|
||||
<!-- -->
|
||||
<!-- Any title is fine -->
|
||||
<!-- -->
|
||||
|
|
Loading…
Reference in New Issue