diff --git a/src/main/java/org/gcube/application/geoportal/common/model/legacy/AbstractRelazione.java b/src/main/java/org/gcube/application/geoportal/common/model/legacy/AbstractRelazione.java new file mode 100644 index 0000000..d5cab38 --- /dev/null +++ b/src/main/java/org/gcube/application/geoportal/common/model/legacy/AbstractRelazione.java @@ -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; + + +} diff --git a/src/main/java/org/gcube/application/geoportal/common/model/legacy/Concessione.java b/src/main/java/org/gcube/application/geoportal/common/model/legacy/Concessione.java index b99f9db..f664862 100644 --- a/src/main/java/org/gcube/application/geoportal/common/model/legacy/Concessione.java +++ b/src/main/java/org/gcube/application/geoportal/common/model/legacy/Concessione.java @@ -71,7 +71,8 @@ public class Concessione extends Record{ private Double centroidLong; private RelazioneScavo relazioneScavo; - + private AssociatedContent abstractRelazione; + private List immaginiRappresentative=new ArrayList(); private LayerConcessione posizionamentoScavo; @@ -92,7 +93,7 @@ public class Concessione extends Record{ public final static String POSIZIONAMENTO="posizionamentoScavo"; public final static String PIANTE="piante"; public final static String IMMAGINI="immagini"; - + public final static String ABSTRACT_RELAZIONE="abstract_relazione"; public static final String MONGO_ID="mongo_id"; public final static String piantaByIndex(int index) {return makeByIndex(PIANTE,index);}; @@ -113,6 +114,7 @@ public class Concessione extends Record{ switch(path) { case Paths.RELAZIONE : return getRelazioneScavo(); case Paths.POSIZIONAMENTO : return getPosizionamentoScavo(); + case Paths.ABSTRACT_RELAZIONE: return getAbstractRelazione(); } if(path.matches("\\w+\\[\\d+\\]")) { // Array section @@ -168,7 +170,11 @@ public class Concessione extends Record{ break; } case Paths.POSIZIONAMENTO : { - setRelazioneScavo((RelazioneScavo) toSet); + setPosizionamentoScavo((LayerConcessione) toSet); + break; + } + case Paths.ABSTRACT_RELAZIONE:{ + setAbstractRelazione((AbstractRelazione)toSet); break; } case Paths.PIANTE : { @@ -218,8 +224,7 @@ public class Concessione extends Record{ validator.checkMandatory(paroleChiaveLibere, "Parole chiave libere"); validator.checkMandatory(responsabile,"Responsabile"); - - + validator.checkMandatory(titolareCopyright, "Titolare Copyright"); validator.checkMandatory(titolareLicenza,"Titolare licenza"); @@ -228,12 +233,13 @@ public class Concessione extends Record{ if(validator.checkMandatory(relazioneScavo, "Relazione scavo")) { - - - validator.addChild(relazioneScavo.validateForInsertion()); } + if(validator.checkMandatory(abstractRelazione,"Abstract Relazione")){ + validator.addChild(abstractRelazione.validateForInsertion()); + } + // if(immaginiRappresentative!=null) // // for(UploadedImage img : immaginiRappresentative) { @@ -297,6 +303,13 @@ public class Concessione extends Record{ 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) for(UploadedImage img : immaginiRappresentative) { @@ -344,7 +357,7 @@ public class Concessione extends Record{ l.setParoleChiaveLibere(ConstraintCheck.defaultFor(l.getParoleChiaveLibere(),getParoleChiaveLibere()).evaluate()); l.setParoleChiaveICCD(ConstraintCheck.defaultFor(l.getParoleChiaveICCD(),getParoleChiaveICCD()).evaluate()); - //TODO Evaluate + l.setBbox(ConstraintCheck.defaultFor(l.getBbox(), BBOX.WORLD_EXTENT).evaluate()); l.setPolicy(ConstraintCheck.defaultFor(l.getPolicy(),getPolicy()).evaluate());; @@ -409,70 +422,17 @@ public class Concessione extends Record{ if (getClass() != obj.getClass()) return false; 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 (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 (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 (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 (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 (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 (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 (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 (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 (centroidLat == null) { if (other.centroidLat != null) return false; diff --git a/src/main/java/org/gcube/application/geoportal/common/model/legacy/RelazioneScavo.java b/src/main/java/org/gcube/application/geoportal/common/model/legacy/RelazioneScavo.java index f813a5d..6cc5e88 100644 --- a/src/main/java/org/gcube/application/geoportal/common/model/legacy/RelazioneScavo.java +++ b/src/main/java/org/gcube/application/geoportal/common/model/legacy/RelazioneScavo.java @@ -16,10 +16,7 @@ public class RelazioneScavo extends AssociatedContent { -// private String abstractSection; - private String abstractIta; - private String abstractEng; - + private List responsabili; private List soggetto; @@ -38,10 +35,7 @@ public class RelazioneScavo extends AssociatedContent { public int hashCode() { final int prime = 31; 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 + ((soggetto == null) ? 0 : soggetto.hashCode()); result = prime * result + CollectionsUtils.hashCode(soggetto); return result; } @@ -55,27 +49,11 @@ public class RelazioneScavo extends AssociatedContent { if (getClass() != obj.getClass()) return false; 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 (soggetto == null) { -// if (other.soggetto != null) -// return false; -// } else if (!soggetto.equals(other.soggetto)) -// return false; + if(!CollectionsUtils.equalsCollections(soggetto, other.soggetto)) return false; - - + return true; }