use of org.orcid.jaxb.model.record_rc4.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewExternalIdentifier.
@Override
public Response viewExternalIdentifier(String orcid, Long putCode) {
PersonExternalIdentifier extId = externalIdentifierManagerReadOnly.getExternalIdentifier(orcid, putCode);
orcidSecurityManager.checkAndFilter(orcid, extId, ScopePathType.ORCID_BIO_READ_LIMITED);
ElementUtils.setPathToExternalIdentifier(extId, orcid);
sourceUtils.setSourceName(extId);
return Response.ok(extId).build();
}
use of org.orcid.jaxb.model.record_rc4.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewExternalIdentifiers.
@Override
public Response viewExternalIdentifiers(String orcid) {
PersonExternalIdentifiers extIds = externalIdentifierManagerReadOnly.getExternalIdentifiers(orcid, getLastModifiedTime(orcid));
// Lets copy the list so we don't modify the cached collection
if (extIds.getExternalIdentifiers() != null) {
List<PersonExternalIdentifier> filteredList = new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers());
extIds = new PersonExternalIdentifiers();
extIds.setExternalIdentifiers(filteredList);
}
orcidSecurityManager.checkAndFilter(orcid, extIds.getExternalIdentifiers(), ScopePathType.ORCID_BIO_READ_LIMITED);
ElementUtils.setPathToExternalIdentifiers(extIds, orcid);
Api2_0_LastModifiedDatesHelper.calculateLastModified(extIds);
sourceUtils.setSourceName(extIds);
return Response.ok(extIds).build();
}
use of org.orcid.jaxb.model.record_rc4.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class Utils method getPersonExternalIdentifier.
public static PersonExternalIdentifier getPersonExternalIdentifier() {
PersonExternalIdentifier newExtId = new PersonExternalIdentifier();
newExtId.setType("new-common-name");
newExtId.setValue("new-reference");
newExtId.setUrl(new Url("http://newUrl.com"));
newExtId.setVisibility(Visibility.LIMITED);
return newExtId;
}
use of org.orcid.jaxb.model.record_rc4.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class PersonDetailsManagerReadOnlyImpl method getPersonDetails.
@Override
public Person getPersonDetails(String orcid) {
long lastModifiedTime = getLastModified(orcid);
Person person = new Person();
person.setName(recordNameManager.getRecordName(orcid, lastModifiedTime));
person.setBiography(biographyManager.getBiography(orcid, lastModifiedTime));
Addresses addresses = addressManager.getAddresses(orcid, lastModifiedTime);
if (addresses.getAddress() != null) {
Addresses filteredAddresses = new Addresses();
filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
person.setAddresses(filteredAddresses);
}
PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid, lastModifiedTime);
if (extIds.getExternalIdentifiers() != null) {
PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
person.setExternalIdentifiers(filteredExtIds);
}
Keywords keywords = profileKeywordManager.getKeywords(orcid, lastModifiedTime);
if (keywords.getKeywords() != null) {
Keywords filteredKeywords = new Keywords();
filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
person.setKeywords(filteredKeywords);
}
OtherNames otherNames = otherNameManager.getOtherNames(orcid, lastModifiedTime);
if (otherNames.getOtherNames() != null) {
OtherNames filteredOtherNames = new OtherNames();
filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
person.setOtherNames(filteredOtherNames);
}
ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid, lastModifiedTime);
if (rUrls.getResearcherUrls() != null) {
ResearcherUrls filteredRUrls = new ResearcherUrls();
filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
person.setResearcherUrls(filteredRUrls);
}
Emails emails = emailManager.getEmails(orcid, lastModifiedTime);
if (emails.getEmails() != null) {
Emails filteredEmails = new Emails();
filteredEmails.setEmails(new ArrayList<Email>(emails.getEmails()));
person.setEmails(filteredEmails);
}
return person;
}
use of org.orcid.jaxb.model.record_rc4.PersonExternalIdentifier in project ORCID-Source by ORCID.
the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(PersonExternalIdentifiers extIds) {
if (extIds != null && extIds.getExternalIdentifiers() != null && !extIds.getExternalIdentifiers().isEmpty()) {
LastModifiedDate latest = null;
for (PersonExternalIdentifier extId : extIds.getExternalIdentifiers()) {
if (extId.getLastModifiedDate() != null && extId.getLastModifiedDate().after(latest)) {
latest = extId.getLastModifiedDate();
}
}
extIds.setLastModifiedDate(latest);
}
}
Aggregations