コード例 #1
0
 public NotificationsReport poll(String id)
     throws SessionNotFoundException, SessionTimeoutException {
   try {
     ApiMessageContext apiMessageContext = newApiMessageContext();
     return notificationsTransfer.poll(id, apiMessageContext);
   } catch (UnregisteredException e) {
     errorHandler.log(e);
     throw errorHandler.newWebApplicationException(
         new Throwable(),
         Response.Status.NOT_FOUND,
         ExceptionToErrorCodeMapper.ErrorCode.UNREGISTERED_FOR_NOTIFICATIONS,
         e.getMessage());
   } catch (PermissionException e) {
     throw errorHandler.newWebApplicationException(
         new Throwable(),
         Response.Status.UNAUTHORIZED,
         ExceptionToErrorCodeMapper.ErrorCode.NON_ADMIN_ERR,
         "");
   }
 }
コード例 #2
0
 public void unregister(String id) throws SessionNotFoundException, SessionTimeoutException {
   try {
     ApiMessageContext apiMessageContext = newApiMessageContext();
     notificationsTransfer.unregister(apiMessageContext, id);
   } catch (PermissionException e) {
     throw errorHandler.newWebApplicationException(
         new Throwable(),
         Response.Status.UNAUTHORIZED,
         ExceptionToErrorCodeMapper.ErrorCode.NON_ADMIN_ERR,
         "");
   }
 }