public boolean querySave(DominoDocument doc) throws NotesException { // Create the encoded ID for the snippet String category = doc.getItemValueString("Category"); String name = doc.getItemValueString("Name"); doc.replaceItemValue("Id", AbstractNode.encodeSnippet(category, name)); return true; }
private CategoryNode findCategory(CategoryNode parent, String[] cats, int level) { List<AbstractNode> children = parent.getChildren(); CategoryNode found = null; for (int i = 0; i < children.size(); i++) { AbstractNode c = children.get(i); if (c instanceof CategoryNode) { if (StringUtil.equals(cats[level], c.getName())) { found = (CategoryNode) c; break; } } } if (found == null) { found = new CategoryNode(parent, cats[level]); parent.getChildren().add(found); } if (level < cats.length - 1) { return findCategory(found, cats, level + 1); } return found; }