Search in sources :

Example 1 with DeactivationDate

use of org.orcid.jaxb.model.v3.dev1.record.DeactivationDate in project ORCID-Source by ORCID.

the class RecordManagerReadOnlyImpl method getHistory.

private History getHistory(String orcid) {
    History history = new History();
    ProfileEntity profile = profileEntityCacheManager.retrieve(orcid);
    history.setClaimed(profile.getClaimed());
    if (profile.getCompletedDate() != null) {
        history.setCompletionDate(new CompletionDate(DateUtils.convertToXMLGregorianCalendar(profile.getCompletedDate())));
    }
    if (!PojoUtil.isEmpty(profile.getCreationMethod())) {
        history.setCreationMethod(CreationMethod.fromValue(profile.getCreationMethod()));
    }
    if (profile.getDeactivationDate() != null) {
        history.setDeactivationDate(new DeactivationDate(DateUtils.convertToXMLGregorianCalendar(profile.getDeactivationDate())));
    }
    if (profile.getLastModified() != null) {
        history.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(profile.getLastModified())));
    }
    if (profile.getSubmissionDate() != null) {
        history.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(profile.getSubmissionDate())));
    }
    if (profile.getSource() != null) {
        history.setSource(new Source(profile.getSource().getSourceId()));
    }
    boolean verfiedEmail = false;
    boolean verfiedPrimaryEmail = false;
    Emails emails = emailManager.getEmails(orcid);
    if (emails != null) {
        for (Email email : emails.getEmails()) {
            if (email.isVerified()) {
                verfiedEmail = true;
                if (email.isPrimary()) {
                    verfiedPrimaryEmail = true;
                    break;
                }
            }
        }
    }
    history.setVerifiedEmail(verfiedEmail);
    history.setVerifiedPrimaryEmail(verfiedPrimaryEmail);
    return history;
}
Also used : LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) Email(org.orcid.jaxb.model.v3.dev1.record.Email) Emails(org.orcid.jaxb.model.v3.dev1.record.Emails) History(org.orcid.jaxb.model.v3.dev1.record.History) SubmissionDate(org.orcid.jaxb.model.v3.dev1.record.SubmissionDate) CompletionDate(org.orcid.jaxb.model.v3.dev1.record.CompletionDate) DeactivationDate(org.orcid.jaxb.model.v3.dev1.record.DeactivationDate) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Source(org.orcid.jaxb.model.v3.dev1.common.Source)

Aggregations

LastModifiedDate (org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate)1 Source (org.orcid.jaxb.model.v3.dev1.common.Source)1 CompletionDate (org.orcid.jaxb.model.v3.dev1.record.CompletionDate)1 DeactivationDate (org.orcid.jaxb.model.v3.dev1.record.DeactivationDate)1 Email (org.orcid.jaxb.model.v3.dev1.record.Email)1 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)1 History (org.orcid.jaxb.model.v3.dev1.record.History)1 SubmissionDate (org.orcid.jaxb.model.v3.dev1.record.SubmissionDate)1 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)1