@Test(expected = DS4PException.class) public void testGenerateMetadataXml_Throws_DS4PException() { @SuppressWarnings("unused") final String metadata = metadataGenerator.generateMetadataXml("", executionResponseContainer, homeCommunityId, senderEmailAddress, recipientEmailAddress); }
@Override public String generateMetadataXml(String document, String executionResponseContainer, String homeCommunityId, String senderEmailAddress, String recipientEmailAddress) { final Params params = ParamsBuilder .withParam(PARAM_NAME_HOME_COMMUNITY_ID, homeCommunityId) .and(PARAM_NAME_AUTHOR_TELECOMMUNICATION, senderEmailAddress) .and(PARAM_NAME_INTENDED_RECIPIENT, recipientEmailAddress); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(METADATA_XSL).toString(); executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final Optional<URIResolver> uriResolver = Optional .of(new StringURIResolver().put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer)); final String metadataXml = xmlTransformer.transform(document, xslUrl, Optional.of(params), uriResolver); logger.debug("Metadata:"); logger.debug(metadataXml); return metadataXml; }
MetadataGeneratorImpl implements MetadataGenerator { @Override public String generateMetadataXml(String document, String executionResponseContainer, String homeCommunityId, String senderEmailAddress, String recipientEmailAddress) { final Params params = ParamsBuilder .withParam(PARAM_NAME_HOME_COMMUNITY_ID, homeCommunityId) .and(PARAM_NAME_AUTHOR_TELECOMMUNICATION, senderEmailAddress) .and(PARAM_NAME_INTENDED_RECIPIENT, recipientEmailAddress); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(METADATA_XSL).toString(); executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final Optional<URIResolver> uriResolver = Optional .of(new StringURIResolver().put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer)); final String metadataXml = xmlTransformer.transform(document, xslUrl, Optional.of(params), uriResolver); logger.debug("Metadata:"); logger.debug(metadataXml); return metadataXml; } }
MetadataGeneratorImpl implements MetadataGenerator { @Override public String generateMetadataXml(String document, String executionResponseContainer, String homeCommunityId, String senderEmailAddress, String recipientEmailAddress) { final Params params = ParamsBuilder .withParam(PARAM_NAME_HOME_COMMUNITY_ID, homeCommunityId) .and(PARAM_NAME_AUTHOR_TELECOMMUNICATION, senderEmailAddress) .and(PARAM_NAME_INTENDED_RECIPIENT, recipientEmailAddress); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(METADATA_XSL).toString(); executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final Optional<URIResolver> uriResolver = Optional .of(new StringURIResolver().put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer)); final String metadataXml = xmlTransformer.transform(document, xslUrl, Optional.of(params), uriResolver); logger.debug("Metadata:"); logger.debug(metadataXml); return metadataXml; } MetadataGeneratorImpl(XmlTransformer xmlTransformer); }
MetadataGeneratorImpl implements MetadataGenerator { @Override public String generateMetadataXml(String document, String executionResponseContainer, String homeCommunityId, String senderEmailAddress, String recipientEmailAddress) { final Params params = ParamsBuilder .withParam(PARAM_NAME_HOME_COMMUNITY_ID, homeCommunityId) .and(PARAM_NAME_AUTHOR_TELECOMMUNICATION, senderEmailAddress) .and(PARAM_NAME_INTENDED_RECIPIENT, recipientEmailAddress); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(METADATA_XSL).toString(); executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final Optional<URIResolver> uriResolver = Optional .of(new StringURIResolver().put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer)); final String metadataXml = xmlTransformer.transform(document, xslUrl, Optional.of(params), uriResolver); logger.debug("Metadata:"); logger.debug(metadataXml); return metadataXml; } MetadataGeneratorImpl(XmlTransformer xmlTransformer); @Override String generateMetadataXml(String document,
			String executionResponseContainer, String homeCommunityId,
			String senderEmailAddress, String recipientEmailAddress); }
MetadataGeneratorImpl implements MetadataGenerator { @Override public String generateMetadataXml(String document, String executionResponseContainer, String homeCommunityId, String senderEmailAddress, String recipientEmailAddress) { final Params params = ParamsBuilder .withParam(PARAM_NAME_HOME_COMMUNITY_ID, homeCommunityId) .and(PARAM_NAME_AUTHOR_TELECOMMUNICATION, senderEmailAddress) .and(PARAM_NAME_INTENDED_RECIPIENT, recipientEmailAddress); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(METADATA_XSL).toString(); executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final Optional<URIResolver> uriResolver = Optional .of(new StringURIResolver().put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer)); final String metadataXml = xmlTransformer.transform(document, xslUrl, Optional.of(params), uriResolver); logger.debug("Metadata:"); logger.debug(metadataXml); return metadataXml; } MetadataGeneratorImpl(XmlTransformer xmlTransformer); @Override String generateMetadataXml(String document,
			String executionResponseContainer, String homeCommunityId,
			String senderEmailAddress, String recipientEmailAddress);  }