Skip to content

Commit

Permalink
set verification date
Browse files Browse the repository at this point in the history
  • Loading branch information
auumgn committed Nov 5, 2024
1 parent ce8a357 commit 012da05
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@
import org.orcid.core.utils.JsonUtils;
import org.orcid.core.utils.cache.redis.RedisClient;
import org.orcid.core.utils.v3.SourceUtils;
import org.orcid.jaxb.model.v3.release.common.CreatedDate;
import org.orcid.jaxb.model.v3.release.common.FuzzyDate;
import org.orcid.jaxb.model.v3.release.common.LastModifiedDate;
import org.orcid.jaxb.model.v3.release.common.Source;
import org.orcid.jaxb.model.v3.release.common.Visibility;
import org.orcid.jaxb.model.v3.release.common.*;
import org.orcid.jaxb.model.v3.release.record.AffiliationType;
import org.orcid.jaxb.model.v3.release.record.Group;
import org.orcid.jaxb.model.v3.release.record.GroupableActivity;
Expand Down Expand Up @@ -286,6 +282,7 @@ public RecordSummaryPojo getRecordSummaryPojo(String orcid) {
for (EmailDomain ed : recordSummary.getEmailDomains().getEmailDomains()) {
EmailDomainSummary eds = new EmailDomainSummary();
eds.setValue(ed.getValue());
eds.setVerificationDate(ed.getVerificationDate().toString());
emailDomains.add(eds);
}
}
Expand Down Expand Up @@ -524,21 +521,22 @@ public void generateEmailDomainsSummary(RecordSummary recordSummary, String orci
for (ProfileEmailDomainEntity ped : emailDomains) {
ed = new EmailDomain();
ed.setValue(ped.getEmailDomain());
ed.setVerificationDate( new VerificationDate(DateUtils.convertToXMLGregorianCalendar(ped.getDateCreated())));
edList.add(ed);
}
}
List<EmailDomain> emailDomainsTop3 = new ArrayList<EmailDomain>();
edList.stream().limit(3).forEach(t -> {
EmailDomain ed = new EmailDomain();
ed.setValue(t.getValue());
ed.setVerificationDate(t.getVerificationDate());
emailDomainsTop3.add(ed);
});

EmailDomains eds = new EmailDomains();
eds.setCount(edList.size());
if (!emailDomainsTop3.isEmpty()) {
eds.setEmailDomains(emailDomainsTop3);

}

recordSummary.setEmailDomains(eds);
Expand Down
15 changes: 13 additions & 2 deletions orcid-core/src/main/java/org/orcid/core/model/EmailDomain.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,37 @@
import javax.xml.bind.annotation.XmlType;

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

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

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = { "value"})
@XmlType(propOrder = { "value", "verificationDate"})
@XmlRootElement(name = "email-domain", namespace = "http://www.orcid.org/ns/summary")
@Schema(description = "Email Domain")
public class EmailDomain {
@XmlElement(name = "value", namespace = "http://www.orcid.org/ns/summary")
protected String value;

@XmlElement(name = "verification-date", namespace = "http://www.orcid.org/ns/summary")
protected VerificationDate verificationDate;

public String getValue() {
return value;
}

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


public VerificationDate getVerificationDate() {
return verificationDate;
}

public void setVerificationDate(VerificationDate verificationDate) {
this.verificationDate = verificationDate;
}

@Override
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
package org.orcid.pojo.summary;

import org.orcid.jaxb.model.v3.release.common.VerificationDate;
import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity;
import org.orcid.pojo.ajaxForm.Date;
import org.orcid.pojo.ajaxForm.PojoUtil;
import org.orcid.utils.DateUtils;

public class EmailDomainSummary {
private String value;

public String verificationDate;

public String getValue() {
return value;
}
Expand All @@ -14,17 +19,24 @@ public void setValue(String value) {
this.value = value;
}


public String getVerificationDate() {
return verificationDate;
}

public void setVerificationDate(String verificationDate) {
this.verificationDate = verificationDate;
}


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

if (pem != null) {
if(!PojoUtil.isEmpty(pem.getEmailDomain())) {
form.setValue(pem.getEmailDomain());
}
form.setVerificationDate(DateUtils.convertToXMLGregorianCalendar(pem.getDateCreated()).toString());
}
return form;
}


}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.orcid.persistence.jpa.entities;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
Expand All @@ -16,6 +17,7 @@ public class ProfileEmailDomainEntity extends BaseEntity<Long> {
private String orcid;
private String emailDomain;
private String visibility;
private Date dateCreated;

@Id
@Column(name = "id")
Expand Down Expand Up @@ -56,6 +58,15 @@ public void setVisibility(String visibility) {
this.visibility = visibility;
}

@Column(name = "date_created")
public Date getDateCreated() {
return dateCreated;
}

public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}


@Override
public boolean equals(Object obj) {
Expand Down

0 comments on commit 012da05

Please sign in to comment.