Package org.tailormap.api.drawing
Class DrawingService
java.lang.Object
org.tailormap.api.drawing.DrawingService
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
ConstructorsConstructorDescriptionDrawingService
(org.springframework.jdbc.core.simple.JdbcClient jdbcClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptioncreateDrawing
(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.
-
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 createauthentication
- 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 createauthentication
- 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 drawingauthentication
- 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 drawingauthentication
- the current userwithGeometries
- whether to fetch the geometries for the drawingrequestedSrid
- 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 drawingauthentication
- the current user
-