Update REST API for data streams
@@ -25,13 +25,19 @@ import org.apache.streampipes.rest.core.base.impl.AbstractAuthGuardedRestResourc
import org.apache.streampipes.rest.security.AuthConstants;
import org.apache.streampipes.rest.shared.annotation.JacksonSerialized;
import org.apache.streampipes.rest.shared.util.SpMediaType;
+
import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
-import javax.ws.rs.*;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import java.util.List;
@Component
@@ -48,12 +54,23 @@ public class DataStreamResource extends AbstractAuthGuardedRestResource {
return getDataStreamResourceManager().findAll();
}
+ @GET
+ @Path("/")
+ @Produces({MediaType.APPLICATION_JSON, SpMediaType.JSONLD})
+ @JacksonSerialized
+ @PreAuthorize(AuthConstants.HAS_READ_PIPELINE_ELEMENT_PRIVILEGE)
+ @PostFilter("hasPermission(filterObject.elementId, 'READ')")
+ public List<SpDataStream> get() {
+ return getDataStreamResourceManager().findAllAsInvocation();
+ }
+
@GET
@Path("/own")
@Produces({MediaType.APPLICATION_JSON, SpMediaType.JSONLD})
@JacksonSerialized
@PreAuthorize(AuthConstants.HAS_READ_PIPELINE_ELEMENT_PRIVILEGE)
@PostFilter("hasPermission(filterObject.elementId, 'READ')")
+ @Deprecated(since = "0.71.0", forRemoval = true)
public List<SpDataStream> getOwn() {
return getDataStreamResourceManager().findAllAsInvocation();
}
@@ -63,11 +80,22 @@ public class DataStreamResource extends AbstractAuthGuardedRestResource {
@Produces(MediaType.APPLICATION_JSON)
@JacksonSerialized
@PreAuthorize(AuthConstants.HAS_DELETE_PIPELINE_ELEMENT_PRIVILEGE)
+ @Deprecated(since = "0.71.0", forRemoval = true)
public Response removeOwn(@PathParam("elementId") String elementId) {
getDataStreamResourceManager().delete(elementId);
return constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification());
}
+ @DELETE
+ @Path("/{elementId}")
+ @Produces(MediaType.APPLICATION_JSON)
+ @JacksonSerialized
+ @PreAuthorize(AuthConstants.HAS_DELETE_PIPELINE_ELEMENT_PRIVILEGE)
+ public Response delete(@PathParam("elementId") String elementId) {
+ getDataStreamResourceManager().delete(elementId);
+ return constructSuccessMessage(NotificationType.STORAGE_SUCCESS.uiNotification());
+ }
+
@Path("/{elementId}")
@GET
@Produces(MediaType.APPLICATION_JSON)
