|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package org.gcube.portlets.user.geoportaldataviewer.server;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatterBuilder;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
@ -31,6 +33,15 @@ public class ConvertToDataViewModel {
|
|
|
|
|
/** The Constant LOG. */
|
|
|
|
|
private static final Logger LOG = LoggerFactory.getLogger(ConvertToDataViewModel.class);
|
|
|
|
|
|
|
|
|
|
public static final String DATE_FORMAT = "yyyy-MM-dd";
|
|
|
|
|
|
|
|
|
|
public static final String HOURS_MINUTES_SEPARATOR = ":";
|
|
|
|
|
|
|
|
|
|
public static final String TIME_FORMAT = "HH" + HOURS_MINUTES_SEPARATOR + "mm";
|
|
|
|
|
|
|
|
|
|
public static final DateTimeFormatterBuilder dtf = new DateTimeFormatterBuilder()
|
|
|
|
|
.appendPattern(DATE_FORMAT + " " + TIME_FORMAT);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To concessione.
|
|
|
|
|
*
|
|
|
|
@ -38,68 +49,70 @@ public class ConvertToDataViewModel {
|
|
|
|
|
* @return the concessione
|
|
|
|
|
* @throws Exception the exception
|
|
|
|
|
*/
|
|
|
|
|
public static ConcessioneDV toConcessione(
|
|
|
|
|
Concessione concessione) throws Exception {
|
|
|
|
|
|
|
|
|
|
if(concessione==null)
|
|
|
|
|
public static ConcessioneDV toConcessione(Concessione concessione) throws Exception {
|
|
|
|
|
|
|
|
|
|
if (concessione == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConcessioneDV theConcessione = new ConcessioneDV();
|
|
|
|
|
theConcessione.setAccesso(concessione.getAccesso().name());
|
|
|
|
|
theConcessione.setAuthors(concessione.getAuthors());
|
|
|
|
|
theConcessione.setCentroidLat(concessione.getCentroidLat());
|
|
|
|
|
theConcessione.setCentroidLong(concessione.getCentroidLong());
|
|
|
|
|
theConcessione.setContributore(concessione.getContributore());
|
|
|
|
|
theConcessione.setCreationTime(concessione.getCreationTime());
|
|
|
|
|
theConcessione.setCreationUser(concessione.getCreationUser());
|
|
|
|
|
theConcessione.setDataFineProgetto(concessione.getDataFineProgetto());
|
|
|
|
|
theConcessione.setDataInizioProgetto(concessione.getDataInizioProgetto());
|
|
|
|
|
theConcessione.setCreationTime(toDateString(concessione.getCreationTime()));
|
|
|
|
|
theConcessione.setCreationUser(concessione.getCreationUser().toString());
|
|
|
|
|
theConcessione.setDataFineProgetto(toDateString(concessione.getDataFineProgetto()));
|
|
|
|
|
theConcessione.setDataInizioProgetto(toDateString(concessione.getDataInizioProgetto()));
|
|
|
|
|
theConcessione.setDescrizioneContenuto(concessione.getDescrizioneContenuto());
|
|
|
|
|
theConcessione.setEditore(concessione.getEditore());
|
|
|
|
|
theConcessione.setFontiFinanziamento(concessione.getFontiFinanziamento());
|
|
|
|
|
theConcessione.setId(concessione.getId());
|
|
|
|
|
|
|
|
|
|
if(concessione.getGenericContent()!=null){
|
|
|
|
|
List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(concessione.getGenericContent().size());
|
|
|
|
|
|
|
|
|
|
if (concessione.getGenericContent() != null) {
|
|
|
|
|
List<OtherContentDV> otherContentsDV = new ArrayList<OtherContentDV>(
|
|
|
|
|
concessione.getGenericContent().size());
|
|
|
|
|
for (OtherContent gc : concessione.getGenericContent()) {
|
|
|
|
|
otherContentsDV.add(toOtherContentDV(gc, theConcessione));
|
|
|
|
|
}
|
|
|
|
|
theConcessione.setGenericContent(otherContentsDV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(concessione.getImmaginiRappresentative()!=null){
|
|
|
|
|
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(concessione.getImmaginiRappresentative().size());
|
|
|
|
|
if (concessione.getImmaginiRappresentative() != null) {
|
|
|
|
|
List<UploadedImageDV> uploadedImagesDV = new ArrayList<UploadedImageDV>(
|
|
|
|
|
concessione.getImmaginiRappresentative().size());
|
|
|
|
|
for (UploadedImage ui : concessione.getImmaginiRappresentative()) {
|
|
|
|
|
uploadedImagesDV.add(toUploadedImage(ui, theConcessione));
|
|
|
|
|
}
|
|
|
|
|
theConcessione.setImmaginiRappresentative(uploadedImagesDV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
theConcessione.setIntroduzione(concessione.getIntroduzione());
|
|
|
|
|
theConcessione.setLastUpdateTime(concessione.getLastUpdateTime());
|
|
|
|
|
theConcessione.setLastUpdateTime(toDateString(concessione.getLastUpdateTime()));
|
|
|
|
|
theConcessione.setLastUpdateUser(concessione.getLastUpdateUser());
|
|
|
|
|
theConcessione.setLicenzaID(concessione.getLicenzaID());
|
|
|
|
|
theConcessione.setNome(concessione.getNome());
|
|
|
|
|
theConcessione.setParoleChiaveICCD(concessione.getParoleChiaveICCD());
|
|
|
|
|
theConcessione.setParoleChiaveLibere(concessione.getParoleChiaveLibere());
|
|
|
|
|
|
|
|
|
|
if(concessione.getPianteFineScavo()!=null){
|
|
|
|
|
List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(concessione.getPianteFineScavo().size());
|
|
|
|
|
|
|
|
|
|
if (concessione.getPianteFineScavo() != null) {
|
|
|
|
|
List<LayerConcessioneDV> piantaScavoDV = new ArrayList<LayerConcessioneDV>(
|
|
|
|
|
concessione.getPianteFineScavo().size());
|
|
|
|
|
for (LayerConcessione lc : concessione.getPianteFineScavo()) {
|
|
|
|
|
piantaScavoDV.add(toLayerConcessione(lc, theConcessione));
|
|
|
|
|
}
|
|
|
|
|
theConcessione.setPianteFineScavo(piantaScavoDV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(concessione.getPosizionamentoScavo()!=null){
|
|
|
|
|
|
|
|
|
|
if (concessione.getPosizionamentoScavo() != null) {
|
|
|
|
|
LayerConcessioneDV thePosizScavo = toLayerConcessione(concessione.getPosizionamentoScavo(), theConcessione);
|
|
|
|
|
theConcessione.setPosizionamentoScavo(thePosizScavo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
theConcessione.setRecordType(concessione.getRecordType().name());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
theConcessione.setRelazioneScavo(toRelazioneScavo(concessione.getRelazioneScavo(), theConcessione));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
theConcessione.setResponsabile(concessione.getResponsabile());
|
|
|
|
|
theConcessione.setRisorseCorrelate(concessione.getRisorseCorrelate());
|
|
|
|
|
theConcessione.setSoggetto(concessione.getSoggetto());
|
|
|
|
@ -107,12 +120,16 @@ public class ConvertToDataViewModel {
|
|
|
|
|
theConcessione.setTitolareLicenza(concessione.getTitolareLicenza());
|
|
|
|
|
theConcessione.setTitolari(concessione.getTitolari());
|
|
|
|
|
theConcessione.setVersion(concessione.getVersion());
|
|
|
|
|
|
|
|
|
|
LOG.debug("Returning concessione: "+theConcessione);
|
|
|
|
|
|
|
|
|
|
LOG.debug("Returning concessione: " + theConcessione);
|
|
|
|
|
return theConcessione;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static String toDateString(LocalDateTime dateTime) {
|
|
|
|
|
return dateTime.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* To relazione scavo.
|
|
|
|
|
*
|
|
|
|
@ -127,7 +144,7 @@ public class ConvertToDataViewModel {
|
|
|
|
|
|
|
|
|
|
RelazioneScavoDV theRelazioneDiScavo = new RelazioneScavoDV();
|
|
|
|
|
theRelazioneDiScavo.setAbstractSection(relazioneScavo.getAbstractSection());
|
|
|
|
|
theRelazioneDiScavo.setCreationTime(relazioneScavo.getCreationTime());
|
|
|
|
|
theRelazioneDiScavo.setCreationTime(toDateString(relazioneScavo.getCreationTime()));
|
|
|
|
|
theRelazioneDiScavo.setId(relazioneScavo.getId());
|
|
|
|
|
theRelazioneDiScavo.setLicenseID(relazioneScavo.getLicenseID());
|
|
|
|
|
theRelazioneDiScavo.setPolicy(relazioneScavo.getPolicy().name());
|
|
|
|
@ -136,7 +153,7 @@ public class ConvertToDataViewModel {
|
|
|
|
|
theRelazioneDiScavo.setSoggetto(relazioneScavo.getSoggetto());
|
|
|
|
|
theRelazioneDiScavo.setTitolo(relazioneScavo.getTitolo());
|
|
|
|
|
|
|
|
|
|
LOG.debug("Returning: "+theRelazioneDiScavo);
|
|
|
|
|
LOG.debug("Returning: " + theRelazioneDiScavo);
|
|
|
|
|
return theRelazioneDiScavo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -153,7 +170,7 @@ public class ConvertToDataViewModel {
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
UploadedImageDV theUploadedImageDV = new UploadedImageDV();
|
|
|
|
|
theUploadedImageDV.setCreationTime(uploadedImage.getCreationTime());
|
|
|
|
|
theUploadedImageDV.setCreationTime(toDateString(uploadedImage.getCreationTime()));
|
|
|
|
|
theUploadedImageDV.setDidascalia(uploadedImage.getDidascalia());
|
|
|
|
|
theUploadedImageDV.setFormat(uploadedImage.getFormat());
|
|
|
|
|
theUploadedImageDV.setId(uploadedImage.getId());
|
|
|
|
@ -164,7 +181,7 @@ public class ConvertToDataViewModel {
|
|
|
|
|
theUploadedImageDV.setSoggetto(uploadedImage.getSoggetto());
|
|
|
|
|
theUploadedImageDV.setTitolo(uploadedImage.getTitolo());
|
|
|
|
|
|
|
|
|
|
LOG.debug("Returning: "+theUploadedImageDV);
|
|
|
|
|
LOG.debug("Returning: " + theUploadedImageDV);
|
|
|
|
|
return theUploadedImageDV;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -188,7 +205,7 @@ public class ConvertToDataViewModel {
|
|
|
|
|
theLayerConessione.setAuthors(layerConcessione.getAuthors());
|
|
|
|
|
BoundsMap bounds = toBoundMap(layerConcessione.getBbox());
|
|
|
|
|
theLayerConessione.setBbox(bounds);
|
|
|
|
|
theLayerConessione.setCreationTime(layerConcessione.getCreationTime());
|
|
|
|
|
theLayerConessione.setCreationTime(toDateString(layerConcessione.getCreationTime()));
|
|
|
|
|
theLayerConessione.setId(layerConcessione.getId());
|
|
|
|
|
theLayerConessione.setLicenseID(layerConcessione.getLicenseID());
|
|
|
|
|
theLayerConessione.setMetodoRaccoltaDati(layerConcessione.getMetodoRaccoltaDati());
|
|
|
|
@ -201,7 +218,7 @@ public class ConvertToDataViewModel {
|
|
|
|
|
theLayerConessione.setValutazioneQualita(layerConcessione.getValutazioneQualita());
|
|
|
|
|
theLayerConessione.setWmsLink(layerConcessione.getWmsLink());
|
|
|
|
|
|
|
|
|
|
LOG.debug("Returning: "+theLayerConessione);
|
|
|
|
|
LOG.debug("Returning: " + theLayerConessione);
|
|
|
|
|
return theLayerConessione;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -219,7 +236,7 @@ public class ConvertToDataViewModel {
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
OtherContentDV theOtherContent = new OtherContentDV();
|
|
|
|
|
theOtherContent.setCreationTime(otherContent.getCreationTime());
|
|
|
|
|
theOtherContent.setCreationTime(toDateString(otherContent.getCreationTime()));
|
|
|
|
|
theOtherContent.setId(otherContent.getId());
|
|
|
|
|
theOtherContent.setLicenseID(otherContent.getLicenseID());
|
|
|
|
|
theOtherContent.setPolicy(otherContent.getPolicy().name());
|
|
|
|
|