[Bug #1177] Allows to insert EffortDuration instead of hours in webservices

FEA: ItEr75S04BugFixing
This commit is contained in:
Ignacio Diaz Teijido 2011-09-22 16:07:14 +02:00 committed by Manuel Rego Casasnovas
parent 0e4088215c
commit bc4fbb417d
4 changed files with 15 additions and 9 deletions

View file

@ -73,7 +73,10 @@ public class OneOrderElementPerWorkReportLine implements
@Override
public String getOrderElementCodesBound(
IWorkReportsElements workReportEntity) {
return workReportEntity.getOrderElement().getCode();
if (workReportEntity.getOrderElement() != null)
return workReportEntity.getOrderElement().getCode();
else
return "";
}
@Override

View file

@ -67,7 +67,7 @@ public class WorkReportLineDTO extends IntegrationEntityDTO implements
public XMLGregorianCalendar clockFinish;
@XmlAttribute(name = "hours")
public Integer numHours;
public String numHours;
@XmlElementWrapper(name = "label-list")
@XmlElement(name = "label")
@ -84,7 +84,7 @@ public class WorkReportLineDTO extends IntegrationEntityDTO implements
String resource,
String orderElement, String typeOfWorkHours,
XMLGregorianCalendar clockStart, XMLGregorianCalendar clockFinish,
Integer numHours, Set<LabelReferenceDTO> labels,
String numHours, Set<LabelReferenceDTO> labels,
Set<DescriptionValueDTO> descriptionValues) {
super(code);
this.date = date;

View file

@ -40,6 +40,7 @@ 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.workingday.EffortDuration;
import org.navalplanner.business.workreports.entities.WorkReport;
import org.navalplanner.business.workreports.entities.WorkReportLine;
import org.navalplanner.business.workreports.entities.WorkReportType;
@ -136,7 +137,8 @@ public final class WorkReportConverter {
// Mandatory fields
workReportLine.setCode(workReportLineDTO.code);
workReportLine.setNumHours(workReportLineDTO.numHours);
workReportLine.setEffort(EffortDuration
.parseFromFormattedString(workReportLineDTO.numHours));
if (workReportLineDTO.typeOfWorkHours != null) {
try {
@ -299,9 +301,9 @@ public final class WorkReportConverter {
.getClockFinish());
}
Integer numHours = null;
if(line.getNumHours() != null){
numHours = line.getNumHours();
String numHours = null;
if (line.getEffort() != null) {
numHours = line.getEffort().toFormattedString();
}
Set<LabelReferenceDTO> labelDTOs = LabelReferenceConverter.toDTO(line
@ -536,7 +538,8 @@ public final class WorkReportConverter {
}
if (workReportLineDTO.numHours != null) {
workReportLine.setNumHours(workReportLineDTO.numHours);
workReportLine.setEffort(EffortDuration
.parseFromFormattedString(workReportLineDTO.numHours));
}
}

View file

@ -313,7 +313,7 @@ public class WorkReportServiceTest {
workReportLineDTO.date = DateConverter
.toXMLGregorianCalendar(new Date());
workReportLineDTO.typeOfWorkHours = typeOfWorkHoursCode;
workReportLineDTO.numHours = 8;
workReportLineDTO.numHours = "8:15";
return workReportLineDTO;
}