protected Response constructErrorMessage(Notification... notifications) { return statusMessage(new ErrorMessage(notifications)); }
private Message errorMessage() { return new ErrorMessage(elementDescription.getName(), collectNotifications()); }
public static ErrorMessage error(String message) { return new ErrorMessage(new Notification(message, "")); }
private Message errorMessage() { return new ErrorMessage(elementDescription.getName(), collectNotifications()); }
@Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @GsonWithIds @POST @Override @Path("/login") public Response doLogin(ShiroAuthenticationRequest token) { try { ShiroAuthenticationResponse authResponse = login(token); return ok(authResponse); } catch (AuthenticationException e) { return ok(new ErrorMessage(NotificationType.LOGIN_FAILED.uiNotification())); } }
@GET @GsonWithIds @Path("/authc") @Override public Response userAuthenticated(@Context HttpServletRequest req) { if (BackendConfig.INSTANCE.isConfigured()) { if (SecurityUtils.getSubject().isAuthenticated()) { ShiroAuthenticationResponse response = ShiroAuthenticationResponseFactory.create(getUserStorage().getUser((String) SecurityUtils.getSubject().getPrincipal())); System.out.println(SecurityUtils.getSubject().getSession().getId().toString()); return ok(response); } } return ok(new ErrorMessage(NotificationType.NOT_LOGGED_IN.uiNotification())); }
public static ErrorMessage error(NotificationType type, String info) { return new ErrorMessage(new Notification(type.name(), type.description(), info)); } }
public static ErrorMessage error(NotificationType type) { return new ErrorMessage(new Notification(type.name(), type.description())); }
public Message verifyAndUpdate(String username) throws SepaParseException { try { this.elementDescription = transform(); } catch (RDFParseException | UnsupportedRDFormatException | RepositoryException | IOException e) { return new ErrorMessage(NotificationType.UNKNOWN_ERROR.uiNotification()); } verify(); if (isVerifiedSuccessfully()) { update(username); return successMessage(); } else return errorMessage(); }
public Message verifyAndUpdate(String username) throws SepaParseException { try { this.elementDescription = transform(); } catch (RDFParseException | UnsupportedRDFormatException | RepositoryException | IOException e) { return new ErrorMessage(NotificationType.UNKNOWN_ERROR.uiNotification()); } verify(); if (isVerifiedSuccessfully()) { update(username); return successMessage(); } else return errorMessage(); }
public Message verifyAndAdd(String username, boolean publicElement) throws SepaParseException { try { this.elementDescription = transform(); } catch (RDFParseException | UnsupportedRDFormatException | RepositoryException | IOException e) { return new ErrorMessage(NotificationType.UNKNOWN_ERROR.uiNotification()); } verify(); if (isVerifiedSuccessfully()) { StorageState state = store(username, publicElement); if (state == StorageState.STORED) return successMessage(); else if (state == StorageState.ALREADY_IN_SESAME) return addedToUserSuccessMessage(); else return skippedSuccessMessage(); } else return errorMessage(); }
public Message verifyAndAdd(String username, boolean publicElement) throws SepaParseException { try { this.elementDescription = transform(); } catch (RDFParseException | UnsupportedRDFormatException | RepositoryException | IOException e) { return new ErrorMessage(NotificationType.UNKNOWN_ERROR.uiNotification()); } verify(); if (isVerifiedSuccessfully()) { StorageState state = store(username, publicElement); if (state == StorageState.STORED) return successMessage(); else if (state == StorageState.ALREADY_IN_SESAME) return addedToUserSuccessMessage(); else return skippedSuccessMessage(); } else return errorMessage(); }