Section Abstract Relazione

This commit is contained in:
Fabio Sinibaldi 2021-09-20 12:48:59 +02:00
parent 0494aa7039
commit 7233768700
3 changed files with 44 additions and 90 deletions

View File

@ -0,0 +1,16 @@
package org.gcube.application.geoportal.common.model.legacy;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString(callSuper=true)
public class AbstractRelazione extends AssociatedContent{
private String abstractIta;
private String abstractEng;
}

View File

@ -71,7 +71,8 @@ public class Concessione extends Record{
private Double centroidLong; private Double centroidLong;
private RelazioneScavo relazioneScavo; private RelazioneScavo relazioneScavo;
private AssociatedContent abstractRelazione;
private List<UploadedImage> immaginiRappresentative=new ArrayList<UploadedImage>(); private List<UploadedImage> immaginiRappresentative=new ArrayList<UploadedImage>();
private LayerConcessione posizionamentoScavo; private LayerConcessione posizionamentoScavo;
@ -92,7 +93,7 @@ public class Concessione extends Record{
public final static String POSIZIONAMENTO="posizionamentoScavo"; public final static String POSIZIONAMENTO="posizionamentoScavo";
public final static String PIANTE="piante"; public final static String PIANTE="piante";
public final static String IMMAGINI="immagini"; public final static String IMMAGINI="immagini";
public final static String ABSTRACT_RELAZIONE="abstract_relazione";
public static final String MONGO_ID="mongo_id"; public static final String MONGO_ID="mongo_id";
public final static String piantaByIndex(int index) {return makeByIndex(PIANTE,index);}; public final static String piantaByIndex(int index) {return makeByIndex(PIANTE,index);};
@ -113,6 +114,7 @@ public class Concessione extends Record{
switch(path) { switch(path) {
case Paths.RELAZIONE : return getRelazioneScavo(); case Paths.RELAZIONE : return getRelazioneScavo();
case Paths.POSIZIONAMENTO : return getPosizionamentoScavo(); case Paths.POSIZIONAMENTO : return getPosizionamentoScavo();
case Paths.ABSTRACT_RELAZIONE: return getAbstractRelazione();
} }
if(path.matches("\\w+\\[\\d+\\]")) { if(path.matches("\\w+\\[\\d+\\]")) {
// Array section // Array section
@ -168,7 +170,11 @@ public class Concessione extends Record{
break; break;
} }
case Paths.POSIZIONAMENTO : { case Paths.POSIZIONAMENTO : {
setRelazioneScavo((RelazioneScavo) toSet); setPosizionamentoScavo((LayerConcessione) toSet);
break;
}
case Paths.ABSTRACT_RELAZIONE:{
setAbstractRelazione((AbstractRelazione)toSet);
break; break;
} }
case Paths.PIANTE : { case Paths.PIANTE : {
@ -218,8 +224,7 @@ public class Concessione extends Record{
validator.checkMandatory(paroleChiaveLibere, "Parole chiave libere"); validator.checkMandatory(paroleChiaveLibere, "Parole chiave libere");
validator.checkMandatory(responsabile,"Responsabile"); validator.checkMandatory(responsabile,"Responsabile");
validator.checkMandatory(titolareCopyright, "Titolare Copyright"); validator.checkMandatory(titolareCopyright, "Titolare Copyright");
validator.checkMandatory(titolareLicenza,"Titolare licenza"); validator.checkMandatory(titolareLicenza,"Titolare licenza");
@ -228,12 +233,13 @@ public class Concessione extends Record{
if(validator.checkMandatory(relazioneScavo, "Relazione scavo")) { if(validator.checkMandatory(relazioneScavo, "Relazione scavo")) {
validator.addChild(relazioneScavo.validateForInsertion()); validator.addChild(relazioneScavo.validateForInsertion());
} }
if(validator.checkMandatory(abstractRelazione,"Abstract Relazione")){
validator.addChild(abstractRelazione.validateForInsertion());
}
// if(immaginiRappresentative!=null) // if(immaginiRappresentative!=null)
// //
// for(UploadedImage img : immaginiRappresentative) { // for(UploadedImage img : immaginiRappresentative) {
@ -297,6 +303,13 @@ public class Concessione extends Record{
relazioneScavo.setPolicy(getPolicy()); relazioneScavo.setPolicy(getPolicy());
} }
if(abstractRelazione!=null) {
abstractRelazione.setTitolo(ConstraintCheck.defaultFor(abstractRelazione.getTitolo(),getNome()+" abstract relazione di scavo").evaluate());
abstractRelazione.setCreationTime(ConstraintCheck.defaultFor(abstractRelazione.getCreationTime(),getCreationTime()).evaluate());
abstractRelazione.setLicenseID(ConstraintCheck.defaultFor(getLicenzaID(), "CC-BY-4.0").evaluate());
abstractRelazione.setPolicy(getPolicy());
}
if(immaginiRappresentative!=null) if(immaginiRappresentative!=null)
for(UploadedImage img : immaginiRappresentative) { for(UploadedImage img : immaginiRappresentative) {
@ -344,7 +357,7 @@ public class Concessione extends Record{
l.setParoleChiaveLibere(ConstraintCheck.defaultFor(l.getParoleChiaveLibere(),getParoleChiaveLibere()).evaluate()); l.setParoleChiaveLibere(ConstraintCheck.defaultFor(l.getParoleChiaveLibere(),getParoleChiaveLibere()).evaluate());
l.setParoleChiaveICCD(ConstraintCheck.defaultFor(l.getParoleChiaveICCD(),getParoleChiaveICCD()).evaluate()); l.setParoleChiaveICCD(ConstraintCheck.defaultFor(l.getParoleChiaveICCD(),getParoleChiaveICCD()).evaluate());
//TODO Evaluate
l.setBbox(ConstraintCheck.defaultFor(l.getBbox(), BBOX.WORLD_EXTENT).evaluate()); l.setBbox(ConstraintCheck.defaultFor(l.getBbox(), BBOX.WORLD_EXTENT).evaluate());
l.setPolicy(ConstraintCheck.defaultFor(l.getPolicy(),getPolicy()).evaluate());; l.setPolicy(ConstraintCheck.defaultFor(l.getPolicy(),getPolicy()).evaluate());;
@ -409,70 +422,17 @@ public class Concessione extends Record{
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
Concessione other = (Concessione) obj; Concessione other = (Concessione) obj;
// if (authors == null) {
// if (other.authors != null)
// return false;
// } else if (!authors.equals(other.authors))
// return false;
if(!CollectionsUtils.equalsCollections(authors, other.authors)) return false; if(!CollectionsUtils.equalsCollections(authors, other.authors)) return false;
// if (fontiFinanaziamento == null) {
// if (other.fontiFinanaziamento != null)
// return false;
// } else if (!fontiFinanaziamento.equals(other.fontiFinanaziamento))
// return false;
if (!CollectionsUtils.equalsCollections(fontiFinanziamento, other.fontiFinanziamento)) return false; if (!CollectionsUtils.equalsCollections(fontiFinanziamento, other.fontiFinanziamento)) return false;
// if (immaginiRappresentative == null) {
// if (other.immaginiRappresentative != null)
// return false;
// } else if (!immaginiRappresentative.equals(other.immaginiRappresentative))
// return false;
if (!CollectionsUtils.equalsCollections(immaginiRappresentative, other.immaginiRappresentative)) return false; if (!CollectionsUtils.equalsCollections(immaginiRappresentative, other.immaginiRappresentative)) return false;
// if (paroleChiaveICCD == null) {
// if (other.paroleChiaveICCD != null)
// return false;
// } else if (!paroleChiaveICCD.equals(other.paroleChiaveICCD))
// return false;
if (!CollectionsUtils.equalsCollections(paroleChiaveICCD, other.paroleChiaveICCD)) return false; if (!CollectionsUtils.equalsCollections(paroleChiaveICCD, other.paroleChiaveICCD)) return false;
// if (paroleChiaveLibere == null) {
// if (other.paroleChiaveLibere != null)
// return false;
// } else if (!paroleChiaveLibere.equals(other.paroleChiaveLibere))
// return false;
if (!CollectionsUtils.equalsCollections(paroleChiaveLibere, other.paroleChiaveLibere)) return false; if (!CollectionsUtils.equalsCollections(paroleChiaveLibere, other.paroleChiaveLibere)) return false;
// if (piantaFineScavo == null) {
// if (other.piantaFineScavo != null)
// return false;
// } else if (!piantaFineScavo.equals(other.piantaFineScavo))
// return false;
if (!CollectionsUtils.equalsCollections(pianteFineScavo, other.pianteFineScavo)) return false; if (!CollectionsUtils.equalsCollections(pianteFineScavo, other.pianteFineScavo)) return false;
// if (risorseCorrelate == null) {
// if (other.risorseCorrelate != null)
// return false;
// } else if (!risorseCorrelate.equals(other.risorseCorrelate))
// return false;
if (!CollectionsUtils.equalsCollections(risorseCorrelate, other.risorseCorrelate)) return false; if (!CollectionsUtils.equalsCollections(risorseCorrelate, other.risorseCorrelate)) return false;
// if (soggetto == null) {
// if (other.soggetto != null)
// return false;
// } else if (!soggetto.equals(other.soggetto))
// return false;
if (!CollectionsUtils.equalsCollections(soggetto, other.soggetto)) return false; if (!CollectionsUtils.equalsCollections(soggetto, other.soggetto)) return false;
// if (titolari == null) {
// if (other.titolari != null)
// return false;
// } else if (!titolari.equals(other.titolari))
// return false;
if (!CollectionsUtils.equalsCollections(titolari, other.titolari)) return false; if (!CollectionsUtils.equalsCollections(titolari, other.titolari)) return false;
if (centroidLat == null) { if (centroidLat == null) {
if (other.centroidLat != null) if (other.centroidLat != null)
return false; return false;

View File

@ -16,10 +16,7 @@ public class RelazioneScavo extends AssociatedContent {
// private String abstractSection;
private String abstractIta;
private String abstractEng;
private List<String> responsabili; private List<String> responsabili;
private List<String> soggetto; private List<String> soggetto;
@ -38,10 +35,7 @@ public class RelazioneScavo extends AssociatedContent {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
// result = prime * result + ((abstractSection == null) ? 0 : abstractSection.hashCode());
// result = prime * result + ((responsabili == null) ? 0 : responsabili.hashCode());
result = prime * result + CollectionsUtils.hashCode(responsabili); result = prime * result + CollectionsUtils.hashCode(responsabili);
// result = prime * result + ((soggetto == null) ? 0 : soggetto.hashCode());
result = prime * result + CollectionsUtils.hashCode(soggetto); result = prime * result + CollectionsUtils.hashCode(soggetto);
return result; return result;
} }
@ -55,27 +49,11 @@ public class RelazioneScavo extends AssociatedContent {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
RelazioneScavo other = (RelazioneScavo) obj; RelazioneScavo other = (RelazioneScavo) obj;
// if (abstractSection == null) {
// if (other.abstractSection != null)
// return false;
// } else if (!abstractSection.equals(other.abstractSection))
// return false;
// if (responsabili == null) {
// if (other.responsabili != null)
// return false;
// } else if (!responsabili.equals(other.responsabili))
// return false;
if(!CollectionsUtils.equalsCollections(responsabili, other.responsabili)) return false; if(!CollectionsUtils.equalsCollections(responsabili, other.responsabili)) return false;
// if (soggetto == null) {
// if (other.soggetto != null)
// return false;
// } else if (!soggetto.equals(other.soggetto))
// return false;
if(!CollectionsUtils.equalsCollections(soggetto, other.soggetto)) return false; if(!CollectionsUtils.equalsCollections(soggetto, other.soggetto)) return false;
return true; return true;
} }