use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class MemberV2ApiServiceDelegatorImpl method viewKeyword.
@Override
public Response viewKeyword(String orcid, Long putCode) {
Keyword keyword = profileKeywordManagerReadOnly.getKeyword(orcid, putCode);
orcidSecurityManager.checkAndFilter(orcid, keyword, ScopePathType.ORCID_BIO_READ_LIMITED);
ElementUtils.setPathToKeyword(keyword, orcid);
sourceUtils.setSourceName(keyword);
return Response.ok(keyword).build();
}
use of org.orcid.jaxb.model.record_v2.Keyword 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_v2.Keyword in project ORCID-Source by ORCID.
the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Keywords keywords) {
if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
LastModifiedDate latest = null;
for (Keyword keyword : keywords.getKeywords()) {
if (keyword.getLastModifiedDate() != null && keyword.getLastModifiedDate().after(latest)) {
latest = keyword.getLastModifiedDate();
}
}
keywords.setLastModifiedDate(latest);
}
}
use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Keywords keywords) {
if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
LastModifiedDate latest = null;
for (Keyword keyword : keywords.getKeywords()) {
if (keyword.getLastModifiedDate() != null && keyword.getLastModifiedDate().after(latest)) {
latest = keyword.getLastModifiedDate();
}
}
keywords.setLastModifiedDate(latest);
}
}
use of org.orcid.jaxb.model.record_v2.Keyword in project ORCID-Source by ORCID.
the class KeywordForm method toKeyword.
public Keyword toKeyword() {
Keyword keyword = new Keyword();
if (!PojoUtil.isEmpty(putCode)) {
keyword.setPutCode(Long.valueOf(putCode));
}
if (!PojoUtil.isEmpty(content)) {
keyword.setContent(content);
}
if (visibility != null && visibility.getVisibility() != null) {
keyword.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(visibility.getVisibility().value()));
} else {
keyword.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.KEYWORD_DEFAULT.getVisibility().value()));
}
if (createdDate != null) {
keyword.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(createdDate.toCalendar())));
}
if (lastModified != null) {
keyword.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified.toCalendar())));
}
if (displayIndex != null) {
keyword.setDisplayIndex(displayIndex);
} else {
keyword.setDisplayIndex(0L);
}
keyword.setSource(new Source(source));
return keyword;
}
Aggregations