From 74d8352c34450c76d2578d2885901c56f820e9d9 Mon Sep 17 00:00:00 2001 From: gerardmallol Date: Tue, 20 Feb 2024 16:09:44 +0100 Subject: [PATCH] Adoptions class --- EntitiesModel.puml | 1 + .../eps/softarch/demo/domain/Adoptions.java | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java diff --git a/EntitiesModel.puml b/EntitiesModel.puml index 1daee45..d492df9 100644 --- a/EntitiesModel.puml +++ b/EntitiesModel.puml @@ -82,6 +82,7 @@ Location "1" -> "1" Shelter : has> Shelter "1" -> "*" User : < pertain Shelter "1" -> "*" Pet : has > Shelter "1" -> "1" ShelterCertificate : has > +Shelter "1" -- "*" Adoptions Schedule "*" -> "1" Shelter :available > Adoptions "1" -> "1" Pet :adopted > diff --git a/src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java new file mode 100644 index 0000000..331a7d2 --- /dev/null +++ b/src/main/java/cat/udl/eps/softarch/demo/domain/Adoptions.java @@ -0,0 +1,32 @@ +package cat.udl.eps.softarch.demo.domain; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import java.time.LocalDateTime; + + +@Setter +@Getter +@Entity +@Data +@EqualsAndHashCode (callSuper = false) + +public class Adoptions { + @NotNull + @NotBlank + private LocalDateTime dateOfAdoption; + @Id + @GeneratedValue + private int id; + + public Adoptions() { + this.dateOfAdoption = LocalDateTime.now(); + } + +}