use of org.orcid.jaxb.model.v3.dev1.record.Keyword in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorTest method testViewKeywords.
@Test
public void testViewKeywords() {
Response response = serviceDelegator.viewKeywords(ORCID);
assertNotNull(response);
Keywords keywords = (Keywords) response.getEntity();
assertNotNull(keywords);
assertNotNull(keywords.getLastModifiedDate());
assertNotNull(keywords.getLastModifiedDate().getValue());
assertEquals("/0000-0000-0000-0003/keywords", keywords.getPath());
assertEquals(1, keywords.getKeywords().size());
Keyword keyword = keywords.getKeywords().get(0);
assertNotNull(keyword);
assertNotNull(keyword.getLastModifiedDate());
assertNotNull(keyword.getLastModifiedDate().getValue());
assertEquals(Long.valueOf(9), keyword.getPutCode());
assertEquals("PUBLIC", keyword.getContent());
assertEquals(Visibility.PUBLIC.value(), keyword.getVisibility().value());
assertEquals("/0000-0000-0000-0003/keywords/9", keyword.getPath());
assertEquals("APP-5555555555555555", keyword.getSource().retrieveSourcePath());
}
use of org.orcid.jaxb.model.v3.dev1.record.Keyword in project ORCID-Source by ORCID.
the class PublicAPISecurityManagerV3Test method getKeywordsElement.
private Keywords getKeywordsElement(Visibility... vs) {
Keywords elements = new Keywords();
for (Visibility v : vs) {
Keyword element = new Keyword();
element.setVisibility(v);
if (elements.getKeywords() == null) {
elements.setKeywords(new ArrayList<Keyword>());
}
elements.getKeywords().add(element);
}
return elements;
}
use of org.orcid.jaxb.model.v3.dev1.record.Keyword in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorImpl method viewKeyword.
@Override
public Response viewKeyword(String orcid, Long putCode) {
Keyword keyword = profileKeywordManagerReadOnly.getKeyword(orcid, putCode);
publicAPISecurityManagerV3.checkIsPublic(keyword);
ElementUtils.setPathToKeyword(keyword, orcid);
sourceUtilsReadOnly.setSourceName(keyword);
return Response.ok(keyword).build();
}
use of org.orcid.jaxb.model.v3.dev1.record.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));
person.setBiography(biographyManager.getBiography(orcid));
Addresses addresses = addressManager.getAddresses(orcid);
if (addresses.getAddress() != null) {
Addresses filteredAddresses = new Addresses();
filteredAddresses.setAddress(new ArrayList<Address>(addresses.getAddress()));
person.setAddresses(filteredAddresses);
}
PersonExternalIdentifiers extIds = externalIdentifierManager.getExternalIdentifiers(orcid);
if (extIds.getExternalIdentifiers() != null) {
PersonExternalIdentifiers filteredExtIds = new PersonExternalIdentifiers();
filteredExtIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(extIds.getExternalIdentifiers()));
person.setExternalIdentifiers(filteredExtIds);
}
Keywords keywords = profileKeywordManager.getKeywords(orcid);
if (keywords.getKeywords() != null) {
Keywords filteredKeywords = new Keywords();
filteredKeywords.setKeywords(new ArrayList<Keyword>(keywords.getKeywords()));
person.setKeywords(filteredKeywords);
}
OtherNames otherNames = otherNameManager.getOtherNames(orcid);
if (otherNames.getOtherNames() != null) {
OtherNames filteredOtherNames = new OtherNames();
filteredOtherNames.setOtherNames(new ArrayList<OtherName>(otherNames.getOtherNames()));
person.setOtherNames(filteredOtherNames);
}
ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(orcid);
if (rUrls.getResearcherUrls() != null) {
ResearcherUrls filteredRUrls = new ResearcherUrls();
filteredRUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(rUrls.getResearcherUrls()));
person.setResearcherUrls(filteredRUrls);
}
Emails emails = emailManager.getEmails(orcid);
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.v3.dev1.record.Keyword in project ORCID-Source by ORCID.
the class OrcidInfo method groupKeywords.
private LinkedHashMap<String, List<Keyword>> groupKeywords(Keywords keywords) {
if (keywords == null || keywords.getKeywords() == null) {
return null;
}
/* Grouping items */
LinkedHashMap<String, List<Keyword>> groups = new LinkedHashMap<String, List<Keyword>>();
for (Keyword k : keywords.getKeywords()) {
if (groups.containsKey(k.getContent())) {
groups.get(k.getContent()).add(k);
} else {
List<Keyword> list = new ArrayList<Keyword>();
list.add(k);
groups.put(k.getContent(), list);
}
}
return groups;
}
Aggregations