Search in sources :

Example 36 with Source

use of org.orcid.jaxb.model.common_v2.Source in project ORCID-Source by ORCID.

the class SourceNameConverter method convert.

@Override
public SourceName convert(String source, Type<? extends SourceName> destinationType) {
    if (PojoUtil.isEmpty(source)) {
        return null;
    }
    String sourceName = sourceNameCacheManager.retrieve(source);
    if (PojoUtil.isEmpty(sourceName)) {
        return null;
    }
    SourceName result = new SourceName();
    result.setContent(sourceName);
    return result;
}
Also used : SourceName(org.orcid.jaxb.model.common_v2.SourceName)

Example 37 with Source

use of org.orcid.jaxb.model.common_v2.Source in project ORCID-Source by ORCID.

the class SourceOrcidConverter method convertFrom.

@Override
public SourceOrcid convertFrom(String source, Type<SourceOrcid> destinationType) {
    if (PojoUtil.isEmpty(source)) {
        return null;
    }
    SourceOrcid sourceOrcid = new SourceOrcid();
    sourceOrcid.setHost(orcidUrlManager.getBaseHost());
    sourceOrcid.setUri(orcidUrlManager.getBaseUriHttp() + "/" + source);
    sourceOrcid.setPath(source);
    return sourceOrcid;
}
Also used : SourceOrcid(org.orcid.jaxb.model.common_v2.SourceOrcid)

Example 38 with Source

use of org.orcid.jaxb.model.common_v2.Source in project ORCID-Source by ORCID.

the class SourceClientIdConverter method convertFrom.

@Override
public SourceClientId convertFrom(String source, Type<SourceClientId> destinationType) {
    if (PojoUtil.isEmpty(source)) {
        return null;
    }
    SourceClientId sourceClientId = new SourceClientId();
    sourceClientId.setHost(orcidUrlManager.getBaseHost());
    sourceClientId.setUri(orcidUrlManager.getBaseUriHttp() + "/client/" + source);
    sourceClientId.setPath(source);
    return sourceClientId;
}
Also used : SourceClientId(org.orcid.jaxb.model.common_v2.SourceClientId)

Example 39 with Source

use of org.orcid.jaxb.model.common_v2.Source 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, profile.getLastModified().getTime());
    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.common_v2.LastModifiedDate) Email(org.orcid.jaxb.model.record_v2.Email) Emails(org.orcid.jaxb.model.record_v2.Emails) History(org.orcid.jaxb.model.record_v2.History) SubmissionDate(org.orcid.jaxb.model.record_v2.SubmissionDate) CompletionDate(org.orcid.jaxb.model.record_v2.CompletionDate) DeactivationDate(org.orcid.jaxb.model.record_v2.DeactivationDate) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Source(org.orcid.jaxb.model.common_v2.Source)

Example 40 with Source

use of org.orcid.jaxb.model.common_v2.Source in project ORCID-Source by ORCID.

the class OrcidSecurityManagerTestBase method setSource.

protected void setSource(SourceAware element, String sourceId) {
    Source source = new Source();
    source.setSourceClientId(new SourceClientId(sourceId));
    element.setSource(source);
}
Also used : SourceClientId(org.orcid.jaxb.model.common_v2.SourceClientId) Source(org.orcid.jaxb.model.common_v2.Source)

Aggregations

Test (org.junit.Test)25 Source (org.orcid.jaxb.model.common_v2.Source)16 Source (hex.glm.GLM2.Source)11 Url (org.orcid.jaxb.model.common_v2.Url)11 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)11 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)11 Visibility (org.orcid.jaxb.model.common_v2.Visibility)10 SourceClientId (org.orcid.jaxb.model.common_v2.SourceClientId)7 Items (org.orcid.jaxb.model.notification.permission_v2.Items)6 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)6 Date (java.util.Date)5 HashMap (java.util.HashMap)5 OrcidDuplicatedElementException (org.orcid.core.exception.OrcidDuplicatedElementException)5 Item (org.orcid.jaxb.model.notification.permission_v2.Item)5 CreatedDate (org.orcid.jaxb.model.common_v2.CreatedDate)4 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)4 SourceName (org.orcid.jaxb.model.common_v2.SourceName)4 OrgEntity (org.orcid.persistence.jpa.entities.OrgEntity)4 SourceOrcid (org.orcid.jaxb.model.common_v2.SourceOrcid)3 NotificationPermission (org.orcid.jaxb.model.notification.permission_v2.NotificationPermission)3