package eu.dnetlib.dhp.schema.oaf; import java.io.Serializable; import java.util.List; public class Instance implements Serializable { private Field license; private AccessRight accessright; private Qualifier instancetype; private KeyValue hostedby; private List url; // other research products specifc private String distributionlocation; private KeyValue collectedfrom; private List pid; private List alternateIdentifier; private Field dateofacceptance; // ( article | book ) processing charges. Defined here to cope with possible wrongly typed // results private Field processingchargeamount; // currency - alphabetic code describe in ISO-4217. Defined here to cope with possible wrongly // typed results private Field processingchargecurrency; private Qualifier refereed; // peer-review status public Field getLicense() { return license; } public void setLicense(Field license) { this.license = license; } public AccessRight getAccessright() { return accessright; } public void setAccessright(AccessRight accessright) { this.accessright = accessright; } public Qualifier getInstancetype() { return instancetype; } public void setInstancetype(Qualifier instancetype) { this.instancetype = instancetype; } public KeyValue getHostedby() { return hostedby; } public void setHostedby(KeyValue hostedby) { this.hostedby = hostedby; } public List getUrl() { return url; } public void setUrl(List url) { this.url = url; } public String getDistributionlocation() { return distributionlocation; } public void setDistributionlocation(String distributionlocation) { this.distributionlocation = distributionlocation; } public KeyValue getCollectedfrom() { return collectedfrom; } public void setCollectedfrom(KeyValue collectedfrom) { this.collectedfrom = collectedfrom; } public List getPid() { return pid; } public void setPid(List pid) { this.pid = pid; } public Field getDateofacceptance() { return dateofacceptance; } public void setDateofacceptance(Field dateofacceptance) { this.dateofacceptance = dateofacceptance; } public List getAlternateIdentifier() { return alternateIdentifier; } public void setAlternateIdentifier(List alternateIdentifier) { this.alternateIdentifier = alternateIdentifier; } public Field getProcessingchargeamount() { return processingchargeamount; } public void setProcessingchargeamount(Field processingchargeamount) { this.processingchargeamount = processingchargeamount; } public Field getProcessingchargecurrency() { return processingchargecurrency; } public void setProcessingchargecurrency(Field processingchargecurrency) { this.processingchargecurrency = processingchargecurrency; } public Qualifier getRefereed() { return refereed; } public void setRefereed(Qualifier refereed) { this.refereed = refereed; } public String toComparableString() { return String .format( "%s::%s::%s::%s", hostedby != null && hostedby.getKey() != null ? hostedby.getKey().toLowerCase() : "", accessright != null && accessright.getClassid() != null ? accessright.getClassid() : "", instancetype != null && instancetype.getClassid() != null ? instancetype.getClassid() : "", url != null ? url : ""); } @Override public int hashCode() { return toComparableString().hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Instance other = (Instance) obj; return toComparableString().equals(other.toComparableString()); } }