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