#22040 Revisited the "Abstract Relazione di Scavo"
This commit is contained in:
parent
71cbc96d10
commit
486418a6b3
|
@ -15,6 +15,7 @@ Moved to maven-portal-bom 3.6.3
|
|||
[#20599] Get List of Records
|
||||
[#22002] Integrated with ValidationReport and status
|
||||
[#21990] Provide the (first version of) edit mode
|
||||
[#22040] Revisited the "Abstract Relazione di Scavo"
|
||||
|
||||
|
||||
## [v1.2.0] - 2020-12-18
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.AccessPolicy;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||
|
@ -19,7 +20,6 @@ import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
/**
|
||||
* The Class ConvertToServiceModel.
|
||||
*
|
||||
|
@ -44,7 +44,7 @@ public class ConvertToServiceModel {
|
|||
* @param gdb the gdb
|
||||
* @param user the user
|
||||
* @return the concessione
|
||||
* @throws Exception
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static Concessione toConcessione(GenericDatasetBean gdb, GCubeUser user) throws Exception {
|
||||
|
||||
|
@ -52,13 +52,11 @@ public class ConvertToServiceModel {
|
|||
|
||||
Concessione concessione = new Concessione();
|
||||
|
||||
|
||||
// List<String> authors = mapFields.get("Autore");
|
||||
// if(authors!=null) {
|
||||
// concessione.setAuthors(authors);
|
||||
// }
|
||||
|
||||
|
||||
List<String> authors = mapFields.get("Nome Autore, Email, Ruolo");
|
||||
if (authors != null) {
|
||||
concessione.setAuthors(authors);
|
||||
|
@ -88,7 +86,6 @@ public class ConvertToServiceModel {
|
|||
concessione.setDataFineProgetto(theLDT);
|
||||
}
|
||||
|
||||
|
||||
List<String> descrizioneLst = mapFields.get("Descrizione del contenuto");
|
||||
if (descrizioneLst != null && descrizioneLst.size() > 0) {
|
||||
concessione.setDescrizioneContenuto(descrizioneLst.get(0));
|
||||
|
@ -194,15 +191,14 @@ public class ConvertToServiceModel {
|
|||
/**
|
||||
* To relazione scavo.
|
||||
*
|
||||
* @param abstractRelazioneScavo the abstract relazione scavo
|
||||
* @param gdb the gdb
|
||||
* @return the relazione scavo
|
||||
*/
|
||||
public static RelazioneScavo toRelazioneScavo(RelazioneScavo abstractRelazioneScavo, GenericDatasetBean gdb){
|
||||
public static RelazioneScavo toRelazioneScavo(GenericDatasetBean gdb) {
|
||||
|
||||
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
|
||||
|
||||
RelazioneScavo relazioneScavo = abstractRelazioneScavo == null?new RelazioneScavo():abstractRelazioneScavo;
|
||||
RelazioneScavo relazioneScavo = new RelazioneScavo();
|
||||
|
||||
List<String> responsabiliLst = mapFields.get("Responsabile del documento");
|
||||
if (responsabiliLst != null) {
|
||||
|
@ -242,48 +238,46 @@ public class ConvertToServiceModel {
|
|||
return relazioneScavo;
|
||||
}
|
||||
|
||||
public static RelazioneScavo toAbstractRelazioneScavo(GenericDatasetBean gdb) {
|
||||
/**
|
||||
* To abstract relazione scavo.
|
||||
*
|
||||
* @param gdb the gdb
|
||||
* @return the abstract relazione
|
||||
*/
|
||||
public static AbstractRelazione toAbstractRelazioneScavo(GenericDatasetBean gdb) {
|
||||
|
||||
Map<String, List<String>> mapFields = gdb.getFormDataEntryFields();
|
||||
|
||||
RelazioneScavo relazioneScavo = new RelazioneScavo();
|
||||
AbstractRelazione abstractrelazione = new AbstractRelazione();
|
||||
|
||||
List<String> abstractLstIta = mapFields.get("Abstract in Italiano");
|
||||
if (abstractLstIta != null && abstractLstIta.size() > 0) {
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
LOG.warn("TODO ABSTRACT RELAZIONE DI SCAVO IN ITA");
|
||||
//relazioneScavo.setAbstractIta(abstractLstIta.get(0));
|
||||
abstractrelazione.setAbstractIta(abstractLstIta.get(0));
|
||||
}
|
||||
|
||||
List<String> abstractLstEng = mapFields.get("Abstract in Inglese");
|
||||
if (abstractLstEng != null && abstractLstEng.size() > 0) {
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
LOG.warn("TODO ABSTRACT RELAZIONE DI SCAVO IN ENG");
|
||||
//relazioneScavo.setAbstractEng(abstractLstEng.get(0));
|
||||
abstractrelazione.setAbstractEng(abstractLstEng.get(0));
|
||||
}
|
||||
|
||||
//TODO IN FUTURE WHEN THE MODEL WILL BE UPDATED
|
||||
/*List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
|
||||
// THIS SHOULD BE ALWAYS "OPEN"
|
||||
List<String> politicaDiAccessoLst = mapFields.get("Politica di accesso");
|
||||
if (politicaDiAccessoLst != null && politicaDiAccessoLst.size() > 0) {
|
||||
try {
|
||||
AccessPolicy ap = AccessPolicy.valueOf(politicaDiAccessoLst.get(0));
|
||||
relazioneScavo.setPolicy(ap);
|
||||
abstractrelazione.setPolicy(ap);
|
||||
} catch (Exception e) {
|
||||
LOG.warn("I cannot cast " + politicaDiAccessoLst.get(0) + " to " + AccessPolicy.values(), e);
|
||||
}
|
||||
}
|
||||
|
||||
// THIS SHOULD BE ALWAYS "CC-BY-4.0"
|
||||
List<String> licenzaIdList = mapFields.get("ID Licenza");
|
||||
if (licenzaIdList != null && licenzaIdList.size() > 0) {
|
||||
relazioneScavo.setLicenseID(licenzaIdList.get(0));
|
||||
}*/
|
||||
abstractrelazione.setLicenseID(licenzaIdList.get(0));
|
||||
}
|
||||
|
||||
return relazioneScavo;
|
||||
return abstractrelazione;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -390,7 +384,6 @@ public class ConvertToServiceModel {
|
|||
// TODO MUST BE INTENGRATED IN THE SERVICE
|
||||
}
|
||||
|
||||
|
||||
List<String> licenzaIdList = mapFields.get("ID Licenza");
|
||||
if (licenzaIdList != null && licenzaIdList.size() > 0) {
|
||||
layerConcessione.setLicenseID(licenzaIdList.get(0));
|
||||
|
@ -404,7 +397,6 @@ public class ConvertToServiceModel {
|
|||
return layerConcessione;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To local date time.
|
||||
*
|
||||
|
@ -429,7 +421,6 @@ public class ConvertToServiceModel {
|
|||
return theLocalDT;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert to local date time via instant.
|
||||
*
|
||||
|
@ -437,9 +428,7 @@ public class ConvertToServiceModel {
|
|||
* @return the local date time
|
||||
*/
|
||||
public static LocalDateTime convertToLocalDateTimeViaInstant(Date dateToConvert) {
|
||||
return dateToConvert.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime();
|
||||
return dateToConvert.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.AbstractRelazione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione.Paths;
|
||||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||
|
@ -121,7 +122,9 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
GenericDatasetBean ards = listGDB.get(0);
|
||||
LOG.debug("\n\n");
|
||||
LOG.debug(ConcessioniFormCardTitle.ABSTRACT_RELAZIONE_DI_SCAVO + " building with client obj: " + ards);
|
||||
RelazioneScavo abstractRelazioneDiScavo = ConvertToServiceModel.toAbstractRelazioneScavo(ards);
|
||||
AbstractRelazione abstractRelazioneDiScavo = ConvertToServiceModel.toAbstractRelazioneScavo(ards);
|
||||
// Setting Abstract Relazione
|
||||
concessioneNew.setAbstractRelazione(abstractRelazioneDiScavo);
|
||||
|
||||
// RELAZIONE_DI_SCAVO
|
||||
list = toMap.get(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO);
|
||||
|
@ -133,7 +136,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
GenericDatasetBean rds = listGDB.get(0);
|
||||
LOG.debug("\n\n");
|
||||
LOG.debug(ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO + " building with client obj: " + rds);
|
||||
RelazioneScavo relazioneDiScavo = ConvertToServiceModel.toRelazioneScavo(abstractRelazioneDiScavo, rds);
|
||||
RelazioneScavo relazioneDiScavo = ConvertToServiceModel.toRelazioneScavo(rds);
|
||||
LOG.debug("Built " + ConcessioniFormCardTitle.RELAZIONE_DI_SCAVO + " as server obj: " + relazioneDiScavo);
|
||||
|
||||
// Setting Relazione
|
||||
|
@ -224,11 +227,11 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
// Building TempFile for ABSTRACT DELLA RELAZIONE DI SCAVO
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
List<TempFile> ardsFiles = serviceUtil.toTemFiles(ards.getFilesUploaded());
|
||||
// TODO DEVE ESSERE PASSATO CON PATH RELAZIONE OPPURE BISOGNA PREVEDERE UN
|
||||
// ABSTRACT_RELAZIONE???
|
||||
// Building TempFile for ABSTRACT RELAZIONE
|
||||
if (ardsFiles != null && ardsFiles.size() > 0) {
|
||||
// saving into back-end
|
||||
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.RELAZIONE, ardsFiles);
|
||||
AddSectionToConcessioneRequest request = new AddSectionToConcessioneRequest(Paths.ABSTRACT_RELAZIONE,
|
||||
ardsFiles);
|
||||
clientMongo.registerFileSet(mongoId, request);
|
||||
LOG.info("Registered the mongoId " + mongoId + " request " + Paths.RELAZIONE + "with "
|
||||
+ ardsFiles.size() + " file/s");
|
||||
|
@ -322,24 +325,6 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
|
|||
cRep.setMongoId(concessione.getMongo_id());
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue