@Test public void testRetrieveVlerDocumentList() { VlerQuery query = new VlerQuery(); query.setPatientIds(new PatientIds.Builder() .pid(pid) .icn(icn) .uid(uid) .build()); VLERDocQueryResponse vlerDocQueryResponse = retrieveVlerDocumentService.retrieveVlerDocumentList(query); List<VLERDoc> list = vlerDocQueryResponse.getDocumentList(); assertThat(1, is(list.size())); for(VLERDoc vlerDoc:list) { assertThat(testDocumentUniqueId, is(vlerDoc.getDocumentUniqueId())); assertThat(testHomeCommunityId, is(vlerDoc.getHomeCommunityId())); assertThat(testName, is(vlerDoc.getName())); assertThat(testRepositoryUniqueId, is(vlerDoc.getRepositoryUniqueId())); assertThat(testSourcePatientId, is(vlerDoc.getSourcePatientId())); assertThat(testDocDateTime, is(vlerDoc.getCreationTime())); assertThat(testAuthorInstitution, is(vlerDoc.getAuthorList().get(0).getName())); assertThat(testAuthorName, is(vlerDoc.getAuthorList().get(0).getInstitution())); } }
@Override public VLERDocQueryResponse retrieveVlerDocumentList(VlerQuery vlerQuery) { logger.debug("retrieveVlerDocumentList begin"); if (vlerQuery == null || vlerQuery.getPatientIds() == null || StringUtils.isBlank(vlerQuery.getPatientIds().getIcn())) throw new IllegalArgumentException("Patient Ids icn is null or missing"); VLERDocQueryResponse vlerDocQueryResponse = new VLERDocQueryResponse(); try { RespondingGatewayCrossGatewayQueryRequestType qrt = generateDocumentQuery( vlerQuery.getPatientIds().getIcn(), nhinAdapterCfg.getSystemUserName(), nhinAdapterCfg.getSystemSiteCode()); AdhocQueryResponse aqr = entityDocQuery.respondingGatewayCrossGatewayQuery(qrt); RegistryObjectListType rolt = aqr.getRegistryObjectList(); ObjectRefType objectRef; ExtrinsicObjectType extrinsicObject; if((aqr.getTotalResultCount() != null) && (aqr.getTotalResultCount().intValue() == 0) && (aqr.getRegistryErrorList() != null)) { for (RegistryError re : aqr.getRegistryErrorList().getRegistryError()) { if(re != null){ vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg(re.getErrorCode() + " :: " + "Error: " + re.getCodeContext() + "::" + re.getValue()); logger.error(vlerDocQueryResponse.getErrorMsg()); } else { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response"); logger.error(vlerDocQueryResponse.getErrorMsg()); } } } else if(aqr.getTotalResultCount() == null && aqr.getStatus() != null && aqr.getStatus().indexOf("Success") > 0) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty response; most likely no patient correlation."); logger.error(vlerDocQueryResponse.getErrorMsg()); } else if(aqr.getTotalResultCount() == null) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response."); logger.error(vlerDocQueryResponse.getErrorMsg()); } if(rolt != null){ List<JAXBElement<? extends IdentifiableType >> jbList = rolt.getIdentifiable(); for( JAXBElement <? extends IdentifiableType> jaxb : jbList) { if (jaxb.getValue() instanceof ObjectRefType) { objectRef = (ObjectRefType) jaxb.getValue(); if (objectRef != null && (objectRef.getHome() == null || objectRef.getHome().isEmpty())) { objectRef.setHome("test"); } } if (jaxb.getValue() instanceof ExtrinsicObjectType) { extrinsicObject = (ExtrinsicObjectType) jaxb.getValue(); if (extrinsicObject != null && (extrinsicObject.getHome() != null && !extrinsicObject.getHome().isEmpty())) { VLERDoc vDoc = new VLERDoc(); vDoc.setDocumentUniqueId(""); vDoc.setHomeCommunityId(extrinsicObject.getHome()); vDoc.setRepositoryUniqueId(""); vDoc.setName(extrinsicObject.getName().getLocalizedString().get(0).getValue()); for(SlotType1 st1 : extrinsicObject.getSlot()) { if(SOURCE_PATIENT_ID.equalsIgnoreCase(st1.getName())) { vDoc.setSourcePatientId(st1.getValueList().getValue().get(0)); } else if(REPOSITORY_UNIQUE_ID.equalsIgnoreCase(st1.getName())) { vDoc.setRepositoryUniqueId(st1.getValueList().getValue().get(0)); } else if(CREATION_TIME.equalsIgnoreCase(st1.getName())) { vDoc.setCreationTime(st1.getValueList().getValue().get(0)); } } for(ExternalIdentifierType it : extrinsicObject.getExternalIdentifier()) { if(DOCUMENT_UNIQUE_ID.equalsIgnoreCase(it.getName().getLocalizedString().get(0).getValue())) { vDoc.setDocumentUniqueId(it.getValue()); } } List<Author> authorList = new ArrayList<Author>(); for(ClassificationType ct : extrinsicObject.getClassification()) { if(AUTHOR_INFORMATION.equals(ct.getClassificationScheme())) { Author docAuth = new Author(); for(SlotType1 st : ct.getSlot()) { if( !st.getValueList().getValue().isEmpty()) { if(AUTHOR_PERSON.equalsIgnoreCase(st.getName()) ) { docAuth.setName(st.getValueList().getValue().get(0)); } else if(AUTHOR_INSTITUTION.equalsIgnoreCase(st.getName())) { docAuth.setInstitution(st.getValueList().getValue().get(0)); } } } authorList.add(docAuth); } } vDoc.getAuthorList().addAll(authorList); vlerDocQueryResponse.getDocumentList().add(vDoc); } } } } } catch (RuntimeException e) { if(e.getCause() instanceof ConnectException) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + e.getMessage()); logger.error(vlerDocQueryResponse.getErrorMsg()); return vlerDocQueryResponse; } throw new VlerDocumentException(e); } catch (Exception e) { logger.error("Error performing VLER Document Query: " + e.getMessage()); throw new VlerDocumentException(e); } return vlerDocQueryResponse; }
RetrieveVlerDocumentService implements IRetrieveVlerDocumentService { @Override public VLERDocQueryResponse retrieveVlerDocumentList(VlerQuery vlerQuery) { logger.debug("retrieveVlerDocumentList begin"); if (vlerQuery == null || vlerQuery.getPatientIds() == null || StringUtils.isBlank(vlerQuery.getPatientIds().getIcn())) throw new IllegalArgumentException("Patient Ids icn is null or missing"); VLERDocQueryResponse vlerDocQueryResponse = new VLERDocQueryResponse(); try { RespondingGatewayCrossGatewayQueryRequestType qrt = generateDocumentQuery( vlerQuery.getPatientIds().getIcn(), nhinAdapterCfg.getSystemUserName(), nhinAdapterCfg.getSystemSiteCode()); AdhocQueryResponse aqr = entityDocQuery.respondingGatewayCrossGatewayQuery(qrt); RegistryObjectListType rolt = aqr.getRegistryObjectList(); ObjectRefType objectRef; ExtrinsicObjectType extrinsicObject; if((aqr.getTotalResultCount() != null) && (aqr.getTotalResultCount().intValue() == 0) && (aqr.getRegistryErrorList() != null)) { for (RegistryError re : aqr.getRegistryErrorList().getRegistryError()) { if(re != null){ vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg(re.getErrorCode() + " :: " + "Error: " + re.getCodeContext() + "::" + re.getValue()); logger.error(vlerDocQueryResponse.getErrorMsg()); } else { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response"); logger.error(vlerDocQueryResponse.getErrorMsg()); } } } else if(aqr.getTotalResultCount() == null && aqr.getStatus() != null && aqr.getStatus().indexOf("Success") > 0) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty response; most likely no patient correlation."); logger.error(vlerDocQueryResponse.getErrorMsg()); } else if(aqr.getTotalResultCount() == null) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response."); logger.error(vlerDocQueryResponse.getErrorMsg()); } if(rolt != null){ List<JAXBElement<? extends IdentifiableType >> jbList = rolt.getIdentifiable(); for( JAXBElement <? extends IdentifiableType> jaxb : jbList) { if (jaxb.getValue() instanceof ObjectRefType) { objectRef = (ObjectRefType) jaxb.getValue(); if (objectRef != null && (objectRef.getHome() == null || objectRef.getHome().isEmpty())) { objectRef.setHome("test"); } } if (jaxb.getValue() instanceof ExtrinsicObjectType) { extrinsicObject = (ExtrinsicObjectType) jaxb.getValue(); if (extrinsicObject != null && (extrinsicObject.getHome() != null && !extrinsicObject.getHome().isEmpty())) { VLERDoc vDoc = new VLERDoc(); vDoc.setDocumentUniqueId(""); vDoc.setHomeCommunityId(extrinsicObject.getHome()); vDoc.setRepositoryUniqueId(""); vDoc.setName(extrinsicObject.getName().getLocalizedString().get(0).getValue()); for(SlotType1 st1 : extrinsicObject.getSlot()) { if(SOURCE_PATIENT_ID.equalsIgnoreCase(st1.getName())) { vDoc.setSourcePatientId(st1.getValueList().getValue().get(0)); } else if(REPOSITORY_UNIQUE_ID.equalsIgnoreCase(st1.getName())) { vDoc.setRepositoryUniqueId(st1.getValueList().getValue().get(0)); } else if(CREATION_TIME.equalsIgnoreCase(st1.getName())) { vDoc.setCreationTime(st1.getValueList().getValue().get(0)); } } for(ExternalIdentifierType it : extrinsicObject.getExternalIdentifier()) { if(DOCUMENT_UNIQUE_ID.equalsIgnoreCase(it.getName().getLocalizedString().get(0).getValue())) { vDoc.setDocumentUniqueId(it.getValue()); } } List<Author> authorList = new ArrayList<Author>(); for(ClassificationType ct : extrinsicObject.getClassification()) { if(AUTHOR_INFORMATION.equals(ct.getClassificationScheme())) { Author docAuth = new Author(); for(SlotType1 st : ct.getSlot()) { if( !st.getValueList().getValue().isEmpty()) { if(AUTHOR_PERSON.equalsIgnoreCase(st.getName()) ) { docAuth.setName(st.getValueList().getValue().get(0)); } else if(AUTHOR_INSTITUTION.equalsIgnoreCase(st.getName())) { docAuth.setInstitution(st.getValueList().getValue().get(0)); } } } authorList.add(docAuth); } } vDoc.getAuthorList().addAll(authorList); vlerDocQueryResponse.getDocumentList().add(vDoc); } } } } } catch (RuntimeException e) { if(e.getCause() instanceof ConnectException) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + e.getMessage()); logger.error(vlerDocQueryResponse.getErrorMsg()); return vlerDocQueryResponse; } throw new VlerDocumentException(e); } catch (Exception e) { logger.error("Error performing VLER Document Query: " + e.getMessage()); throw new VlerDocumentException(e); } return vlerDocQueryResponse; } }
RetrieveVlerDocumentService implements IRetrieveVlerDocumentService { @Override public VLERDocQueryResponse retrieveVlerDocumentList(VlerQuery vlerQuery) { logger.debug("retrieveVlerDocumentList begin"); if (vlerQuery == null || vlerQuery.getPatientIds() == null || StringUtils.isBlank(vlerQuery.getPatientIds().getIcn())) throw new IllegalArgumentException("Patient Ids icn is null or missing"); VLERDocQueryResponse vlerDocQueryResponse = new VLERDocQueryResponse(); try { RespondingGatewayCrossGatewayQueryRequestType qrt = generateDocumentQuery( vlerQuery.getPatientIds().getIcn(), nhinAdapterCfg.getSystemUserName(), nhinAdapterCfg.getSystemSiteCode()); AdhocQueryResponse aqr = entityDocQuery.respondingGatewayCrossGatewayQuery(qrt); RegistryObjectListType rolt = aqr.getRegistryObjectList(); ObjectRefType objectRef; ExtrinsicObjectType extrinsicObject; if((aqr.getTotalResultCount() != null) && (aqr.getTotalResultCount().intValue() == 0) && (aqr.getRegistryErrorList() != null)) { for (RegistryError re : aqr.getRegistryErrorList().getRegistryError()) { if(re != null){ vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg(re.getErrorCode() + " :: " + "Error: " + re.getCodeContext() + "::" + re.getValue()); logger.error(vlerDocQueryResponse.getErrorMsg()); } else { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response"); logger.error(vlerDocQueryResponse.getErrorMsg()); } } } else if(aqr.getTotalResultCount() == null && aqr.getStatus() != null && aqr.getStatus().indexOf("Success") > 0) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty response; most likely no patient correlation."); logger.error(vlerDocQueryResponse.getErrorMsg()); } else if(aqr.getTotalResultCount() == null) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response."); logger.error(vlerDocQueryResponse.getErrorMsg()); } if(rolt != null){ List<JAXBElement<? extends IdentifiableType >> jbList = rolt.getIdentifiable(); for( JAXBElement <? extends IdentifiableType> jaxb : jbList) { if (jaxb.getValue() instanceof ObjectRefType) { objectRef = (ObjectRefType) jaxb.getValue(); if (objectRef != null && (objectRef.getHome() == null || objectRef.getHome().isEmpty())) { objectRef.setHome("test"); } } if (jaxb.getValue() instanceof ExtrinsicObjectType) { extrinsicObject = (ExtrinsicObjectType) jaxb.getValue(); if (extrinsicObject != null && (extrinsicObject.getHome() != null && !extrinsicObject.getHome().isEmpty())) { VLERDoc vDoc = new VLERDoc(); vDoc.setDocumentUniqueId(""); vDoc.setHomeCommunityId(extrinsicObject.getHome()); vDoc.setRepositoryUniqueId(""); vDoc.setName(extrinsicObject.getName().getLocalizedString().get(0).getValue()); for(SlotType1 st1 : extrinsicObject.getSlot()) { if(SOURCE_PATIENT_ID.equalsIgnoreCase(st1.getName())) { vDoc.setSourcePatientId(st1.getValueList().getValue().get(0)); } else if(REPOSITORY_UNIQUE_ID.equalsIgnoreCase(st1.getName())) { vDoc.setRepositoryUniqueId(st1.getValueList().getValue().get(0)); } else if(CREATION_TIME.equalsIgnoreCase(st1.getName())) { vDoc.setCreationTime(st1.getValueList().getValue().get(0)); } } for(ExternalIdentifierType it : extrinsicObject.getExternalIdentifier()) { if(DOCUMENT_UNIQUE_ID.equalsIgnoreCase(it.getName().getLocalizedString().get(0).getValue())) { vDoc.setDocumentUniqueId(it.getValue()); } } List<Author> authorList = new ArrayList<Author>(); for(ClassificationType ct : extrinsicObject.getClassification()) { if(AUTHOR_INFORMATION.equals(ct.getClassificationScheme())) { Author docAuth = new Author(); for(SlotType1 st : ct.getSlot()) { if( !st.getValueList().getValue().isEmpty()) { if(AUTHOR_PERSON.equalsIgnoreCase(st.getName()) ) { docAuth.setName(st.getValueList().getValue().get(0)); } else if(AUTHOR_INSTITUTION.equalsIgnoreCase(st.getName())) { docAuth.setInstitution(st.getValueList().getValue().get(0)); } } } authorList.add(docAuth); } } vDoc.getAuthorList().addAll(authorList); vlerDocQueryResponse.getDocumentList().add(vDoc); } } } } } catch (RuntimeException e) { if(e.getCause() instanceof ConnectException) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + e.getMessage()); logger.error(vlerDocQueryResponse.getErrorMsg()); return vlerDocQueryResponse; } throw new VlerDocumentException(e); } catch (Exception e) { logger.error("Error performing VLER Document Query: " + e.getMessage()); throw new VlerDocumentException(e); } return vlerDocQueryResponse; } @Autowired  RetrieveVlerDocumentService(NhinAdapterCfg nhinAdapterCfg); }
RetrieveVlerDocumentService implements IRetrieveVlerDocumentService { @Override public VLERDocQueryResponse retrieveVlerDocumentList(VlerQuery vlerQuery) { logger.debug("retrieveVlerDocumentList begin"); if (vlerQuery == null || vlerQuery.getPatientIds() == null || StringUtils.isBlank(vlerQuery.getPatientIds().getIcn())) throw new IllegalArgumentException("Patient Ids icn is null or missing"); VLERDocQueryResponse vlerDocQueryResponse = new VLERDocQueryResponse(); try { RespondingGatewayCrossGatewayQueryRequestType qrt = generateDocumentQuery( vlerQuery.getPatientIds().getIcn(), nhinAdapterCfg.getSystemUserName(), nhinAdapterCfg.getSystemSiteCode()); AdhocQueryResponse aqr = entityDocQuery.respondingGatewayCrossGatewayQuery(qrt); RegistryObjectListType rolt = aqr.getRegistryObjectList(); ObjectRefType objectRef; ExtrinsicObjectType extrinsicObject; if((aqr.getTotalResultCount() != null) && (aqr.getTotalResultCount().intValue() == 0) && (aqr.getRegistryErrorList() != null)) { for (RegistryError re : aqr.getRegistryErrorList().getRegistryError()) { if(re != null){ vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg(re.getErrorCode() + " :: " + "Error: " + re.getCodeContext() + "::" + re.getValue()); logger.error(vlerDocQueryResponse.getErrorMsg()); } else { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response"); logger.error(vlerDocQueryResponse.getErrorMsg()); } } } else if(aqr.getTotalResultCount() == null && aqr.getStatus() != null && aqr.getStatus().indexOf("Success") > 0) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty response; most likely no patient correlation."); logger.error(vlerDocQueryResponse.getErrorMsg()); } else if(aqr.getTotalResultCount() == null) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response."); logger.error(vlerDocQueryResponse.getErrorMsg()); } if(rolt != null){ List<JAXBElement<? extends IdentifiableType >> jbList = rolt.getIdentifiable(); for( JAXBElement <? extends IdentifiableType> jaxb : jbList) { if (jaxb.getValue() instanceof ObjectRefType) { objectRef = (ObjectRefType) jaxb.getValue(); if (objectRef != null && (objectRef.getHome() == null || objectRef.getHome().isEmpty())) { objectRef.setHome("test"); } } if (jaxb.getValue() instanceof ExtrinsicObjectType) { extrinsicObject = (ExtrinsicObjectType) jaxb.getValue(); if (extrinsicObject != null && (extrinsicObject.getHome() != null && !extrinsicObject.getHome().isEmpty())) { VLERDoc vDoc = new VLERDoc(); vDoc.setDocumentUniqueId(""); vDoc.setHomeCommunityId(extrinsicObject.getHome()); vDoc.setRepositoryUniqueId(""); vDoc.setName(extrinsicObject.getName().getLocalizedString().get(0).getValue()); for(SlotType1 st1 : extrinsicObject.getSlot()) { if(SOURCE_PATIENT_ID.equalsIgnoreCase(st1.getName())) { vDoc.setSourcePatientId(st1.getValueList().getValue().get(0)); } else if(REPOSITORY_UNIQUE_ID.equalsIgnoreCase(st1.getName())) { vDoc.setRepositoryUniqueId(st1.getValueList().getValue().get(0)); } else if(CREATION_TIME.equalsIgnoreCase(st1.getName())) { vDoc.setCreationTime(st1.getValueList().getValue().get(0)); } } for(ExternalIdentifierType it : extrinsicObject.getExternalIdentifier()) { if(DOCUMENT_UNIQUE_ID.equalsIgnoreCase(it.getName().getLocalizedString().get(0).getValue())) { vDoc.setDocumentUniqueId(it.getValue()); } } List<Author> authorList = new ArrayList<Author>(); for(ClassificationType ct : extrinsicObject.getClassification()) { if(AUTHOR_INFORMATION.equals(ct.getClassificationScheme())) { Author docAuth = new Author(); for(SlotType1 st : ct.getSlot()) { if( !st.getValueList().getValue().isEmpty()) { if(AUTHOR_PERSON.equalsIgnoreCase(st.getName()) ) { docAuth.setName(st.getValueList().getValue().get(0)); } else if(AUTHOR_INSTITUTION.equalsIgnoreCase(st.getName())) { docAuth.setInstitution(st.getValueList().getValue().get(0)); } } } authorList.add(docAuth); } } vDoc.getAuthorList().addAll(authorList); vlerDocQueryResponse.getDocumentList().add(vDoc); } } } } } catch (RuntimeException e) { if(e.getCause() instanceof ConnectException) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + e.getMessage()); logger.error(vlerDocQueryResponse.getErrorMsg()); return vlerDocQueryResponse; } throw new VlerDocumentException(e); } catch (Exception e) { logger.error("Error performing VLER Document Query: " + e.getMessage()); throw new VlerDocumentException(e); } return vlerDocQueryResponse; } @Autowired  RetrieveVlerDocumentService(NhinAdapterCfg nhinAdapterCfg); void setEntityDocQuery(EntityDocQueryPortType entityDocQuery); void setEntityDocRetrieve(EntityDocRetrievePortType entityDocRetrieve); Future<VLERDocRetrieveResponse> retrieveVlerDocument(VlerQuery vlerQuery); @Override VLERDocQueryResponse retrieveVlerDocumentList(VlerQuery vlerQuery); }
RetrieveVlerDocumentService implements IRetrieveVlerDocumentService { @Override public VLERDocQueryResponse retrieveVlerDocumentList(VlerQuery vlerQuery) { logger.debug("retrieveVlerDocumentList begin"); if (vlerQuery == null || vlerQuery.getPatientIds() == null || StringUtils.isBlank(vlerQuery.getPatientIds().getIcn())) throw new IllegalArgumentException("Patient Ids icn is null or missing"); VLERDocQueryResponse vlerDocQueryResponse = new VLERDocQueryResponse(); try { RespondingGatewayCrossGatewayQueryRequestType qrt = generateDocumentQuery( vlerQuery.getPatientIds().getIcn(), nhinAdapterCfg.getSystemUserName(), nhinAdapterCfg.getSystemSiteCode()); AdhocQueryResponse aqr = entityDocQuery.respondingGatewayCrossGatewayQuery(qrt); RegistryObjectListType rolt = aqr.getRegistryObjectList(); ObjectRefType objectRef; ExtrinsicObjectType extrinsicObject; if((aqr.getTotalResultCount() != null) && (aqr.getTotalResultCount().intValue() == 0) && (aqr.getRegistryErrorList() != null)) { for (RegistryError re : aqr.getRegistryErrorList().getRegistryError()) { if(re != null){ vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg(re.getErrorCode() + " :: " + "Error: " + re.getCodeContext() + "::" + re.getValue()); logger.error(vlerDocQueryResponse.getErrorMsg()); } else { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response"); logger.error(vlerDocQueryResponse.getErrorMsg()); } } } else if(aqr.getTotalResultCount() == null && aqr.getStatus() != null && aqr.getStatus().indexOf("Success") > 0) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty response; most likely no patient correlation."); logger.error(vlerDocQueryResponse.getErrorMsg()); } else if(aqr.getTotalResultCount() == null) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + "The server returned an empty/invalid response."); logger.error(vlerDocQueryResponse.getErrorMsg()); } if(rolt != null){ List<JAXBElement<? extends IdentifiableType >> jbList = rolt.getIdentifiable(); for( JAXBElement <? extends IdentifiableType> jaxb : jbList) { if (jaxb.getValue() instanceof ObjectRefType) { objectRef = (ObjectRefType) jaxb.getValue(); if (objectRef != null && (objectRef.getHome() == null || objectRef.getHome().isEmpty())) { objectRef.setHome("test"); } } if (jaxb.getValue() instanceof ExtrinsicObjectType) { extrinsicObject = (ExtrinsicObjectType) jaxb.getValue(); if (extrinsicObject != null && (extrinsicObject.getHome() != null && !extrinsicObject.getHome().isEmpty())) { VLERDoc vDoc = new VLERDoc(); vDoc.setDocumentUniqueId(""); vDoc.setHomeCommunityId(extrinsicObject.getHome()); vDoc.setRepositoryUniqueId(""); vDoc.setName(extrinsicObject.getName().getLocalizedString().get(0).getValue()); for(SlotType1 st1 : extrinsicObject.getSlot()) { if(SOURCE_PATIENT_ID.equalsIgnoreCase(st1.getName())) { vDoc.setSourcePatientId(st1.getValueList().getValue().get(0)); } else if(REPOSITORY_UNIQUE_ID.equalsIgnoreCase(st1.getName())) { vDoc.setRepositoryUniqueId(st1.getValueList().getValue().get(0)); } else if(CREATION_TIME.equalsIgnoreCase(st1.getName())) { vDoc.setCreationTime(st1.getValueList().getValue().get(0)); } } for(ExternalIdentifierType it : extrinsicObject.getExternalIdentifier()) { if(DOCUMENT_UNIQUE_ID.equalsIgnoreCase(it.getName().getLocalizedString().get(0).getValue())) { vDoc.setDocumentUniqueId(it.getValue()); } } List<Author> authorList = new ArrayList<Author>(); for(ClassificationType ct : extrinsicObject.getClassification()) { if(AUTHOR_INFORMATION.equals(ct.getClassificationScheme())) { Author docAuth = new Author(); for(SlotType1 st : ct.getSlot()) { if( !st.getValueList().getValue().isEmpty()) { if(AUTHOR_PERSON.equalsIgnoreCase(st.getName()) ) { docAuth.setName(st.getValueList().getValue().get(0)); } else if(AUTHOR_INSTITUTION.equalsIgnoreCase(st.getName())) { docAuth.setInstitution(st.getValueList().getValue().get(0)); } } } authorList.add(docAuth); } } vDoc.getAuthorList().addAll(authorList); vlerDocQueryResponse.getDocumentList().add(vDoc); } } } } } catch (RuntimeException e) { if(e.getCause() instanceof ConnectException) { vlerDocQueryResponse.setError(true); vlerDocQueryResponse.setErrorMsg("VLER Document Query Error" + " :: " + e.getMessage()); logger.error(vlerDocQueryResponse.getErrorMsg()); return vlerDocQueryResponse; } throw new VlerDocumentException(e); } catch (Exception e) { logger.error("Error performing VLER Document Query: " + e.getMessage()); throw new VlerDocumentException(e); } return vlerDocQueryResponse; } @Autowired  RetrieveVlerDocumentService(NhinAdapterCfg nhinAdapterCfg); void setEntityDocQuery(EntityDocQueryPortType entityDocQuery); void setEntityDocRetrieve(EntityDocRetrievePortType entityDocRetrieve); Future<VLERDocRetrieveResponse> retrieveVlerDocument(VlerQuery vlerQuery); @Override VLERDocQueryResponse retrieveVlerDocumentList(VlerQuery vlerQuery);  }