Package org.libreplan.business.workreports.entities

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


            Resource resource = getWorker(workLogItem.getAuthor().getName());
            if (resource == null) {
                continue;
            }

            WorkReportLine workReportLine;
            String code = orderElement.getCode() + "-" + workLogItem.getId();

            try {
                workReportLine = workReport.getWorkReportLineByCode(code);
            } catch (InstanceNotFoundException e) {
                workReportLine = WorkReportLine.create(workReport);
                workReport.addWorkReportLine(workReportLine);
                workReportLine.setCode(code);
            }

            updateWorkReportLine(workReportLine, orderElement, workLogItem,
                    resource);
        }
View Full Code Here


        workReportDAO.save(workReport);
    }

    private WorkReportLine createWorkReportLine(OrderElement orderElement,
            Integer hours) {
        WorkReportLine workReportLine = WorkReportLine.create(workReport);
        workReportLine.setCode("default-work-report-line-" + UUID.randomUUID());
        workReportLine.setDate(new Date());
        workReportLine.setResource(resource);
        workReportLine.setOrderElement(orderElement);
        workReportLine.setTypeOfWorkHours(typesOfWorkHours.get(0));
        workReportLine.setEffort(EffortDuration.hours(hours));
        return workReportLine;
    }
View Full Code Here

        return workReportLine;
    }

    private WorkReportLine createWorkReportLine(Integer hours,
            TypeOfWorkHours type) {
        WorkReportLine workReportLine = WorkReportLine.create(workReport);
        workReportLine.setCode("default-work-report-line-" + UUID.randomUUID());
        workReportLine.setDate(new Date());
        workReportLine.setResource(resource);
        workReportLine.setOrderElement(orderElements.get(0));
        workReportLine.setTypeOfWorkHours(type);
        workReportLine.setEffort(EffortDuration.hours(hours));
        return workReportLine;
    }
View Full Code Here

                return o1.date.compare(o2.date);
            }
        });

        for (WorkReportLineDTO each : exportedLines) {
            WorkReportLine line = importedLines.remove(0);
            assertThat(line.getDate().getTime(), equalTo(asTime(each.getDate())));
        }
    }
View Full Code Here

    }

    private List<OrderCostsPerResourceDTO> createEmptyWorkReportLineList(Order order) {
        List<OrderCostsPerResourceDTO> listWorkReportLineDTO = new ArrayList<OrderCostsPerResourceDTO>();
        Worker emptyWorker = createFictitiousWorker();
        WorkReportLine wrl = createEmptyWorkReportLine(emptyWorker);
        listWorkReportLineDTO.add(createEmptyOrderCostsPerResourceDTO(order, emptyWorker, wrl));
        return listWorkReportLineDTO;
    }
View Full Code Here

        leaf.setCode(_("All project tasks"));

        TypeOfWorkHours w = TypeOfWorkHours.create();
        w.setDefaultPrice(new BigDecimal(0));

        WorkReportLine wrl = new WorkReportLine();
        wrl.setEffort(EffortDuration.zero());
        wrl.setTypeOfWorkHours(w);
        wrl.setResource(worker);
        wrl.setOrderElement(leaf);
        return wrl;
    }
View Full Code Here

        this.hourType = hourType;
    }

    @Override
    public boolean accepts(Object object) {
        WorkReportLine line = (WorkReportLine) object;
        return (isEqual(resource, line.getResource())
                && isEqual(orderElement, line.getOrderElement())
                && isEqual(hourType, line.getTypeOfWorkHours()) && acceptFiltersDates(line));
    }
View Full Code Here

            }

            // find the start date in its lines
            Date dateStart = null;
            if (workReport.getWorkReportLines().size() > 0) {
                WorkReportLine line0 = (WorkReportLine) workReport
                    .getWorkReportLines().toArray()[0];
                dateStart = line0.getDate();
                for (WorkReportLine line : workReport.getWorkReportLines()) {
                     if ((dateStart != null) && (line.getDate() != null)
                            && (line.getDate().before(dateStart))) {
                        dateStart = line.getDate();
                    }
View Full Code Here

                return workReport.getDate();
            }

            Date dateFinish = null;
            if (workReport.getWorkReportLines().size() > 0) {
                WorkReportLine line0 = (WorkReportLine) workReport
                    .getWorkReportLines().toArray()[0];
                dateFinish = line0.getDate();
                for (WorkReportLine line : workReport.getWorkReportLines()) {
                    if ((dateFinish != null) && (line.getDate() != null)
                            && (line.getDate().after(dateFinish))) {
                        dateFinish = line.getDate();
                    }
View Full Code Here

    }

    @Override
    public WorkReportLine addWorkReportLine() {
        if (workReport != null) {
            WorkReportLine workReportLine = WorkReportLine.create(workReport);
            workReportLine.setCode("");

            // Adding default date
            workReportLine.setDate(new Date());
            workReport.addWorkReportLine(workReportLine);
            return workReportLine;
        }
        return null;
    }
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.