XDRHelper { public static List<String> getIntendedRecepients(ProvideAndRegisterDocumentSetRequestType body) { List<String> result = new ArrayList<>(); LOG.debug("begin getIntendedRecepients()"); if (body != null && body.getSubmitObjectsRequest() != null) { RegistryObjectListType regList = body.getSubmitObjectsRequest().getRegistryObjectList(); for (int x = 0; x < regList.getIdentifiable().size(); x++) { if (regList.getIdentifiable().get(x).getDeclaredType().equals(ExtrinsicObjectType.class)) { ExtrinsicObjectType extObj = (ExtrinsicObjectType) regList.getIdentifiable().get(x).getValue(); SlotType1 recipSlot = getNamedSlotItem(extObj.getSlot(), XDS_INTENDED_RECIPIENT_SLOT); if (recipSlot != null) { result = recipSlot.getValueList().getValue(); LOG.info("Intended Recipients: {}", result); } } } } LOG.debug("Found {} recipients", result.size()); return result; }  static RegistryResponseType createErrorResponse(RegistryErrorList errorList); static RegistryResponseType createPositiveAck(); RegistryErrorList validateDocumentMetaData(ProvideAndRegisterDocumentSetRequestType body); static List<String> getIntendedRecepients(ProvideAndRegisterDocumentSetRequestType body); static List<String> getRoutingBeans(List<String> intendedRecipients); static String getSubmissionSetPatientId(ProvideAndRegisterDocumentSetRequestType body); static String getSourcePatientId(ProvideAndRegisterDocumentSetRequestType body); static final String XDR_EC_XDSMissingDocument; static final String XDR_EC_XDSMissingDocumentMetadata; static final String XDR_EC_XDSUnknownPatientId; static final String XDR_EC_XDSPatientIdDoesNotMatch; static final String XDS_RETRIEVE_RESPONSE_STATUS_FAILURE; static final String XDS_RETRIEVE_RESPONSE_STATUS_SUCCESS; static final String XDS_SOURCE_PATIENT_ID_SLOT; static final String XDS_INTENDED_RECIPIENT_SLOT; }
@Test public void testgetIntendedRecepients_Null() { System.out.println("testgetIntendedRecepients_Null"); ProvideAndRegisterDocumentSetRequestType body = null; XDRHelper instance = createHelper(); List<String> result = instance.getIntendedRecepients(body); assertTrue(result.isEmpty()); }
@Test public void testgetIntendedRecepients_NullSubmitObj() { System.out.println("testgetIntendedRecepients_NullSubmitObj"); ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper().getSampleMessage(); XDRHelper instance = createHelper(); body.setSubmitObjectsRequest(null); List<String> result = instance.getIntendedRecepients(body); assertTrue(result.isEmpty()); }
@Test public void testgetIntendedRecepients_Valid() { System.out.println("testgetIntendedRecepients_Valid"); ProvideAndRegisterDocumentSetRequestType body = new XDRMessageHelper() .getSampleMessage("ProvideAndRegisterDocumentSet-IntendedRecpient.xml"); XDRHelper instance = createHelper(); List<String> result = instance.getIntendedRecepients(body); assertNotNull(result); assertEquals(4, result.size()); }