Search in sources :

Example 41 with ResearcherUrls

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

the class PublicV3ApiServiceDelegatorImpl method viewResearcherUrls.

@Override
public Response viewResearcherUrls(String orcid) {
    ResearcherUrls researcherUrls = researcherUrlManagerReadOnly.getPublicResearcherUrls(orcid);
    ElementUtils.setPathToResearcherUrls(researcherUrls, orcid);
    Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(researcherUrls);
    sourceUtilsReadOnly.setSourceName(researcherUrls);
    return Response.ok(researcherUrls).build();
}
Also used : ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)

Example 42 with ResearcherUrls

use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls 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 43 with ResearcherUrls

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

the class WorkspaceController method setWebsitesFormJson.

/**
 * Retrieve all external identifiers as a json string
 */
@RequestMapping(value = "/my-orcid/websitesForms.json", method = RequestMethod.POST)
@ResponseBody
public WebsitesForm setWebsitesFormJson(HttpServletRequest request, @RequestBody WebsitesForm ws) throws NoSuchRequestHandlingMethodException {
    ws.setErrors(new ArrayList<String>());
    if (ws != null) {
        Set<String> existingUrls = new HashSet<String>();
        for (WebsiteForm w : ws.getWebsites()) {
            // Clean old errors
            w.setErrors(new ArrayList<String>());
            // Validate url
            validateUrl(w.getUrl());
            copyErrors(w.getUrl(), w);
            // Validate url name
            if (isLongerThan(w.getUrlName(), SiteConstants.URL_NAME_MAX_LENGTH)) {
                w.getErrors().add(getMessage("manualWork.length_less_X", SiteConstants.URL_NAME_MAX_LENGTH));
            }
            // Check there are no duplicates
            if (existingUrls.contains(w.getUrl().getValue())) {
                w.getErrors().add(getMessage("researcher_url.error.duplicated", w.getUrl()));
            } else {
                existingUrls.add(w.getUrl().getValue());
            }
            // Validate visibility is not null
            validateVisibility(w);
            copyErrors(w, ws);
            copyErrors(w.getUrl(), ws);
            copyErrors(w.getVisibility(), ws);
        }
        if (ws.getErrors().size() > 0) {
            return ws;
        }
        ResearcherUrls rUrls = ws.toResearcherUrls();
        researcherUrlManager.updateResearcherUrls(getCurrentUserOrcid(), rUrls);
    }
    return ws;
}
Also used : WebsiteForm(org.orcid.pojo.ajaxForm.WebsiteForm) ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls) HashSet(java.util.HashSet) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 44 with ResearcherUrls

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

the class WorkspaceController method getWebsitesFormJson.

/**
 * Retrieve all external identifiers as a json string
 */
@RequestMapping(value = "/my-orcid/websitesForms.json", method = RequestMethod.GET)
@ResponseBody
public WebsitesForm getWebsitesFormJson(HttpServletRequest request) throws NoSuchRequestHandlingMethodException {
    ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(getCurrentUserOrcid());
    WebsitesForm form = WebsitesForm.valueOf(rUrls);
    // 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 : ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls) WebsitesForm(org.orcid.pojo.ajaxForm.WebsitesForm) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 45 with ResearcherUrls

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

the class JpaJaxbResearcherUrlAdapterImpl method toResearcherUrlList.

@Override
public ResearcherUrls toResearcherUrlList(Collection<ResearcherUrlEntity> entities) {
    if (entities == null) {
        return null;
    }
    List<ResearcherUrl> researchUrlList = mapperFacade.mapAsList(entities, ResearcherUrl.class);
    ResearcherUrls researchUrls = new ResearcherUrls();
    researchUrls.setResearcherUrls(researchUrlList);
    return researchUrls;
}
Also used : ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)

Aggregations

ResearcherUrls (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls)52 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)44 Test (org.junit.Test)38 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)34 Addresses (org.orcid.jaxb.model.v3.dev1.record.Addresses)33 Keywords (org.orcid.jaxb.model.v3.dev1.record.Keywords)33 PersonExternalIdentifiers (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers)33 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)32 Address (org.orcid.jaxb.model.v3.dev1.record.Address)31 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)31 Email (org.orcid.jaxb.model.v3.dev1.record.Email)30 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)30 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)30 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)30 Name (org.orcid.jaxb.model.v3.dev1.record.Name)26 Person (org.orcid.jaxb.model.v3.dev1.record.Person)25 Record (org.orcid.jaxb.model.v3.dev1.record.Record)13 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)13 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)13 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)13