@Test public void testFilterByPatientAndAuthor2() throws XdsbRepositoryAdapterException { RetrieveDocumentSetResponse response = mock(RetrieveDocumentSetResponse.class); String patientId = "1"; String authorNPI = "2"; LinkedList<DocumentResponse> docList = new LinkedList<DocumentResponse>(); when(response.getDocumentResponse()).thenReturn(docList); retrieveDocumentSetResponseFilter.filterByPatientAndAuthor(response, patientId, authorNPI); }
@Loggable public RetrieveDocumentSetResponse filterByPatientAndAuthor( RetrieveDocumentSetResponse response, String patientId, String authorNPI) throws XdsbRepositoryAdapterException { LinkedList<DocumentResponse> removeList = new LinkedList<DocumentResponse>(); for (DocumentResponse docResponse : response.getDocumentResponse()) { try { String docString = new String(docResponse.getDocument()); String xPathExpr = " String attributeName = "extension"; String xPathExpr2 = " String attributeName2 = "extension"; String docPatientId = getAttributeValue(docString, xPathExpr, attributeName); String docAuthorNPI = getAttributeValue(docString, xPathExpr2, attributeName2); if (!patientId.equals(docPatientId) || !authorNPI.equals(docAuthorNPI)) { removeList.add(docResponse); } } catch (NoDocumentFoundException ndf) { logger.error(ndf.getMessage() + patientId); response = xdsbErrorFactory.noClinicalDocumentFound(patientId, authorNPI); } catch (DocumentXmlConverterException | XPathExpressionException e) { logger.error(e.getMessage()); throw new XdsbRepositoryAdapterException(e); } } if (removeList.size() > 0) { response.getDocumentResponse().removeAll(removeList); response = xdsbErrorFactory .setRetrieveDocumentSetResponseRegistryErrorListFilteredByPatientAndAuthor( response, removeList.size(), patientId, authorNPI); } return response; }
RetrieveDocumentSetResponseFilter { @Loggable public RetrieveDocumentSetResponse filterByPatientAndAuthor( RetrieveDocumentSetResponse response, String patientId, String authorNPI) throws XdsbRepositoryAdapterException { LinkedList<DocumentResponse> removeList = new LinkedList<DocumentResponse>(); for (DocumentResponse docResponse : response.getDocumentResponse()) { try { String docString = new String(docResponse.getDocument()); String xPathExpr = " String attributeName = "extension"; String xPathExpr2 = " String attributeName2 = "extension"; String docPatientId = getAttributeValue(docString, xPathExpr, attributeName); String docAuthorNPI = getAttributeValue(docString, xPathExpr2, attributeName2); if (!patientId.equals(docPatientId) || !authorNPI.equals(docAuthorNPI)) { removeList.add(docResponse); } } catch (NoDocumentFoundException ndf) { logger.error(ndf.getMessage() + patientId); response = xdsbErrorFactory.noClinicalDocumentFound(patientId, authorNPI); } catch (DocumentXmlConverterException | XPathExpressionException e) { logger.error(e.getMessage()); throw new XdsbRepositoryAdapterException(e); } } if (removeList.size() > 0) { response.getDocumentResponse().removeAll(removeList); response = xdsbErrorFactory .setRetrieveDocumentSetResponseRegistryErrorListFilteredByPatientAndAuthor( response, removeList.size(), patientId, authorNPI); } return response; } }
RetrieveDocumentSetResponseFilter { @Loggable public RetrieveDocumentSetResponse filterByPatientAndAuthor( RetrieveDocumentSetResponse response, String patientId, String authorNPI) throws XdsbRepositoryAdapterException { LinkedList<DocumentResponse> removeList = new LinkedList<DocumentResponse>(); for (DocumentResponse docResponse : response.getDocumentResponse()) { try { String docString = new String(docResponse.getDocument()); String xPathExpr = " String attributeName = "extension"; String xPathExpr2 = " String attributeName2 = "extension"; String docPatientId = getAttributeValue(docString, xPathExpr, attributeName); String docAuthorNPI = getAttributeValue(docString, xPathExpr2, attributeName2); if (!patientId.equals(docPatientId) || !authorNPI.equals(docAuthorNPI)) { removeList.add(docResponse); } } catch (NoDocumentFoundException ndf) { logger.error(ndf.getMessage() + patientId); response = xdsbErrorFactory.noClinicalDocumentFound(patientId, authorNPI); } catch (DocumentXmlConverterException | XPathExpressionException e) { logger.error(e.getMessage()); throw new XdsbRepositoryAdapterException(e); } } if (removeList.size() > 0) { response.getDocumentResponse().removeAll(removeList); response = xdsbErrorFactory .setRetrieveDocumentSetResponseRegistryErrorListFilteredByPatientAndAuthor( response, removeList.size(), patientId, authorNPI); } return response; } RetrieveDocumentSetResponseFilter(DocumentXmlConverter converter,
			DocumentAccessor documentAccessor, XdsbErrorFactory xdsbErrorFactory); }
RetrieveDocumentSetResponseFilter { @Loggable public RetrieveDocumentSetResponse filterByPatientAndAuthor( RetrieveDocumentSetResponse response, String patientId, String authorNPI) throws XdsbRepositoryAdapterException { LinkedList<DocumentResponse> removeList = new LinkedList<DocumentResponse>(); for (DocumentResponse docResponse : response.getDocumentResponse()) { try { String docString = new String(docResponse.getDocument()); String xPathExpr = " String attributeName = "extension"; String xPathExpr2 = " String attributeName2 = "extension"; String docPatientId = getAttributeValue(docString, xPathExpr, attributeName); String docAuthorNPI = getAttributeValue(docString, xPathExpr2, attributeName2); if (!patientId.equals(docPatientId) || !authorNPI.equals(docAuthorNPI)) { removeList.add(docResponse); } } catch (NoDocumentFoundException ndf) { logger.error(ndf.getMessage() + patientId); response = xdsbErrorFactory.noClinicalDocumentFound(patientId, authorNPI); } catch (DocumentXmlConverterException | XPathExpressionException e) { logger.error(e.getMessage()); throw new XdsbRepositoryAdapterException(e); } } if (removeList.size() > 0) { response.getDocumentResponse().removeAll(removeList); response = xdsbErrorFactory .setRetrieveDocumentSetResponseRegistryErrorListFilteredByPatientAndAuthor( response, removeList.size(), patientId, authorNPI); } return response; } RetrieveDocumentSetResponseFilter(DocumentXmlConverter converter,
			DocumentAccessor documentAccessor, XdsbErrorFactory xdsbErrorFactory); @Loggable RetrieveDocumentSetResponse filterByPatientAndAuthor(
			RetrieveDocumentSetResponse response, String patientId,
			String authorNPI); }
RetrieveDocumentSetResponseFilter { @Loggable public RetrieveDocumentSetResponse filterByPatientAndAuthor( RetrieveDocumentSetResponse response, String patientId, String authorNPI) throws XdsbRepositoryAdapterException { LinkedList<DocumentResponse> removeList = new LinkedList<DocumentResponse>(); for (DocumentResponse docResponse : response.getDocumentResponse()) { try { String docString = new String(docResponse.getDocument()); String xPathExpr = " String attributeName = "extension"; String xPathExpr2 = " String attributeName2 = "extension"; String docPatientId = getAttributeValue(docString, xPathExpr, attributeName); String docAuthorNPI = getAttributeValue(docString, xPathExpr2, attributeName2); if (!patientId.equals(docPatientId) || !authorNPI.equals(docAuthorNPI)) { removeList.add(docResponse); } } catch (NoDocumentFoundException ndf) { logger.error(ndf.getMessage() + patientId); response = xdsbErrorFactory.noClinicalDocumentFound(patientId, authorNPI); } catch (DocumentXmlConverterException | XPathExpressionException e) { logger.error(e.getMessage()); throw new XdsbRepositoryAdapterException(e); } } if (removeList.size() > 0) { response.getDocumentResponse().removeAll(removeList); response = xdsbErrorFactory .setRetrieveDocumentSetResponseRegistryErrorListFilteredByPatientAndAuthor( response, removeList.size(), patientId, authorNPI); } return response; } RetrieveDocumentSetResponseFilter(DocumentXmlConverter converter,
			DocumentAccessor documentAccessor, XdsbErrorFactory xdsbErrorFactory); @Loggable RetrieveDocumentSetResponse filterByPatientAndAuthor(
			RetrieveDocumentSetResponse response, String patientId,
			String authorNPI);  }