|
|
|
@ -9,14 +9,12 @@ 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.Record;
|
|
|
|
|
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 org.gcube.application.geoportal.model.report.PublicationReport;
|
|
|
|
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
|
|
|
|
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
|
|
|
|
import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitle;
|
|
|
|
@ -203,33 +201,37 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
}
|
|
|
|
|
PublicationReport report = manager.commitSafely(publish);
|
|
|
|
|
LOG.info("PublicationReport: " + report);
|
|
|
|
|
Record registered = report.getTheRecord();
|
|
|
|
|
|
|
|
|
|
if(registered==null)
|
|
|
|
|
throw new Exception(report.prettyPrint());
|
|
|
|
|
|
|
|
|
|
// String link = "toTest";
|
|
|
|
|
CommitReport cRep = new CommitReport();
|
|
|
|
|
cRep.setRecordId(registered.getId());
|
|
|
|
|
if (link != null) {
|
|
|
|
|
cRep.setReport(report.prettyPrint());
|
|
|
|
|
|
|
|
|
|
switch (report.getStatus()) {
|
|
|
|
|
case PASSED:
|
|
|
|
|
cRep.setState(STATE.OK);
|
|
|
|
|
cRep.setMsg("Project saved successfully");
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
case WARNING:
|
|
|
|
|
cRep.setState(STATE.WARN);
|
|
|
|
|
cRep.setMsg("Project saved with errors");
|
|
|
|
|
cRep.setMsg(report.getWarningMessages().toString());
|
|
|
|
|
break;
|
|
|
|
|
case ERROR:
|
|
|
|
|
cRep.setState(STATE.ERROR);
|
|
|
|
|
cRep.setMsg(report.getErrorMessages().toString());
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
cRep.setState(STATE.UNKNOWN);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
LOG.error("Error on commiting data: ", e);
|
|
|
|
|
throw new Exception(
|
|
|
|
|