Search in sources :

Example 1 with Keywords

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

the class OrcidIndexManagerImplTest method getStandardOrcid.

private OrcidProfile getStandardOrcid() {
    OrcidProfile orcidProfile = new OrcidProfile();
    orcidProfile.setOrcidIdentifier("1234");
    OrcidBio orcidBio = new OrcidBio();
    ContactDetails contactDetails = new ContactDetails();
    Email email = new Email("email");
    email.setVisibility(Visibility.PUBLIC);
    contactDetails.addOrReplacePrimaryEmail(email);
    orcidBio.setContactDetails(contactDetails);
    Keywords bioKeywords = new Keywords();
    bioKeywords.getKeyword().add(new Keyword("Pavement Studies", Visibility.PUBLIC));
    bioKeywords.getKeyword().add(new Keyword("Advanced Tea Making", Visibility.PUBLIC));
    bioKeywords.setVisibility(Visibility.PUBLIC);
    orcidBio.setKeywords(bioKeywords);
    PersonalDetails personalDetails = new PersonalDetails();
    CreditName creditName = new CreditName("credit name");
    creditName.setVisibility(Visibility.PUBLIC);
    personalDetails.setCreditName(creditName);
    FamilyName familyName = new FamilyName("familyName");
    familyName.setVisibility(Visibility.PUBLIC);
    personalDetails.setFamilyName(familyName);
    OtherNames otherNames = new OtherNames();
    otherNames.setVisibility(Visibility.PUBLIC);
    otherNames.getOtherName().add(new OtherName("Other 1", Visibility.PUBLIC));
    otherNames.getOtherName().add(new OtherName("Other 2", Visibility.PUBLIC));
    personalDetails.setOtherNames(otherNames);
    GivenNames givenNames = new GivenNames("givenNames");
    givenNames.setVisibility(Visibility.PUBLIC);
    personalDetails.setGivenNames(givenNames);
    orcidBio.setPersonalDetails(personalDetails);
    ExternalIdentifiers externalIdentifiers = new ExternalIdentifiers();
    externalIdentifiers.setVisibility(Visibility.PUBLIC);
    orcidBio.setExternalIdentifiers(externalIdentifiers);
    ExternalIdentifier externalIdentifier1 = createExternalIdentifier("45678", "defghi");
    externalIdentifiers.getExternalIdentifier().add(externalIdentifier1);
    ExternalIdentifier externalIdentifier2 = createExternalIdentifier("54321", "abc123");
    externalIdentifiers.getExternalIdentifier().add(externalIdentifier2);
    OrcidActivities orcidActivities = new OrcidActivities();
    orcidProfile.setOrcidActivities(orcidActivities);
    Affiliations affiliations = new Affiliations();
    orcidActivities.setAffiliations(affiliations);
    FundingList fundings = new FundingList();
    orcidActivities.setFundings(fundings);
    OrcidWorks orcidWorks = new OrcidWorks();
    OrcidWork orcidWork1 = new OrcidWork();
    orcidWork1.setVisibility(Visibility.PUBLIC);
    OrcidWork orcidWork2 = new OrcidWork();
    orcidWork2.setVisibility(Visibility.PUBLIC);
    OrcidWork orcidWork3 = new OrcidWork();
    orcidWork3.setVisibility(Visibility.LIMITED);
    WorkTitle workTitle1 = new WorkTitle();
    Title title1 = new Title("Work title 1");
    workTitle1.setTitle(title1);
    workTitle1.setSubtitle(null);
    orcidWork1.setWorkTitle(workTitle1);
    WorkExternalIdentifier wei = new WorkExternalIdentifier();
    wei.setWorkExternalIdentifierId(new WorkExternalIdentifierId("work1-pmid"));
    wei.setWorkExternalIdentifierType(WorkExternalIdentifierType.PMID);
    orcidWork1.setWorkExternalIdentifiers(new WorkExternalIdentifiers(Arrays.asList(wei)));
    WorkTitle workTitle2 = new WorkTitle();
    Title title2 = new Title("Work title 2");
    workTitle2.setSubtitle(null);
    workTitle2.setTitle(title2);
    orcidWork2.setWorkTitle(workTitle2);
    WorkTitle workTitle3 = new WorkTitle();
    Title title3 = new Title("Work Title 3");
    workTitle3.setSubtitle(null);
    workTitle3.setTitle(title3);
    orcidWork3.setWorkTitle(workTitle3);
    orcidWorks.setOrcidWork(new ArrayList<OrcidWork>(Arrays.asList(new OrcidWork[] { orcidWork1, orcidWork2, orcidWork3 })));
    orcidProfile.setOrcidWorks(orcidWorks);
    orcidProfile.setOrcidBio(orcidBio);
    return orcidProfile;
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) OrcidWork(org.orcid.jaxb.model.message.OrcidWork) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) Keyword(org.orcid.jaxb.model.message.Keyword) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) WorkExternalIdentifierId(org.orcid.jaxb.model.message.WorkExternalIdentifierId) Title(org.orcid.jaxb.model.message.Title) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) FundingTitle(org.orcid.jaxb.model.message.FundingTitle) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OrcidActivities(org.orcid.jaxb.model.message.OrcidActivities) OrcidWorks(org.orcid.jaxb.model.message.OrcidWorks) FundingList(org.orcid.jaxb.model.message.FundingList) Affiliations(org.orcid.jaxb.model.message.Affiliations) WorkTitle(org.orcid.jaxb.model.message.WorkTitle) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier)

Example 2 with Keywords

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

the class OrcidProfileManagerImplTest method setBio.

private void setBio(OrcidProfile profile, Visibility defaultVisibility) {
    OrcidBio bio = new OrcidBio();
    Biography biography = new Biography("This is my biography");
    if (defaultVisibility != null) {
        biography.setVisibility(defaultVisibility);
    }
    bio.setBiography(biography);
    ContactDetails contactDetails = new ContactDetails();
    Address address = new Address();
    address.setCountry(new Country(Iso3166Country.US));
    if (defaultVisibility != null) {
        address.getCountry().setVisibility(defaultVisibility);
    }
    contactDetails.setAddress(address);
    List<Email> emails = new ArrayList<Email>();
    Email email = new Email();
    email.setPrimary(true);
    email.setValue(System.currentTimeMillis() + "@test.orcid.org");
    emails.add(email);
    contactDetails.setEmail(emails);
    bio.setContactDetails(contactDetails);
    ExternalIdentifiers extIds = new ExternalIdentifiers();
    ExternalIdentifier extId = new ExternalIdentifier();
    extId.setExternalIdCommonName(new ExternalIdCommonName("common-name"));
    extId.setExternalIdReference(new ExternalIdReference("ext-id-reference"));
    extId.setExternalIdUrl(new ExternalIdUrl("http://orcid.org/ext-id"));
    extIds.getExternalIdentifier().add(extId);
    if (defaultVisibility != null) {
        extIds.setVisibility(defaultVisibility);
    }
    bio.setExternalIdentifiers(extIds);
    Keywords keywords = new Keywords();
    Keyword keyword = new Keyword();
    keyword.setContent("k1");
    keywords.getKeyword().add(keyword);
    if (defaultVisibility != null) {
        keywords.setVisibility(defaultVisibility);
    }
    bio.setKeywords(keywords);
    PersonalDetails personalDetails = new PersonalDetails();
    personalDetails.setCreditName(new CreditName("credit-name"));
    personalDetails.setGivenNames(new GivenNames("given-names"));
    personalDetails.setFamilyName(new FamilyName("family-name"));
    OtherNames otherNames = new OtherNames();
    OtherName otherName = new OtherName();
    otherName.setContent("o1");
    otherNames.getOtherName().add(otherName);
    if (defaultVisibility != null) {
        otherNames.setVisibility(defaultVisibility);
    }
    personalDetails.setOtherNames(otherNames);
    bio.setPersonalDetails(personalDetails);
    ResearcherUrls researcherUrls = new ResearcherUrls();
    ResearcherUrl researcherUrl = new ResearcherUrl();
    researcherUrl.setUrl(new Url("http://orcid.org/researcher-url-1"));
    researcherUrl.setUrlName(new UrlName("url-name-1"));
    researcherUrls.getResearcherUrl().add(researcherUrl);
    if (defaultVisibility != null) {
        researcherUrls.setVisibility(defaultVisibility);
    }
    bio.setResearcherUrls(researcherUrls);
    profile.setOrcidBio(bio);
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) Address(org.orcid.jaxb.model.message.Address) OrganizationAddress(org.orcid.jaxb.model.message.OrganizationAddress) FamilyName(org.orcid.jaxb.model.message.FamilyName) OtherNames(org.orcid.jaxb.model.message.OtherNames) ArrayList(java.util.ArrayList) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) ContactDetails(org.orcid.jaxb.model.message.ContactDetails) GivenNames(org.orcid.jaxb.model.message.GivenNames) Biography(org.orcid.jaxb.model.message.Biography) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) CreditName(org.orcid.jaxb.model.message.CreditName) OtherName(org.orcid.jaxb.model.message.OtherName) UrlName(org.orcid.jaxb.model.message.UrlName) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) Country(org.orcid.jaxb.model.message.Country) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country)

Example 3 with Keywords

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

the class OrcidApiAuthorizationSecurityAspect method visibilityResponseFilter.

@AfterReturning(pointcut = "@annotation(accessControl)", returning = "response")
public void visibilityResponseFilter(Response response, AccessControl accessControl) {
    if (accessControl.requestComesFromInternalApi()) {
        return;
    }
    Object entity = response.getEntity();
    if (entity != null && OrcidMessage.class.isAssignableFrom(entity.getClass())) {
        OrcidMessage orcidMessage = (OrcidMessage) entity;
        // If it is search results, don't filter them, just return them
        if (orcidMessage.getOrcidSearchResults() != null) {
            return;
        }
        // get the client id
        Object authentication = getAuthentication();
        Set<Visibility> visibilities = new HashSet<Visibility>();
        if (allowAnonymousAccess((Authentication) authentication, accessControl)) {
            visibilities.add(Visibility.PUBLIC);
        } else {
            visibilities = permissionChecker.obtainVisibilitiesForAuthentication(getAuthentication(), accessControl.requiredScope(), orcidMessage);
        }
        // If the message contains a bio, and the given name is filtered, restore it as an empty space
        boolean setEmptyGivenNameIfFiltered = false;
        if (orcidMessage.getOrcidProfile() != null) {
            if (orcidMessage.getOrcidProfile() != null && orcidMessage.getOrcidProfile().getOrcidBio() != null) {
                setEmptyGivenNameIfFiltered = true;
            }
        }
        ScopePathType requiredScope = accessControl.requiredScope();
        // If the required scope is */read-limited or */update
        if (isUpdateOrReadScope(requiredScope)) {
            // if it should be able to
            if (OrcidOAuth2Authentication.class.isAssignableFrom(authentication.getClass())) {
                OrcidOAuth2Authentication orcidAuth = (OrcidOAuth2Authentication) getAuthentication();
                OAuth2Request authorization = orcidAuth.getOAuth2Request();
                String clientId = authorization.getClientId();
                // #1: Get the user orcid
                String userOrcid = getUserOrcidFromOrcidMessage(orcidMessage);
                // #2: Evaluate the scope to know which field to filter
                boolean allowWorks = false;
                boolean allowFunding = false;
                boolean allowAffiliations = false;
                // Get the update equivalent scope, if it is reading, but,
                // doesnt have the read permissions, check if it have the
                // update permissions
                ScopePathType equivalentUpdateScope = getEquivalentUpdateScope(requiredScope);
                if (requiredScope.equals(ScopePathType.READ_LIMITED)) {
                    if (hasScopeEnabled(clientId, userOrcid, ScopePathType.ORCID_WORKS_READ_LIMITED.getContent(), ScopePathType.ORCID_WORKS_UPDATE.getContent()))
                        allowWorks = true;
                    if (hasScopeEnabled(clientId, userOrcid, ScopePathType.FUNDING_READ_LIMITED.getContent(), ScopePathType.FUNDING_UPDATE.getContent()))
                        allowFunding = true;
                    if (hasScopeEnabled(clientId, userOrcid, ScopePathType.AFFILIATIONS_READ_LIMITED.getContent(), ScopePathType.AFFILIATIONS_UPDATE.getContent()))
                        allowAffiliations = true;
                } else if (requiredScope.equals(ScopePathType.ORCID_WORKS_UPDATE) || requiredScope.equals(ScopePathType.ORCID_WORKS_READ_LIMITED)) {
                    // works
                    if (hasScopeEnabled(clientId, userOrcid, requiredScope.getContent(), equivalentUpdateScope == null ? null : equivalentUpdateScope.getContent()))
                        // If so, allow him to see private works
                        allowWorks = true;
                } else if (requiredScope.equals(ScopePathType.FUNDING_UPDATE) || requiredScope.equals(ScopePathType.FUNDING_READ_LIMITED)) {
                    // funding
                    if (hasScopeEnabled(clientId, userOrcid, requiredScope.getContent(), equivalentUpdateScope == null ? null : equivalentUpdateScope.getContent()))
                        // If so, allow him to see private funding
                        allowFunding = true;
                } else if (requiredScope.equals(ScopePathType.AFFILIATIONS_UPDATE) || requiredScope.equals(ScopePathType.AFFILIATIONS_READ_LIMITED)) {
                    // affiliations
                    if (hasScopeEnabled(clientId, userOrcid, requiredScope.getContent(), equivalentUpdateScope == null ? null : equivalentUpdateScope.getContent()))
                        // If so, allow him to see private affiliations
                        allowAffiliations = true;
                }
                visibilityFilter.filter(orcidMessage, clientId, allowWorks, allowFunding, allowAffiliations, visibilities.toArray(new Visibility[visibilities.size()]));
            } else {
                visibilityFilter.filter(orcidMessage, null, false, false, false, visibilities.toArray(new Visibility[visibilities.size()]));
            }
        } else {
            visibilityFilter.filter(orcidMessage, null, false, false, false, visibilities.toArray(new Visibility[visibilities.size()]));
        }
        // If the given name was set at the beginning and now is filtered, it means we should restore it as an empty field
        if (setEmptyGivenNameIfFiltered) {
            if (orcidMessage.getOrcidProfile() != null) {
                if (orcidMessage.getOrcidProfile().getOrcidBio() == null) {
                    orcidMessage.getOrcidProfile().setOrcidBio(new OrcidBio());
                }
                if (orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails() == null) {
                    orcidMessage.getOrcidProfile().getOrcidBio().setPersonalDetails(new PersonalDetails());
                }
            }
        }
        // Filter given or family names visibility
        if (orcidMessage.getOrcidProfile() != null) {
            if (orcidMessage.getOrcidProfile().getOrcidBio() != null) {
                if (orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails() != null) {
                    if (orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails().getGivenNames() != null) {
                        orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails().getGivenNames().setVisibility(null);
                    } else {
                        // Null given names could break client integrations, so, lets return an empty string
                        GivenNames empty = new GivenNames();
                        empty.setContent(StringUtils.EMPTY);
                        orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails().setGivenNames(empty);
                    }
                    if (orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails().getFamilyName() != null) {
                        orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails().getFamilyName().setVisibility(null);
                    }
                }
            }
        }
        // replace section visibilities now we may have filtered items
        if (orcidMessage.getOrcidProfile() != null) {
            if (orcidMessage.getOrcidProfile().getOrcidBio() != null) {
                if (orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails() != null) {
                    OtherNames n = orcidMessage.getOrcidProfile().getOrcidBio().getPersonalDetails().getOtherNames();
                    if (n != null) {
                        n.setVisibility(getMostFromCollection(n.getOtherName()));
                    }
                }
                ExternalIdentifiers ids = orcidMessage.getOrcidProfile().getOrcidBio().getExternalIdentifiers();
                if (ids != null) {
                    ids.setVisibility(getMostFromCollection(ids.getExternalIdentifier()));
                }
                Keywords kws = orcidMessage.getOrcidProfile().getOrcidBio().getKeywords();
                if (kws != null) {
                    kws.setVisibility(getMostFromCollection(kws.getKeyword()));
                }
                ResearcherUrls urls = orcidMessage.getOrcidProfile().getOrcidBio().getResearcherUrls();
                if (urls != null) {
                    urls.setVisibility(getMostFromCollection(urls.getResearcherUrl()));
                }
            }
        }
    }
}
Also used : Keywords(org.orcid.jaxb.model.message.Keywords) OrcidBio(org.orcid.jaxb.model.message.OrcidBio) OtherNames(org.orcid.jaxb.model.message.OtherNames) OrcidOAuth2Authentication(org.orcid.core.oauth.OrcidOAuth2Authentication) PersonalDetails(org.orcid.jaxb.model.message.PersonalDetails) OAuth2Request(org.springframework.security.oauth2.provider.OAuth2Request) ScopePathType(org.orcid.jaxb.model.message.ScopePathType) GivenNames(org.orcid.jaxb.model.message.GivenNames) OrcidMessage(org.orcid.jaxb.model.message.OrcidMessage) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) Visibility(org.orcid.jaxb.model.message.Visibility) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) HashSet(java.util.HashSet) AfterReturning(org.aspectj.lang.annotation.AfterReturning)

Example 4 with Keywords

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

the class OrcidProfileManagerImplTest method testDefaultVisibilityForItemsAppliedOnUpdate.

@Test
@Transactional
@Rollback(true)
public void testDefaultVisibilityForItemsAppliedOnUpdate() {
    OrcidProfile profile = createBasicProfile();
    OrcidHistory orcidHistory = new OrcidHistory();
    orcidHistory.setClaimed(new Claimed(true));
    orcidHistory.setCreationMethod(CreationMethod.DIRECT);
    orcidHistory.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    profile.setOrcidHistory(orcidHistory);
    Keyword k = new Keyword("word", null);
    Keywords kk = new Keywords();
    kk.getKeyword().add(k);
    kk.setVisibility(Visibility.LIMITED);
    ResearcherUrl r = new ResearcherUrl(new Url("http://whatever.com"), null);
    ResearcherUrls rr = new ResearcherUrls();
    rr.getResearcherUrl().add(r);
    rr.setVisibility(Visibility.LIMITED);
    ExternalIdentifier i = new ExternalIdentifier(null);
    i.setExternalIdReference(new ExternalIdReference("ref"));
    i.setExternalIdCommonName(new ExternalIdCommonName("cn"));
    ExternalIdentifiers ii = new ExternalIdentifiers();
    ii.getExternalIdentifier().add(i);
    ii.setVisibility(Visibility.LIMITED);
    OtherNames oo = new OtherNames();
    oo.addOtherName("other", null);
    oo.setVisibility(Visibility.LIMITED);
    profile.getOrcidBio().setKeywords(kk);
    profile.getOrcidBio().setResearcherUrls(rr);
    profile.getOrcidBio().setExternalIdentifiers(ii);
    profile.getOrcidBio().getPersonalDetails().setOtherNames(oo);
    // Create the profile
    profile = orcidProfileManager.createOrcidProfile(profile, true, false);
    Preferences preferences = new Preferences();
    preferences.setSendChangeNotifications(new SendChangeNotifications(true));
    preferences.setSendOrcidNews(new SendOrcidNews(true));
    // Default visibility for user will be LIMITED
    preferences.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.LIMITED));
    preferences.setNotificationsEnabled(DefaultPreferences.NOTIFICATIONS_ENABLED);
    preferences.setSendEmailFrequencyDays(DefaultPreferences.SEND_EMAIL_FREQUENCY_DAYS);
    preferences.setSendMemberUpdateRequests(DefaultPreferences.SEND_MEMBER_UPDATE_REQUESTS);
    OrcidInternal internal = new OrcidInternal();
    internal.setPreferences(preferences);
    profile.setOrcidInternal(internal);
    profile.getOrcidInternal().getPreferences().setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.LIMITED));
    // Claim the profile
    profile = orcidProfileManager.updateOrcidProfile(profile);
    // now attempt to alter privacy.  It should fail as record has been claimed.
    profile.getOrcidBio().getKeywords().setVisibility(Visibility.PUBLIC);
    profile.getOrcidBio().getResearcherUrls().setVisibility(Visibility.PUBLIC);
    profile.getOrcidBio().getExternalIdentifiers().setVisibility(Visibility.PUBLIC);
    profile.getOrcidBio().getPersonalDetails().getOtherNames().setVisibility(Visibility.PUBLIC);
    profile = orcidProfileManager.updateOrcidProfile(profile);
    assertEquals("word", profile.getOrcidBio().getKeywords().getKeyword().iterator().next().getContent());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getKeywords().getKeyword().iterator().next().getVisibility());
    assertEquals(new Url("http://whatever.com"), profile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getUrl());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getResearcherUrls().getResearcherUrl().iterator().next().getVisibility());
    assertEquals("cn", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getExternalIdCommonName().getContent());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().iterator().next().getVisibility());
    assertEquals("other", profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getContent());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().iterator().next().getVisibility());
}
Also used : SendOrcidNews(org.orcid.jaxb.model.message.SendOrcidNews) Keywords(org.orcid.jaxb.model.message.Keywords) Keyword(org.orcid.jaxb.model.message.Keyword) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) ExternalIdentifier(org.orcid.jaxb.model.message.ExternalIdentifier) WorkExternalIdentifier(org.orcid.jaxb.model.message.WorkExternalIdentifier) FundingExternalIdentifier(org.orcid.jaxb.model.message.FundingExternalIdentifier) OtherNames(org.orcid.jaxb.model.message.OtherNames) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Claimed(org.orcid.jaxb.model.message.Claimed) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Date(java.util.Date) ApprovalDate(org.orcid.jaxb.model.message.ApprovalDate) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) ResearcherUrls(org.orcid.jaxb.model.message.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) WorkExternalIdentifiers(org.orcid.jaxb.model.message.WorkExternalIdentifiers) FundingExternalIdentifiers(org.orcid.jaxb.model.message.FundingExternalIdentifiers) ExternalIdentifiers(org.orcid.jaxb.model.message.ExternalIdentifiers) Preferences(org.orcid.jaxb.model.message.Preferences) DefaultPreferences(org.orcid.core.constants.DefaultPreferences) SendChangeNotifications(org.orcid.jaxb.model.message.SendChangeNotifications) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with Keywords

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

the class OrcidBatchLoad method assignPersistenceFields.

private void assignPersistenceFields(OrcidProfile profile) {
    // set the transient fields that the encrypters need
    profile.setPassword("password");
    // profile.setOrcidIdentifier();
    profile.setSecurityQuestionAnswer("securityQuestionAnswer");
    profile.setVerificationCode("1111");
    // randomise any fields that are uniquely constrained so that we can
    // re-use the test data
    profile.getOrcidBio().getContactDetails().addOrReplacePrimaryEmail(new Email(RandomStringUtils.randomAlphabetic(150)));
    Keywords keywords = new Keywords();
    keywords.getKeyword().add(new Keyword(RandomStringUtils.randomAlphabetic(255), Visibility.PUBLIC));
    profile.getOrcidBio().setKeywords(keywords);
    profile.retrieveOrcidWorks().getOrcidWork();
}
Also used : Email(org.orcid.jaxb.model.message.Email) Keywords(org.orcid.jaxb.model.message.Keywords) Keyword(org.orcid.jaxb.model.message.Keyword)

Aggregations

Keywords (org.orcid.jaxb.model.message.Keywords)12 Keyword (org.orcid.jaxb.model.message.Keyword)9 ExternalIdentifiers (org.orcid.jaxb.model.message.ExternalIdentifiers)8 OrcidBio (org.orcid.jaxb.model.message.OrcidBio)8 OtherNames (org.orcid.jaxb.model.message.OtherNames)8 ResearcherUrls (org.orcid.jaxb.model.message.ResearcherUrls)8 ExternalIdentifier (org.orcid.jaxb.model.message.ExternalIdentifier)7 ResearcherUrl (org.orcid.jaxb.model.message.ResearcherUrl)7 PersonalDetails (org.orcid.jaxb.model.message.PersonalDetails)6 Url (org.orcid.jaxb.model.message.Url)6 CreditName (org.orcid.jaxb.model.message.CreditName)5 Email (org.orcid.jaxb.model.message.Email)5 ExternalIdCommonName (org.orcid.jaxb.model.message.ExternalIdCommonName)5 ExternalIdReference (org.orcid.jaxb.model.message.ExternalIdReference)5 GivenNames (org.orcid.jaxb.model.message.GivenNames)5 OrcidProfile (org.orcid.jaxb.model.message.OrcidProfile)5 WorkExternalIdentifier (org.orcid.jaxb.model.message.WorkExternalIdentifier)5 WorkExternalIdentifiers (org.orcid.jaxb.model.message.WorkExternalIdentifiers)5 Test (org.junit.Test)4 ContactDetails (org.orcid.jaxb.model.message.ContactDetails)4