From 00f2b8410a51ef31738b1d04d0133bebb6312504 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Fri, 24 Jul 2020 17:23:57 +0200 Subject: [PATCH] changed the definition of the model to intesert porvenance information to some classes --- .../dnetlib/dhp/schema/dump/oaf/Context.java | 12 ++++ .../dnetlib/dhp/schema/dump/oaf/Country.java | 2 +- .../eu/dnetlib/dhp/schema/dump/oaf/Pid.java | 29 +++++---- .../dhp/schema/dump/oaf/Provenance.java | 47 ++++++++------ .../dnetlib/dhp/schema/dump/oaf/Result.java | 64 +++++++++++++++---- .../dnetlib/dhp/schema/dump/oaf/Subject.java | 29 +++++---- 6 files changed, 122 insertions(+), 61 deletions(-) diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Context.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Context.java index 21267486a..915974d86 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Context.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Context.java @@ -2,6 +2,7 @@ package eu.dnetlib.dhp.schema.dump.oaf; import java.util.List; +import java.util.Objects; public class Context extends Qualifier { private List provenance; @@ -13,4 +14,15 @@ public class Context extends Qualifier { public void setProvenance(List provenance) { this.provenance = provenance; } + + + @Override + public int hashCode() { + String provenance = new String(); + this.provenance.forEach(p -> provenance.concat(p.toString())); + return Objects.hash(getCode(), getLabel(), provenance); + } + + + } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Country.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Country.java index d75272513..749474e87 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Country.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Country.java @@ -21,7 +21,7 @@ public class Country extends Qualifier { return c; } - public static Country newInstance(String code, String label, String provenance, String trust){ + public static Country newInstance(String code, String label, String provenance, String trust) { return newInstance(code, label, Provenance.newInstance(provenance, trust)); } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Pid.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Pid.java index 5bdc0cdbe..fb200028b 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Pid.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Pid.java @@ -1,24 +1,25 @@ + package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; public class Pid implements Serializable { - private ControlledField pid; - private Provenance provenance; + private ControlledField pid; + private Provenance provenance; - public ControlledField getPid() { - return pid; - } + public ControlledField getPid() { + return pid; + } - public void setPid(ControlledField pid) { - this.pid = pid; - } + public void setPid(ControlledField pid) { + this.pid = pid; + } - public Provenance getProvenance() { - return provenance; - } + public Provenance getProvenance() { + return provenance; + } - public void setProvenance(Provenance provenance) { - this.provenance = provenance; - } + public void setProvenance(Provenance provenance) { + this.provenance = provenance; + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Provenance.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Provenance.java index f3115819f..bfd84dfee 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Provenance.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Provenance.java @@ -1,31 +1,36 @@ + package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; -public class Provenance implements Serializable { - private String provenance; - private String trust; +public class Provenance implements Serializable { + private String provenance; + private String trust; - public String getProvenance() { - return provenance; - } + public String getProvenance() { + return provenance; + } - public void setProvenance(String provenance) { - this.provenance = provenance; - } + public void setProvenance(String provenance) { + this.provenance = provenance; + } - public String getTrust() { - return trust; - } + public String getTrust() { + return trust; + } - public void setTrust(String trust) { - this.trust = trust; - } + public void setTrust(String trust) { + this.trust = trust; + } - public static Provenance newInstance(String provenance, String trust){ - Provenance p = new Provenance(); - p.provenance = provenance; - p.trust = trust; - return p; - } + public static Provenance newInstance(String provenance, String trust) { + Provenance p = new Provenance(); + p.provenance = provenance; + p.trust = trust; + return p; + } + + public String toString(){ + return provenance + trust; + } } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java index 6ba70bcef..ac1dae382 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Result.java @@ -4,7 +4,9 @@ package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; import java.util.List; -public class Result extends OafEntity implements Serializable { +import eu.dnetlib.dhp.schema.dump.oaf.community.Project; + +public class Result implements Serializable { private List author; @@ -40,8 +42,6 @@ public class Result extends OafEntity implements Serializable { private AccessRight bestaccessright; - private List context; - private List externalReference; private List instance; @@ -66,6 +66,56 @@ public class Result extends OafEntity implements Serializable { private List geolocation; // dataset + private String id; + + private List originalId; + + private List pid; + + private String dateofcollection; + + private Long lastupdatetimestamp; + + public Long getLastupdatetimestamp() { + return lastupdatetimestamp; + } + + public void setLastupdatetimestamp(Long lastupdatetimestamp) { + this.lastupdatetimestamp = lastupdatetimestamp; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List getOriginalId() { + return originalId; + } + + public void setOriginalId(List originalId) { + this.originalId = originalId; + } + + public List getPid() { + return pid; + } + + public void setPid(List pid) { + this.pid = pid; + } + + public String getDateofcollection() { + return dateofcollection; + } + + public void setDateofcollection(String dateofcollection) { + this.dateofcollection = dateofcollection; + } + public List getAuthor() { return author; } @@ -202,14 +252,6 @@ public class Result extends OafEntity implements Serializable { this.bestaccessright = bestaccessright; } - public List getContext() { - return context; - } - - public void setContext(List context) { - this.context = context; - } - public List getExternalReference() { return externalReference; } diff --git a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java index 1587e29ad..4c9bf352b 100644 --- a/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java +++ b/dhp-schemas/src/main/java/eu/dnetlib/dhp/schema/dump/oaf/Subject.java @@ -1,25 +1,26 @@ + package eu.dnetlib.dhp.schema.dump.oaf; import java.io.Serializable; public class Subject implements Serializable { - private ControlledField subject; - private Provenance provenance; + private ControlledField subject; + private Provenance provenance; - public ControlledField getSubject() { - return subject; - } + public ControlledField getSubject() { + return subject; + } - public void setSubject(ControlledField subject) { - this.subject = subject; - } + public void setSubject(ControlledField subject) { + this.subject = subject; + } - public Provenance getProvenance() { - return provenance; - } + public Provenance getProvenance() { + return provenance; + } - public void setProvenance(Provenance provenance) { - this.provenance = provenance; - } + public void setProvenance(Provenance provenance) { + this.provenance = provenance; + } }