diff --git a/src/main/java/de/hmmh/pmt/db/Allocation.java b/src/main/java/de/hmmh/pmt/db/Allocation.java new file mode 100644 index 0000000..3f2ae9b --- /dev/null +++ b/src/main/java/de/hmmh/pmt/db/Allocation.java @@ -0,0 +1,34 @@ +package de.hmmh.pmt.db; + +import jakarta.persistence.*; +import jakarta.validation.constraints.NotNull; +import lombok.*; + +@NoArgsConstructor +@AllArgsConstructor +@Getter +@Setter +@Entity +@IdClass(AllocationId.class) +@Table(name = "allocation") +public class Allocation { + + @Id + @Setter(AccessLevel.NONE) + private Long projectId; + + @ManyToOne + @JoinColumn(name = "allocation_project", referencedColumnName = "id", insertable = false, updatable = false) + private Project project; + + @Id + private Long employeeId; + + @NotNull + private Long role; // This is a QualificationId + + public void setProject(Project project) { + this.project = project; + this.projectId = project.getId(); + } +} diff --git a/src/main/java/de/hmmh/pmt/db/AllocationId.java b/src/main/java/de/hmmh/pmt/db/AllocationId.java new file mode 100644 index 0000000..355cfa9 --- /dev/null +++ b/src/main/java/de/hmmh/pmt/db/AllocationId.java @@ -0,0 +1,18 @@ +package de.hmmh.pmt.db; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.io.Serializable; + +@Getter +@Setter +@NoArgsConstructor +@AllArgsConstructor +public class AllocationId implements Serializable { + private static final long serialVersionUID = 1L; + private Long projectId; + private Long employeeId; +} diff --git a/src/main/resources/spotbugs-exclude.xml b/src/main/resources/spotbugs-exclude.xml index af92a63..6fab22b 100644 --- a/src/main/resources/spotbugs-exclude.xml +++ b/src/main/resources/spotbugs-exclude.xml @@ -4,6 +4,10 @@ + + + +