diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/reports/dtos/HoursWorkedPerWorkerDTO.java b/navalplanner-business/src/main/java/org/navalplanner/business/reports/dtos/HoursWorkedPerWorkerDTO.java new file mode 100644 index 000000000..7b0fb9445 --- /dev/null +++ b/navalplanner-business/src/main/java/org/navalplanner/business/reports/dtos/HoursWorkedPerWorkerDTO.java @@ -0,0 +1,143 @@ +/* + * This file is part of ###PROJECT_NAME### + * + * Copyright (C) 2009 Fundación para o Fomento da Calidade Industrial e + * Desenvolvemento Tecnolóxico de Galicia + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package org.navalplanner.business.reports.dtos; + +import java.util.Date; +import java.util.Set; + +import org.navalplanner.business.labels.entities.Label; +import org.navalplanner.business.resources.entities.Worker; +import org.navalplanner.business.workreports.entities.WorkReportLine; +import org.navalplanner.business.workreports.valueobjects.DescriptionValue; + +public class HoursWorkedPerWorkerDTO { + + private String workerName; + + private Date date; + + private Date clockStart; + + private Date clockFinish; + + private Integer numHours; + + private String orderElementCode; + + private String descriptionValues; + + private String labels; + + public HoursWorkedPerWorkerDTO( + Worker worker, + WorkReportLine workReportLine) { + + this.workerName = worker.getName(); + this.date = workReportLine.getDate(); + this.clockStart = workReportLine.getClockStart(); + this.clockFinish = workReportLine.getClockFinish(); + this.numHours = workReportLine.getNumHours(); + this.orderElementCode = workReportLine.getOrderElement().getCode(); + this.descriptionValues = descriptionValuesAsString(workReportLine.getDescriptionValues()); + this.labels = labelsAsString(workReportLine.getLabels()); + } + + private String labelsAsString(Set