use of org.orcid.jaxb.model.v3.dev1.record.Keywords 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.Keywords 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.Keywords 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;
}
use of org.orcid.jaxb.model.v3.dev1.record.Keywords in project ORCID-Source by ORCID.
the class WorkspaceController method setKeywordsFormJson.
@RequestMapping(value = "/my-orcid/keywordsForms.json", method = RequestMethod.POST)
@ResponseBody
public KeywordsForm setKeywordsFormJson(HttpServletRequest request, @RequestBody KeywordsForm kf) throws NoSuchRequestHandlingMethodException {
kf.setErrors(new ArrayList<String>());
if (kf != null) {
Iterator<KeywordForm> it = kf.getKeywords().iterator();
while (it.hasNext()) {
KeywordForm k = it.next();
if (!PojoUtil.isEmpty(k.getContent())) {
if (k.getContent().length() > SiteConstants.KEYWORD_MAX_LENGTH) {
k.setContent(k.getContent().substring(0, SiteConstants.KEYWORD_MAX_LENGTH));
}
} else {
it.remove();
}
// Validate visibility is not null
validateVisibility(k);
copyErrors(k, kf);
copyErrors(k.getVisibility(), kf);
}
if (kf.getErrors().size() > 0) {
return kf;
}
Keywords updatedKeywords = kf.toKeywords();
profileKeywordManager.updateKeywords(getCurrentUserOrcid(), updatedKeywords);
}
return kf;
}
use of org.orcid.jaxb.model.v3.dev1.record.Keywords in project ORCID-Source by ORCID.
the class WorkspaceController method getKeywordsFormJson.
@RequestMapping(value = "/my-orcid/keywordsForms.json", method = RequestMethod.GET)
@ResponseBody
public KeywordsForm getKeywordsFormJson(HttpServletRequest request) throws NoSuchRequestHandlingMethodException {
Keywords keywords = profileKeywordManager.getKeywords(getCurrentUserOrcid());
KeywordsForm form = KeywordsForm.valueOf(keywords);
// Set the default visibility
ProfileEntity profile = profileEntityCacheManager.retrieve(getCurrentUserOrcid());
if (profile != null && profile.getActivitiesVisibilityDefault() != null) {
form.setVisibility(Visibility.valueOf(profile.getActivitiesVisibilityDefault()));
}
return form;
}
Aggregations