PMT-16: Add Validation for Time Range to Project Entity
Signed-off-by: Dominik Säume <Dominik.Saeume@hmmh.de>
This commit is contained in:
parent
20492ecaef
commit
d8bc3a5608
1 changed files with 6 additions and 1 deletions
|
@ -19,7 +19,7 @@ import java.time.LocalDateTime;
|
||||||
@Table(name = "project")
|
@Table(name = "project")
|
||||||
public class Project {
|
public class Project {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@NotBlank
|
@NotBlank
|
||||||
|
@ -43,5 +43,10 @@ public class Project {
|
||||||
private LocalDateTime plannedEnd;
|
private LocalDateTime plannedEnd;
|
||||||
|
|
||||||
private LocalDateTime realEnd; // Cant be named just "end" because it's and SQL Keyword
|
private LocalDateTime realEnd; // Cant be named just "end" because it's and SQL Keyword
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isValid() {
|
||||||
|
return plannedEnd.isAfter(start) && (realEnd == null || realEnd.isAfter(start));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue