ItEr50S13AdaptacionServiciosRESTItEr49S18 : Adapting of WorkReportServiceRest to GenericServiceRest.
This patch should be applied after the following patches :
ItEr50S13AdaptacionServiciosRESTItEr49S18 : Adds class validations.
ItEr50S13AdaptacionServiciosRESTItEr49S18 : Refactoring the create way a work report line.
It is need a work report to create a work report line , and now the work report line
does not change its work report.
This commit is contained in:
parent
5024b7c4bc
commit
4fe334f33c
11 changed files with 740 additions and 97 deletions
|
|
@ -373,4 +373,23 @@ public class WorkReport extends IntegrationEntity {
|
|||
return (workReportType != null);
|
||||
}
|
||||
|
||||
public WorkReportLine getWorkReportLineByCode(String code)
|
||||
throws InstanceNotFoundException {
|
||||
|
||||
if (StringUtils.isBlank(code)) {
|
||||
throw new InstanceNotFoundException(code, WorkReportLine.class
|
||||
.getName());
|
||||
}
|
||||
|
||||
for (WorkReportLine l : this.workReportLines) {
|
||||
if (l.getCode().equalsIgnoreCase(StringUtils.trim(code))) {
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InstanceNotFoundException(code, WorkReportLine.class
|
||||
.getName());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,24 +280,48 @@ public class WorkReportLine extends IntegrationEntity implements Comparable {
|
|||
}
|
||||
|
||||
private void assignItsLabels(WorkReportType workReportType) {
|
||||
Set<Label> updatedLabels = new HashSet<Label>();
|
||||
if (workReportType != null) {
|
||||
labels.clear();
|
||||
for (WorkReportLabelTypeAssigment labelTypeAssigment : workReportType
|
||||
.getLineLabels()) {
|
||||
labels.add(labelTypeAssigment.getDefaultLabel());
|
||||
Label label = getLabelBy(labelTypeAssigment);
|
||||
if (label != null) {
|
||||
updatedLabels.add(label);
|
||||
} else {
|
||||
updatedLabels.add(labelTypeAssigment.getDefaultLabel());
|
||||
}
|
||||
}
|
||||
this.labels = updatedLabels;
|
||||
}
|
||||
}
|
||||
|
||||
private Label getLabelBy(WorkReportLabelTypeAssigment labelTypeAssigment) {
|
||||
LabelType type = labelTypeAssigment.getLabelType();
|
||||
for (Label label : labels) {
|
||||
if (label.getType().getId().equals(type.getId())) {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void assignItsDescriptionValues(WorkReportType workReportType) {
|
||||
Set<DescriptionValue> updatedDescriptionValues = new HashSet<DescriptionValue>();
|
||||
if (workReportType != null) {
|
||||
descriptionValues.clear();
|
||||
for (DescriptionField descriptionField : workReportType
|
||||
.getLineFields()) {
|
||||
DescriptionValue descriptionValue = DescriptionValue.create(
|
||||
DescriptionValue descriptionValue;
|
||||
try {
|
||||
descriptionValue = this
|
||||
.getDescriptionValueByFieldName(descriptionField
|
||||
.getFieldName());
|
||||
} catch (InstanceNotFoundException e) {
|
||||
descriptionValue = DescriptionValue.create(
|
||||
descriptionField.getFieldName(), null);
|
||||
descriptionValues.add(descriptionValue);
|
||||
}
|
||||
updatedDescriptionValues.add(descriptionValue);
|
||||
}
|
||||
this.descriptionValues = updatedDescriptionValues;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -86,5 +86,4 @@ public class DescriptionValue implements INewObject {
|
|||
value = "";
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,14 @@ public final class LabelReferenceConverter {
|
|||
private LabelReferenceConverter() {
|
||||
}
|
||||
|
||||
public final static Set<LabelReferenceDTO> toDTO(Set<Label> labels) {
|
||||
Set<LabelReferenceDTO> labelDTOs = new HashSet<LabelReferenceDTO>();
|
||||
for (Label label : labels) {
|
||||
labelDTOs.add(toDTO(label));
|
||||
}
|
||||
return labelDTOs;
|
||||
}
|
||||
|
||||
public final static LabelReferenceDTO toDTO(Label label) {
|
||||
return new LabelReferenceDTO(label.getCode());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,9 @@ import org.navalplanner.ws.common.api.InstanceConstraintViolationsListDTO;
|
|||
*/
|
||||
public interface IWorkReportService {
|
||||
|
||||
InstanceConstraintViolationsListDTO addWorkReports(
|
||||
public WorkReportListDTO getWorkReports();
|
||||
|
||||
public InstanceConstraintViolationsListDTO addWorkReports(
|
||||
WorkReportListDTO workReportListDTO);
|
||||
|
||||
}
|
||||
|
|
@ -20,32 +20,43 @@
|
|||
|
||||
package org.navalplanner.ws.workreports.impl;
|
||||
|
||||
import static org.navalplanner.web.I18nHelper._;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
||||
import org.navalplanner.business.costcategories.entities.TypeOfWorkHours;
|
||||
import org.navalplanner.business.labels.entities.Label;
|
||||
import org.navalplanner.business.labels.entities.LabelType;
|
||||
import org.navalplanner.business.orders.entities.OrderElement;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
import org.navalplanner.business.resources.entities.Worker;
|
||||
import org.navalplanner.business.workreports.entities.WorkReport;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportLine;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportType;
|
||||
import org.navalplanner.business.workreports.valueobjects.DescriptionValue;
|
||||
import org.navalplanner.ws.common.api.LabelReferenceDTO;
|
||||
import org.navalplanner.ws.common.impl.LabelReferenceConverter;
|
||||
import org.navalplanner.ws.workreports.api.DescriptionValueDTO;
|
||||
import org.navalplanner.ws.workreports.api.WorkReportDTO;
|
||||
import org.navalplanner.ws.workreports.api.WorkReportLineDTO;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Converter from/to work report related entities to/from DTOs.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
|
||||
*/
|
||||
public final class WorkReportConverter {
|
||||
|
||||
public static WorkReport toEntity(WorkReportDTO workReportDTO)
|
||||
throws InstanceNotFoundException {
|
||||
|
||||
WorkReport workReport = WorkReport.create();
|
||||
|
||||
// Mandatory fields
|
||||
|
|
@ -66,19 +77,28 @@ public final class WorkReportConverter {
|
|||
}
|
||||
|
||||
if (workReportDTO.orderElement != null) {
|
||||
OrderElement orderElement = Registry.getOrderElementDAO()
|
||||
try {
|
||||
OrderElement orderElement = Registry.getOrderElementDAO()
|
||||
.findUniqueByCode(workReportDTO.orderElement);
|
||||
workReport.setOrderElement(orderElement);
|
||||
workReport.setOrderElement(orderElement);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
workReport.setOrderElement(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (workReportDTO.resource != null) {
|
||||
Worker worker = Registry.getWorkerDAO().findUniqueByNif(
|
||||
workReportDTO.resource);
|
||||
workReport.setResource(worker);
|
||||
try {
|
||||
Worker worker = Registry.getWorkerDAO().findUniqueByNif(
|
||||
workReportDTO.resource);
|
||||
workReport.setResource(worker);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
workReport.setResource(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (workReportDTO.labels != null) {
|
||||
workReport.setLabels(LabelReferenceConverter.toEntity(workReportDTO.labels));
|
||||
workReport.setLabels(LabelReferenceConverter
|
||||
.toEntity(workReportDTO.labels));
|
||||
}
|
||||
|
||||
if (workReportDTO.descriptionValues != null) {
|
||||
|
|
@ -92,14 +112,24 @@ public final class WorkReportConverter {
|
|||
private static WorkReportLine toEntity(WorkReportLineDTO workReportLineDTO,
|
||||
WorkReport workReport)
|
||||
throws InstanceNotFoundException {
|
||||
|
||||
WorkReportLine workReportLine = WorkReportLine.create(workReport);
|
||||
|
||||
// Mandatory fields
|
||||
workReportLine.setCode(workReportLineDTO.code);
|
||||
workReportLine.setNumHours(workReportLineDTO.numHours);
|
||||
|
||||
TypeOfWorkHours typeOfWorkHours = Registry.getTypeOfWorkHoursDAO()
|
||||
.findUniqueByCode(workReportLineDTO.typeOfWorkHours);
|
||||
workReportLine.setTypeOfWorkHours(typeOfWorkHours);
|
||||
if (workReportLineDTO.typeOfWorkHours != null) {
|
||||
try {
|
||||
TypeOfWorkHours typeOfWorkHours = Registry
|
||||
.getTypeOfWorkHoursDAO().findUniqueByCode(
|
||||
workReportLineDTO.typeOfWorkHours);
|
||||
workReportLine.setTypeOfWorkHours(typeOfWorkHours);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("There is no type of work hours with this code"));
|
||||
}
|
||||
}
|
||||
|
||||
// Optional fields
|
||||
if (workReportLineDTO.date != null) {
|
||||
|
|
@ -107,15 +137,23 @@ public final class WorkReportConverter {
|
|||
}
|
||||
|
||||
if (workReportLineDTO.orderElement != null) {
|
||||
OrderElement orderElement = Registry.getOrderElementDAO()
|
||||
try {
|
||||
OrderElement orderElement = Registry.getOrderElementDAO()
|
||||
.findUniqueByCode(workReportLineDTO.orderElement);
|
||||
workReportLine.setOrderElement(orderElement);
|
||||
workReportLine.setOrderElement(orderElement);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
workReportLine.setOrderElement(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (workReportLineDTO.resource != null) {
|
||||
try {
|
||||
Worker worker = Registry.getWorkerDAO().findUniqueByNif(
|
||||
workReportLineDTO.resource);
|
||||
workReportLine.setResource(worker);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
workReportLine.setResource(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (workReportLineDTO.clockStart != null) {
|
||||
|
|
@ -138,6 +176,7 @@ public final class WorkReportConverter {
|
|||
return workReportLine;
|
||||
}
|
||||
|
||||
|
||||
private static Set<DescriptionValue> toEntity(
|
||||
Set<DescriptionValueDTO> descriptionValues) {
|
||||
Set<DescriptionValue> result = new HashSet<DescriptionValue>();
|
||||
|
|
@ -153,4 +192,382 @@ public final class WorkReportConverter {
|
|||
descriptionValueDTO.value);
|
||||
}
|
||||
|
||||
public final static WorkReportDTO toDTO(WorkReport workReport) {
|
||||
|
||||
String code = workReport.getCode();
|
||||
|
||||
String workReportTypeCode = null;
|
||||
if (workReport.getWorkReportType() != null) {
|
||||
workReportTypeCode = workReport.getWorkReportType()
|
||||
.getCode();
|
||||
} else {
|
||||
throw new ValidationException(
|
||||
_("missing work report code in a work report"));
|
||||
}
|
||||
|
||||
// Optional fields
|
||||
Date date = null;
|
||||
if (workReport.getDate() != null) {
|
||||
date = workReport.getDate();
|
||||
}
|
||||
|
||||
String orderElementCode = null;
|
||||
if (workReport.getOrderElement() != null) {
|
||||
orderElementCode = workReport.getOrderElement().getCode();
|
||||
}
|
||||
|
||||
String resourceNif = null;
|
||||
if ((workReport.getResource() != null)) {
|
||||
try {
|
||||
Worker worker = Registry.getWorkerDAO().findByCode(
|
||||
workReport.getResource().getCode());
|
||||
resourceNif = worker.getNif();
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("missing worker code in the work report"));
|
||||
}
|
||||
}
|
||||
|
||||
Set<LabelReferenceDTO> labelDTOs = LabelReferenceConverter
|
||||
.toDTO(workReport.getLabels());
|
||||
if (labelDTOs.isEmpty()) {
|
||||
labelDTOs = null;
|
||||
}
|
||||
|
||||
Set<DescriptionValueDTO> descriptionValuesDTOs = toDTO(workReport
|
||||
.getDescriptionValues());
|
||||
if (descriptionValuesDTOs.isEmpty()) {
|
||||
descriptionValuesDTOs = null;
|
||||
}
|
||||
|
||||
Set<WorkReportLineDTO> workReportLineDTOs = new HashSet<WorkReportLineDTO>();
|
||||
|
||||
for (WorkReportLine line : workReport.getWorkReportLines()) {
|
||||
workReportLineDTOs.add(toDTO(line));
|
||||
}
|
||||
if (workReportLineDTOs.isEmpty()) {
|
||||
workReportLineDTOs = null;
|
||||
}
|
||||
|
||||
return new WorkReportDTO(code, workReportTypeCode, date, resourceNif,
|
||||
orderElementCode, labelDTOs, descriptionValuesDTOs,
|
||||
workReportLineDTOs);
|
||||
|
||||
}
|
||||
|
||||
public final static WorkReportLineDTO toDTO(WorkReportLine line){
|
||||
String code = line.getCode();
|
||||
Date date = line.getDate();
|
||||
|
||||
String resource = null;
|
||||
if((line.getResource() != null) && (line.getResource() instanceof Worker)){
|
||||
resource = ((Worker)line.getResource()).getNif();
|
||||
}
|
||||
|
||||
String orderElement = null;
|
||||
if(line.getOrderElement() != null){
|
||||
orderElement = line.getOrderElement().getCode();
|
||||
}
|
||||
|
||||
String typeOfWorkHours = null;
|
||||
if(line.getTypeOfWorkHours() != null){
|
||||
typeOfWorkHours = line.getTypeOfWorkHours().getCode();
|
||||
}
|
||||
|
||||
Date clockStart = null;
|
||||
if(line.getClockStart() != null){
|
||||
clockStart = line.getClockStart().toDateTimeToday().toDate();
|
||||
}
|
||||
|
||||
Date clockFinish = null;
|
||||
if(line.getClockFinish() != null){
|
||||
clockFinish = line.getClockFinish().toDateTimeToday().toDate();
|
||||
}
|
||||
|
||||
Integer numHours = null;
|
||||
if(line.getNumHours() != null){
|
||||
numHours = line.getNumHours();
|
||||
}
|
||||
|
||||
Set<LabelReferenceDTO> labelDTOs = LabelReferenceConverter.toDTO(line
|
||||
.getLabels());
|
||||
if(labelDTOs.isEmpty()){
|
||||
labelDTOs = null;
|
||||
}
|
||||
|
||||
Set<DescriptionValueDTO> descriptionValuesDTOs = toDTO(line
|
||||
.getDescriptionValues());
|
||||
if (descriptionValuesDTOs.isEmpty()) {
|
||||
descriptionValuesDTOs = null;
|
||||
}
|
||||
|
||||
WorkReportLineDTO workReportLineDTO = new WorkReportLineDTO(code, date,
|
||||
resource, orderElement, typeOfWorkHours, clockStart,
|
||||
clockFinish, numHours, labelDTOs, descriptionValuesDTOs);
|
||||
|
||||
return workReportLineDTO;
|
||||
}
|
||||
|
||||
private static Set<DescriptionValueDTO> toDTO(
|
||||
Set<DescriptionValue> descriptionValues) {
|
||||
Set<DescriptionValueDTO> result = new HashSet<DescriptionValueDTO>();
|
||||
for (DescriptionValue descriptionValue : descriptionValues) {
|
||||
result.add(toDTO(descriptionValue));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static DescriptionValueDTO toDTO(DescriptionValue descriptionValue) {
|
||||
return new DescriptionValueDTO(descriptionValue.getFieldName(),
|
||||
descriptionValue.getValue());
|
||||
}
|
||||
|
||||
|
||||
public final static void updateWorkReport(WorkReport workReport,
|
||||
WorkReportDTO workReportDTO) throws ValidationException {
|
||||
|
||||
WorkReportType type = workReport.getWorkReportType();
|
||||
/*
|
||||
* 1: Update the existing work report line or add new
|
||||
* work report line.
|
||||
*/
|
||||
for (WorkReportLineDTO lineDTO : workReportDTO.workReportLines) {
|
||||
|
||||
System.out.println(" line:: " + lineDTO.code);
|
||||
/* Step 1.1: requires each work report line DTO to have a code. */
|
||||
if (StringUtils.isBlank(lineDTO.code)) {
|
||||
throw new ValidationException(
|
||||
_("missing code in a work report line"));
|
||||
}
|
||||
|
||||
try {
|
||||
WorkReportLine line = workReport
|
||||
.getWorkReportLineByCode(lineDTO.code);
|
||||
updateWorkReportLine(line, lineDTO);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
try {
|
||||
workReport.addWorkReportLine(toEntity(lineDTO, workReport));
|
||||
} catch (InstanceNotFoundException o) {
|
||||
throw new ValidationException(
|
||||
_("missing type of work hours in a work report line"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 2: Update the existing labels
|
||||
*/
|
||||
for (LabelReferenceDTO labelDTO : workReportDTO.labels) {
|
||||
|
||||
/* Step 2.1: requires each label reference DTO to have a code. */
|
||||
if (StringUtils.isBlank(labelDTO.code)) {
|
||||
throw new ValidationException(
|
||||
_("missing code in a label"));
|
||||
}
|
||||
|
||||
try {
|
||||
Set<Label> labels = workReport.getLabels();
|
||||
updateLabel(labelDTO, labels);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("work report have not this label type assigned"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 3: Update the existing description values
|
||||
*/
|
||||
for (DescriptionValueDTO valueDTO : workReportDTO.descriptionValues) {
|
||||
|
||||
/* Step 3.1: requires each description value DTO to have a code. */
|
||||
if (StringUtils.isBlank(valueDTO.fieldName)) {
|
||||
throw new ValidationException(
|
||||
_("missing field name in a description value"));
|
||||
}
|
||||
|
||||
try {
|
||||
DescriptionValue value = workReport
|
||||
.getDescriptionValueByFieldName(valueDTO.fieldName);
|
||||
value.setValue(StringUtils.trim(valueDTO.value));
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("work report have not any description value with this field name"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 4: Update basic properties in existing work report
|
||||
*/
|
||||
|
||||
/* Step 4.1: Update the date. */
|
||||
Date date = workReportDTO.date;
|
||||
workReport.setDate(date);
|
||||
|
||||
/* Step 4.2: Update the resource. */
|
||||
String resourceNif = workReportDTO.resource;
|
||||
if ((resourceNif != null) && (!resourceNif.isEmpty())) {
|
||||
try {
|
||||
Resource resource = Registry.getWorkerDAO().findUniqueByNif(
|
||||
resourceNif);
|
||||
workReport.setResource(resource);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("There is no resource with this nif"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Step 4.3: Update the order element. */
|
||||
String orderElementCode = workReportDTO.orderElement;
|
||||
if ((orderElementCode != null) && (!orderElementCode.isEmpty())) {
|
||||
try {
|
||||
OrderElement orderElement = Registry.getOrderElementDAO()
|
||||
.findUniqueByCode(orderElementCode);
|
||||
workReport.setOrderElement(orderElement);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("There is no order element with this code"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final static void updateWorkReportLine(
|
||||
WorkReportLine workReportLine, WorkReportLineDTO workReportLineDTO)
|
||||
throws ValidationException {
|
||||
|
||||
/*
|
||||
* 1: Update the existing labels
|
||||
*/
|
||||
for (LabelReferenceDTO labelDTO : workReportLineDTO.labels) {
|
||||
|
||||
/* Step 2.1: requires each label reference DTO to have a code. */
|
||||
if (StringUtils.isBlank(labelDTO.code)) {
|
||||
throw new ValidationException(_("missing code in a label"));
|
||||
}
|
||||
|
||||
try {
|
||||
Set<Label> labels = workReportLine.getLabels();
|
||||
updateLabel(labelDTO, labels);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("work report line have not this label type assigned"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 2: Update the existing description values
|
||||
*/
|
||||
updateDescriptionValues(workReportLineDTO.descriptionValues,
|
||||
workReportLine);
|
||||
|
||||
/*
|
||||
* 3: Update basic properties in existing work report line
|
||||
*/
|
||||
|
||||
/* Step 3.1: Update the date. */
|
||||
Date date = workReportLineDTO.date;
|
||||
workReportLine.setDate(date);
|
||||
|
||||
/* Step 3.2: Update the resource. */
|
||||
String resourceNif = workReportLineDTO.resource;
|
||||
try {
|
||||
Resource resource = Registry.getWorkerDAO().findUniqueByNif(
|
||||
resourceNif);
|
||||
workReportLine.setResource(resource);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("There is no resource with this nif"));
|
||||
}
|
||||
|
||||
/* Step 3.3: Update the order element. */
|
||||
String orderElementCode = workReportLineDTO.orderElement;
|
||||
try {
|
||||
OrderElement orderElement = Registry.getOrderElementDAO()
|
||||
.findUniqueByCode(orderElementCode);
|
||||
workReportLine.setOrderElement(orderElement);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("There is no order element with this code"));
|
||||
}
|
||||
|
||||
/* Step 3.4: Update the type of work hours. */
|
||||
if(workReportLineDTO.typeOfWorkHours != null){
|
||||
try{
|
||||
TypeOfWorkHours typeOfWorkHours = Registry.getTypeOfWorkHoursDAO().findUniqueByCode(workReportLineDTO.typeOfWorkHours);
|
||||
workReportLine.setTypeOfWorkHours(typeOfWorkHours);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("There is no type of work hours with this code"));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 3.4: Update the clock start and the clock end and the number of
|
||||
* hours.
|
||||
*/
|
||||
if (workReportLineDTO.clockStart != null) {
|
||||
workReportLine.setClockStart(workReportLineDTO.clockStart);
|
||||
}
|
||||
if (workReportLineDTO.clockFinish != null) {
|
||||
workReportLine.setClockFinish(workReportLineDTO.clockFinish);
|
||||
}
|
||||
|
||||
if (workReportLineDTO.numHours != null) {
|
||||
workReportLine.setNumHours(workReportLineDTO.numHours);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void updateDescriptionValues(
|
||||
Set<DescriptionValueDTO> descriptionValues,
|
||||
WorkReportLine workReportLine) {
|
||||
for (DescriptionValueDTO valueDTO : descriptionValues) {
|
||||
|
||||
/* Step 3.1: requires each description value DTO to have a code. */
|
||||
if (StringUtils.isBlank(valueDTO.fieldName)) {
|
||||
throw new ValidationException(
|
||||
_("missing field name in a description value"));
|
||||
}
|
||||
|
||||
try {
|
||||
DescriptionValue value = workReportLine
|
||||
.getDescriptionValueByFieldName(valueDTO.fieldName);
|
||||
value.setValue(StringUtils.trim(valueDTO.value));
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new ValidationException(
|
||||
_("work report have not any description value with this field name"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional
|
||||
private static void updateLabel(LabelReferenceDTO labelDTO,
|
||||
Set<Label> labels)
|
||||
throws InstanceNotFoundException {
|
||||
Label labelToAdd = Registry.getLabelDAO().findByCode(labelDTO.code);
|
||||
LabelType labelType = labelToAdd.getType();
|
||||
|
||||
Label labelToChange = getLabelByLabelType(labels, labelType);
|
||||
if (labelToAdd.getCode() != labelToChange.getCode()) {
|
||||
labels.remove(labelToChange);
|
||||
labels.add(labelToAdd);
|
||||
}
|
||||
}
|
||||
|
||||
private static Label getLabelByLabelType(Set<Label> labels, LabelType type)
|
||||
throws InstanceNotFoundException {
|
||||
|
||||
if (type == null) {
|
||||
throw new InstanceNotFoundException(type, LabelType.class.getName());
|
||||
}
|
||||
|
||||
for (Label l : labels) {
|
||||
if (l.getType().equals(type)) {
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InstanceNotFoundException(type, LabelType.class.getName());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,22 +20,19 @@
|
|||
|
||||
package org.navalplanner.ws.workreports.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.navalplanner.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.navalplanner.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.navalplanner.business.common.exceptions.ValidationException;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportDAO;
|
||||
import org.navalplanner.business.workreports.entities.WorkReport;
|
||||
import org.navalplanner.ws.common.api.InstanceConstraintViolationsDTO;
|
||||
import org.navalplanner.ws.common.api.InstanceConstraintViolationsListDTO;
|
||||
import org.navalplanner.ws.common.impl.ConstraintViolationConverter;
|
||||
import org.navalplanner.ws.common.impl.Util;
|
||||
import org.navalplanner.ws.common.impl.GenericRESTService;
|
||||
import org.navalplanner.ws.workreports.api.IWorkReportService;
|
||||
import org.navalplanner.ws.workreports.api.WorkReportDTO;
|
||||
import org.navalplanner.ws.workreports.api.WorkReportListDTO;
|
||||
|
|
@ -51,50 +48,53 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@Path("/workreports/")
|
||||
@Produces("application/xml")
|
||||
@Service("workReportServiceREST")
|
||||
public class WorkReportServiceREST implements IWorkReportService {
|
||||
public class WorkReportServiceREST extends
|
||||
GenericRESTService<WorkReport, WorkReportDTO> implements
|
||||
IWorkReportService {
|
||||
|
||||
@Autowired
|
||||
private IWorkReportDAO workReportDAO;
|
||||
|
||||
@Override
|
||||
@GET
|
||||
@Transactional(readOnly = true)
|
||||
public WorkReportListDTO getWorkReports() {
|
||||
return new WorkReportListDTO(findAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
@POST
|
||||
@Consumes("application/xml")
|
||||
@Transactional
|
||||
public InstanceConstraintViolationsListDTO addWorkReports(
|
||||
WorkReportListDTO workReportListDTO) {
|
||||
List<InstanceConstraintViolationsDTO> instanceConstraintViolationsList = new ArrayList<InstanceConstraintViolationsDTO>();
|
||||
Long numItem = new Long(1);
|
||||
return save(workReportListDTO.workReports);
|
||||
}
|
||||
|
||||
for (WorkReportDTO workReportDTO : workReportListDTO.workReports) {
|
||||
InstanceConstraintViolationsDTO instanceConstraintViolationsDTO = null;
|
||||
|
||||
try {
|
||||
WorkReport workReport = WorkReportConverter
|
||||
.toEntity(workReportDTO);
|
||||
|
||||
workReport.validate();
|
||||
workReportDAO.save(workReport);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
instanceConstraintViolationsDTO = InstanceConstraintViolationsDTO
|
||||
.create(
|
||||
Util.generateInstanceConstraintViolationsDTOId(
|
||||
numItem, workReportDTO), e.getMessage());
|
||||
} catch (ValidationException e) {
|
||||
instanceConstraintViolationsDTO = ConstraintViolationConverter
|
||||
.toDTO(Util.generateInstanceConstraintViolationsDTOId(
|
||||
numItem, workReportDTO), e.getInvalidValues());
|
||||
}
|
||||
|
||||
if (instanceConstraintViolationsDTO != null) {
|
||||
instanceConstraintViolationsList
|
||||
.add(instanceConstraintViolationsDTO);
|
||||
}
|
||||
|
||||
numItem++;
|
||||
@Override
|
||||
protected WorkReport toEntity(WorkReportDTO entityDTO) {
|
||||
try {
|
||||
return WorkReportConverter.toEntity(entityDTO);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WorkReportDTO toDTO(WorkReport entity) {
|
||||
return WorkReportConverter.toDTO(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIntegrationEntityDAO<WorkReport> getIntegrationEntityDAO() {
|
||||
return workReportDAO;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateEntity(WorkReport entity, WorkReportDTO entityDTO)
|
||||
throws ValidationException {
|
||||
|
||||
WorkReportConverter.updateWorkReport(entity, entityDTO);
|
||||
|
||||
return new InstanceConstraintViolationsListDTO(
|
||||
instanceConstraintViolationsList);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ import org.hibernate.SessionFactory;
|
|||
import org.joda.time.LocalTime;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.navalplanner.business.common.IAdHocTransactionService;
|
||||
import org.navalplanner.business.costcategories.daos.ITypeOfWorkHoursDAO;
|
||||
import org.navalplanner.business.costcategories.entities.TypeOfWorkHours;
|
||||
import org.navalplanner.business.orders.daos.IOrderElementDAO;
|
||||
|
|
@ -55,6 +56,7 @@ import org.navalplanner.ws.workreports.api.WorkReportDTO;
|
|||
import org.navalplanner.ws.workreports.api.WorkReportLineDTO;
|
||||
import org.navalplanner.ws.workreports.api.WorkReportListDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -89,60 +91,91 @@ public class WorkReportServiceTest {
|
|||
@Autowired
|
||||
private IWorkReportTypeDAO workReportTypeDAO;
|
||||
|
||||
@Autowired
|
||||
private IAdHocTransactionService adHocTransaction;
|
||||
|
||||
@Autowired
|
||||
private IWorkReportDAO workReportDAO;
|
||||
|
||||
private Worker givenWorkerStored() {
|
||||
Worker worker = Worker.create("Firstname", "Surname", "NIF-"
|
||||
+ UUID.randomUUID());
|
||||
private final String workReportTypeCode = "TypeCode-A";
|
||||
|
||||
private final String workReportTypeCode2 = "TypeCode-B";
|
||||
|
||||
private final String workReportTypeCode3 = "TypeCode-C";
|
||||
|
||||
private final String workReportTypeCode4 = "TypeCode-C";
|
||||
|
||||
private final String resourceCode = "ResourceCode-A";
|
||||
|
||||
private final String orderElementCode = "OrderElementCode-A";
|
||||
|
||||
private final String typeOfWorkHoursCode = "TypeOfWorkHoursCode-A";
|
||||
|
||||
@Test
|
||||
@Rollback(false)
|
||||
public void givenWorkerStored() {
|
||||
Worker worker = Worker.create("Firstname", "Surname", resourceCode);
|
||||
workerDAO.save(worker);
|
||||
workerDAO.flush();
|
||||
sessionFactory.getCurrentSession().evict(worker);
|
||||
|
||||
worker.dontPoseAsTransientObjectAnymore();
|
||||
|
||||
return worker;
|
||||
}
|
||||
|
||||
private OrderLine givenOrderLineStored() {
|
||||
@Test
|
||||
@Rollback(false)
|
||||
public void givenOrderLineStored() {
|
||||
OrderLine orderLine = OrderLine.create();
|
||||
orderLine.setCode("order-line-code-" + UUID.randomUUID());
|
||||
orderLine.setName("order-line-name");
|
||||
orderLine.setCode(orderElementCode);
|
||||
orderLine.setName("order-line-name" + UUID.randomUUID());
|
||||
|
||||
orderElementDAO.save(orderLine);
|
||||
orderElementDAO.flush();
|
||||
sessionFactory.getCurrentSession().evict(orderLine);
|
||||
|
||||
orderLine.dontPoseAsTransientObjectAnymore();
|
||||
|
||||
return orderLine;
|
||||
}
|
||||
|
||||
private TypeOfWorkHours givenTypeOfWorkHoursStored() {
|
||||
@Test
|
||||
@Rollback(false)
|
||||
public void givenTypeOfWorkHoursStored() {
|
||||
TypeOfWorkHours typeOfWorkHours = TypeOfWorkHours.create();
|
||||
typeOfWorkHours.setCode("type-of-work-hours-code-" + UUID.randomUUID());
|
||||
typeOfWorkHours.setName("type-of-work-hours-name");
|
||||
typeOfWorkHours.setCode(typeOfWorkHoursCode);
|
||||
typeOfWorkHours.setName("type-of-work-hours-name-" + UUID.randomUUID());
|
||||
|
||||
typeOfWorkHoursDAO.save(typeOfWorkHours);
|
||||
typeOfWorkHoursDAO.flush();
|
||||
sessionFactory.getCurrentSession().evict(typeOfWorkHours);
|
||||
|
||||
typeOfWorkHours.dontPoseAsTransientObjectAnymore();
|
||||
|
||||
return typeOfWorkHours;
|
||||
}
|
||||
|
||||
private WorkReportType givenWorkReportTypeStored() {
|
||||
return givenWorkReportTypeStored(false, false, false, null);
|
||||
@Test
|
||||
@Rollback(false)
|
||||
public void givenWorkReportTypeStored() {
|
||||
givenWorkReportTypeStored(false, false, false, null, workReportTypeCode);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback(false)
|
||||
public void givenWorkReportTypeStored2() {
|
||||
givenWorkReportTypeStored(true, false, false, null, workReportTypeCode2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Rollback(false)
|
||||
public void givenWorkReportTypeStored3() {
|
||||
givenWorkReportTypeStored(false, false, false,
|
||||
HoursManagementEnum.HOURS_CALCULATED_BY_CLOCK,
|
||||
workReportTypeCode3);
|
||||
}
|
||||
|
||||
private WorkReportType givenWorkReportTypeStored(boolean dateShared,
|
||||
boolean orderElementShared, boolean resourceShared,
|
||||
HoursManagementEnum hoursManagement) {
|
||||
HoursManagementEnum hoursManagement, String workReportTypeCode) {
|
||||
WorkReportType workReportType = WorkReportType.create();
|
||||
workReportType.setCode("type-of-work-hours-code-" + UUID.randomUUID());
|
||||
workReportType.setName("type-of-work-hours-name");
|
||||
workReportType.setCode(workReportTypeCode);
|
||||
workReportType.setName(workReportTypeCode);
|
||||
|
||||
workReportType.setDateIsSharedByLines(dateShared);
|
||||
workReportType.setOrderElementIsSharedInLines(orderElementShared);
|
||||
|
|
@ -165,32 +198,30 @@ public class WorkReportServiceTest {
|
|||
WorkReportLineDTO workReportLineDTO = new WorkReportLineDTO();
|
||||
|
||||
workReportLineDTO.code = "work-report-line-code-" + UUID.randomUUID();
|
||||
workReportLineDTO.resource = givenWorkerStored().getNif();
|
||||
workReportLineDTO.orderElement = givenOrderLineStored().getCode();
|
||||
workReportLineDTO.resource = resourceCode;
|
||||
workReportLineDTO.orderElement = orderElementCode;
|
||||
workReportLineDTO.date = new Date();
|
||||
workReportLineDTO.typeOfWorkHours = givenTypeOfWorkHoursStored()
|
||||
.getCode();
|
||||
workReportLineDTO.typeOfWorkHours = typeOfWorkHoursCode;
|
||||
workReportLineDTO.numHours = 8;
|
||||
|
||||
return workReportLineDTO;
|
||||
}
|
||||
|
||||
private WorkReportDTO createWorkReportDTO(WorkReportType workReportType) {
|
||||
private WorkReportDTO createWorkReportDTO(String type) {
|
||||
WorkReportDTO workReportDTO = new WorkReportDTO();
|
||||
workReportDTO.code = "work-report-code-" + UUID.randomUUID();
|
||||
workReportDTO.workReportType = workReportType.getCode();
|
||||
|
||||
workReportDTO.workReportType = type;
|
||||
workReportDTO.workReportLines.add(createWorkReportLineDTO());
|
||||
|
||||
return workReportDTO;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void importValidWorkReport() {
|
||||
int previous = workReportDAO.getAll().size();
|
||||
|
||||
WorkReportListDTO workReportListDTO = new WorkReportListDTO(Arrays
|
||||
.asList(createWorkReportDTO(givenWorkReportTypeStored())));
|
||||
.asList(createWorkReportDTO(workReportTypeCode)));
|
||||
|
||||
InstanceConstraintViolationsListDTO instanceConstraintViolationsListDTO = workReportService
|
||||
.addWorkReports(workReportListDTO);
|
||||
|
|
@ -200,10 +231,12 @@ public class WorkReportServiceTest {
|
|||
List<WorkReport> workReports = workReportDAO.getAll();
|
||||
assertThat(workReports.size(), equalTo(previous + 1));
|
||||
|
||||
Set<WorkReportLine> workReportLines = workReports.get(previous).getWorkReportLines();
|
||||
Set<WorkReportLine> workReportLines = workReports.get(previous)
|
||||
.getWorkReportLines();
|
||||
assertThat(workReportLines.size(), equalTo(1));
|
||||
|
||||
assertThat(workReportLines.iterator().next().getNumHours(), equalTo(8));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -211,8 +244,7 @@ public class WorkReportServiceTest {
|
|||
int previous = workReportDAO.getAll().size();
|
||||
|
||||
WorkReportListDTO workReportListDTO = new WorkReportListDTO(Arrays
|
||||
.asList(createWorkReportDTO(givenWorkReportTypeStored(true,
|
||||
false, false, null))));
|
||||
.asList(createWorkReportDTO(workReportTypeCode2)));
|
||||
|
||||
InstanceConstraintViolationsListDTO instanceConstraintViolationsListDTO = workReportService
|
||||
.addWorkReports(workReportListDTO);
|
||||
|
|
@ -227,8 +259,7 @@ public class WorkReportServiceTest {
|
|||
public void importValidWorkReportWithDateAtWorkReportLevel() {
|
||||
int previous = workReportDAO.getAll().size();
|
||||
|
||||
WorkReportDTO workReportDTO = createWorkReportDTO(givenWorkReportTypeStored(
|
||||
true, false, false, null));
|
||||
WorkReportDTO workReportDTO = createWorkReportDTO(workReportTypeCode2);
|
||||
Date date = new Date();
|
||||
workReportDTO.date = date;
|
||||
|
||||
|
|
@ -253,9 +284,7 @@ public class WorkReportServiceTest {
|
|||
int previous = workReportDAO.getAll().size();
|
||||
|
||||
WorkReportListDTO workReportListDTO = new WorkReportListDTO(Arrays
|
||||
.asList(createWorkReportDTO(givenWorkReportTypeStored(false,
|
||||
false, false,
|
||||
HoursManagementEnum.HOURS_CALCULATED_BY_CLOCK))));
|
||||
.asList(createWorkReportDTO(workReportTypeCode3)));
|
||||
|
||||
InstanceConstraintViolationsListDTO instanceConstraintViolationsListDTO = workReportService
|
||||
.addWorkReports(workReportListDTO);
|
||||
|
|
@ -270,9 +299,7 @@ public class WorkReportServiceTest {
|
|||
public void importValidWorkReportCalculatedHours() {
|
||||
int previous = workReportDAO.getAll().size();
|
||||
|
||||
WorkReportDTO workReportDTO = createWorkReportDTO(givenWorkReportTypeStored(
|
||||
false, false, false,
|
||||
HoursManagementEnum.HOURS_CALCULATED_BY_CLOCK));
|
||||
WorkReportDTO workReportDTO = createWorkReportDTO(workReportTypeCode3);
|
||||
WorkReportLineDTO workReportLineDTO = workReportDTO.workReportLines
|
||||
.iterator().next();
|
||||
|
||||
|
|
@ -301,4 +328,38 @@ public class WorkReportServiceTest {
|
|||
equalTo(hours));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional
|
||||
public void importAndUpdateValidWorkReport() {
|
||||
int previous = workReportDAO.getAll().size();
|
||||
|
||||
WorkReportDTO workReportDTO = createWorkReportDTO(workReportTypeCode);
|
||||
WorkReportListDTO workReportListDTO = new WorkReportListDTO(Arrays
|
||||
.asList(workReportDTO));
|
||||
|
||||
InstanceConstraintViolationsListDTO instanceConstraintViolationsListDTO = workReportService
|
||||
.addWorkReports(workReportListDTO);
|
||||
assertThat(
|
||||
instanceConstraintViolationsListDTO.instanceConstraintViolationsList
|
||||
.size(), equalTo(0));
|
||||
List<WorkReport> workReports = workReportDAO.getAll();
|
||||
assertThat(workReports.size(), equalTo(previous + 1));
|
||||
|
||||
Set<WorkReportLine> workReportLines = workReports.get(previous)
|
||||
.getWorkReportLines();
|
||||
assertThat(workReportLines.size(), equalTo(1));
|
||||
|
||||
assertThat(workReportLines.iterator().next().getNumHours(), equalTo(8));
|
||||
|
||||
workReportDTO.workReportLines.add(createWorkReportLineDTO());
|
||||
WorkReportListDTO workReportListDTO2 = new WorkReportListDTO(Arrays
|
||||
.asList(workReportDTO));
|
||||
instanceConstraintViolationsListDTO = workReportService
|
||||
.addWorkReports(workReportListDTO2);
|
||||
|
||||
assertThat(
|
||||
instanceConstraintViolationsListDTO.instanceConstraintViolationsList
|
||||
.size(), equalTo(0));
|
||||
|
||||
}
|
||||
}
|
||||
21
scripts/rest-clients/export-work-reports.sh
Executable file
21
scripts/rest-clients/export-work-reports.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./rest-common-env.sh
|
||||
|
||||
printf "Login name: "
|
||||
read loginName
|
||||
printf "Password: "
|
||||
read password
|
||||
|
||||
if [ "$1" = "--prod" ]; then
|
||||
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
|
||||
certificate=$PRODUCTION_CERTIFICATE
|
||||
else
|
||||
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
|
||||
certificate=$DEVELOPMENT_CERTIFICATE
|
||||
fi
|
||||
|
||||
authorization=`./base64.sh $loginName:$password`
|
||||
|
||||
curl -sv -X GET $certificate --header "Authorization: Basic $authorization" \
|
||||
$baseServiceURL/workreports | tidy -xml -i -q -utf8
|
||||
33
scripts/rest-clients/import-work-reports.sh
Executable file
33
scripts/rest-clients/import-work-reports.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
. ./rest-common-env.sh
|
||||
|
||||
printf "Login name: "
|
||||
read loginName
|
||||
printf "Password: "
|
||||
read password
|
||||
|
||||
baseServiceURL=$DEVELOPMENT_BASE_SERVICE_URL
|
||||
certificate=$DEVELOPMENT_CERTIFICATE
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
if [ "$i" = "--prod" ]; then
|
||||
baseServiceURL=$PRODUCTION_BASE_SERVICE_URL
|
||||
certificate=$PRODUCTION_CERTIFICATE
|
||||
else
|
||||
file=$i
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$file" = "" ]; then
|
||||
printf "Missing file\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
authorization=`./base64.sh $loginName:$password`
|
||||
|
||||
curl -sv -X POST $certificate -d @$file \
|
||||
--header "Content-type: application/xml" \
|
||||
--header "Authorization: Basic $authorization" \
|
||||
$baseServiceURL/workreports | tidy -xml -i -q -utf8
|
||||
59
scripts/rest-clients/workReportsSample.xml
Normal file
59
scripts/rest-clients/workReportsSample.xml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<work-report-list xmlns="http://rest.ws.navalplanner.org">
|
||||
<work-report work-order="proxecto-00006-00009"
|
||||
resource="30303030D" date="2010-03-09T00:00:00+01:00"
|
||||
work-report-type="codeXX"
|
||||
code="c3573671-1245-4b49-91b2-2f0914a5cf8b">
|
||||
<label-list>
|
||||
<label code="b2b9cdee-2785-4c03-8e01-cec0a93b61aa" />
|
||||
</label-list>
|
||||
<work-report-line-list>
|
||||
<work-report-line hours="4"
|
||||
finish-hour="2010-03-08T05:00:00+01:00"
|
||||
start-hour="2010-03-08T01:00:00+01:00" hour-type="Normal"
|
||||
work-order="proxecto-00006-00009" resource="30303030D"
|
||||
date="2010-03-09T00:00:00+01:00"
|
||||
code="77011765-2d77-4350-b315-84435d065a60">
|
||||
<label-list>
|
||||
<label code="774e42b9-c35c-4de2-a20b-487ff1c413ef" />
|
||||
</label-list>
|
||||
</work-report-line>
|
||||
<work-report-line hours="6"
|
||||
finish-hour="2010-03-08T07:00:00+01:00"
|
||||
start-hour="2010-03-08T01:00:00+01:00" hour-type="Normal"
|
||||
work-order="proxecto-00006-00009" resource="30303030D"
|
||||
date="2010-03-09T00:00:00+01:00"
|
||||
code="77011765-2d77-4350-b315-84435d065555">
|
||||
<label-list>
|
||||
<label code="a6256552-5ac7-46a7-95d6-8b8c8b415c65" />
|
||||
</label-list>
|
||||
</work-report-line>
|
||||
</work-report-line-list>
|
||||
</work-report>
|
||||
<work-report work-order="proxecto-00001-00002"
|
||||
resource="66666666F" date="2010-03-18T00:00:00+01:00"
|
||||
work-report-type="codeXY"
|
||||
code="e230a3b4-3848-4ea9-9e7b-2c21e246200e">
|
||||
<text-field-list>
|
||||
<text-field value="oooh!" name="campoH" />
|
||||
</text-field-list>
|
||||
<work-report-line-list>
|
||||
<work-report-line hours="12" hour-type="Normal"
|
||||
work-order="proxecto-00001-00002" resource="66666666F"
|
||||
date="2010-03-18T00:00:00+01:00"
|
||||
code="89ec8b66-5c21-4076-a06f-22f8e190dd36">
|
||||
<text-field-list>
|
||||
<text-field value="aaaaa" name="campoA" />
|
||||
</text-field-list>
|
||||
</work-report-line>
|
||||
<work-report-line hours="15" hour-type="Normal"
|
||||
work-order="proxecto-00001-00002" resource="66666666F"
|
||||
date="2010-03-18T00:00:00+01:00"
|
||||
code="89ec8b66-5c21-4076-a06f-22f8e190dd98">
|
||||
<text-field-list>
|
||||
<text-field value="xxxxx" name="campoA" />
|
||||
</text-field-list>
|
||||
</work-report-line>
|
||||
</work-report-line-list>
|
||||
</work-report>
|
||||
</work-report-list>
|
||||
Loading…
Add table
Reference in a new issue