-
- /**
- * Check if is filter used and then prepare and post data do client.
- *
- * @param xml XML data of notification.
- */
- @SuppressWarnings("checkstyle:IllegalCatch")
- // FIXME: this method is never called, have we lost functionality compared to bierman02?
- boolean checkFilter(final String xml) {
- if (filter == null) {
- return true;
- }
- try {
- return parseFilterParam(xml);
- } catch (final Exception e) {
- throw new RestconfDocumentedException("Problem while parsing filter.", e);
- }
- }
-
- /**
- * Parse and evaluate filter statement by XML format.
- *
- * @return {@code true} or {@code false} depending on filter expression and data of notification.
- * @throws Exception If operation fails.
- */
- private boolean parseFilterParam(final String xml) throws Exception {
- final Document docOfXml = DBF.newDocumentBuilder().parse(new InputSource(new StringReader(xml)));
- final XPath xPath = XPathFactory.newInstance().newXPath();
- // FIXME: BUG-7956: xPath.setNamespaceContext(nsContext);
- return (boolean) xPath.compile(filter).evaluate(docOfXml, XPathConstants.BOOLEAN);
- }