use of org.orcid.jaxb.model.message.Visibility in project ORCID-Source by ORCID.
the class OrcidJaxbCopyManagerImpl method copyOtherNamesPreservingVisibility.
private void copyOtherNamesPreservingVisibility(PersonalDetails existingPersonalDetails, PersonalDetails updatedPersonalDetails) {
OtherNames existingOtherNames = existingPersonalDetails.getOtherNames();
OtherNames updatedOtherNames = updatedPersonalDetails.getOtherNames();
// if no update, nothing to do
if (updatedOtherNames == null) {
return;
}
// otherwise take into account the visibility of updated and existing
Visibility existingVisibility = existingOtherNames.getVisibility() != null ? existingOtherNames.getVisibility() : OrcidVisibilityDefaults.OTHER_NAMES_DEFAULT.getVisibility();
updatedOtherNames.setVisibility(updatedOtherNames.getVisibility() != null ? updatedOtherNames.getVisibility() : existingVisibility);
// now visibility has been preserved, overwrite the content
existingPersonalDetails.setOtherNames(updatedOtherNames);
}
use of org.orcid.jaxb.model.message.Visibility in project ORCID-Source by ORCID.
the class Jaxb2JpaAdapterImpl method setBiographyDetails.
private void setBiographyDetails(ProfileEntity profileEntity, Biography biography) {
if (biography != null) {
Visibility defaultVisibility = profileEntity.getActivitiesVisibilityDefault() == null ? OrcidVisibilityDefaults.BIOGRAPHY_DEFAULT.getVisibility() : Visibility.fromValue(profileEntity.getActivitiesVisibilityDefault().value());
if (profileEntity.getBiographyEntity() == null) {
profileEntity.setBiographyEntity(new BiographyEntity());
profileEntity.getBiographyEntity().setProfile(profileEntity);
}
profileEntity.getBiographyEntity().setBiography(biography.getContent());
if (profileEntity.getClaimed() == null || !profileEntity.getClaimed()) {
if (biography.getVisibility() != null) {
profileEntity.getBiographyEntity().setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(biography.getVisibility().value()));
} else {
profileEntity.getBiographyEntity().setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(defaultVisibility.value()));
}
}
//Fill the visibility in case it is still null
if (profileEntity.getBiographyEntity().getVisibility() == null) {
profileEntity.getBiographyEntity().setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(defaultVisibility.value()));
}
}
}
Aggregations