Search in sources :

Example 56 with Visibility

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

the class PeerReviewManagerImpl method setIncomingPrivacy.

private void setIncomingPrivacy(PeerReviewEntity entity, ProfileEntity profile) {
    Visibility incomingVisibility = entity.getVisibility();
    Visibility defaultVisibility = profile.getActivitiesVisibilityDefault();
    if (profile.getClaimed()) {
        entity.setVisibility(defaultVisibility);
    } else if (incomingVisibility == null) {
        entity.setVisibility(Visibility.PRIVATE);
    }
}
Also used : Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 57 with Visibility

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

the class OtherNameManagerImpl method setIncomingPrivacy.

private void setIncomingPrivacy(OtherNameEntity entity, ProfileEntity profile) {
    org.orcid.jaxb.model.common_v2.Visibility incomingOtherNameVisibility = entity.getVisibility();
    org.orcid.jaxb.model.common_v2.Visibility defaultOtherNamesVisibility = (profile.getActivitiesVisibilityDefault() == null) ? org.orcid.jaxb.model.common_v2.Visibility.PRIVATE : org.orcid.jaxb.model.common_v2.Visibility.fromValue(profile.getActivitiesVisibilityDefault().value());
    if (profile.getClaimed()) {
        entity.setVisibility(defaultOtherNamesVisibility);
    } else if (incomingOtherNameVisibility == null) {
        entity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
    }
}
Also used : Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 58 with Visibility

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

the class ProfileFundingManagerImpl method setIncomingWorkPrivacy.

private void setIncomingWorkPrivacy(ProfileFundingEntity profileFundingEntity, ProfileEntity profile) {
    Visibility incomingWorkVisibility = profileFundingEntity.getVisibility();
    Visibility defaultWorkVisibility = profile.getActivitiesVisibilityDefault();
    if (profile.getClaimed()) {
        profileFundingEntity.setVisibility(defaultWorkVisibility);
    } else if (incomingWorkVisibility == null) {
        profileFundingEntity.setVisibility(Visibility.PRIVATE);
    }
}
Also used : Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 59 with Visibility

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

the class WorkManagerImpl method setIncomingWorkPrivacy.

private void setIncomingWorkPrivacy(WorkEntity workEntity, ProfileEntity profile) {
    Visibility incomingWorkVisibility = workEntity.getVisibility();
    Visibility defaultWorkVisibility = profile.getActivitiesVisibilityDefault();
    if (profile.getClaimed()) {
        workEntity.setVisibility(defaultWorkVisibility);
    } else if (incomingWorkVisibility == null) {
        workEntity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
    }
}
Also used : Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 60 with Visibility

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

the class ActivityValidator method validateEmployment.

public void validateEmployment(Employment employment, SourceEntity sourceEntity, boolean createFlag, boolean isApiRequest, Visibility originalVisibility) {
    if (employment.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 = employment.getVisibility();
        validateVisibilityDoesntChange(updatedVisibility, originalVisibility);
    }
}
Also used : HashMap(java.util.HashMap) InvalidPutCodeException(org.orcid.core.exception.InvalidPutCodeException) Visibility(org.orcid.jaxb.model.common_v2.Visibility)

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