@Test public void testTagDocument_Entry_Level_Tagging() throws Exception { logger.debug(c32); String factModelXml = documentFactModelExtractor.extractFactModel(c32, fileReader.readFile("testXacmlResultRedactHIV.xml")); c32 = embeddedClinicalDocumentExtractor .extractClinicalDocumentFromFactModel(factModelXml); factModelXml = removeEmbeddedClinicalDocument(factModelXml); final FactModel factModel = marshaller.unmarshalFromXml( FactModel.class, factModelXml); final String executionResponseContainer = ruleExecutionService .assertAndExecuteClinicalFacts(factModel) .getRuleExecutionResponseContainer(); final String taggedDocument = documentTagger.tagDocument(c32, executionResponseContainer); logger.debug(taggedDocument); assertTrue(!taggedDocument.contains("<confidentialityCode/>")); assertTrue(taggedDocument .contains("<confidentialityCode xmlns:ds4p=\"http: assertTrue(taggedDocument.contains("code=\"R\"")); assertTrue(taggedDocument.contains(DISCLAIMER_TEXT)); assertTrue(taggedDocument .contains("codeSystem=\"2.16.840.1.113883.5.25\"")); assertTrue(c32.contains("<confidentialityCode/>")); assertTrue(!c32 .contains("<confidentialityCode xmlns:ds4p=\"http: assertTrue(!c32.contains("code=\"R\"")); assertTrue(!c32.contains("codeSystem=\"2.16.840.1.113883.5.25\"")); final Document taggedDoc = documentXmlConverter .loadDocument(taggedDocument); verifyEntryLevelTags(taggedDoc, "d1e259", Arrays.asList(new String[] { "R", "NODSCLCD", "ENCRYPT" })); verifyEntryLevelTags(taggedDoc, "d1e220", Arrays.asList(new String[] { "V", "ENCRYPT", "NODSCLCD" })); verifyEntryLevelTags(taggedDoc, "d1e1261", Arrays.asList(new String[] { "R", "ENCRYPT", "NORDSCLCD" })); }
@Override public String tagDocument(String document, String executionResponseContainer) { executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(TAG_XSL).toString(); final StringURIResolver stringURIResolver = new StringURIResolver(); stringURIResolver.put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer); stringURIResolver.put(URI_RESOLVER_HREF_DISCLAMER, disclaimerText); final Optional<URIResolver> uriResolver = Optional .of(stringURIResolver); final String taggedDocument = xmlTransformer.transform(document, xslUrl, Optional.empty(), uriResolver); logger.debug("Tagged Document:"); logger.debug(taggedDocument); return taggedDocument; }
DocumentTaggerImpl implements DocumentTagger { @Override public String tagDocument(String document, String executionResponseContainer) { executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(TAG_XSL).toString(); final StringURIResolver stringURIResolver = new StringURIResolver(); stringURIResolver.put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer); stringURIResolver.put(URI_RESOLVER_HREF_DISCLAMER, disclaimerText); final Optional<URIResolver> uriResolver = Optional .of(stringURIResolver); final String taggedDocument = xmlTransformer.transform(document, xslUrl, Optional.empty(), uriResolver); logger.debug("Tagged Document:"); logger.debug(taggedDocument); return taggedDocument; } }
DocumentTaggerImpl implements DocumentTagger { @Override public String tagDocument(String document, String executionResponseContainer) { executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(TAG_XSL).toString(); final StringURIResolver stringURIResolver = new StringURIResolver(); stringURIResolver.put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer); stringURIResolver.put(URI_RESOLVER_HREF_DISCLAMER, disclaimerText); final Optional<URIResolver> uriResolver = Optional .of(stringURIResolver); final String taggedDocument = xmlTransformer.transform(document, xslUrl, Optional.empty(), uriResolver); logger.debug("Tagged Document:"); logger.debug(taggedDocument); return taggedDocument; } DocumentTaggerImpl(String disclaimerText,
			XmlTransformer xmlTransformer); }
DocumentTaggerImpl implements DocumentTagger { @Override public String tagDocument(String document, String executionResponseContainer) { executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(TAG_XSL).toString(); final StringURIResolver stringURIResolver = new StringURIResolver(); stringURIResolver.put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer); stringURIResolver.put(URI_RESOLVER_HREF_DISCLAMER, disclaimerText); final Optional<URIResolver> uriResolver = Optional .of(stringURIResolver); final String taggedDocument = xmlTransformer.transform(document, xslUrl, Optional.empty(), uriResolver); logger.debug("Tagged Document:"); logger.debug(taggedDocument); return taggedDocument; } DocumentTaggerImpl(String disclaimerText,
			XmlTransformer xmlTransformer); @Override String tagDocument(String document, String executionResponseContainer); }
DocumentTaggerImpl implements DocumentTagger { @Override public String tagDocument(String document, String executionResponseContainer) { executionResponseContainer = executionResponseContainer.replace( "<ruleExecutionContainer>", "<ruleExecutionContainer xmlns=\"urn:hl7-org:v3\">"); final String xslUrl = Thread.currentThread().getContextClassLoader() .getResource(TAG_XSL).toString(); final StringURIResolver stringURIResolver = new StringURIResolver(); stringURIResolver.put( URI_RESOLVER_HREF_RULE_EXECUTION_RESPONSE_CONTAINER, executionResponseContainer); stringURIResolver.put(URI_RESOLVER_HREF_DISCLAMER, disclaimerText); final Optional<URIResolver> uriResolver = Optional .of(stringURIResolver); final String taggedDocument = xmlTransformer.transform(document, xslUrl, Optional.empty(), uriResolver); logger.debug("Tagged Document:"); logger.debug(taggedDocument); return taggedDocument; } DocumentTaggerImpl(String disclaimerText,
			XmlTransformer xmlTransformer); @Override String tagDocument(String document, String executionResponseContainer);  }