Search in sources :

Example 61 with Visibility

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

the class ActivityValidator method validateEducation.

public void validateEducation(Education education, SourceEntity sourceEntity, boolean createFlag, boolean isApiRequest, Visibility originalVisibility) {
    if (education.getPutCode() != null && createFlag) {
        Map<String, String> params = new HashMap<String, String>();
        if (sourceEntity != null) {
            params.put("clientName", sourceEntity.getSourceName());
        }
        throw new InvalidPutCodeException(params);
    }
    // Check that we are not changing the visibility
    if (isApiRequest && !createFlag) {
        Visibility updatedVisibility = education.getVisibility();
        validateVisibilityDoesntChange(updatedVisibility, originalVisibility);
    }
}
Also used : HashMap(java.util.HashMap) InvalidPutCodeException(org.orcid.core.exception.InvalidPutCodeException) Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 62 with Visibility

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

the class PublicAPISecurityManagerV2Test method getAddressesElement.

private Addresses getAddressesElement(Visibility... vs) {
    Addresses elements = new Addresses();
    for (Visibility v : vs) {
        Address element = new Address();
        element.setVisibility(v);
        if (elements.getAddress() == null) {
            elements.setAddress(new ArrayList<Address>());
        }
        elements.getAddress().add(element);
    }
    return elements;
}
Also used : Addresses(org.orcid.jaxb.model.record_v2.Addresses) Address(org.orcid.jaxb.model.record_v2.Address) Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 63 with Visibility

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

the class PublicAPISecurityManagerV2Test method getPersonElement.

private Person getPersonElement() {
    Visibility[] vs = { Visibility.PUBLIC, Visibility.PUBLIC, Visibility.PUBLIC };
    Person p = new Person();
    p.setAddresses(getAddressesElement(vs));
    p.setEmails(getEmailsElement(vs));
    p.setExternalIdentifiers(getPersonExternalIdentifiersElement(vs));
    p.setKeywords(getKeywordsElement(vs));
    p.setOtherNames(getOtherNamesElement(vs));
    p.setResearcherUrls(getResearcherUrlsElement(vs));
    Name name = new Name();
    name.setVisibility(Visibility.PUBLIC);
    p.setName(name);
    Biography b = new Biography();
    b.setVisibility(Visibility.PUBLIC);
    b.setContent("Biography test");
    p.setBiography(b);
    return p;
}
Also used : Biography(org.orcid.jaxb.model.record_v2.Biography) Visibility(org.orcid.jaxb.model.common_v2.Visibility) Person(org.orcid.jaxb.model.record_v2.Person) OtherName(org.orcid.jaxb.model.record_v2.OtherName) Name(org.orcid.jaxb.model.record_v2.Name)

Example 64 with Visibility

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

the class PublicAPISecurityManagerV2Test method getEmployments.

private Employments getEmployments(Visibility... vs) {
    Employments e = new Employments();
    for (Visibility v : vs) {
        EmploymentSummary s = new EmploymentSummary();
        s.setVisibility(v);
        e.getSummaries().add(s);
    }
    return e;
}
Also used : Employments(org.orcid.jaxb.model.record.summary_v2.Employments) EmploymentSummary(org.orcid.jaxb.model.record.summary_v2.EmploymentSummary) Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 65 with Visibility

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

the class PublicAPISecurityManagerV2Test method getEmailsElement.

private Emails getEmailsElement(Visibility... vs) {
    Emails elements = new Emails();
    for (Visibility v : vs) {
        Email element = new Email();
        element.setVisibility(v);
        if (elements.getEmails() == null) {
            elements.setEmails(new ArrayList<Email>());
        }
        elements.getEmails().add(element);
    }
    return elements;
}
Also used : Email(org.orcid.jaxb.model.record_v2.Email) Visibility(org.orcid.jaxb.model.common_v2.Visibility) Emails(org.orcid.jaxb.model.record_v2.Emails)

Aggregations

Visibility (org.orcid.jaxb.model.common_v2.Visibility)55 ClientResponse (com.sun.jersey.api.client.ClientResponse)36 Test (org.junit.Test)36 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)12 OrcidError (org.orcid.jaxb.model.error_v2.OrcidError)11 HashMap (java.util.HashMap)10 OrcidError (org.orcid.jaxb.model.error_rc1.OrcidError)9 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)9 Visibility (org.orcid.jaxb.model.common_rc2.Visibility)8 Date (java.util.Date)7 Visibility (org.orcid.jaxb.model.common_rc1.Visibility)7 Visibility (org.orcid.jaxb.model.common_rc3.Visibility)6 Work (org.orcid.jaxb.model.record_v2.Work)6 OrcidDuplicatedElementException (org.orcid.core.exception.OrcidDuplicatedElementException)5 Funding (org.orcid.jaxb.model.record_v2.Funding)5 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)5 Visibility (org.orcid.jaxb.model.common_rc4.Visibility)4 OrcidError (org.orcid.jaxb.model.error_rc3.OrcidError)4 OrgEntity (org.orcid.persistence.jpa.entities.OrgEntity)4 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)4