Search in sources :

Example 91 with Url

use of org.orcid.jaxb.model.v3.dev1.common.Url in project ORCID-Source by ORCID.

the class Utils method getPersonExternalIdentifier.

public static PersonExternalIdentifier getPersonExternalIdentifier() {
    PersonExternalIdentifier newExtId = new PersonExternalIdentifier();
    newExtId.setType("new-common-name");
    newExtId.setValue("new-reference");
    newExtId.setUrl(new Url("http://newUrl.com"));
    newExtId.setVisibility(Visibility.LIMITED);
    return newExtId;
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 92 with Url

use of org.orcid.jaxb.model.v3.dev1.common.Url in project ORCID-Source by ORCID.

the class Utils method getFunding.

public static Funding getFunding() {
    Funding newFunding = new Funding();
    FundingTitle title = new FundingTitle();
    title.setTitle(new Title("Public Funding # 2"));
    newFunding.setTitle(title);
    newFunding.setType(FundingType.AWARD);
    ExternalID fExtId = new ExternalID();
    fExtId.setRelationship(Relationship.PART_OF);
    fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
    fExtId.setUrl(new Url("http://fundingExtId.com"));
    fExtId.setValue("new-funding-ext-id");
    ExternalIDs fExtIds = new ExternalIDs();
    fExtIds.getExternalIdentifier().add(fExtId);
    newFunding.setExternalIdentifiers(fExtIds);
    newFunding.setOrganization(getOrganization());
    return newFunding;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 93 with Url

use of org.orcid.jaxb.model.v3.dev1.common.Url in project ORCID-Source by ORCID.

the class Utils method getWork.

public static Work getWork(String title) {
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title(title));
    work.setWorkTitle(workTitle);
    work.setWorkType(WorkType.BOOK);
    work.setVisibility(Visibility.PUBLIC);
    ExternalIDs extIds = new ExternalIDs();
    ExternalID extId = new ExternalID();
    extId.setRelationship(Relationship.PART_OF);
    extId.setType(WorkExternalIdentifierType.AGR.value());
    extId.setValue("ext-id-" + System.currentTimeMillis());
    extId.setUrl(new Url("http://thisIsANewUrl.com"));
    extIds.getExternalIdentifier().add(extId);
    work.setWorkExternalIdentifiers(extIds);
    return work;
}
Also used : ExternalIDs(org.orcid.jaxb.model.v3.dev1.record.ExternalIDs) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) ExternalID(org.orcid.jaxb.model.v3.dev1.record.ExternalID) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Url(org.orcid.jaxb.model.v3.dev1.common.Url)

Example 94 with Url

use of org.orcid.jaxb.model.v3.dev1.common.Url in project ORCID-Source by ORCID.

the class PersonValidatorTest method validateExternalIdentifier_invalidUrl_emptyUrlTest.

@Test(expected = OrcidValidationException.class)
public void validateExternalIdentifier_invalidUrl_emptyUrlTest() {
    PersonExternalIdentifier extId = getPersonExternalIdentifier();
    extId.setUrl(new Url());
    PersonValidator.validateExternalIdentifier(extId, getSourceEntity(), true, true, Visibility.PUBLIC, true);
    fail();
}
Also used : PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) Url(org.orcid.jaxb.model.v3.dev1.common.Url) Test(org.junit.Test)

Example 95 with Url

use of org.orcid.jaxb.model.v3.dev1.common.Url 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)

Aggregations

Url (org.orcid.jaxb.model.v3.dev1.common.Url)85 Test (org.junit.Test)76 ExternalID (org.orcid.jaxb.model.v3.dev1.record.ExternalID)68 ExternalIDs (org.orcid.jaxb.model.v3.dev1.record.ExternalIDs)50 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)42 Response (javax.ws.rs.core.Response)28 DBUnitTest (org.orcid.test.DBUnitTest)28 Title (org.orcid.jaxb.model.v3.dev1.common.Title)23 Work (org.orcid.jaxb.model.v3.dev1.record.Work)23 WorkTitle (org.orcid.jaxb.model.v3.dev1.record.WorkTitle)19 List (java.util.List)16 PeerReview (org.orcid.jaxb.model.v3.dev1.record.PeerReview)13 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)13 Funding (org.orcid.jaxb.model.v3.dev1.record.Funding)12 ClientResponse (com.sun.jersey.api.client.ClientResponse)10 DisambiguatedOrganization (org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization)8 TranslatedTitle (org.orcid.jaxb.model.v3.dev1.common.TranslatedTitle)8 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)8 BaseTest (org.orcid.core.BaseTest)7 Organization (org.orcid.jaxb.model.v3.dev1.common.Organization)6