use of org.orcid.jaxb.model.message.OrcidWork in project ORCID-Source by ORCID.
the class OrcidMessageVersionConverterImplV1_2_rc5ToV1_2_rc6 method downgradeProfile.
private void downgradeProfile(OrcidProfile orcidProfile) {
if (orcidProfile != null) {
if (orcidProfile.getOrcidBio() != null)
if (orcidProfile.getOrcidBio().getExternalIdentifiers() != null)
for (ExternalIdentifier externalIdentifier : orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier()) {
Source source = externalIdentifier.getSource();
if (source != null) {
SourceOrcid sourceOrcid = source.getSourceOrcid();
if (sourceOrcid != null) {
externalIdentifier.setSource(null);
externalIdentifier.setExternalIdSource(new ExternalIdSource(sourceOrcid));
}
}
}
if (orcidProfile.getOrcidActivities() != null) {
if (orcidProfile.getOrcidActivities().getOrcidWorks() != null) {
for (OrcidWork act : orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork()) downGradeActivity(act);
}
}
OrcidInternal orcidInternal = orcidProfile.getOrcidInternal();
if (orcidInternal != null) {
Preferences prefs = orcidInternal.getPreferences();
if (prefs != null) {
prefs.setSendEmailFrequencyDays(null);
prefs.setSendMemberUpdateRequests(null);
}
ReferredBy referredBy = orcidInternal.getReferredBy();
if (referredBy != null && !OrcidStringUtils.isValidOrcid(referredBy.getPath())) {
orcidInternal.setReferredBy(null);
}
}
}
}
use of org.orcid.jaxb.model.message.OrcidWork in project ORCID-Source by ORCID.
the class OrcidMessageVersionConverterImplV1_1ToV1_2_rc1 method downgradeProfile.
private void downgradeProfile(OrcidProfile orcidProfile) {
if (orcidProfile != null) {
orcidProfile.setAffiliations(null);
OrcidBio orcidBio = orcidProfile.getOrcidBio();
if (orcidBio != null) {
ContactDetails contactDetails = orcidBio.getContactDetails();
if (contactDetails != null) {
for (Email email : contactDetails.getEmail()) {
email.setSourceClientId(null);
}
}
ExternalIdentifiers extIds = orcidBio.getExternalIdentifiers();
if (extIds != null) {
for (ExternalIdentifier extId : extIds.getExternalIdentifier()) {
extId.setSource(null);
}
}
}
if (orcidProfile.getOrcidActivities() != null) {
if (orcidProfile.getOrcidActivities().getOrcidWorks() != null) {
for (OrcidWork act : orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork()) downGradeActivity(act);
}
}
}
}
use of org.orcid.jaxb.model.message.OrcidWork in project ORCID-Source by ORCID.
the class OrcidIndexManagerImplTest method getOrcidWithSubtitledWork.
private OrcidProfile getOrcidWithSubtitledWork() {
OrcidProfile orcidProfile = getStandardOrcid();
OrcidWork orcidWork1 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(0);
OrcidWork orcidWork2 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(1);
OrcidWork orcidWork3 = orcidProfile.retrieveOrcidWorks().getOrcidWork().get(2);
WorkTitle workTitle1 = new WorkTitle();
Subtitle subTitle1 = new Subtitle("Subtitle 1");
workTitle1.setSubtitle(subTitle1);
workTitle1.setTitle(new Title("Work title 1"));
orcidWork1.setWorkTitle(workTitle1);
WorkTitle workTitle2 = orcidWork2.getWorkTitle();
Subtitle subTitle2 = new Subtitle("Subtitle 2");
workTitle2.setSubtitle(subTitle2);
workTitle2.setTitle(new Title("Work title 2"));
orcidWork2.setWorkTitle(workTitle2);
WorkTitle workTitle3 = orcidWork3.getWorkTitle();
Subtitle subTitle3 = new Subtitle("Subtitle 3");
workTitle3.setSubtitle(subTitle3);
workTitle3.setTitle(new Title("Work title 3"));
orcidWork3.setWorkTitle(workTitle3);
return orcidProfile;
}
use of org.orcid.jaxb.model.message.OrcidWork in project ORCID-Source by ORCID.
the class OrcidProfileManagerImplTest method testAddOrcidWorks.
@Test
@Transactional
@Rollback(true)
public void testAddOrcidWorks() {
OrcidProfile profile1 = createBasicProfile();
OrcidHistory history = new OrcidHistory();
history.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
profile1.setOrcidHistory(history);
history.setClaimed(new Claimed(true));
profile1 = orcidProfileManager.createOrcidProfile(profile1, false, false);
String originalPutCode = profile1.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getPutCode();
OrcidProfile profile2 = new OrcidProfile();
profile2.setOrcidIdentifier(TEST_ORCID);
OrcidWorks orcidWorks = new OrcidWorks();
profile2.setOrcidWorks(orcidWorks);
WorkTitle workTitle1 = new WorkTitle();
workTitle1.setTitle(new Title("Another Title"));
workTitle1.setSubtitle(new Subtitle("Journal of Cloud Spotting"));
OrcidWork work1 = createWork1(workTitle1);
Source source = new Source(TEST_ORCID);
work1.setSource(source);
orcidWorks.getOrcidWork().add(work1);
WorkTitle workTitle2 = new WorkTitle();
workTitle2.setTitle(new Title("New Title"));
workTitle2.setSubtitle(new Subtitle("Another New subtitle"));
OrcidWork work2 = createWork2(workTitle2);
orcidWorks.getOrcidWork().add(work2);
// Try to add a duplicate
WorkTitle workTitle3 = new WorkTitle();
workTitle3.setTitle(new Title("New Title"));
workTitle3.setSubtitle(new Subtitle("Another New subtitle"));
OrcidWork work3 = createWork2(workTitle3);
work3.setVisibility(Visibility.LIMITED);
orcidWorks.getOrcidWork().add(work3);
orcidProfileManager.addOrcidWorks(profile2);
OrcidProfile resultProfile = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
assertEquals("Will", resultProfile.getOrcidBio().getPersonalDetails().getGivenNames().getContent());
List<OrcidWork> works = resultProfile.retrieveOrcidWorks().getOrcidWork();
assertEquals(3, works.size());
assertEquals("Another Title", works.get(0).getWorkTitle().getTitle().getContent());
assertEquals("Journal of Cloud Spotting", works.get(0).getWorkTitle().getSubtitle().getContent());
for (OrcidWork work : works) {
assertEquals(Visibility.PRIVATE, work.getVisibility());
}
assertEquals("Put code of original work should not have changed", originalPutCode, works.get(2).getPutCode());
}
use of org.orcid.jaxb.model.message.OrcidWork in project ORCID-Source by ORCID.
the class OrcidProfileManagerContributorVisibilityTest method retrieveAddedWorkFromApi.
private OrcidWork retrieveAddedWorkFromApi() {
OrcidProfile retrieved = orcidProfileManager.retrieveOrcidProfile(TEST_ORCID);
OrcidWorks orcidWorks = retrieved.retrieveOrcidWorks();
assertNotNull(orcidWorks);
List<OrcidWork> orcidWorkList = orcidWorks.getOrcidWork();
assertEquals(1, orcidWorkList.size());
return orcidWorkList.get(0);
}
Aggregations