@Test public void testSetPlaceholderValue() { placeholderValues[0] = 5564; placeholderValues[1] = "cdef"; handler.filterItemIndex = 0; handler.placeholderValues = placeholderValues; handler.setPlaceholderValue(handler.whereClause); IdentifierNode ident = handler.whereClause.getChildNode(0).getChildNode(0).getChildNode(0) .getChildType(IdentifierNode.class, 0); assertEquals(String.valueOf(5564), ident.getValue()); }
@Override public void setPlaceholderValue(TreeNode node) { for (TreeNode child : node.getChildNodes()) { if (child.getClass().isAssignableFrom((LogicalOperation.class))) { setPlaceholderValue(child); } else if (child.getClass().isAssignableFrom((FilterItem.class))) { if ((child.hasChildType(Placeholder.class) || child.hasChildType(IdentifierNode.class)) && placeholderIndexes.contains(filterItemIndex)) { if (null != placeholderValues[placeholderIndexes.indexOf(filterItemIndex)]) { IdentifierNode ident = new IdentifierNode( placeholderValues[placeholderIndexes.indexOf(filterItemIndex)].toString()); child.setChildNode(ident, 2); } else { LOGGER.error("ERROR : Can't set NULL value"); throw new BlkchnException("Can't set NULL value"); } } filterItemIndex++; } else { LOGGER.error("ERROR while setting up filterItem values"); throw new BlkchnException("ERROR while setting up filterItem values"); } } }
QueryPlaceholderHandler implements PlaceholderHandler { @Override public void setPlaceholderValue(TreeNode node) { for (TreeNode child : node.getChildNodes()) { if (child.getClass().isAssignableFrom((LogicalOperation.class))) { setPlaceholderValue(child); } else if (child.getClass().isAssignableFrom((FilterItem.class))) { if ((child.hasChildType(Placeholder.class) || child.hasChildType(IdentifierNode.class)) && placeholderIndexes.contains(filterItemIndex)) { if (null != placeholderValues[placeholderIndexes.indexOf(filterItemIndex)]) { IdentifierNode ident = new IdentifierNode( placeholderValues[placeholderIndexes.indexOf(filterItemIndex)].toString()); child.setChildNode(ident, 2); } else { LOGGER.error("ERROR : Can't set NULL value"); throw new BlkchnException("Can't set NULL value"); } } filterItemIndex++; } else { LOGGER.error("ERROR while setting up filterItem values"); throw new BlkchnException("ERROR while setting up filterItem values"); } } } }
QueryPlaceholderHandler implements PlaceholderHandler { @Override public void setPlaceholderValue(TreeNode node) { for (TreeNode child : node.getChildNodes()) { if (child.getClass().isAssignableFrom((LogicalOperation.class))) { setPlaceholderValue(child); } else if (child.getClass().isAssignableFrom((FilterItem.class))) { if ((child.hasChildType(Placeholder.class) || child.hasChildType(IdentifierNode.class)) && placeholderIndexes.contains(filterItemIndex)) { if (null != placeholderValues[placeholderIndexes.indexOf(filterItemIndex)]) { IdentifierNode ident = new IdentifierNode( placeholderValues[placeholderIndexes.indexOf(filterItemIndex)].toString()); child.setChildNode(ident, 2); } else { LOGGER.error("ERROR : Can't set NULL value"); throw new BlkchnException("Can't set NULL value"); } } filterItemIndex++; } else { LOGGER.error("ERROR while setting up filterItem values"); throw new BlkchnException("ERROR while setting up filterItem values"); } } } QueryPlaceholderHandler(LogicalPlan logicalPlan); }
QueryPlaceholderHandler implements PlaceholderHandler { @Override public void setPlaceholderValue(TreeNode node) { for (TreeNode child : node.getChildNodes()) { if (child.getClass().isAssignableFrom((LogicalOperation.class))) { setPlaceholderValue(child); } else if (child.getClass().isAssignableFrom((FilterItem.class))) { if ((child.hasChildType(Placeholder.class) || child.hasChildType(IdentifierNode.class)) && placeholderIndexes.contains(filterItemIndex)) { if (null != placeholderValues[placeholderIndexes.indexOf(filterItemIndex)]) { IdentifierNode ident = new IdentifierNode( placeholderValues[placeholderIndexes.indexOf(filterItemIndex)].toString()); child.setChildNode(ident, 2); } else { LOGGER.error("ERROR : Can't set NULL value"); throw new BlkchnException("Can't set NULL value"); } } filterItemIndex++; } else { LOGGER.error("ERROR while setting up filterItem values"); throw new BlkchnException("ERROR while setting up filterItem values"); } } } QueryPlaceholderHandler(LogicalPlan logicalPlan); @Override void setPlaceholderIndex(); @Override void setPlaceholderIndex(TreeNode node); @Override void alterLogicalPlan(Object[] placeholderValues); @Override void setPlaceholderValue(TreeNode node); @Override boolean isIndexListEmpty(); @Override int getIndexListCount(); }
QueryPlaceholderHandler implements PlaceholderHandler { @Override public void setPlaceholderValue(TreeNode node) { for (TreeNode child : node.getChildNodes()) { if (child.getClass().isAssignableFrom((LogicalOperation.class))) { setPlaceholderValue(child); } else if (child.getClass().isAssignableFrom((FilterItem.class))) { if ((child.hasChildType(Placeholder.class) || child.hasChildType(IdentifierNode.class)) && placeholderIndexes.contains(filterItemIndex)) { if (null != placeholderValues[placeholderIndexes.indexOf(filterItemIndex)]) { IdentifierNode ident = new IdentifierNode( placeholderValues[placeholderIndexes.indexOf(filterItemIndex)].toString()); child.setChildNode(ident, 2); } else { LOGGER.error("ERROR : Can't set NULL value"); throw new BlkchnException("Can't set NULL value"); } } filterItemIndex++; } else { LOGGER.error("ERROR while setting up filterItem values"); throw new BlkchnException("ERROR while setting up filterItem values"); } } } QueryPlaceholderHandler(LogicalPlan logicalPlan); @Override void setPlaceholderIndex(); @Override void setPlaceholderIndex(TreeNode node); @Override void alterLogicalPlan(Object[] placeholderValues); @Override void setPlaceholderValue(TreeNode node); @Override boolean isIndexListEmpty(); @Override int getIndexListCount();  }