Package org.libreplan.business.workreports.entities

Examples of org.libreplan.business.workreports.entities.WorkReportLine


    public void visit(Task task) {
        if (task.isFinished()) {
            List<WorkReportLine> workReportLines = task.
                    getOrderElement().getWorkReportLines(true);
            if (workReportLines.size() > 0) {
                WorkReportLine last = getLastWorkReportLineWithEffortDurationNoZero(workReportLines);
                if (last != null) {
                    LocalDate lastRLDate = LocalDate.fromDateFields(last
                            .getDate());
                    LocalDate endDate = task.getEndAsLocalDate();
                    deviations.add((double) Days.daysBetween(endDate,
                            lastRLDate).getDays());
                }
View Full Code Here


        // Calculate date for first and last work reports
        final List<WorkReportLine> workReportLines = workReportLineDAO
                .findByOrderElementAndChildren(orderElement, true);
        if (!workReportLines.isEmpty()) {
            final WorkReportLine firstWorkReportLine = workReportLines.get(0);
            this.firstWorkReportDate = firstWorkReportLine.getDate();

            final WorkReportLine lastWorkReportLine = workReportLines
                    .get(workReportLines.size() - 1);
            this.lastWorkReportDate = lastWorkReportLine.getDate();
        }

        if (orderElement.getDeadline() == null) {
            this.deadline = deadLineOrder;
        } else {
View Full Code Here

    }

    @Override
    public EffortDuration getEffortDuration(OrderElement orderElement,
            LocalDate date) {
        WorkReportLine workReportLine = getWorkReportLine(orderElement, date);
        if (workReportLine == null) {
            return null;
        }
        return workReportLine.getEffort();
    }
View Full Code Here

    @Override
    @Transactional(readOnly = true)
    public void setEffortDuration(OrderElement orderElement, LocalDate date,
            EffortDuration effortDuration) {
        WorkReportLine workReportLine = getOrCreateWorkReportLine(orderElement,
                date);
        workReportLine.setEffort(effortDuration);
        modified = true;
        markAsModified(orderElement, date);
    }
View Full Code Here

        markAsModified(orderElement, date);
    }

    private WorkReportLine getOrCreateWorkReportLine(OrderElement orderElement,
            LocalDate date) {
        WorkReportLine workReportLine = getWorkReportLine(orderElement, date);
        if (workReportLine == null) {
            workReportLine = createWorkReportLine(orderElement, date);
            workReport.addWorkReportLine(workReportLine);
        }
        return workReportLine;
View Full Code Here

        modifiedMap.get(orderElement).add(date);
    }

    private WorkReportLine createWorkReportLine(OrderElement orderElement,
            LocalDate date) {
        WorkReportLine workReportLine = WorkReportLine.create(workReport);
        workReportLine.setCodeAutogenerated(true);
        workReportLine.setOrderElement(orderElement);
        workReportLine.setDate(date.toDateTimeAtStartOfDay().toDate());
        workReportLine.setTypeOfWorkHours(getTypeOfWorkHours());
        workReportLine.setEffort(EffortDuration.zero());
        return workReportLine;
    }
View Full Code Here

        return periodicity.next(date);
    }

    @Override
    public Boolean isFinished(OrderElement orderElement, LocalDate date) {
        WorkReportLine workReportLine = getWorkReportLine(orderElement, date);
        if (workReportLine == null) {
            return false;
        }
        return workReportLine.isFinished();
    }
View Full Code Here

    }

    @Override
    public void setFinished(OrderElement orderElement, LocalDate date,
            Boolean finished) {
        WorkReportLine workReportLine = getOrCreateWorkReportLine(orderElement,
                date);
        workReportLine.setFinished(finished);
        modified = true;
        markAsModified(orderElement, date);
    }
View Full Code Here

            Pair<EffortDuration, OrderElement> previous = transactionService
                    .runOnAnotherTransaction(new IOnTransaction<Pair<EffortDuration, OrderElement>>() {
                        @Override
                        public Pair<EffortDuration, OrderElement> execute() {
                            try {
                                WorkReportLine line = workReportLineDAO
                                        .find(workReportLine.getId());

                                OrderElement orderElement = line
                                        .getOrderElement();
                                forceLoadParents(orderElement);

                                return Pair.create(line.getEffort(),
                                        orderElement);
                            } catch (InstanceNotFoundException e) {
                                throw new RuntimeException(e);
                            }
                        }
View Full Code Here

                    OrderElement previousOrderElement = transactionService
                            .runOnAnotherTransaction(new IOnTransaction<OrderElement>() {
                                @Override
                                public OrderElement execute() {
                                    try {
                                        WorkReportLine line = workReportLineDAO
                                                .find(workReportLine.getId());

                                        return line.getOrderElement();
                                    } catch (InstanceNotFoundException e) {
                                        throw new RuntimeException(e);
                                    }
                                }
                            });
View Full Code Here

TOP

Related Classes of org.libreplan.business.workreports.entities.WorkReportLine

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.