Search in sources :

Example 46 with Keywords

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

the class PublicAPISecurityManagerV3Test method getKeywordsElement.

private Keywords getKeywordsElement(Visibility... vs) {
    Keywords elements = new Keywords();
    for (Visibility v : vs) {
        Keyword element = new Keyword();
        element.setVisibility(v);
        if (elements.getKeywords() == null) {
            elements.setKeywords(new ArrayList<Keyword>());
        }
        elements.getKeywords().add(element);
    }
    return elements;
}
Also used : Keywords(org.orcid.jaxb.model.v3.dev1.record.Keywords) Keyword(org.orcid.jaxb.model.v3.dev1.record.Keyword) Visibility(org.orcid.jaxb.model.v3.dev1.common.Visibility)

Example 47 with Keywords

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

the class PersonDetailsManagerReadOnlyImpl method getPersonDetails.

@Override
public Person getPersonDetails(String orcid) {
    long lastModifiedTime = getLastModified(orcid);
    Person person = new Person();
    person.setName(recordNameManager.getRecordName(orcid));
    person.setBiography(biographyManager.getBiography(orcid));
    Addresses addresses = addressManager.getAddresses(orcid);
    if (addresses.getAddress() != null) {
        Addresses filteredAddresses = new Addresses();
        filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
        person.setAddresses(filteredAddresses);
    }
    PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid);
    if (extIds.getExternalIdentifiers() != null) {
        PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
        filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
        person.setExternalIdentifiers(filteredExtIds);
    }
    Keywords keywords = profileKeywordManager.getKeywords(orcid);
    if (keywords.getKeywords() != null) {
        Keywords filteredKeywords = new Keywords();
        filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
        person.setKeywords(filteredKeywords);
    }
    OtherNames otherNames = otherNameManager.getOtherNames(orcid);
    if (otherNames.getOtherNames() != null) {
        OtherNames filteredOtherNames = new OtherNames();
        filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
        person.setOtherNames(filteredOtherNames);
    }
    ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid);
    if (rUrls.getResearcherUrls() != null) {
        ResearcherUrls filteredRUrls = new ResearcherUrls();
        filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
        person.setResearcherUrls(filteredRUrls);
    }
    Emails emails = emailManager.getEmails(orcid);
    if (emails.getEmails() != null) {
        Emails filteredEmails = new Emails();
        filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
        person.setEmails(filteredEmails);
    }
    return person;
}
Also used : Keywords(org.orcid.jaxb.model.v3.dev1.record.Keywords) Email(org.orcid.jaxb.model.v3.dev1.record.Email) Address(org.orcid.jaxb.model.v3.dev1.record.Address) Keyword(org.orcid.jaxb.model.v3.dev1.record.Keyword) OtherNames(org.orcid.jaxb.model.v3.dev1.record.OtherNames) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Addresses(org.orcid.jaxb.model.v3.dev1.record.Addresses) PersonExternalIdentifiers(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers) ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Emails(org.orcid.jaxb.model.v3.dev1.record.Emails) Person(org.orcid.jaxb.model.v3.dev1.record.Person)

Example 48 with Keywords

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

the class OrcidInfo method groupKeywords.

private LinkedHashMap<String, List<Keyword>> groupKeywords(Keywords keywords) {
    if (keywords == null || keywords.getKeywords() == null) {
        return null;
    }
    /* Grouping items */
    LinkedHashMap<String, List<Keyword>> groups = new LinkedHashMap<String, List<Keyword>>();
    for (Keyword k : keywords.getKeywords()) {
        if (groups.containsKey(k.getContent())) {
            groups.get(k.getContent()).add(k);
        } else {
            List<Keyword> list = new ArrayList<Keyword>();
            list.add(k);
            groups.put(k.getContent(), list);
        }
    }
    return groups;
}
Also used : Keyword(org.orcid.jaxb.model.v3.dev1.record.Keyword) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap)

Example 49 with Keywords

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

the class WorkspaceController method setKeywordsFormJson.

@RequestMapping(value = "/my-orcid/keywordsForms.json", method = RequestMethod.POST)
@ResponseBody
public KeywordsForm setKeywordsFormJson(HttpServletRequest request, @RequestBody KeywordsForm kf) throws NoSuchRequestHandlingMethodException {
    kf.setErrors(new ArrayList<String>());
    if (kf != null) {
        Iterator<KeywordForm> it = kf.getKeywords().iterator();
        while (it.hasNext()) {
            KeywordForm k = it.next();
            if (!PojoUtil.isEmpty(k.getContent())) {
                if (k.getContent().length() > SiteConstants.KEYWORD_MAX_LENGTH) {
                    k.setContent(k.getContent().substring(0, SiteConstants.KEYWORD_MAX_LENGTH));
                }
            } else {
                it.remove();
            }
            // Validate visibility is not null
            validateVisibility(k);
            copyErrors(k, kf);
            copyErrors(k.getVisibility(), kf);
        }
        if (kf.getErrors().size() > 0) {
            return kf;
        }
        Keywords updatedKeywords = kf.toKeywords();
        profileKeywordManager.updateKeywords(getCurrentUserOrcid(), updatedKeywords);
    }
    return kf;
}
Also used : KeywordForm(org.orcid.pojo.ajaxForm.KeywordForm) Keywords(org.orcid.jaxb.model.v3.dev1.record.Keywords) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 50 with Keywords

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

the class WorkspaceController method getKeywordsFormJson.

@RequestMapping(value = "/my-orcid/keywordsForms.json", method = RequestMethod.GET)
@ResponseBody
public KeywordsForm getKeywordsFormJson(HttpServletRequest request) throws NoSuchRequestHandlingMethodException {
    Keywords keywords = profileKeywordManager.getKeywords(getCurrentUserOrcid());
    KeywordsForm form = KeywordsForm.valueOf(keywords);
    // Set the default visibility
    ProfileEntity profile = profileEntityCacheManager.retrieve(getCurrentUserOrcid());
    if (profile != null && profile.getActivitiesVisibilityDefault() != null) {
        form.setVisibility(Visibility.valueOf(profile.getActivitiesVisibilityDefault()));
    }
    return form;
}
Also used : KeywordsForm(org.orcid.pojo.ajaxForm.KeywordsForm) Keywords(org.orcid.jaxb.model.v3.dev1.record.Keywords) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Keywords (org.orcid.jaxb.model.v3.dev1.record.Keywords)50 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)49 Test (org.junit.Test)44 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)34 Address (org.orcid.jaxb.model.v3.dev1.record.Address)33 Addresses (org.orcid.jaxb.model.v3.dev1.record.Addresses)33 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)33 PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)33 ResearcherUrls (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)33 Email (org.orcid.jaxb.model.v3.dev1.record.Email)32 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)32 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)32 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)32 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)31 Person (org.orcid.jaxb.model.v3.dev1.record.Person)28 Name (org.orcid.jaxb.model.v3.dev1.record.Name)27 Record (org.orcid.jaxb.model.v3.dev1.record.Record)15 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)14 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)14 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)14