|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|