From 4fe334f33c703239ff3d530597c6bb1cb85542c8 Mon Sep 17 00:00:00 2001 From: Susana Montes Pedreira Date: Tue, 9 Mar 2010 18:18:48 +0100 Subject: [PATCH] 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. --- .../workreports/entities/WorkReport.java | 19 + .../workreports/entities/WorkReportLine.java | 34 +- .../valueobjects/DescriptionValue.java | 1 - .../common/impl/LabelReferenceConverter.java | 8 + .../workreports/api/IWorkReportService.java | 4 +- .../workreports/impl/WorkReportConverter.java | 441 +++++++++++++++++- .../impl/WorkReportServiceREST.java | 76 +-- .../ws/workreports/WorkReportServiceTest.java | 141 ++++-- scripts/rest-clients/export-work-reports.sh | 21 + scripts/rest-clients/import-work-reports.sh | 33 ++ scripts/rest-clients/workReportsSample.xml | 59 +++ 11 files changed, 740 insertions(+), 97 deletions(-) create mode 100755 scripts/rest-clients/export-work-reports.sh create mode 100755 scripts/rest-clients/import-work-reports.sh create mode 100644 scripts/rest-clients/workReportsSample.xml diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReport.java b/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReport.java index d457d5c52..8a5b5fdb5 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReport.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReport.java @@ -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()); + + } + } diff --git a/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReportLine.java b/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReportLine.java index 31849ca71..949d92eb9 100644 --- a/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReportLine.java +++ b/navalplanner-business/src/main/java/org/navalplanner/business/workreports/entities/WorkReportLine.java @@ -280,24 +280,48 @@ public class WorkReportLine extends IntegrationEntity implements Comparable { } private void assignItsLabels(WorkReportType workReportType) { + Set