Skip to content

Commit

Permalink
Added the implementation for emailDomains
Browse files Browse the repository at this point in the history
  • Loading branch information
Camelia-Orcid committed Sep 16, 2024
1 parent 0b4177c commit d50e10a
Show file tree
Hide file tree
Showing 8 changed files with 376 additions and 103 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,4 @@ public boolean equals(Object obj) {
&& Objects.equals(role, other.role) && Objects.equals(startDate, other.startDate) && Objects.equals(type, other.type) && Objects.equals(url, other.url)
&& validated == other.validated;
}

}
68 changes: 68 additions & 0 deletions orcid-core/src/main/java/org/orcid/core/model/EmailDomain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package org.orcid.core.model;

import java.util.Objects;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import org.orcid.jaxb.model.v3.release.common.FuzzyDate;
import org.orcid.pojo.ajaxForm.Date;

import io.swagger.v3.oas.annotations.media.Schema;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = { "putCode", "type", "organizationName", "role", "url", "startDate", "endDate", "validated" })
@XmlRootElement(name = "education-qualification", namespace = "http://www.orcid.org/ns/summary")
@Schema(description = "Education Qualification")
public class EmailDomain {
@XmlElement(name = "value", namespace = "http://www.orcid.org/ns/summary")
protected String value;
@XmlElement(name = "created-date", namespace = "http://www.orcid.org/ns/common")
protected Date createdDate;
@XmlElement(name = "last-modified", namespace = "http://www.orcid.org/ns/common")
protected Date lastModified;

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

public Date getCreatedDate() {
return createdDate;
}

public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}

public Date getLastModified() {
return lastModified;
}

public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}

@Override
public int hashCode() {
return Objects.hash(value, createdDate, lastModified);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EmailDomain other = (EmailDomain) obj;
return Objects.equals(createdDate, other.createdDate) && Objects.equals(lastModified, other.lastModified) && Objects.equals(value, other.value);
}
}
62 changes: 62 additions & 0 deletions orcid-core/src/main/java/org/orcid/core/model/EmailDomains.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package org.orcid.core.model;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

import io.swagger.v3.oas.annotations.media.Schema;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = { "count", "emailDomains" })
@XmlRootElement(name = "email-domains", namespace = "http://www.orcid.org/ns/summary")
@Schema(description = "Email domains list")
public class EmailDomains implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
@XmlElement(name = "count", namespace = "http://www.orcid.org/ns/summary")
private Integer count;
@XmlElement(name = "email-domain", namespace = "http://www.orcid.org/ns/summary")
private List<EmailDomain> emailDomains;

public Integer getCount() {
return count;
}

public void setCount(Integer count) {
this.count = count;
}

public List<EmailDomain> getEmailDomains() {
return emailDomains;
}

public void setEmailDomains(List<EmailDomain> emailDomains ) {
this.emailDomains = emailDomains ;
}

@Override
public int hashCode() {
return Objects.hash(count, emailDomains);
}

@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EmailDomains other = (EmailDomains) obj;
return Objects.equals(count, other.count) && Objects.equals(emailDomains, other.emailDomains);
}

}
24 changes: 17 additions & 7 deletions orcid-core/src/main/java/org/orcid/core/model/RecordSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ public class RecordSummary implements Serializable {
private Works works;
@XmlElement(name = "peer-reviews", namespace = "http://www.orcid.org/ns/summary")
private PeerReviews peerReviews;

@XmlElement(name = "education-qualifications", namespace = "http://www.orcid.org/ns/summary")
private EducationQualifications educationQualifications;
@XmlElement(name = "research-resources", namespace = "http://www.orcid.org/ns/summary")
private ResearchResources researchResources;

@XmlElement(name = "email-domains", namespace = "http://www.orcid.org/ns/summary")
private EmailDomains emailDomains;

public OrcidIdentifier getOrcidIdentifier() {
return orcidIdentifier;
Expand Down Expand Up @@ -137,7 +138,7 @@ public PeerReviews getPeerReviews() {
public void setPeerReviews(PeerReviews peerReviews) {
this.peerReviews = peerReviews;
}

public EducationQualifications getEducationQualifications() {
return educationQualifications;
}
Expand All @@ -146,7 +147,6 @@ public void setEducationQualifications(EducationQualifications educationQualific
this.educationQualifications = educationQualifications;
}


public ResearchResources getResearchResources() {
return researchResources;
}
Expand All @@ -155,10 +155,18 @@ public void setResearchResources(ResearchResources researchResources) {
this.researchResources = researchResources;
}

public EmailDomains getEmailDomains() {
return emailDomains;
}

public void setEmailDomains(EmailDomains emailDomains) {
this.emailDomains = emailDomains;
}

@Override
public int hashCode() {
return Objects.hash(createdDate, creditName, employments, externalIdentifiers, fundings, lastModifiedDate, orcidIdentifier, orcidUrlManager, peerReviews,
professionalActivities, works);
professionalActivities, works, educationQualifications, researchResources, emailDomains);
}

@Override
Expand All @@ -174,6 +182,8 @@ public boolean equals(Object obj) {
&& Objects.equals(externalIdentifiers, other.externalIdentifiers) && Objects.equals(fundings, other.fundings)
&& Objects.equals(lastModifiedDate, other.lastModifiedDate) && Objects.equals(orcidIdentifier, other.orcidIdentifier)
&& Objects.equals(orcidUrlManager, other.orcidUrlManager) && Objects.equals(peerReviews, other.peerReviews)
&& Objects.equals(professionalActivities, other.professionalActivities) && Objects.equals(works, other.works);
}
&& Objects.equals(professionalActivities, other.professionalActivities) && Objects.equals(works, other.works)
&& Objects.equals(educationQualifications, other.educationQualifications) && Objects.equals(researchResources, other.researchResources)
&& Objects.equals(emailDomains, other.emailDomains) ;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.orcid.pojo.summary;

import java.util.Date;

import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity;
import org.orcid.pojo.ajaxForm.PojoUtil;

public class EmailDomainSummary {
private String value;
private Date createdDate;
private Date lastModified;

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

public Date getCreatedDate() {
return createdDate;
}

public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}

public Date getLastModified() {
return lastModified;
}

public void setLastModified(Date lastModified) {
this.lastModified = lastModified;
}


public static EmailDomainSummary valueOf(ProfileEmailDomainEntity pem) {
EmailDomainSummary form = new EmailDomainSummary();

if (pem != null) {
if(!PojoUtil.isEmpty(pem.getEmailDomain())) {
form.setValue(pem.getEmailDomain());
}

if (pem.getDateCreated() != null) {
form.setCreatedDate(pem.getDateCreated());
}

if (pem.getLastModified() !=null) {
form.setLastModified(pem.getLastModified());
}
}
return form;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class RecordSummaryPojo {
private int educationQualificationsCount;
private int validatedResearchResources;
private int selfAssertedResearchResources;

private List<EmailDomainSummary> emailDomains;
private int emailDomainsCount;

public String getName() {
return name;
Expand Down Expand Up @@ -199,5 +202,21 @@ public int getSelfAssertedResearchResources() {
public void setSelfAssertedResearchResources(int selfAssertedResearchResources) {
this.selfAssertedResearchResources = selfAssertedResearchResources;
}

public List<EmailDomainSummary> getEmailDomains() {
return emailDomains;
}

public void setEmailDomains(List<EmailDomainSummary> emailDomains) {
this.emailDomains = emailDomains;
}

public int getEmailDomainsCount() {
return emailDomainsCount;
}

public void setEmailDomainsCount(int emailDomainsCount) {
this.emailDomainsCount = emailDomainsCount;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.xml.datatype.XMLGregorianCalendar;

import org.junit.Before;
Expand All @@ -28,6 +29,7 @@
import org.orcid.core.manager.v3.read_only.ProfileFundingManagerReadOnly;
import org.orcid.core.manager.v3.read_only.RecordManagerReadOnly;
import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly;
import org.orcid.core.manager.v3.read_only.ResearchResourceManagerReadOnly;
import org.orcid.core.model.ProfessionalActivity;
import org.orcid.core.model.RecordSummary;
import org.orcid.jaxb.model.v3.release.common.CreatedDate;
Expand Down Expand Up @@ -103,6 +105,9 @@ public class SummaryManagerTest {

@Mock
private WorksCacheManager worksCacheManagerMock;

@Mock
private ResearchResourceManagerReadOnly researchResourceManagerReadOnly;

@Before
public void setUp() {
Expand Down

0 comments on commit d50e10a

Please sign in to comment.