use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class T1OrcidApiServiceImplLatestMetricsTest method orcidWithMultipleResults.
private Response orcidWithMultipleResults() {
OrcidMessage orcidMessage = new OrcidMessage();
OrcidProfile orcidProfile1 = new OrcidProfile();
OrcidProfile orcidProfile2 = new OrcidProfile();
OrcidProfile orcidProfile3 = new OrcidProfile();
OrcidSearchResult orcidSearchResult1 = new OrcidSearchResult();
OrcidSearchResult orcidSearchResult2 = new OrcidSearchResult();
OrcidSearchResult orcidSearchResult3 = new OrcidSearchResult();
orcidSearchResult1.setOrcidProfile(orcidProfile1);
orcidSearchResult2.setOrcidProfile(orcidProfile2);
orcidSearchResult3.setOrcidProfile(orcidProfile3);
List<OrcidSearchResult> searchResults = new ArrayList<OrcidSearchResult>();
searchResults.add(orcidSearchResult1);
searchResults.add(orcidSearchResult2);
searchResults.add(orcidSearchResult3);
OrcidSearchResults orcidSearchResults = new OrcidSearchResults();
orcidSearchResults.getOrcidSearchResult().addAll(searchResults);
orcidMessage.setOrcidSearchResults(orcidSearchResults);
return Response.ok(orcidMessage).build();
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class GroupAdministratorController method manageClients.
@RequestMapping
public ModelAndView manageClients() {
ModelAndView mav = new ModelAndView("member_developer_tools");
OrcidProfile profile = getEffectiveProfile();
if (profile.getType() == null || !profile.getType().equals(OrcidType.GROUP)) {
LOGGER.warn("Trying to access group/developer-tools page with user {} which is not a group", profile.getOrcidIdentifier().getPath());
return new ModelAndView("redirect:/my-orcid");
}
OrcidClientGroup group = orcidClientGroupManager.retrieveOrcidClientGroup(profile.getOrcidIdentifier().getPath());
mav.addObject("group", group);
switch(profile.getGroupType()) {
case BASIC:
mav.addObject("clientType", "UPDATER");
break;
case PREMIUM:
mav.addObject("clientType", "PREMIUM_UPDATER");
break;
case BASIC_INSTITUTION:
mav.addObject("clientType", "CREATOR");
break;
case PREMIUM_INSTITUTION:
mav.addObject("clientType", "PREMIUM_CREATOR");
break;
}
return mav;
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class GroupAdministratorController method editClient.
@RequestMapping(value = "/edit-client.json", method = RequestMethod.POST)
@Produces(value = { MediaType.APPLICATION_JSON })
@ResponseBody
public Client editClient(@RequestBody Client client) {
// Clean the error list
client.setErrors(new ArrayList<String>());
// Validate fields
validateDisplayName(client);
validateWebsite(client);
validateShortDescription(client);
validateRedirectUris(client);
copyErrors(client.getDisplayName(), client);
copyErrors(client.getWebsite(), client);
copyErrors(client.getShortDescription(), client);
for (RedirectUri redirectUri : client.getRedirectUris()) {
copyErrors(redirectUri, client);
}
if (client.getErrors().size() == 0) {
OrcidProfile profile = getEffectiveProfile();
String groupOrcid = profile.getOrcidIdentifier().getPath();
if (profile.getType() == null || !profile.getType().equals(OrcidType.GROUP)) {
LOGGER.warn("Trying to edit client with non group user {}", profile.getOrcidIdentifier().getPath());
throw new OrcidClientGroupManagementException(getMessage("web.orcid.privilege.exception"));
}
OrcidClient result = null;
try {
result = orcidClientGroupManager.updateClient(groupOrcid, client.toOrcidClient());
clearCache();
} catch (OrcidClientGroupManagementException e) {
LOGGER.error(e.getMessage());
result = new OrcidClient();
result.setErrors(new ErrorDesc(getMessage("manage.developer_tools.group.unable_to_update")));
}
client = Client.valueOf(result);
}
return client;
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class ManageDelegatorsController method manageDelegators.
@RequestMapping
public ModelAndView manageDelegators() {
ModelAndView mav = new ModelAndView("manage_delegators");
OrcidProfile profile = getEffectiveProfile();
mav.addObject("profile", profile);
return mav;
}
use of org.orcid.jaxb.model.message.OrcidProfile in project ORCID-Source by ORCID.
the class NotificationController method setPreference.
@RequestMapping(value = "/frequencies/{encryptedEmail}/email-frequencies.json", method = RequestMethod.POST)
@ResponseBody
public Preferences setPreference(HttpServletRequest request, HttpServletResponse response, @RequestBody Preferences preferences, @PathVariable("encryptedEmail") String encryptedEmail) throws UnsupportedEncodingException {
String decryptedEmail = encryptionManager.decryptForExternalUse(new String(Base64.decodeBase64(encryptedEmail), "UTF-8"));
OrcidProfile profile = orcidProfileManager.retrieveOrcidProfileByEmail(decryptedEmail);
orcidProfileManager.updatePreferences(profile.getOrcidIdentifier().getPath(), preferences);
response.addHeader("X-Robots-Tag", "noindex");
return preferences;
}
Aggregations