@Test public void testNullAndEmptyVlerDocumentList() { when(mockDocQueryResponse.getDocumentList()).thenReturn(null); PatientIds patientIds = new PatientIds.Builder() .pid(pid) .icn(icn) .uid(uid) .build(); List<VistaDataChunk> vistaDataChunkList = vlerService.fetchVlerData(patientIds); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); when(mockDocQueryResponse.getDocumentList()).thenReturn(new ArrayList<VLERDoc>()); assertNotNull(vistaDataChunkList); assertThat(vistaDataChunkList.size(), is(0)); }
public List<VistaDataChunk> fetchVlerData(PatientIds patientIds) { LOG.debug("VlerService.fetchVlerData - Entering method..."); if (patientIds == null || StringUtils.isBlank(patientIds.getIcn())) throw new IllegalArgumentException("Missing patient icn"); List<VistaDataChunk> vlerDocChunks = new ArrayList<>(); VlerQuery query = new VlerQuery(); query.setPatientIds(patientIds); List<VLERDoc> vlerDocuments = retrieveVlerDocuments(query); LOG.debug("VlerService.fetchVlerData: " + ((vlerDocuments == null) ? "NO" : "" + vlerDocuments.size()) + " results retrieved from JMeadows."); if ((vlerDocuments != null) && (vlerDocuments.size() > 0)) { int curVlerDocIdx = 1; for (VLERDoc vlerDocument : vlerDocuments) { LOG.debug("VlerService.fetchVlerData: Found VLER Document - Processing it... idx: " + curVlerDocIdx); VistaDataChunk vlerDocChunk = transformVlerDocChunk(vlerDocument, query.getPatientIds(), vlerDocuments.size(), curVlerDocIdx); if (vlerDocChunk != null) { vlerDocChunks.add(vlerDocChunk); curVlerDocIdx++; } } } return vlerDocChunks; }
VlerService implements IVlerService { public List<VistaDataChunk> fetchVlerData(PatientIds patientIds) { LOG.debug("VlerService.fetchVlerData - Entering method..."); if (patientIds == null || StringUtils.isBlank(patientIds.getIcn())) throw new IllegalArgumentException("Missing patient icn"); List<VistaDataChunk> vlerDocChunks = new ArrayList<>(); VlerQuery query = new VlerQuery(); query.setPatientIds(patientIds); List<VLERDoc> vlerDocuments = retrieveVlerDocuments(query); LOG.debug("VlerService.fetchVlerData: " + ((vlerDocuments == null) ? "NO" : "" + vlerDocuments.size()) + " results retrieved from JMeadows."); if ((vlerDocuments != null) && (vlerDocuments.size() > 0)) { int curVlerDocIdx = 1; for (VLERDoc vlerDocument : vlerDocuments) { LOG.debug("VlerService.fetchVlerData: Found VLER Document - Processing it... idx: " + curVlerDocIdx); VistaDataChunk vlerDocChunk = transformVlerDocChunk(vlerDocument, query.getPatientIds(), vlerDocuments.size(), curVlerDocIdx); if (vlerDocChunk != null) { vlerDocChunks.add(vlerDocChunk); curVlerDocIdx++; } } } return vlerDocChunks; } }
VlerService implements IVlerService { public List<VistaDataChunk> fetchVlerData(PatientIds patientIds) { LOG.debug("VlerService.fetchVlerData - Entering method..."); if (patientIds == null || StringUtils.isBlank(patientIds.getIcn())) throw new IllegalArgumentException("Missing patient icn"); List<VistaDataChunk> vlerDocChunks = new ArrayList<>(); VlerQuery query = new VlerQuery(); query.setPatientIds(patientIds); List<VLERDoc> vlerDocuments = retrieveVlerDocuments(query); LOG.debug("VlerService.fetchVlerData: " + ((vlerDocuments == null) ? "NO" : "" + vlerDocuments.size()) + " results retrieved from JMeadows."); if ((vlerDocuments != null) && (vlerDocuments.size() > 0)) { int curVlerDocIdx = 1; for (VLERDoc vlerDocument : vlerDocuments) { LOG.debug("VlerService.fetchVlerData: Found VLER Document - Processing it... idx: " + curVlerDocIdx); VistaDataChunk vlerDocChunk = transformVlerDocChunk(vlerDocument, query.getPatientIds(), vlerDocuments.size(), curVlerDocIdx); if (vlerDocChunk != null) { vlerDocChunks.add(vlerDocChunk); curVlerDocIdx++; } } } return vlerDocChunks; } @Autowired  VlerService(IRetrieveVlerDocumentService vlerDocumentService); }
VlerService implements IVlerService { public List<VistaDataChunk> fetchVlerData(PatientIds patientIds) { LOG.debug("VlerService.fetchVlerData - Entering method..."); if (patientIds == null || StringUtils.isBlank(patientIds.getIcn())) throw new IllegalArgumentException("Missing patient icn"); List<VistaDataChunk> vlerDocChunks = new ArrayList<>(); VlerQuery query = new VlerQuery(); query.setPatientIds(patientIds); List<VLERDoc> vlerDocuments = retrieveVlerDocuments(query); LOG.debug("VlerService.fetchVlerData: " + ((vlerDocuments == null) ? "NO" : "" + vlerDocuments.size()) + " results retrieved from JMeadows."); if ((vlerDocuments != null) && (vlerDocuments.size() > 0)) { int curVlerDocIdx = 1; for (VLERDoc vlerDocument : vlerDocuments) { LOG.debug("VlerService.fetchVlerData: Found VLER Document - Processing it... idx: " + curVlerDocIdx); VistaDataChunk vlerDocChunk = transformVlerDocChunk(vlerDocument, query.getPatientIds(), vlerDocuments.size(), curVlerDocIdx); if (vlerDocChunk != null) { vlerDocChunks.add(vlerDocChunk); curVlerDocIdx++; } } } return vlerDocChunks; } @Autowired  VlerService(IRetrieveVlerDocumentService vlerDocumentService); List<VistaDataChunk> fetchVlerData(PatientIds patientIds); }
VlerService implements IVlerService { public List<VistaDataChunk> fetchVlerData(PatientIds patientIds) { LOG.debug("VlerService.fetchVlerData - Entering method..."); if (patientIds == null || StringUtils.isBlank(patientIds.getIcn())) throw new IllegalArgumentException("Missing patient icn"); List<VistaDataChunk> vlerDocChunks = new ArrayList<>(); VlerQuery query = new VlerQuery(); query.setPatientIds(patientIds); List<VLERDoc> vlerDocuments = retrieveVlerDocuments(query); LOG.debug("VlerService.fetchVlerData: " + ((vlerDocuments == null) ? "NO" : "" + vlerDocuments.size()) + " results retrieved from JMeadows."); if ((vlerDocuments != null) && (vlerDocuments.size() > 0)) { int curVlerDocIdx = 1; for (VLERDoc vlerDocument : vlerDocuments) { LOG.debug("VlerService.fetchVlerData: Found VLER Document - Processing it... idx: " + curVlerDocIdx); VistaDataChunk vlerDocChunk = transformVlerDocChunk(vlerDocument, query.getPatientIds(), vlerDocuments.size(), curVlerDocIdx); if (vlerDocChunk != null) { vlerDocChunks.add(vlerDocChunk); curVlerDocIdx++; } } } return vlerDocChunks; } @Autowired  VlerService(IRetrieveVlerDocumentService vlerDocumentService); List<VistaDataChunk> fetchVlerData(PatientIds patientIds); static final String DOMAIN_VLER_DOCUMENT; }