Improve Order's validations
Init date and deadline date are required depending on the scheduling mode. FEA: ItEr64OTS03PlanificacionHaciaAtras
This commit is contained in:
parent
7886af8f29
commit
d0e19c2062
1 changed files with 11 additions and 3 deletions
|
|
@ -311,14 +311,22 @@ public class Order extends OrderLineGroup {
|
|||
|
||||
@SuppressWarnings("unused")
|
||||
@AssertTrue(message = "the order must have a init date")
|
||||
private boolean checkConstraintOrderMustHaveStartDate() {
|
||||
return getInitDate() != null;
|
||||
private boolean ifSchedulingModeIsForwardOrderMustHaveStartDate() {
|
||||
return getSchedulingMode() != SchedulingMode.FORWARD
|
||||
|| getInitDate() != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@AssertTrue(message = "the order must have a deadline")
|
||||
private boolean ifSchedulingModeIsBackwardsOrderMustHaveDeadline() {
|
||||
return getSchedulingMode() != SchedulingMode.BACKWARDS
|
||||
|| getDeadline() != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@AssertTrue(message = "deadline must be after start date")
|
||||
private boolean checkConstraintDeadlineMustBeAfterStart() {
|
||||
return !this.isDeadlineBeforeStart();
|
||||
return getInitDate() == null || !this.isDeadlineBeforeStart();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue