-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for processing stationary images
Introduced the `StationaryImage` entity and corresponding repository to handle stationary images. Updated the image processing service and controller to support processing images from stationary cameras. Also added database schema changes and necessary DTO adjustments to accommodate the new image type.
- Loading branch information
1 parent
777e034
commit 246564c
Showing
12 changed files
with
248 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/de/app/fivegla/controller/dto/request/StationaryImageProcessingRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package de.app.fivegla.controller.dto.request; | ||
|
||
import de.app.fivegla.controller.dto.request.inner.CameraImage; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Request for image processing. | ||
*/ | ||
@Getter | ||
@Setter | ||
@Schema(description = "Request for image processing.") | ||
public class StationaryImageProcessingRequest { | ||
|
||
@NotBlank | ||
@Schema(description = "The id of the camera.") | ||
private String cameraId; | ||
|
||
@Schema(description = "The images to process.") | ||
private List<CameraImage> images; | ||
|
||
@Schema(description = "A custom group ID, which can be used to group devices / measurements. This is optional, if not set, the default group will be used.") | ||
protected String groupId; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/main/java/de/app/fivegla/persistence/StationaryImageRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package de.app.fivegla.persistence; | ||
|
||
import de.app.fivegla.persistence.entity.StationaryImage; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
/** | ||
* Repository for the stationary image entity. | ||
*/ | ||
@Repository | ||
public interface StationaryImageRepository extends JpaRepository<StationaryImage, Long> { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/main/java/de/app/fivegla/persistence/entity/StationaryImage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package de.app.fivegla.persistence.entity; | ||
|
||
import de.app.fivegla.persistence.entity.enums.ImageChannel; | ||
import jakarta.persistence.*; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Image. | ||
*/ | ||
@Entity | ||
@Getter | ||
@Setter | ||
@Table(name = "image") | ||
public class StationaryImage extends BaseEntity { | ||
|
||
/** | ||
* The oid of the image. | ||
*/ | ||
@Column(name = "oid", nullable = false, unique = true) | ||
private String oid; | ||
|
||
/** | ||
* The id of the camera. | ||
*/ | ||
@Column(name = "camera_id", nullable = false) | ||
private String cameraId; | ||
|
||
/** | ||
* The channel of the image since the value cannot be read from the EXIF. | ||
*/ | ||
@Column(name = "image_channel", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private ImageChannel channel; | ||
|
||
/** | ||
* The base64 encoded tiff image. | ||
*/ | ||
@Lob | ||
@Column(name = "base64_encoded_image", nullable = false) | ||
private String base64encodedImage; | ||
|
||
/** | ||
* The time the image was taken. | ||
*/ | ||
@Column(name = "measured_at", nullable = false) | ||
@Temporal(TemporalType.TIMESTAMP) | ||
private Date measuredAt; | ||
|
||
/** | ||
* The location of the image. | ||
*/ | ||
@Column(name = "longitude", nullable = false) | ||
private double longitude; | ||
|
||
/** | ||
* The location of the image. | ||
*/ | ||
@Column(name = "latitude", nullable = false) | ||
private double latitude; | ||
|
||
/** | ||
* The group of the image. | ||
*/ | ||
@ManyToOne | ||
@JoinColumn(name = "group_id", nullable = false) | ||
private Group group; | ||
|
||
/** | ||
* The tenant of the image. | ||
*/ | ||
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER, optional = false) | ||
@JoinColumn(name = "tenant_id", nullable = false) | ||
private Tenant tenant; | ||
|
||
/** | ||
* Returns the name of the image. | ||
* | ||
* @return the name of the image | ||
*/ | ||
public String getFullFilename(Tenant tenant) { | ||
return tenant.getTenantId() + "/" + cameraId + "/" + channel.name() + "/" + measuredAt.toInstant().getEpochSecond() + ".tiff"; | ||
} | ||
} |
Oops, something went wrong.