XdsbRegistryAdapter { public List<String> findDeprecatedDocumentUniqueIds( String submissionSetPatientId, String submissionSetAuthorPerson, String messageId) throws XdsbRegistryAdapterException { submissionSetPatientId = submissionSetPatientId.replaceAll("&(?!amp;)", "&amp;"); submissionSetAuthorPerson = submissionSetAuthorPerson.replaceAll( "&(?!amp;)", "&amp;"); List<String> deprecatedDocumentUniqueIds = new LinkedList<String>(); AdhocQueryResponse findSubmissionSetsResponse = findSubmissionSets( submissionSetPatientId, submissionSetAuthorPerson); List<String> submissionSetUniqueIds = extractSubmissionSetUniqueIds(findSubmissionSetsResponse); for (String submissionSetUniqueId : submissionSetUniqueIds) { AdhocQueryResponse getSubmissionSetAndContentsResponse = getSubmissionSetAndContents( submissionSetUniqueId, messageId); String deprecatedDocumentUniqueId = extractDeprecatedDocumentUniqueId( getSubmissionSetAndContentsResponse, messageId); if (deprecatedDocumentUniqueId != null) { deprecatedDocumentUniqueIds.add(deprecatedDocumentUniqueId); } } return deprecatedDocumentUniqueIds; } XdsbRegistryAdapter(XdsbRegistryWebServiceClient xdsbRegistry,
			AdhocQueryResponseFilter responseFilter,
			SimpleMarshaller marshaller,
			DocumentXmlConverter documentXmlConverter,
			DocumentAccessor documentAccessor); AdhocQueryResponse registryStoredQuery(
			AdhocQueryRequest adhocQueryRequest); AdhocQueryResponse registryStoredQuery(String patientId,
			String domainId, String authorId,
			XdsbDocumentType xdsbDocumentType, boolean serviceTimeAware,
			String messageId); AdhocQueryResponse registryStoredQuery(String patientUniqueId,
			String authorNPI, XdsbDocumentType xdsbDocumentType,
			boolean serviceTimeAware, String messageId); AdhocQueryResponse registryStoredQuery(AdhocQueryRequest req,
			String authorNPI, String messageId); List<String> findDeprecatedDocumentUniqueIds(
			String submissionSetPatientId, String submissionSetAuthorPerson,
			String messageId); AdhocQueryResponse findSubmissionSets(String submissionSetPatientId,
			String submissionSetAuthorPerson); AdhocQueryResponse getSubmissionSetAndContents(
			String submissionSetUniqueId, String messageId); List<String> extractSubmissionSetUniqueIds(
			AdhocQueryResponse response); String extractDeprecatedDocumentUniqueId(
			AdhocQueryResponse response, String messageId); List<XdsbDocumentReference> extractXdsbDocumentReferenceList(
			AdhocQueryResponse adhocQueryResponse); RetrieveDocumentSetRequest extractXdsbDocumentReferenceListAsRetrieveDocumentSetRequest(
			AdhocQueryResponse adhocQueryResponse); String extractPatientId(AdhocQueryRequest req); String extractFormatCode(AdhocQueryRequest req); String extractResponseOptionReturnType(AdhocQueryRequest req); String extractDocumentEntryStatus(AdhocQueryRequest req); String getPatientUniqueId(String patientId, String domainId); static final String FORMAT_CODE_CLINICAL_DOCUMENT; static final String FORMAT_CODE_PRIVACY_CONSENT; static final String SLOT_NAME_XDS_DOCUMENT_ENTRY_FORMAT_CODE; static final String SLOT_NAME_XDS_DOCUMENT_ENTRY_PATIENT_ID; static final String SLOT_NAME_XDS_DOCUMENT_ENTRY_STATUS; static final String UUID_XDS_DOCUMENTENTRY; static final String UUID_XDS_DOCUMENTENTRY_UNIQUEID; static final String UUID_XDS_DOCUMENTENTRY_AUTHOR; static final String UUID_XDS_SUBMISSION_SET_UNIQUEID; }
@Test public void testFindDeprecatedDocumentUniqueIds() throws Throwable { String submissionSetPatientIdMock = "submissionSetPatientIdMock"; String submissionSetAuthorPersonMock = "submissionSetAuthorPersonMock"; AdhocQueryRequest findSubmissionSetsRequestMock = mock(AdhocQueryRequest.class); AdhocQueryResponse findSubmissionSetsResponseMock = mock(AdhocQueryResponse.class); AdhocQueryRequest getSubmissionSetAndContentsRequestMock = mock(AdhocQueryRequest.class); AdhocQueryResponse getSubmissionSetAndContentsResponseMock = mock(AdhocQueryResponse.class); List<String> extractSubmissionSetUniqueIdsMock = new LinkedList<String>(); String extractSubmissionSetUniqueIdMock = "extractSubmissionSetUniqueIdMock"; extractSubmissionSetUniqueIdsMock.add(extractSubmissionSetUniqueIdMock); String deprecatedDocumentUniqueIdMock = "deprecatedDocumentUniqueIdMock"; when( xdsbRegistryAdapterSpy.createFindSubmissionSetsRequest( submissionSetPatientIdMock, submissionSetAuthorPersonMock)).thenReturn( findSubmissionSetsRequestMock); when( xdsbRegistryMock .registryStoredQuery(findSubmissionSetsRequestMock)) .thenReturn(findSubmissionSetsResponseMock); doReturn(extractSubmissionSetUniqueIdsMock) .when(xdsbRegistryAdapterSpy).extractSubmissionSetUniqueIds( findSubmissionSetsResponseMock); when( xdsbRegistryAdapterSpy .createGetSubmissionSetAndContentsRequest(extractSubmissionSetUniqueIdMock, "")) .thenReturn(getSubmissionSetAndContentsRequestMock); when( xdsbRegistryMock .registryStoredQuery(getSubmissionSetAndContentsRequestMock)) .thenReturn(getSubmissionSetAndContentsResponseMock); doReturn(deprecatedDocumentUniqueIdMock).when(xdsbRegistryAdapterSpy) .extractDeprecatedDocumentUniqueId( getSubmissionSetAndContentsResponseMock, ""); List<String> result = xdsbRegistryAdapterSpy .findDeprecatedDocumentUniqueIds(submissionSetPatientIdMock, submissionSetAuthorPersonMock, ""); assertTrue(result.contains(deprecatedDocumentUniqueIdMock)); }