AdapterComponentDocRepositoryOrchImpl { public RetrieveDocumentSetResponseType documentRepositoryRetrieveDocumentSet(RetrieveDocumentSetRequestType body) { RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); String docUniqueId; String reposUniqueId; RegistryResponseType regResponse = new RegistryResponseType(); regResponse.setStatus(NhincConstants.NHINC_ADHOC_QUERY_SUCCESS_RESPONSE); response.setRegistryResponse(regResponse); RegistryErrorList regerrList = new RegistryErrorList(); if (body != null && body.getDocumentRequest() != null && !body.getDocumentRequest().isEmpty()) { String homeCommunityId = null; List<String> documentUniqueIds = new ArrayList<>(); List<String> repositoryUniqueIds = new ArrayList<>(); List<DocumentRequest> olDocRequest = body.getDocumentRequest(); Iterator<DocumentRequest> iterDocRequest = olDocRequest.iterator(); while (iterDocRequest.hasNext()) { DocumentRequest oDocRequest = iterDocRequest.next(); if (homeCommunityId == null && oDocRequest.getHomeCommunityId() != null && oDocRequest.getHomeCommunityId().length() > 0) { homeCommunityId = oDocRequest.getHomeCommunityId(); } if (oDocRequest.getDocumentUniqueId() != null && oDocRequest.getDocumentUniqueId().length() > 0 && !oDocRequest.getDocumentUniqueId().isEmpty()) { docUniqueId = StringUtil.extractStringFromTokens(oDocRequest.getDocumentUniqueId(), "'()"); documentUniqueIds.add(docUniqueId); } else { addMissingDocIdToErrorList(regResponse, regerrList); } if (oDocRequest.getRepositoryUniqueId() != null && oDocRequest.getRepositoryUniqueId().length() > 0 && !oDocRequest.getRepositoryUniqueId().isEmpty()) { reposUniqueId = StringUtil.extractStringFromTokens(oDocRequest.getRepositoryUniqueId(), "'()"); repositoryUniqueIds.add(reposUniqueId); } else { LOG.debug("RepositoryId not found"); } } if (!documentUniqueIds.isEmpty() && !repositoryUniqueIds.isEmpty()) { boolean repositoryIdMatched = true; for (String repositoryUniqueId : repositoryUniqueIds) { if (!StringUtils.equalsIgnoreCase(getDefaultRepositoryId(), repositoryUniqueId)) { repositoryIdMatched = false; LOG.warn( "Document repository message not processed due to repository unique id mismatch. Expected: {}, found: {}", getDefaultRepositoryId(), repositoryUniqueId); } } retrieveDocuments(repositoryIdMatched, documentUniqueIds, response, homeCommunityId, regerrList); } } return response; } AdapterComponentDocRepositoryOrchImpl(); DocumentService getDocumentService(); LargeFileUtils getLargeFileUtils(); UTCDateUtil getDateUtil(); RetrieveDocumentSetResponseType documentRepositoryRetrieveDocumentSet(RetrieveDocumentSetRequestType body); RegistryResponseType registerDocumentSet(RegisterDocumentSetRequestType body); RegistryResponseType documentRepositoryProvideAndRegisterDocumentSet(
        ProvideAndRegisterDocumentSetRequestType body); DocumentMetadata saveExtrinsicObject(ExtrinsicObjectType extrinsicObject, RegistryErrorList errorList,
        Map<String, DataHandler> docMap, boolean hasReplacementRequest);  }
@Test public void testDocumentRepositoryRetrieveDocumentSet_Success() { AdapterComponentDocRepositoryOrchImpl docRepo = getDocRepoWithEmptyRetrieveDocuments(); RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); response = docRepo.documentRepositoryRetrieveDocumentSet(createDocumentRequest_Success()); assertSame("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", response.getRegistryResponse().getStatus()); }
@Test public void testDocumentRepositoryRetrieveDocumentSet_Failure() { AdapterComponentDocRepositoryOrchImpl docRepo = getDocRepoWithEmptyRetrieveDocuments(); RetrieveDocumentSetResponseType response = new RetrieveDocumentSetResponseType(); response = docRepo.documentRepositoryRetrieveDocumentSet(createDocumentRequest_Failure()); assertSame("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure", response.getRegistryResponse().getStatus()); }