@Test(expected = WebCertServiceException.class) public void testListAllowedWithApprovedNullIntygsTyp() { testee.listPossibleReceiversWithApprovedInfo(null, "intyg-123"); }
@Override public List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId) { if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } try { List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); ListApprovedReceiversType req = new ListApprovedReceiversType(); IntygId intygId = new IntygId(); intygId.setExtension(intygsId); req.setIntygsId(intygId); ListApprovedReceiversResponseType resp = listApprovedReceiversClient.listApprovedReceivers(logicalAddress, req); for (IntygReceiver ir : intygReceivers) { boolean isHuvudmottagare = CertificateReceiverTypeType.HUVUDMOTTAGARE.name().equalsIgnoreCase(ir.getReceiverType()); ir.setApprovalStatus(resolveApprovalStatus(isHuvudmottagare, ir.getId(), resp.getReceiverList())); ir.setLocked(isHuvudmottagare); } return intygReceivers; } catch (WebServiceException wse) { LOG.warn("Caught WebServiceException fetching approved or possible receivers, only returning Huvudmottagare."); return getIntygReceiverFromEntryPoint(intygsTyp); } }
CertificateReceiverServiceImpl implements CertificateReceiverService { @Override public List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId) { if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } try { List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); ListApprovedReceiversType req = new ListApprovedReceiversType(); IntygId intygId = new IntygId(); intygId.setExtension(intygsId); req.setIntygsId(intygId); ListApprovedReceiversResponseType resp = listApprovedReceiversClient.listApprovedReceivers(logicalAddress, req); for (IntygReceiver ir : intygReceivers) { boolean isHuvudmottagare = CertificateReceiverTypeType.HUVUDMOTTAGARE.name().equalsIgnoreCase(ir.getReceiverType()); ir.setApprovalStatus(resolveApprovalStatus(isHuvudmottagare, ir.getId(), resp.getReceiverList())); ir.setLocked(isHuvudmottagare); } return intygReceivers; } catch (WebServiceException wse) { LOG.warn("Caught WebServiceException fetching approved or possible receivers, only returning Huvudmottagare."); return getIntygReceiverFromEntryPoint(intygsTyp); } } }
CertificateReceiverServiceImpl implements CertificateReceiverService { @Override public List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId) { if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } try { List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); ListApprovedReceiversType req = new ListApprovedReceiversType(); IntygId intygId = new IntygId(); intygId.setExtension(intygsId); req.setIntygsId(intygId); ListApprovedReceiversResponseType resp = listApprovedReceiversClient.listApprovedReceivers(logicalAddress, req); for (IntygReceiver ir : intygReceivers) { boolean isHuvudmottagare = CertificateReceiverTypeType.HUVUDMOTTAGARE.name().equalsIgnoreCase(ir.getReceiverType()); ir.setApprovalStatus(resolveApprovalStatus(isHuvudmottagare, ir.getId(), resp.getReceiverList())); ir.setLocked(isHuvudmottagare); } return intygReceivers; } catch (WebServiceException wse) { LOG.warn("Caught WebServiceException fetching approved or possible receivers, only returning Huvudmottagare."); return getIntygReceiverFromEntryPoint(intygsTyp); } }  }
CertificateReceiverServiceImpl implements CertificateReceiverService { @Override public List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId) { if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } try { List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); ListApprovedReceiversType req = new ListApprovedReceiversType(); IntygId intygId = new IntygId(); intygId.setExtension(intygsId); req.setIntygsId(intygId); ListApprovedReceiversResponseType resp = listApprovedReceiversClient.listApprovedReceivers(logicalAddress, req); for (IntygReceiver ir : intygReceivers) { boolean isHuvudmottagare = CertificateReceiverTypeType.HUVUDMOTTAGARE.name().equalsIgnoreCase(ir.getReceiverType()); ir.setApprovalStatus(resolveApprovalStatus(isHuvudmottagare, ir.getId(), resp.getReceiverList())); ir.setLocked(isHuvudmottagare); } return intygReceivers; } catch (WebServiceException wse) { LOG.warn("Caught WebServiceException fetching approved or possible receivers, only returning Huvudmottagare."); return getIntygReceiverFromEntryPoint(intygsTyp); } }  @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 List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId) { if (Strings.isNullOrEmpty(intygsTyp)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsTyp must be specified"); } if (Strings.isNullOrEmpty(intygsId)) { throw new WebCertServiceException(WebCertServiceErrorCodeEnum.MISSING_PARAMETER, "intygsId must be specified"); } try { List<IntygReceiver> intygReceivers = listPossibleReceivers(intygsTyp); ListApprovedReceiversType req = new ListApprovedReceiversType(); IntygId intygId = new IntygId(); intygId.setExtension(intygsId); req.setIntygsId(intygId); ListApprovedReceiversResponseType resp = listApprovedReceiversClient.listApprovedReceivers(logicalAddress, req); for (IntygReceiver ir : intygReceivers) { boolean isHuvudmottagare = CertificateReceiverTypeType.HUVUDMOTTAGARE.name().equalsIgnoreCase(ir.getReceiverType()); ir.setApprovalStatus(resolveApprovalStatus(isHuvudmottagare, ir.getId(), resp.getReceiverList())); ir.setLocked(isHuvudmottagare); } return intygReceivers; } catch (WebServiceException wse) { LOG.warn("Caught WebServiceException fetching approved or possible receivers, only returning Huvudmottagare."); return getIntygReceiverFromEntryPoint(intygsTyp); } }  @Override void registerApprovedReceivers(String intygsId, String intygsTyp, List<String> receiverIds); @Override List<IntygReceiver> listPossibleReceiversWithApprovedInfo(String intygsTyp, String intygsId); @Override List<IntygReceiver> listPossibleReceivers(String intygsTyp);  }