Source:
public FindDevicesResponse findDevices(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindDevicesRequest request) throws OsgpException { LOGGER.info("Find devices for organisation: {}.", organisationIdentification); final FindDevicesResponse response = new FindDevicesResponse(); try { final PageSpecifier pageSpecifier = this.pageFrom(request); Page<org.opensmartgridplatform.domain.core.entities.Device> result = this.deviceManagementService .findDevices(organisationIdentification, pageSpecifier, deviceFilterFrom(request)); if (result != null && response.getDevices() != null) { response.getDevices().addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); response.setPage(new org.opensmartgridplatform.adapter.ws.schema.core.common.Page()); response.getPage().setPageSize(result.getSize()); response.getPage().setTotalPages(result.getTotalPages()); response.getPage().setCurrentPage(result.getNumber()); } if (request.isUsePages() != null && !request.isUsePages()) { int calls = 0; while ((calls += 1) < result.getTotalPages()) { request.setPage(calls); result = this.deviceManagementService.findDevices(organisationIdentification, pageSpecifier, deviceFilterFrom(request)); response.getDevices() .addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); } } } catch (final MethodConstraintViolationException e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations())); } catch (final Exception e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); this.handleException(e); } return response; }

Target:
public FindDevicesResponse findDevices(@OrganisationIdentification final String organisationIdentification, @RequestPayload final FindDevicesRequest request) throws OsgpException { LOGGER.info("Find devices for organisation: {}.", organisationIdentification); final FindDevicesResponse response = new FindDevicesResponse(); try { final PageSpecifier pageSpecifier = this.pageFrom(request); Page<org.opensmartgridplatform.domain.core.entities.Device> result = this.deviceManagementService .findDevices(organisationIdentification, pageSpecifier, this.deviceFilterFrom(request)); if (result != null && response.getDevices() != null) { response.getDevices().addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); response.setPage(new org.opensmartgridplatform.adapter.ws.schema.core.common.Page()); response.getPage().setPageSize(result.getSize()); response.getPage().setTotalPages(result.getTotalPages()); response.getPage().setCurrentPage(result.getNumber()); } if (request.isUsePages() != null && !request.isUsePages()) { int calls = 0; while ((calls += 1) < result.getTotalPages()) { request.setPage(calls); result = this.deviceManagementService.findDevices(organisationIdentification, pageSpecifier, this.deviceFilterFrom(request)); response.getDevices() .addAll(this.deviceManagementMapper.mapAsList(result.getContent(), Device.class)); } } } catch (final MethodConstraintViolationException e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations())); } catch (final Exception e) { LOGGER.error(EXCEPTION, e.getMessage(), e.getStackTrace(), e); this.handleException(e); } return response; }