use of org.orcid.jaxb.model.v3.dev1.notification.Notification in project ORCID-Source by ORCID.
the class NotificationsApiServiceDelegatorImpl method findPermissionNotification.
@Override
@AccessControl(requiredScope = ScopePathType.PREMIUM_NOTIFICATION)
public Response findPermissionNotification(String orcid, Long id) {
checkIfProfileDeprecated(orcid);
Notification notification = notificationManager.findByOrcidAndId(orcid, id);
if (notification != null) {
checkSource(notification);
return Response.ok(notification).build();
} else {
Map<String, String> params = new HashMap<String, String>();
params.put("orcid", orcid);
params.put("id", String.valueOf(id));
throw new OrcidNotificationNotFoundException(params);
}
}
use of org.orcid.jaxb.model.v3.dev1.notification.Notification in project ORCID-Source by ORCID.
the class NotificationsApiServiceDelegatorImpl method flagNotificationAsArchived.
@Override
@AccessControl(requiredScope = ScopePathType.PREMIUM_NOTIFICATION)
public Response flagNotificationAsArchived(String orcid, Long id) throws OrcidNotificationAlreadyReadException {
checkIfProfileDeprecated(orcid);
Notification notification = notificationManager.flagAsArchived(orcid, id);
if (notification == null) {
Map<String, String> params = new HashMap<String, String>();
params.put("orcid", orcid);
params.put("id", String.valueOf(id));
throw new OrcidNotificationNotFoundException(params);
}
return Response.ok(notification).build();
}
use of org.orcid.jaxb.model.v3.dev1.notification.Notification in project ORCID-Source by ORCID.
the class NotificationController method getInstitutionalConnectionNotificationHtml.
@RequestMapping(value = "/INSTITUTIONAL_CONNECTION/{id}/notification.html", produces = OrcidApiConstants.HTML_UTF)
public ModelAndView getInstitutionalConnectionNotificationHtml(@PathVariable("id") String id) throws UnsupportedEncodingException {
ModelAndView mav = new ModelAndView();
Notification notification = notificationManager.findByOrcidAndId(getCurrentUserOrcid(), Long.valueOf(id));
String clientId = notification.getSource().retrieveSourcePath();
ClientDetailsEntity clientDetails = clientDetailsEntityCacheManager.retrieve(clientId);
String authorizationUrl = notificationManager.buildAuthorizationUrlForInstitutionalSignIn(clientDetails);
addSourceDescription(notification);
mav.addObject("notification", notification);
mav.addObject("baseUri", getBaseUri());
mav.addObject("clientId", clientId);
mav.addObject("authorizationUrl", authorizationUrl);
mav.setViewName("notification/institutional_connection_notification");
mav.addObject("noIndex", true);
return mav;
}
use of org.orcid.jaxb.model.v3.dev1.notification.Notification in project ORCID-Source by ORCID.
the class NotificationController method getPermissionNotificationHtml.
@RequestMapping(value = "/PERMISSION/{id}/notification.html", produces = OrcidApiConstants.HTML_UTF)
public ModelAndView getPermissionNotificationHtml(@PathVariable("id") String id) {
ModelAndView mav = new ModelAndView();
Notification notification = notificationManager.findByOrcidAndId(getCurrentUserOrcid(), Long.valueOf(id));
addSourceDescription(notification);
mav.addObject("notification", notification);
mav.setViewName("notification/add_activities_notification");
mav.addObject("noIndex", true);
return mav;
}
use of org.orcid.jaxb.model.v3.dev1.notification.Notification in project ORCID-Source by ORCID.
the class NotificationController method getCustomNotificationHtml.
@RequestMapping(value = "/CUSTOM/{id}/notification.html", produces = OrcidApiConstants.HTML_UTF)
@ResponseBody
public String getCustomNotificationHtml(HttpServletResponse response, @PathVariable("id") String id) {
Notification notification = notificationManager.findByOrcidAndId(getCurrentUserOrcid(), Long.valueOf(id));
response.addHeader("X-Robots-Tag", "noindex");
if (notification instanceof NotificationCustom) {
return ((NotificationCustom) notification).getBodyHtml();
} else {
return "Notification is of wrong type";
}
}
Aggregations