@Override protected void invalidateNode(SNode sNode) { NodePath affPath = NodePath.forSNode(sNode); SModel containingModel = sNode.getContainingModel(); if (containingModel == null) return; SModelReference mref = containingModel.getReference(); List<NodePath> nodePaths = nodePaths(mref); ListIterator<NodePath> npathIt = nodePaths.listIterator(); while (npathIt.hasNext()) { NodePath path = npathIt.next(); NodePath lcp = affPath.findLowestCommonParent(path); if (lcp != null) { if (lcp.equals(path)) break; // replace with the LCP and stop npathIt.remove(); npathIt.add(lcp); break; } } if (!npathIt.hasNext()) { // not found -> just add nodePaths.add(affPath); } }
public StoredNode getReindexRoot(StoredNode node, NodePath path, boolean includeSelf) { if (node.getNodeType() == Node.ATTRIBUTE_NODE) return null; IndexSpec indexConf = node.getDocument().getCollection().getIndexConfiguration(node.getDocument().getBroker()); if (indexConf != null) { FulltextIndexSpec config = indexConf.getFulltextIndexSpec(); if (config == null) return null; boolean reindexRequired = false; int len = node.getNodeType() == Node.ELEMENT_NODE && !includeSelf ? path.length() - 1 : path.length(); for (int i = 0; i < len; i++) { QName qn = path.getComponent(i); if (config.hasQNameIndex(qn)) { reindexRequired = true; break; } } if (reindexRequired) { StoredNode topMost = null; StoredNode currentNode = node; while (currentNode != null) { if (config.hasQNameIndex(currentNode.getQName())) topMost = currentNode; currentNode = (StoredNode) currentNode.getParentNode(); } return topMost; } } return null; }
private void processAffected(SModelReference mref, Collection<NodePath> nodePaths) { ReloadableModel model = myModelProvider.lookupModel(mref); if (model == null) return; for (NodePath nodePath : nodePaths) { if (nodePath.isEmpty()) { model.reloadAll(); } else { SNodeId nodeId = nodePath.leaf(); model.reload(nodeId); } } }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final NodeBranchEntry that = (NodeBranchEntry) o; if (nodeVersionId != null ? !nodeVersionId.equals(that.nodeVersionId) : that.nodeVersionId != null) { return false; } if (nodeState != that.nodeState) { return false; } if (nodePath != null ? !nodePath.equals(that.nodePath) : that.nodePath != null) { return false; } if (timestamp != null ? !timestamp.equals(that.timestamp) : that.timestamp != null) { return false; } return !(nodeId != null ? !nodeId.equals(that.nodeId) : that.nodeId != null); }
public void attribute(Txn transaction, AttrImpl attrib, NodePath path) { path.addComponent(attrib.getQName()); if (config == null || config.matchAttribute(path)) { engine.storeAttribute( attrib, null, NativeTextEngine.ATTRIBUTE_NOT_BY_QNAME, config, mode == REMOVE_ALL_NODES); } if (config != null && config.hasQNameIndex(attrib.getQName())) { engine.storeAttribute( attrib, null, NativeTextEngine.ATTRIBUTE_BY_QNAME, config, mode == REMOVE_ALL_NODES); } path.removeLastComponent(); super.attribute(transaction, attrib, path); }
@Override public int hashCode() { int result = nodeVersionId != null ? nodeVersionId.hashCode() : 0; result = 31 * result + (nodeState != null ? nodeState.hashCode() : 0); result = 31 * result + (nodePath != null ? nodePath.hashCode() : 0); result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0); result = 31 * result + (nodeId != null ? nodeId.hashCode() : 0); return result; }