Package org.libreplan.business.planner.entities

Examples of org.libreplan.business.planner.entities.TaskPositionConstraint


        return false;
    }

    protected boolean applyConstraintBasedOnInitOrEndDate(Task task,
            boolean scheduleBackwards) {
        TaskPositionConstraint constraint = task.getPositionConstraint();
        if (getInitDate() != null
                && (getDeadline() == null || !scheduleBackwards)) {
            constraint.notEarlierThan(IntraDayDate.startOfDay(LocalDate
                    .fromDateFields(this.getInitDate())));
            return true;
        }
        return false;
    }
View Full Code Here


    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();
    }
View Full Code Here

    public static List<Constraint<GanttDate>> getEndConstraintsFor(
            TaskElement taskElement, LocalDate deadline) {
        if (taskElement instanceof ITaskPositionConstrained) {
            ITaskPositionConstrained task = (ITaskPositionConstrained) taskElement;
            TaskPositionConstraint endConstraint = task.getPositionConstraint();
            PositionConstraintType type = endConstraint.getConstraintType();
            switch (type) {
            case AS_LATE_AS_POSSIBLE:
                if (deadline != null) {
                    return Collections
                            .singletonList(lessOrEqualThan(toGantt(deadline)));
                }
            case FINISH_NOT_LATER_THAN:
                GanttDate date = toGantt(endConstraint.getConstraintDate());
                return Collections.singletonList(lessOrEqualThan(date));
            }
        }
        return Collections.emptyList();
    }
View Full Code Here

        return new BaseMatcher<TaskPositionConstraint>() {

            @Override
            public boolean matches(Object object) {
                if (object instanceof TaskPositionConstraint) {
                    TaskPositionConstraint startConstraint = (TaskPositionConstraint) object;
                    return startConstraint.getConstraintType() == type;
                }
                return false;
            }

            @Override
View Full Code Here

        return new BaseMatcher<TaskPositionConstraint>() {

            @Override
            public boolean matches(Object object) {
                if (object instanceof TaskPositionConstraint) {
                    TaskPositionConstraint startConstraint = (TaskPositionConstraint) object;
                    LocalDate constraintDate = startConstraint
                            .getConstraintDate().toDateTimeAtStartOfDay()
                            .toLocalDate();
                    boolean bothNotNull = value != null
                                                && constraintDate != null;
                    return value == constraintDate || bothNotNull
View Full Code Here

        startConstraintDate.setVisible(constraint.isAssociatedDateRequired());
        updateStartConstraint(constraint);
    }

    private void updateStartConstraint(PositionConstraintType type) {
        TaskPositionConstraint taskStartConstraint = currentTaskElementAsTaskLeafConstraint()
                .getPositionConstraint();
        startConstraintDate.setVisible(type.isAssociatedDateRequired());
        if (taskStartConstraint.getConstraintDateAsDate() != null) {
            startConstraintDate.setValue(taskStartConstraint
                    .getConstraintDateAsDate());
        }
    }
View Full Code Here

                    .getConstraintDateAsDate());
        }
    }

    private boolean saveConstraintChanges() {
        TaskPositionConstraint taskConstraint = currentTaskElementAsTaskLeafConstraint()
                .getPositionConstraint();
        PositionConstraintType type = (PositionConstraintType) startConstraintTypes
                .getSelectedItemApi().getValue();
        IntraDayDate inputDate = type.isAssociatedDateRequired() ? IntraDayDate
                .startOfDay(LocalDate.fromDateFields(startConstraintDate
                        .getValue())) : null;
        if (taskConstraint.isValid(type, inputDate)) {
            taskConstraint.update(type, inputDate);
            //at this point we could call currentContext.recalculatePosition(currentTaskElement)
            //to trigger the scheduling algorithm, but we don't do it because
            //the ResourceAllocationController, which is attached to the other
            //tab of the same window, will do it anyway.
            return true;
View Full Code Here

TOP

Related Classes of org.libreplan.business.planner.entities.TaskPositionConstraint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.