From 1a1302da4601d866d6f06f224e129087dccca5df Mon Sep 17 00:00:00 2001 From: Orlando M Guerreiro Date: Sat, 21 Jun 2025 23:55:23 +0100 Subject: [PATCH] =?UTF-8?q?root/resilient#12=20DashboardComponentResource.?= =?UTF-8?q?buildOrganizationComponent()=20d=C3=A1=20erro=20de=20proxy=20em?= =?UTF-8?q?=20PROD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/DashboardComponentService.java | 16 +++++++++++++++- .../web/rest/DashboardComponentResource.java | 15 +++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/oguerreiro/resilient/service/DashboardComponentService.java b/src/main/java/com/oguerreiro/resilient/service/DashboardComponentService.java index 3e812a2..8eeb794 100644 --- a/src/main/java/com/oguerreiro/resilient/service/DashboardComponentService.java +++ b/src/main/java/com/oguerreiro/resilient/service/DashboardComponentService.java @@ -33,6 +33,8 @@ import com.oguerreiro.resilient.domain.enumeration.DashboardComponentView; import com.oguerreiro.resilient.repository.DashboardComponentRepository; import com.oguerreiro.resilient.repository.OrganizationRepository; import com.oguerreiro.resilient.service.dto.DashboardComponentDTO; +import com.oguerreiro.resilient.service.dto.DashboardComponentDetailValueDTO; +import com.oguerreiro.resilient.service.mapper.DashboardComponentDetailValueMapper; import com.oguerreiro.resilient.service.mapper.DashboardComponentMapper; /** @@ -45,13 +47,25 @@ public class DashboardComponentService private OrganizationRepository organizationRepository; private DashboardComponentMapper dashboardComponentMapper; + private final DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper; public DashboardComponentService(DashboardComponentRepository dashboardComponentRepository, - DashboardComponentMapper dashboardComponentMapper, OrganizationRepository organizationRepository) { + DashboardComponentMapper dashboardComponentMapper, OrganizationRepository organizationRepository, + DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper) { super(DashboardComponent.class, dashboardComponentRepository, dashboardComponentMapper); this.organizationRepository = organizationRepository; this.dashboardComponentMapper = dashboardComponentMapper; + this.dashboardComponentDetailValueMapper = dashboardComponentDetailValueMapper; + } + + public Map> buildDashboardComponentViewDTO(Long organizationId, + Long dashboardComponentId, Long periodVersionId) { + + Map> mapValues = buildDashboardComponentView(organizationId, + dashboardComponentId, periodVersionId); + + return this.dashboardComponentDetailValueMapper.mapToDto(mapValues); } /* diff --git a/src/main/java/com/oguerreiro/resilient/web/rest/DashboardComponentResource.java b/src/main/java/com/oguerreiro/resilient/web/rest/DashboardComponentResource.java index 1724b5b..2d98ef6 100644 --- a/src/main/java/com/oguerreiro/resilient/web/rest/DashboardComponentResource.java +++ b/src/main/java/com/oguerreiro/resilient/web/rest/DashboardComponentResource.java @@ -15,13 +15,11 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.oguerreiro.resilient.domain.DashboardComponent; -import com.oguerreiro.resilient.domain.DashboardComponentDetailValue; import com.oguerreiro.resilient.domain.enumeration.DashboardComponentView; import com.oguerreiro.resilient.repository.DashboardComponentRepository; import com.oguerreiro.resilient.service.DashboardComponentService; import com.oguerreiro.resilient.service.dto.DashboardComponentDTO; import com.oguerreiro.resilient.service.dto.DashboardComponentDetailValueDTO; -import com.oguerreiro.resilient.service.mapper.DashboardComponentDetailValueMapper; /** * REST controller for managing {@link com.oguerreiro.resilient.domain.UnitType}. @@ -32,14 +30,11 @@ public class DashboardComponentResource extends AbstractResilientResource { private static final String ENTITY_NAME = "dashboardComponent"; - private final DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper; private final DashboardComponentService dashboardComponentService; public DashboardComponentResource(DashboardComponentRepository dashboardComponentRepository, - DashboardComponentService dashboardComponentService, - DashboardComponentDetailValueMapper dashboardComponentDetailValueMapper) { + DashboardComponentService dashboardComponentService) { super(DashboardComponent.class, dashboardComponentRepository, dashboardComponentService); - this.dashboardComponentDetailValueMapper = dashboardComponentDetailValueMapper; this.dashboardComponentService = dashboardComponentService; } @@ -67,10 +62,10 @@ public class DashboardComponentResource Optional dashboardComponentDTO = getDashboardComponentService().findOne( dashboardComponentId); - Map> values = getDashboardComponentService().buildDashboardComponentView( + Map> values = getDashboardComponentService().buildDashboardComponentViewDTO( null, dashboardComponentId, periodVersionId); - return this.dashboardComponentDetailValueMapper.mapToDto(values); + return values; } @GetMapping("/build/{organizationId}/{dashboardComponentId}/{periodVersionId}") @@ -82,10 +77,10 @@ public class DashboardComponentResource Optional dashboardComponentDTO = getDashboardComponentService().findOne( dashboardComponentId); - Map> values = getDashboardComponentService().buildDashboardComponentView( + Map> values = getDashboardComponentService().buildDashboardComponentViewDTO( organizationId, dashboardComponentId, periodVersionId); - return this.dashboardComponentDetailValueMapper.mapToDto(values); + return values; } @GetMapping("/active")