RuleExecutionResponseMarkerForRedactedEntries extends
		AbstractPostRedactionLevelRedactionHandler { @Override public void execute(Document xmlDocument, XacmlResult xacmlResult, FactModel factModel, Document factModelDocument, RuleExecutionContainer ruleExecutionContainer, List<Node> listOfNodes, Set<String> redactSectionCodesAndGeneratedEntryIds) throws XPathExpressionException { for (RuleExecutionResponse response : ruleExecutionContainer .getExecutionResponseList()) { if (redactSectionCodesAndGeneratedEntryIds.contains(response .getC32SectionLoincCode()) || redactSectionCodesAndGeneratedEntryIds.contains(response .getEntry())) { response.setItemAction(RuleExecutionResponse.ITEM_ACTION_REDACT); } } } RuleExecutionResponseMarkerForRedactedEntries(
			DocumentAccessor documentAccessor); @Override void execute(Document xmlDocument, XacmlResult xacmlResult,
			FactModel factModel, Document factModelDocument,
			RuleExecutionContainer ruleExecutionContainer,
			List<Node> listOfNodes,
			Set<String> redactSectionCodesAndGeneratedEntryIds);  }
@Test public void testExecute_By_Entry_Match() throws IOException, SimpleMarshallerException, XPathExpressionException { String c32FileName = "MIE_SampleC32.xml"; String factmodelXml = fileReader.readFile(TEST_PATH + FACTMODEL_PATH + c32FileName); String c32 = embeddedClinicalDocumentExtractor.extractClinicalDocumentFromFactModel(factmodelXml); String ruleExecutionContainerXml = fileReader.readFile(TEST_PATH + RULEEXECUTIONCONTAINER_PATH + c32FileName); RuleExecutionContainer ruleExecutionContainer = marshaller.unmarshalFromXml(RuleExecutionContainer.class, ruleExecutionContainerXml); Document c32Document = documentXmlConverter.loadDocument(c32); Document factModelDocument = documentXmlConverter.loadDocument(factmodelXml); FactModel factModel = marshaller.unmarshalFromXml(FactModel.class, factmodelXml); List<Node> listOfNodes = new LinkedList<Node>(); Set<String> redactSectionCodesAndGeneratedEntryIds = new HashSet<String>(); redactSectionCodesAndGeneratedEntryIds.add("d1e1406"); sut.execute(c32Document, factModel.getXacmlResult(), factModel, factModelDocument, ruleExecutionContainer, listOfNodes, redactSectionCodesAndGeneratedEntryIds); assertEquals(2, ruleExecutionContainer.getSize()); assertEquals("REDACT", ruleExecutionContainer.getExecutionResponseList().get(0).getItemAction()); assertEquals("REDACT", ruleExecutionContainer.getExecutionResponseList().get(1).getItemAction()); }
@Test public void testExecute_By_Section_Match() throws IOException, SimpleMarshallerException, XPathExpressionException { String c32FileName = "MIE_SampleC32.xml"; String factmodelXml = fileReader.readFile(TEST_PATH + FACTMODEL_PATH + c32FileName); String c32 = embeddedClinicalDocumentExtractor.extractClinicalDocumentFromFactModel(factmodelXml); String ruleExecutionContainerXml = fileReader.readFile(TEST_PATH + RULEEXECUTIONCONTAINER_PATH + c32FileName); RuleExecutionContainer ruleExecutionContainer = marshaller.unmarshalFromXml(RuleExecutionContainer.class, ruleExecutionContainerXml); Document c32Document = documentXmlConverter.loadDocument(c32); Document factModelDocument = documentXmlConverter.loadDocument(factmodelXml); FactModel factModel = marshaller.unmarshalFromXml(FactModel.class, factmodelXml); List<Node> listOfNodes = new LinkedList<Node>(); Set<String> redactSectionCodesAndGeneratedEntryIds = new HashSet<String>(); redactSectionCodesAndGeneratedEntryIds.add("10160-0"); sut.execute(c32Document, factModel.getXacmlResult(), factModel, factModelDocument, ruleExecutionContainer, listOfNodes, redactSectionCodesAndGeneratedEntryIds); assertEquals(2, ruleExecutionContainer.getSize()); assertEquals("REDACT", ruleExecutionContainer.getExecutionResponseList().get(0).getItemAction()); assertEquals("REDACT", ruleExecutionContainer.getExecutionResponseList().get(1).getItemAction()); }