PMT-4: Mitarbeiter zu einem projekt hinzufügen #14
3 changed files with 56 additions and 0 deletions
34
src/main/java/de/hmmh/pmt/db/Allocation.java
Normal file
34
src/main/java/de/hmmh/pmt/db/Allocation.java
Normal file
|
@ -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();
|
||||
}
|
||||
}
|
18
src/main/java/de/hmmh/pmt/db/AllocationId.java
Normal file
18
src/main/java/de/hmmh/pmt/db/AllocationId.java
Normal file
|
@ -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;
|
||||
}
|
|
@ -4,6 +4,10 @@
|
|||
<Class name="de.hmmh.pmt.employee.ApiClientFactory"/>
|
||||
<Bug code="M,V,EI"/>
|
||||
</Match>
|
||||
<Match>
|
||||
<Class name="de.hmmh.pmt.db.Allocation"/>
|
||||
<Bug code="M,V,EI,EI2"/>
|
||||
</Match>
|
||||
<Match>
|
||||
<!--Ignore Auto Generated Code -->
|
||||
<Source name="~.*build/.*"/>
|
||||
|
|
Loading…
Reference in a new issue