use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls in project ORCID-Source by ORCID.
the class PublicV3ApiServiceDelegatorImpl method viewResearcherUrls.
@Override
public Response viewResearcherUrls(String orcid) {
ResearcherUrls researcherUrls = researcherUrlManagerReadOnly.getPublicResearcherUrls(orcid);
ElementUtils.setPathToResearcherUrls(researcherUrls, orcid);
Api3_0_Dev1LastModifiedDatesHelper.calculateLastModified(researcherUrls);
sourceUtilsReadOnly.setSourceName(researcherUrls);
return Response.ok(researcherUrls).build();
}
use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls 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.ResearcherUrls in project ORCID-Source by ORCID.
the class WorkspaceController method setWebsitesFormJson.
/**
* Retrieve all external identifiers as a json string
*/
@RequestMapping(value = "/my-orcid/websitesForms.json", method = RequestMethod.POST)
@ResponseBody
public WebsitesForm setWebsitesFormJson(HttpServletRequest request, @RequestBody WebsitesForm ws) throws NoSuchRequestHandlingMethodException {
ws.setErrors(new ArrayList<String>());
if (ws != null) {
Set<String> existingUrls = new HashSet<String>();
for (WebsiteForm w : ws.getWebsites()) {
// Clean old errors
w.setErrors(new ArrayList<String>());
// Validate url
validateUrl(w.getUrl());
copyErrors(w.getUrl(), w);
// Validate url name
if (isLongerThan(w.getUrlName(), SiteConstants.URL_NAME_MAX_LENGTH)) {
w.getErrors().add(getMessage("manualWork.length_less_X", SiteConstants.URL_NAME_MAX_LENGTH));
}
// Check there are no duplicates
if (existingUrls.contains(w.getUrl().getValue())) {
w.getErrors().add(getMessage("researcher_url.error.duplicated", w.getUrl()));
} else {
existingUrls.add(w.getUrl().getValue());
}
// Validate visibility is not null
validateVisibility(w);
copyErrors(w, ws);
copyErrors(w.getUrl(), ws);
copyErrors(w.getVisibility(), ws);
}
if (ws.getErrors().size() > 0) {
return ws;
}
ResearcherUrls rUrls = ws.toResearcherUrls();
researcherUrlManager.updateResearcherUrls(getCurrentUserOrcid(), rUrls);
}
return ws;
}
use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls in project ORCID-Source by ORCID.
the class WorkspaceController method getWebsitesFormJson.
/**
* Retrieve all external identifiers as a json string
*/
@RequestMapping(value = "/my-orcid/websitesForms.json", method = RequestMethod.GET)
@ResponseBody
public WebsitesForm getWebsitesFormJson(HttpServletRequest request) throws NoSuchRequestHandlingMethodException {
ResearcherUrls rUrls = researcherUrlManager.getResearcherUrls(getCurrentUserOrcid());
WebsitesForm form = WebsitesForm.valueOf(rUrls);
// Set the default visibility
ProfileEntity profile = profileEntityCacheManager.retrieve(getCurrentUserOrcid());
if (profile != null && profile.getActivitiesVisibilityDefault() != null) {
form.setVisibility(Visibility.valueOf(profile.getActivitiesVisibilityDefault()));
}
return form;
}
use of org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls in project ORCID-Source by ORCID.
the class JpaJaxbResearcherUrlAdapterImpl method toResearcherUrlList.
@Override
public ResearcherUrls toResearcherUrlList(Collection<ResearcherUrlEntity> entities) {
if (entities == null) {
return null;
}
List<ResearcherUrl> researchUrlList = mapperFacade.mapAsList(entities, ResearcherUrl.class);
ResearcherUrls researchUrls = new ResearcherUrls();
researchUrls.setResearcherUrls(researchUrlList);
return researchUrls;
}
Aggregations