public static List<Constraint<GanttDate>> getStartConstraintsFor(
TaskElement taskElement, LocalDate orderInitDate) {
if (taskElement instanceof ITaskPositionConstrained) {
ITaskPositionConstrained task = (ITaskPositionConstrained) taskElement;
TaskPositionConstraint startConstraint = task
.getPositionConstraint();
final PositionConstraintType constraintType = startConstraint
.getConstraintType();
switch (constraintType) {
case AS_SOON_AS_POSSIBLE:
if (orderInitDate != null) {
return Collections
.singletonList(biggerOrEqualThan(toGantt(orderInitDate)));
}
return Collections.emptyList();
case START_IN_FIXED_DATE:
return Collections
.singletonList(equalTo(toGantt(startConstraint
.getConstraintDate())));
case START_NOT_EARLIER_THAN:
return Collections
.singletonList(biggerOrEqualThan(toGantt(startConstraint
.getConstraintDate())));
}
}
return Collections.emptyList();
}