@Test(expected = WebCertServiceException.class) public void testListAllowedReceiversBlankIntygsId() { testee.registerApprovedReceivers("", "lijsp", Arrays.asList("FKASSA")); }
@Override public void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds) { if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); final List<ReceiverApprovalStatus> receiverApprovalStatuses = intygReceivers.stream().map(ir -> { ReceiverApprovalStatus receiverApprovalStatus = new ReceiverApprovalStatus(); receiverApprovalStatus.setReceiverId(ir.getId()); receiverApprovalStatus.setApprovalStatus(receiverIds.contains(ir.getId()) ? ApprovalStatusType.YES : ApprovalStatusType.NO); return receiverApprovalStatus; }).collect(Collectors.toList()); try { certificateSenderService.sendRegisterApprovedReceivers(intygsId, intygsTyp, objectMapper.writeValueAsString(receiverApprovalStatuses)); } catch (JsonProcessingException e) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Could not convert list of approved receivers to JSON array."); } }
CertificateReceiverServiceImpl implements CertificateReceiverService { @Override public void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds) { if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); final List<ReceiverApprovalStatus> receiverApprovalStatuses = intygReceivers.stream().map(ir -> { ReceiverApprovalStatus receiverApprovalStatus = new ReceiverApprovalStatus(); receiverApprovalStatus.setReceiverId(ir.getId()); receiverApprovalStatus.setApprovalStatus(receiverIds.contains(ir.getId()) ? ApprovalStatusType.YES : ApprovalStatusType.NO); return receiverApprovalStatus; }).collect(Collectors.toList()); try { certificateSenderService.sendRegisterApprovedReceivers(intygsId, intygsTyp, objectMapper.writeValueAsString(receiverApprovalStatuses)); } catch (JsonProcessingException e) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Could not convert list of approved receivers to JSON array."); } } }
CertificateReceiverServiceImpl implements CertificateReceiverService { @Override public void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds) { if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); final List<ReceiverApprovalStatus> receiverApprovalStatuses = intygReceivers.stream().map(ir -> { ReceiverApprovalStatus receiverApprovalStatus = new ReceiverApprovalStatus(); receiverApprovalStatus.setReceiverId(ir.getId()); receiverApprovalStatus.setApprovalStatus(receiverIds.contains(ir.getId()) ? ApprovalStatusType.YES : ApprovalStatusType.NO); return receiverApprovalStatus; }).collect(Collectors.toList()); try { certificateSenderService.sendRegisterApprovedReceivers(intygsId, intygsTyp, objectMapper.writeValueAsString(receiverApprovalStatuses)); } catch (JsonProcessingException e) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Could not convert list of approved receivers to JSON array."); } }  }
CertificateReceiverServiceImpl implements CertificateReceiverService { @Override public void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds) { if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); final List<ReceiverApprovalStatus> receiverApprovalStatuses = intygReceivers.stream().map(ir -> { ReceiverApprovalStatus receiverApprovalStatus = new ReceiverApprovalStatus(); receiverApprovalStatus.setReceiverId(ir.getId()); receiverApprovalStatus.setApprovalStatus(receiverIds.contains(ir.getId()) ? ApprovalStatusType.YES : ApprovalStatusType.NO); return receiverApprovalStatus; }).collect(Collectors.toList()); try { certificateSenderService.sendRegisterApprovedReceivers(intygsId, intygsTyp, objectMapper.writeValueAsString(receiverApprovalStatuses)); } catch (JsonProcessingException e) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Could not convert list of approved receivers to JSON array."); } }  @Override void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds); @Override List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId); @Override List<IntygReceiver> listPossibleReceivers(String intygsTyp); }
CertificateReceiverServiceImpl implements CertificateReceiverService { @Override public void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds) { if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); final List<ReceiverApprovalStatus> receiverApprovalStatuses = intygReceivers.stream().map(ir -> { ReceiverApprovalStatus receiverApprovalStatus = new ReceiverApprovalStatus(); receiverApprovalStatus.setReceiverId(ir.getId()); receiverApprovalStatus.setApprovalStatus(receiverIds.contains(ir.getId()) ? ApprovalStatusType.YES : ApprovalStatusType.NO); return receiverApprovalStatus; }).collect(Collectors.toList()); try { certificateSenderService.sendRegisterApprovedReceivers(intygsId, intygsTyp, objectMapper.writeValueAsString(receiverApprovalStatuses)); } catch (JsonProcessingException e) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.INTERNAL_PROBLEM, "Could not convert list of approved receivers to JSON array."); } }  @Override void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds); @Override List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId); @Override List<IntygReceiver> listPossibleReceivers(String intygsTyp);  }