Search in sources :

Example 6 with Visibility

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

the class ProfileEntityManagerImpl method retrivePublicDisplayName.

@Override
public String retrivePublicDisplayName(String orcid) {
    String publicName = "";
    ProfileEntity profile = profileEntityCacheManager.retrieve(orcid);
    if (profile != null) {
        RecordNameEntity recordName = profile.getRecordNameEntity();
        if (recordName != null) {
            Visibility namesVisibility = (recordName.getVisibility() != null) ? Visibility.fromValue(recordName.getVisibility().value()) : Visibility.fromValue(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility().value());
            if (Visibility.PUBLIC.equals(namesVisibility)) {
                if (!PojoUtil.isEmpty(recordName.getCreditName())) {
                    publicName = recordName.getCreditName();
                } else {
                    publicName = PojoUtil.isEmpty(recordName.getGivenNames()) ? "" : recordName.getGivenNames();
                    publicName += PojoUtil.isEmpty(recordName.getFamilyName()) ? "" : " " + recordName.getFamilyName();
                }
            }
        }
    }
    return publicName;
}
Also used : RecordNameEntity(org.orcid.persistence.jpa.entities.RecordNameEntity) Visibility(org.orcid.jaxb.model.common_v2.Visibility) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Example 7 with Visibility

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

the class ProfileKeywordManagerImpl method setIncomingPrivacy.

private void setIncomingPrivacy(ProfileKeywordEntity entity, ProfileEntity profile) {
    org.orcid.jaxb.model.common_v2.Visibility incomingKeywordVisibility = entity.getVisibility();
    org.orcid.jaxb.model.common_v2.Visibility defaultKeywordVisibility = (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() != null && profile.getClaimed()) {
        entity.setVisibility(defaultKeywordVisibility);
    } else if (incomingKeywordVisibility == null) {
        entity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
    }
}
Also used : Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 8 with Visibility

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

the class AddressManagerImpl method setIncomingPrivacy.

private void setIncomingPrivacy(AddressEntity entity, ProfileEntity profile) {
    org.orcid.jaxb.model.common_v2.Visibility incomingCountryVisibility = entity.getVisibility();
    org.orcid.jaxb.model.common_v2.Visibility defaultCountryVisibility = (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() != null && profile.getClaimed()) {
        entity.setVisibility(defaultCountryVisibility);
    } else if (incomingCountryVisibility == null) {
        entity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
    }
}
Also used : Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 9 with Visibility

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

the class ExternalIdentifierManagerImpl method setIncomingPrivacy.

private void setIncomingPrivacy(ExternalIdentifierEntity entity, ProfileEntity profile) {
    org.orcid.jaxb.model.common_v2.Visibility incomingExternalIdentifierVisibility = entity.getVisibility();
    org.orcid.jaxb.model.common_v2.Visibility defaultExternalIdentifierVisibility = (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() != null && profile.getClaimed()) {
        entity.setVisibility(defaultExternalIdentifierVisibility);
    } else if (incomingExternalIdentifierVisibility == null) {
        entity.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PRIVATE);
    }
}
Also used : Visibility(org.orcid.jaxb.model.common_v2.Visibility)

Example 10 with Visibility

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

the class AffiliationsManagerImpl method setIncomingWorkPrivacy.

private void setIncomingWorkPrivacy(OrgAffiliationRelationEntity orgAffiliationRelationEntity, ProfileEntity profile) {
    Visibility incomingElementVisibility = orgAffiliationRelationEntity.getVisibility();
    Visibility defaultElementVisibility = profile.getActivitiesVisibilityDefault();
    if (profile.getClaimed()) {
        orgAffiliationRelationEntity.setVisibility(defaultElementVisibility);
    } else if (incomingElementVisibility == null) {
        orgAffiliationRelationEntity.setVisibility(Visibility.PRIVATE);
    }
}
Also used : 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