Examples of EffortDuration


Examples of org.libreplan.business.workingday.EffortDuration

        return min;
    }

    @Override
    public EffortDuration calculateMaxWorkedHours(final List<OrderElement> list) {
        EffortDuration max = EffortDuration.zero();
        if (!list.isEmpty()) {
            max = getAssignedDirectEffort(list.get(0));
            for (OrderElement orderElement : list) {
                EffortDuration value = getAssignedDirectEffort(orderElement);
                max = EffortDuration.max(max, value);
            }
        }
        return max;
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

        return max;
    }

    @Override
    public EffortDuration calculateMinWorkedHours(final List<OrderElement> list) {
        EffortDuration min = EffortDuration.zero();
        if (!list.isEmpty()) {
            min = getAssignedDirectEffort(list.get(0));
            for (OrderElement orderElement : list) {
                EffortDuration value = getAssignedDirectEffort(orderElement);
                min = EffortDuration.min(min, value);
            }
        }
        return min;
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    }

    public EffortDuration getAssignedDurationDiscounting(
            Map<Long, Set<BaseEntity>> allocationsFromWhichDiscountHours,
            LocalDate day) {
        EffortDuration result = zero();
        for (DayAssignment dayAssignment : getAssignmentsForDay(day)) {

            if (!dayAssignment
                    .belongsToSomeOf(allocationsFromWhichDiscountHours)) {
                result = result.plus(dayAssignment.getDuration());
            }
        }
        return result;
    }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

        return EffortDuration.sum(daysBetween, new IEffortFrom<PartialDay>() {

            @Override
            public EffortDuration from(PartialDay current) {
                EffortDuration capacityCurrent = calendar
                        .getCapacityOn(current);
                if (capacityCurrent != null
                        && (criterionToSatisfy == null || satisfiesCriterionAt(
                                criterionToSatisfy, current.getDate()))) {
                    return capacityCurrent;
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

        }
        return criteria.list();
    }

    private void updateSumOfAllocatedHours(TaskElement taskElement) {
        EffortDuration assignedEffort = EffortDuration.zero();
        EffortDuration oldAssignedEffort = taskElement.getSumOfAssignedEffort();
        for(ResourceAllocation<?> allocation : taskElement.getAllResourceAllocations()) {
            assignedEffort = assignedEffort.plus(allocation.getAssignedEffort());
        }
        if(assignedEffort.compareTo(oldAssignedEffort) != 0) {
            taskElement.setSumOfAssignedEffort(assignedEffort);
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    }

    private void updateSumOfAllocatedHoursToChildren(TaskElement parent) {
        if(parent instanceof TaskGroup) {
            for(TaskElement child : parent.getChildren()) {
                EffortDuration assignedEffort = EffortDuration.zero();
                EffortDuration oldAssignedEffort = child.getSumOfAssignedEffort();
                for(ResourceAllocation<?> allocation : child.getAllResourceAllocations()) {
                    assignedEffort = assignedEffort.plus(allocation.getAssignedEffort());
                }
                if(assignedEffort.compareTo(oldAssignedEffort) != 0) {
                    child.setSumOfAssignedEffort(assignedEffort);
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

    private void apply(ResourceAllocation<?> resourceAllocation,
            LocalDate start, LocalDate end, int totalHours) {

        final LocalDate previousEndDate = resourceAllocation.getEndDate();

        EffortDuration capacity;
        BaseCalendar calendar = resourceAllocation.getTask().getCalendar();
        int daysDuration = daysWithAllocatedHours(resourceAllocation).size();

        // Calculate hours per day and round values
        BigDecimal[] hoursToAllocatePerDay = generateHoursToAllocateFor(daysDuration, totalHours);
        hoursToAllocatePerDay = roundValues(hoursToAllocatePerDay, HOUR_FRAGMENTATION);

        // Calculate reminder (difference between totalHours and sum of hours calculated)
        BigDecimal totalHoursToAllocate = sumHoursPerDay(hoursToAllocatePerDay);
        assert(totalHoursToAllocate.compareTo(BigDecimal.valueOf(totalHours)) <= 0);
        BigDecimal remindingHours = BigDecimal.valueOf(totalHours).subtract(totalHoursToAllocate);
        allocateRemindingHours(hoursToAllocatePerDay, remindingHours);
        avoidZeroHoursInDays(hoursToAllocatePerDay);

        assert(hoursToAllocatePerDay.length == daysDuration);

        // Starting from startDate do allocation, one slot of hours per day in resource
        LocalDate day = new LocalDate(start);
        EffortDuration hours = EffortDuration.zero();
        int i = 0;
        while (i < hoursToAllocatePerDay.length) {
            hours = EffortDuration
                    .fromHoursAsBigDecimal(hoursToAllocatePerDay[i]);
            capacity = calendar.getCapacityOn(PartialDay.wholeDay(day));
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

        return new IAssignedEffortForResource() {

            @Override
            public EffortDuration getAssignedDurationAt(Resource resource,
                    LocalDate day) {
                EffortDuration result = EffortDuration.zero();
                for (IAssignedEffortForResource each : assignedEffortForResources) {
                    EffortDuration e = each
                            .getAssignedDurationAt(resource, day);
                    if (e != null) {
                        result = result.plus(e);
                    }
                }
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

                    @Override
                    public Boolean answer() throws Throwable {
                        AvailabilityTimeLine availability = (AvailabilityTimeLine) getCurrentArguments()[0];
                        ResourcesPerDay resourcesPerDay = (ResourcesPerDay) getCurrentArguments()[1];
                        EffortDuration effortDuration = (EffortDuration) getCurrentArguments()[2];
                        return ThereAreHoursOnWorkHoursCalculator
                                .thereIsAvailableCapacityFor(result,
                                        availability, resourcesPerDay,
                                        effortDuration)
                                .thereIsCapacityAvailable();
View Full Code Here

Examples of org.libreplan.business.workingday.EffortDuration

     * @param rosterDTOs
     *            list of rosterDTO
     */
    private void updateExceptionTypeAndEffort(
            RosterExceptionItem rosterExceptionItem, List<RosterDTO> rosterDTOs) {
        EffortDuration max = EffortDuration.zero();
        EffortDuration sum = EffortDuration.zero();
        String rosterCatName = rosterDTOs.get(0).getRosterCategories().get(0)
                .getName();
        for (RosterDTO rosterDTO : rosterDTOs) {
            EffortDuration duration = EffortDuration
                    .parseFromFormattedString(rosterDTO.getDuration());
            if (duration.compareTo(max) > 0) {
                rosterCatName = rosterDTO.getRosterCategories().get(0)
                        .getName();
            }
            max = EffortDuration.max(max, duration);
            sum = EffortDuration.sum(sum, duration);

        }
        EffortDuration exceptionTime = EffortDuration.zero();

        EffortDuration workableTime = worker.getCalendar().getCapacityOn(
                PartialDay.wholeDay(rosterExceptionItem.getDate()));

        // Convert the total duration from Tim to the productivity time as is
        // configured in resource calendar
        EffortDuration productivityTime = sum.multiplyBy(productivityFactor)
                .divideBy(100);

        // Calculate the exception time
        if (workableTime.compareTo(productivityTime) >= 0) {
            exceptionTime = workableTime.minus(productivityTime);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.