use of org.orcid.jaxb.model.common_rc2.Visibility in project ORCID-Source by ORCID.
the class MemberV2ApiServiceImplV2_0_rc2 method compareWorkAndCreditNameVisibility.
private void compareWorkAndCreditNameVisibility(Work work) {
Visibility workVisibility = work.getVisibility();
if (work.getWorkContributors() != null && work.getWorkContributors().getContributor() != null) {
for (Contributor contributor : work.getWorkContributors().getContributor()) {
if (contributor.getCreditName() != null && contributor.getCreditName().getVisibility() != null && contributor.getCreditName().getVisibility().isMoreRestrictiveThan(workVisibility)) {
String title = (work.getWorkTitle() == null || work.getWorkTitle().getTitle() == null) ? null : work.getWorkTitle().getTitle().getContent();
LOGGER.error("Client posting work '{}' with visibility ({}) less restrictive than its contributor credit name '{}' ({})", new Object[] { title, workVisibility, contributor.getCreditName().getContent(), contributor.getCreditName().getVisibility() });
}
}
}
}
use of org.orcid.jaxb.model.common_rc2.Visibility in project ORCID-Source by ORCID.
the class MemberV2ApiServiceImplV2_0_rc3 method compareFundingAndCreditNameVisibility.
private void compareFundingAndCreditNameVisibility(Funding funding) {
Visibility fundingVisibility = funding.getVisibility();
if (funding.getContributors() != null && funding.getContributors().getContributor() != null) {
for (FundingContributor contributor : funding.getContributors().getContributor()) {
if (contributor.getCreditName() != null && contributor.getCreditName().getVisibility() != null && contributor.getCreditName().getVisibility().isMoreRestrictiveThan(fundingVisibility)) {
String title = (funding.getTitle() == null || funding.getTitle().getTitle() == null) ? null : funding.getTitle().getTitle().getContent();
LOGGER.error("Client posting funding '{}' with visibility ({}) less restrictive than its contributor credit name '{}' ({})", new Object[] { title, fundingVisibility, contributor.getCreditName().getContent(), contributor.getCreditName().getVisibility() });
}
}
}
}
use of org.orcid.jaxb.model.common_rc2.Visibility in project ORCID-Source by ORCID.
the class MigrateAddressData method migrateAddress.
private void migrateAddress() {
LOG.debug("Starting migration process");
List<Object[]> addressElements = Collections.emptyList();
do {
addressElements = addressDao.findAddressesToMigrate();
for (final Object[] addressElement : addressElements) {
String orcid = (String) addressElement[0];
String countryCode = (String) addressElement[1];
String visibilityValue = (String) addressElement[2];
LOG.info("Migrating address for profile: {}", orcid);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
Visibility visibility = null;
try {
visibility = Visibility.fromValue(visibilityValue);
} catch (Exception e) {
visibility = Visibility.fromValue(OrcidVisibilityDefaults.COUNTRY_DEFAULT.getVisibility().value());
}
AddressEntity address = new AddressEntity();
address.setDateCreated(new Date());
address.setLastModified(new Date());
address.setUser(new ProfileEntity(orcid));
address.setIso2Country(Iso3166Country.fromValue(countryCode));
address.setSourceId(orcid);
address.setVisibility(visibility);
addressDao.persist(address);
}
});
}
} while (addressElements != null && !addressElements.isEmpty());
LOG.debug("Finished migration process");
}
use of org.orcid.jaxb.model.common_rc2.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);
}
}
use of org.orcid.jaxb.model.common_rc2.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);
}
}
Aggregations