XdsbErrorFactory { public RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseSchemaValidation( RetrieveDocumentSetResponse response, Map<String, String> errorMap) { StringBuilder builder = new StringBuilder(); builder.append("Document validation error(s) occurred in Policy Enforcement Point for document(s): "); builder.append(errorMap.keySet()); builder.append(". Please contact to system administrator if this error persists."); String codeContext = builder.toString(); String errorCode = "XDSRepositoryError"; boolean isPartial = response.getDocumentResponse().size() > 0; setErrorRegistryResponse(codeContext, errorCode, isPartial, response); return response; } XdsbErrorFactory();  XdsbErrorFactory(RegistryErrorListSetter registryErrorListSetter); RetrieveDocumentSetResponse setRetrieveDocumentSetResponseRegistryErrorListFilteredByPatientAndAuthor(
			RetrieveDocumentSetResponse response, int numRemoved,
			String patientId, String authorNPI); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseMultipleRepositoryId(); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseConstructByErrorMessage(
			String errorMessage); RetrieveDocumentSetResponse errorRetrieveDocumentSetInternalServerError(); RetrieveDocumentSetResponse noClinicalDocumentFound(
			String patientId, String authorNPI); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseSchemaValidation(
			RetrieveDocumentSetResponse response, Map<String, String> errorMap); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseNotExistsOrAccessible(
			RetrieveDocumentSetRequest input); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseRepositoryNotAvailable(); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseInternalPEPError(); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseAccessDeniedByPDP(); RetrieveDocumentSetResponse errorRetrieveDocumentSetResponseNoConsentsFound(
			String patientUniqueId); AdhocQueryResponse errorAdhocQueryResponseConstructByErrorMessage(
			String errorMessage); AdhocQueryResponse errorAdhocQueryResponseRegistryNotAvailable(); AdhocQueryResponse errorAdhocQueryResponseAccessDeniedByPDP(); AdhocQueryResponse errorAdhocQueryResponseInternalServerError(); AdhocQueryResponse errorAdhocQueryResponseNoDocumentsFound(
			String patientUniqueId, String intermediarySubjectNPI); AdhocQueryResponse errorAdhocQueryResponseMissingParameters();  }
@Test public void testErrorRetrieveDocumentSetResponseSchemaValidation_Partial_Success() { RetrieveDocumentSetResponse response = new RetrieveDocumentSetResponse(); DocumentResponse document = new DocumentResponse(); document.setDocumentUniqueId("1"); response.getDocumentResponse().add(document); HashMap<String, String> map = new HashMap<String, String>(); map.put("2", "error message"); RetrieveDocumentSetResponse actualResponse = sut .errorRetrieveDocumentSetResponseSchemaValidation(response, map); assertEquals(1, actualResponse.getDocumentResponse().size()); assertEquals(document, actualResponse.getDocumentResponse().get(0)); assertEquals( "urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:PartialSuccess", actualResponse.getRegistryResponse().getStatus()); assertEquals( "Document validation error(s) occurred in Policy Enforcement Point for document(s): [2]. Please contact to system administrator if this error persists.", actualResponse.getRegistryResponse().getRegistryErrorList() .getRegistryError().get(0).getCodeContext()); }
@Test public void testErrorRetrieveDocumentSetResponseSchemaValidation_Failure() { RetrieveDocumentSetResponse response = new RetrieveDocumentSetResponse(); HashMap<String, String> map = new HashMap<String, String>(); map.put("2", "error message"); RetrieveDocumentSetResponse actualResponse = sut .errorRetrieveDocumentSetResponseSchemaValidation(response, map); assertEquals(0, actualResponse.getDocumentResponse().size()); assertEquals( "urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure", actualResponse.getRegistryResponse().getStatus()); assertEquals( "Document validation error(s) occurred in Policy Enforcement Point for document(s): [2]. Please contact to system administrator if this error persists.", actualResponse.getRegistryResponse().getRegistryErrorList() .getRegistryError().get(0).getCodeContext()); }