use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class PersonalDetailsManagerReadOnlyImpl method getPublicPersonalDetails.
@Override
public PersonalDetails getPublicPersonalDetails(String orcid) {
Date lastModified = getLastModifiedDate(orcid);
PersonalDetails personalDetails = new PersonalDetails();
Biography bio = biographyManager.getPublicBiography(orcid);
if (bio != null) {
personalDetails.setBiography(bio);
}
Name name = recordNameManager.getRecordName(orcid);
if (name != null && !Visibility.PUBLIC.equals(name.getVisibility())) {
personalDetails.setName(null);
} else {
personalDetails.setName(name);
}
OtherNames otherNames = otherNameManager.getPublicOtherNames(orcid);
OtherNames filteredOtherNames = new OtherNames();
personalDetails.setOtherNames(filteredOtherNames);
if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
// Lets copy the list so we don't modify the cached collection
List<OtherName> filteredList = new ArrayList<OtherName>(otherNames.getOtherNames());
filteredOtherNames.setOtherNames(filteredList);
}
if (personalDetails.getLastModifiedDate() == null || personalDetails.getLastModifiedDate().getValue() == null) {
personalDetails.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified)));
}
return personalDetails;
}
use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class ProfileEntityManagerImpl method clearRecord.
/**
* Clears all record info but the email addresses, that stay unmodified
*/
private void clearRecord(String orcid, Boolean disableTokens) {
// Remove works
workManager.removeAllWorks(orcid);
// Remove funding
fundingManager.removeAllFunding(orcid);
// Remove affiliations
affiliationsManager.removeAllAffiliations(orcid);
// Remove peer reviews
peerReviewManager.removeAllPeerReviews(orcid);
// Remove addresses
addressManager.removeAllAddress(orcid);
// Remove external identifiers
externalIdentifierManager.removeAllExternalIdentifiers(orcid);
// Remove researcher urls
researcherUrlManager.removeAllResearcherUrls(orcid);
// Remove other names
otherNamesManager.removeAllOtherNames(orcid);
// Remove keywords
profileKeywordManager.removeAllKeywords(orcid);
// Remove biography
if (biographyManager.exists(orcid)) {
Biography deprecatedBio = new Biography();
deprecatedBio.setContent(null);
deprecatedBio.setVisibility(Visibility.PRIVATE);
biographyManager.updateBiography(orcid, deprecatedBio);
}
// Set the deactivated names
if (recordNameManager.exists(orcid)) {
Name name = new Name();
name.setCreditName(new CreditName());
name.setGivenNames(new GivenNames("Given Names Deactivated"));
name.setFamilyName(new FamilyName("Family Name Deactivated"));
name.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
name.setPath(orcid);
recordNameManager.updateRecordName(orcid, name);
}
//
userConnectionDao.deleteByOrcid(orcid);
if (disableTokens) {
// Disable any token that belongs to this record
orcidOauth2TokenDetailService.disableAccessTokenByUserOrcid(orcid, RevokeReason.RECORD_DEACTIVATED);
}
// Change default visibility to private
profileDao.updateDefaultVisibility(orcid, Visibility.PRIVATE);
}
use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewBiography.
@Override
public Response viewBiography(String orcid) {
Biography bio = biographyManagerReadOnly.getBiography(orcid);
if (bio == null) {
throw new OrcidNoBioException();
}
orcidSecurityManager.checkAndFilter(orcid, bio, ScopePathType.ORCID_BIO_READ_LIMITED);
ElementUtils.setPathToBiography(bio, orcid);
return Response.ok(bio).build();
}
use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class BiographyManagerTest method testUpdateBiography.
@Test
public void testUpdateBiography() {
String orcid = "0000-0000-0000-0001";
Biography bio = biographyManager.getBiography(orcid);
assertNotNull(bio);
assertEquals("Biography for 0000-0000-0000-0001", bio.getContent());
assertEquals(Visibility.PRIVATE, bio.getVisibility());
long now = System.currentTimeMillis();
bio.setContent("Updated bio " + now);
bio.setVisibility(Visibility.PUBLIC);
biographyManager.updateBiography(orcid, bio);
Biography newBio = biographyManager.getBiography(orcid);
assertNotNull(newBio);
assertEquals("Updated bio " + now, newBio.getContent());
assertEquals(Visibility.PUBLIC, newBio.getVisibility());
}
use of org.orcid.jaxb.model.record_rc4.Biography in project ORCID-Source by ORCID.
the class BiographyManagerTest method testGetBiography.
@Test
public void testGetBiography() {
String orcid = "0000-0000-0000-0002";
Biography bio = biographyManager.getBiography(orcid);
assertNotNull(bio);
assertEquals("Biography for 0000-0000-0000-0002", bio.getContent());
assertEquals(Visibility.LIMITED, bio.getVisibility());
}
Aggregations