use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testReadPrivacyOnBioAsPublic.
@Test
public void testReadPrivacyOnBioAsPublic() {
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4497", ScopePathType.READ_PUBLIC);
/*Example A List on 4444-4444-4444-4497:
Item 1 Private (client is source)
Item 2 Private (other source)
Item 3 Limited
Item 4 Public
*/
OrcidProfile p = ((OrcidMessage) t2OrcidApiServiceDelegator.findBioDetails("4444-4444-4444-4497").getEntity()).getOrcidProfile();
assertEquals(1, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("type4", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getVisibility());
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T2OrcidApiServiceDelegatorTest method testReadPrivacyOnBio3.
@Test
public void testReadPrivacyOnBio3() {
/*Example C List:
Item 1 Public
*/
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.READ_LIMITED);
OrcidProfile p = ((OrcidMessage) t2OrcidApiServiceDelegator.findBioDetails("4444-4444-4444-4443").getEntity()).getOrcidProfile();
System.out.println(p.toString());
assertEquals(1, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("Facebook", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getVisibility());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getVisibility());
SecurityContextTestUtils.setUpSecurityContext("4444-4444-4444-4443", ScopePathType.READ_PUBLIC);
p = ((OrcidMessage) t2OrcidApiServiceDelegator.findBioDetails("4444-4444-4444-4443").getEntity()).getOrcidProfile();
System.out.println(p.toString());
assertEquals(1, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
assertEquals("Facebook", p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getVisibility());
assertEquals(Visibility.PUBLIC, p.getOrcidBio().getExternalIdentifiers().getVisibility());
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class MigrateEmails method migrateProfiles.
private void migrateProfiles() {
long startTime = System.currentTimeMillis();
@SuppressWarnings("unchecked") List<String> orcids = Collections.EMPTY_LIST;
int doneCount = 0;
do {
orcids = profileDao.findOrcidsNeedingEmailMigration(CHUNK_SIZE);
for (final String orcid : orcids) {
LOG.info("Migrating emails for profile: {}", orcid);
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
OrcidProfile orcidProfile = orcidProfileManager.retrieveOrcidProfile(orcid);
// Save it straight back - it will be saved back in the
// new DB table automatically
orcidProfileManager.updateOrcidProfile(orcidProfile);
}
});
doneCount++;
}
} while (!orcids.isEmpty());
long endTime = System.currentTimeMillis();
String timeTaken = DurationFormatUtils.formatDurationHMS(endTime - startTime);
LOG.info("Finished migrating emails: doneCount={}, timeTaken={} (H:m:s.S)", doneCount, timeTaken);
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class IndexProfiles method processOrcid.
private void processOrcid(final String orcid) {
LOG.info("Indexing profile: {}", orcid);
try {
OrcidProfile orcidProfile = orcidProfileManager.retrievePublicOrcidProfile(orcid);
orcidIndexManager.persistProfileInformationForIndexing(orcidProfile);
profileDao.updateIndexingStatus(orcid, IndexingStatus.DONE);
} catch (RuntimeException e) {
errorCount++;
if (continueOnError) {
LOG.error("Error indexing profile: orcid={}", orcid, e);
return;
} else {
throw e;
}
}
doneCount++;
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class OrcidClientGroupManagerImpl method createGroup.
/**
* Creates a group profile. If the OrcidClientGroup provided already
* contains a groupOrcid, it will just return it, if it doesnt, it will
* create the profile and update the parameter.
*
* @param orcidClientGroup
* the group to be created
* @return the group updated with his orcid id.
*/
public OrcidClientGroup createGroup(OrcidClientGroup orcidClientGroup) {
String groupOrcid = orcidClientGroup.getGroupOrcid();
if (PojoUtil.isEmpty(groupOrcid)) {
OrcidProfile groupProfile = createGroupProfile(orcidClientGroup);
groupProfile = orcidProfileManager.createOrcidProfile(groupProfile, false, false);
groupOrcid = groupProfile.getOrcidIdentifier().getPath();
orcidClientGroup.setGroupOrcid(groupOrcid);
}
return orcidClientGroup;
}
Aggregations