Class DrawingService

java.lang.Object
org.tailormap.api.drawing.DrawingService

@Service public class DrawingService extends Object
Service for managing drawings.

This service provides methods for creating, updating, reading, and deleting drawings and persisting these operations in the data schema of the tailormap database. Any call can throw a ResponseStatusException if the user is not allowed to perform the operation.

  • Constructor Summary

    Constructors
    Constructor
    Description
    DrawingService(org.springframework.jdbc.core.simple.JdbcClient jdbcClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    createDrawing(Drawing drawing, org.springframework.security.core.Authentication authentication)
    Create a new drawing.
    void
    deleteDrawing(UUID drawingId, org.springframework.security.core.Authentication authentication)
    Delete a drawing by its ID.
    getDrawing(UUID drawingId, org.springframework.security.core.Authentication authentication)
    Get a drawing only — no geometry data — by its ID.
    getDrawing(UUID drawingId, org.springframework.security.core.Authentication authentication, boolean withGeometries, int requestedSrid)
    Get a complete drawing by its ID with GeoJSON geometries in the requested srid.
    getDrawingsForUser(org.springframework.security.core.Authentication authentication)
    Get all drawings for the current user.
    updateDrawing(Drawing drawing, org.springframework.security.core.Authentication authentication)
    Update an existing drawing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DrawingService

      public DrawingService(org.springframework.jdbc.core.simple.JdbcClient jdbcClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
  • Method Details

    • createDrawing

      @Transactional public Drawing createDrawing(@NonNull Drawing drawing, @NonNull org.springframework.security.core.Authentication authentication) throws com.fasterxml.jackson.core.JsonProcessingException
      Create a new drawing.
      Parameters:
      drawing - the drawing to create
      authentication - the current user
      Returns:
      the created drawing
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • updateDrawing

      @Transactional public Drawing updateDrawing(@NonNull Drawing drawing, @NonNull org.springframework.security.core.Authentication authentication) throws com.fasterxml.jackson.core.JsonProcessingException
      Update an existing drawing.
      Parameters:
      drawing - the drawing to create
      authentication - the current user
      Returns:
      the created drawing
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • getDrawingsForUser

      public Set<Drawing> getDrawingsForUser(org.springframework.security.core.Authentication authentication) throws org.springframework.web.server.ResponseStatusException
      Get all drawings for the current user.
      Parameters:
      authentication - the current user
      Returns:
      the drawings, a possibly empty set
      Throws:
      org.springframework.web.server.ResponseStatusException
    • getDrawing

      public Optional<Drawing> getDrawing(@NonNull UUID drawingId, @NonNull org.springframework.security.core.Authentication authentication)
      Get a drawing only — no geometry data — by its ID.
      Parameters:
      drawingId - the ID of the drawing
      authentication - the current user
      Returns:
      the — thinly populated — drawing
    • getDrawing

      @Transactional public Optional<Drawing> getDrawing(@NonNull UUID drawingId, @NonNull org.springframework.security.core.Authentication authentication, boolean withGeometries, int requestedSrid)
      Get a complete drawing by its ID with GeoJSON geometries in the requested srid.
      Parameters:
      drawingId - the ID of the drawing
      authentication - the current user
      withGeometries - whether to fetch the geometries for the drawing
      requestedSrid - the SRID to return the geometries in
      Returns:
      the complete drawing
    • deleteDrawing

      public void deleteDrawing(@NonNull UUID drawingId, @NonNull org.springframework.security.core.Authentication authentication)
      Delete a drawing by its ID.
      Parameters:
      drawingId - the ID of the drawing
      authentication - the current user