Bug #1320: When asking a container for start constraints, return the leftmost
of children's start-in-fixed-date constraints. Doing it, the dependencies of containers will be ensured to comply with the most restrictive start dependency of its children. FEA: ItEr76S04BugFixing
This commit is contained in:
parent
0b1d9197bc
commit
fc4c4ee6c6
1 changed files with 33 additions and 0 deletions
|
|
@ -113,8 +113,41 @@ public class TaskElementAdapter {
|
|||
|
||||
private static final Log LOG = LogFactory.getLog(TaskElementAdapter.class);
|
||||
|
||||
private static TaskPositionConstraint getLeftMostFixedDateConstraintAmongChildren(
|
||||
TaskGroup container) {
|
||||
|
||||
TaskPositionConstraint constraint = null;
|
||||
for(TaskElement child : ((TaskGroup)container).getChildren()) {
|
||||
TaskPositionConstraint currentConstraint = null;
|
||||
if (child instanceof ITaskPositionConstrained) {
|
||||
ITaskPositionConstrained task = (ITaskPositionConstrained) child;
|
||||
currentConstraint = task.getPositionConstraint();
|
||||
}
|
||||
else if (child instanceof TaskGroup) {
|
||||
currentConstraint = getLeftMostFixedDateConstraintAmongChildren(
|
||||
(TaskGroup) child);
|
||||
}
|
||||
if(currentConstraint != null &&
|
||||
currentConstraint.getConstraintType().equals(
|
||||
PositionConstraintType.START_IN_FIXED_DATE) &&
|
||||
(constraint == null || currentConstraint.getConstraintDate().
|
||||
compareTo(constraint.getConstraintDate()) < 0)) {
|
||||
constraint = currentConstraint;
|
||||
}
|
||||
}
|
||||
return constraint;
|
||||
}
|
||||
public static List<Constraint<GanttDate>> getStartConstraintsFor(
|
||||
TaskElement taskElement, LocalDate orderInitDate) {
|
||||
if (taskElement instanceof TaskGroup) {
|
||||
TaskPositionConstraint constraint =
|
||||
getLeftMostFixedDateConstraintAmongChildren((TaskGroup) taskElement);
|
||||
if(constraint == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return Collections.singletonList(equalTo(toGantt(
|
||||
constraint.getConstraintDate())));
|
||||
}
|
||||
if (taskElement instanceof ITaskPositionConstrained) {
|
||||
ITaskPositionConstrained task = (ITaskPositionConstrained) taskElement;
|
||||
TaskPositionConstraint startConstraint = task
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue