public Notification uiNotification() { return new Notification(title, description); } }
public static ErrorMessage error(String message) { return new ErrorMessage(new Notification(message, "")); }
public static SuccessMessage success(String message) { return new SuccessMessage(new Notification(message, "")); }
public static ErrorMessage error(NotificationType type, String info) { return new ErrorMessage(new Notification(type.name(), type.description(), info)); } }
public static SuccessMessage success(NotificationType type) { return new SuccessMessage(new Notification(type.name(), type.description())); }
public static ErrorMessage error(NotificationType type) { return new ErrorMessage(new Notification(type.name(), type.description())); }
public static SuccessMessage success(NotificationType type, String info) { return new SuccessMessage(new Notification(type.name(), type.description(), info)); }
public static Notification create(NotificationType type) { return new Notification(type.name(), type.description()); }
public static Notification create(NotificationType type, String info) { return new Notification(type.name(), type.description(), info); }
public Notification getNotification() { return new Notification(type.title(), type.description()); }
private Message addedToUserSuccessMessage() { List<Notification> notifications = collectNotifications(); notifications.add(new Notification("Already stored", "Element description already stored, added element to user")); return new SuccessMessage(elementDescription.getName(), notifications); }
public Notification getNotification() { return new Notification(type.title(), type.description()); }
private Message skippedSuccessMessage() { List<Notification> notifications = collectNotifications(); notifications.add(new Notification("Already exists", "This element is already in your list of elements, skipped.")); return new SuccessMessage(elementDescription.getName(), notifications); }
private Message skippedSuccessMessage() { List<Notification> notifications = collectNotifications(); notifications.add(new Notification("Already exists", "This element is already in your list of elements, skipped.")); return new SuccessMessage(elementDescription.getName(), notifications); }
private Message addedToUserSuccessMessage() { List<Notification> notifications = collectNotifications(); notifications.add(new Notification("Already stored", "Element description already stored, added element to user")); return new SuccessMessage(elementDescription.getName(), notifications); }
@Path("/{elementUri}/jsonld") @GET @Produces(MediaType.TEXT_PLAIN) @Override public String getAsJsonLd(@PathParam("elementUri") String elementUri) { try { return toJsonLd(getPipelineElementRdfStorage().getSECById(elementUri)); } catch (URISyntaxException e) { return toJson(constructErrorMessage(new Notification(NotificationType.UNKNOWN_ERROR.title(), NotificationType.UNKNOWN_ERROR.description(), e.getMessage()))); } }
public Response stopPipeline(String pipelineId) { try { Pipeline pipeline = getPipelineStorage().getPipeline(pipelineId); PipelineOperationStatus status = Operations.stopPipeline(pipeline); return ok(status); } catch (Exception e) { e.printStackTrace(); return constructErrorMessage(new Notification(NotificationType.UNKNOWN_ERROR.title(), NotificationType.UNKNOWN_ERROR.description(), e.getMessage())); } }
@DELETE @Path("/own/{elementUri}") @RequiresAuthentication @Produces(MediaType.APPLICATION_JSON) @GsonWithIds @Override public Response removeOwn(@PathParam("username") String username, @PathParam("elementUri") String elementUri) { try { getUserService().deleteOwnSource(username, elementUri); getPipelineElementRdfStorage().deleteSEC(getPipelineElementRdfStorage().getSECById(elementUri)); } catch (URISyntaxException e) { return constructErrorMessage(new Notification(NotificationType.STORAGE_ERROR.title(), NotificationType.STORAGE_ERROR.description(), e.getMessage())); } return constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification()); }
protected <T> String toJsonLd(String rootElementUri, T object) { try { return Utils.asString(new JsonLdTransformer(rootElementUri).toJsonLd(object)); } catch (IllegalAccessException | InvocationTargetException | InvalidRdfException | ClassNotFoundException e) { return toJson(constructErrorMessage(new Notification(NotificationType.UNKNOWN_ERROR.title(), NotificationType.UNKNOWN_ERROR.description(), e.getMessage()))); } }
protected <T> String toJsonLd(T object) { try { return Utils.asString(new JsonLdTransformer().toJsonLd(object)); } catch (RDFHandlerException | IllegalArgumentException | IllegalAccessException | SecurityException | InvocationTargetException | ClassNotFoundException | InvalidRdfException e) { return toJson(constructErrorMessage(new Notification(NotificationType.UNKNOWN_ERROR.title(), NotificationType.UNKNOWN_ERROR.description(), e.getMessage()))); } }