private DataProcessorDescription getProcessor(String id) throws URISyntaxException { return getStorage() .getSEPAById(id); }
private DataProcessorDescription getProcessor(String id) throws URISyntaxException { return getStorage() .getSEPAById(id); }
private DataProcessorDescription getProcessor(String id) throws URISyntaxException { return getStorage() .getSEPAById(id); }
private DataProcessorDescription getStreamStoppedEpa() throws URISyntaxException { return StorageManager.INSTANCE.getStorageAPI().getSEPAById(RATE_SEPA_URI); }
private DataProcessorDescription getStreamStoppedEpa() throws URISyntaxException { return StorageManager.INSTANCE.getStorageAPI().getSEPAById(RATE_SEPA_URI); }
@Path("/sepas/{sepaId}") @GET @Produces(MediaType.APPLICATION_JSON) @Override public Response getSepa(@PathParam("sepaId") String sepaId, @QueryParam("keepIds") boolean keepIds) { try { DataProcessorDescription dataProcessorDescription = new DataProcessorDescription(StorageManager.INSTANCE.getStorageAPI().getSEPAById(sepaId)); return ok(dataProcessorDescription); } catch (URISyntaxException e) { return ok(Notifications.error("Error")); } }
@Path("/{elementUri}/jsonld") @GET @Produces(MediaType.TEXT_PLAIN) @Override public String getAsJsonLd(@PathParam("elementUri") String elementUri) { try { return toJsonLd(getPipelineElementRdfStorage().getSEPAById(elementUri)); } catch (URISyntaxException e) { return toJson(constructErrorMessage(Notifications.create(NotificationType.UNKNOWN_ERROR, e.getMessage()))); } }
@Path("/{elementUri}") @GET @Produces(MediaType.APPLICATION_JSON) @GsonWithIds @Override public Response getElement(@PathParam("username") String username, @PathParam("elementUri") String elementUri) { // TODO Access rights try { return ok(new DataProcessorInvocation(new DataProcessorInvocation(getPipelineElementRdfStorage().getSEPAById(elementUri)))); } catch (URISyntaxException e) { return statusMessage(Notifications.error(NotificationType.UNKNOWN_ERROR, 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().deleteOwnSepa(username, elementUri); getPipelineElementRdfStorage().deleteSEPA(getPipelineElementRdfStorage().getSEPAById(elementUri)); } catch (URISyntaxException e) { return constructErrorMessage(Notifications.create(NotificationType.STORAGE_ERROR, e.getMessage())); } return constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification()); }
@Path("{id}/jsonld") @GET @Produces(MediaType.TEXT_PLAIN) public Response getActionAsJsonLd(@PathParam("id") String elementId) { IPipelineElementDescriptionStorage requestor = getPipelineElementRdfStorage(); elementId = decode(elementId); try { if (requestor.getSEPAById(elementId) != null) { return ok(toJsonLd(requestor.getSEPAById(elementId))); } else if (requestor.getSEPById(elementId) != null) { return ok(toJsonLd(requestor.getSEPById(elementId))); } else if (requestor.getSECById(elementId) != null) { return ok(toJsonLd(requestor.getSECById(elementId))); } else { return ok(Notifications.create(NotificationType.UNKNOWN_ERROR)); } } catch (URISyntaxException e) { return constructErrorMessage(new Notification(NotificationType.UNKNOWN_ERROR.title(), NotificationType.UNKNOWN_ERROR.description(), e.getMessage())); } } }
@Path("/{id}") @DELETE @Produces(MediaType.APPLICATION_JSON) public Response deleteElement(@PathParam("username") String username, @PathParam("id") String elementId) { UserService userService = getUserService(); IPipelineElementDescriptionStorage requestor = getPipelineElementRdfStorage(); try { if (requestor.getSEPAById(elementId) != null) { requestor.deleteSEPA(requestor.getSEPAById(elementId)); userService.deleteOwnSepa(username, elementId); } else if (requestor.getSEPById(elementId) != null) { requestor.deleteSEP(requestor.getSEPById(elementId)); userService.deleteOwnSource(username, elementId); } else if (requestor.getSECById(elementId) != null) { requestor.deleteSEC(requestor.getSECById(elementId)); userService.deleteOwnAction(username, elementId); } else { return constructErrorMessage(new Notification(NotificationType.STORAGE_ERROR.title(), NotificationType.STORAGE_ERROR.description())); } } catch (URISyntaxException e) { return constructErrorMessage(new Notification(NotificationType.STORAGE_ERROR.title(), NotificationType.STORAGE_ERROR.description())); } return constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification()); }