/** * Get the most accurate and complete version available of the information * represented in the current node if available. * * @param node * @param defaultNode * @return the node with the most accurate representation of this node if available. * @throws java.lang.IllegalArgumentException when canonical node is not found for the node. * @throws java.lang.RuntimeException when the repository throws a general repository exception */ public static Node getCanonicalNode(Node node) { return getCanonicalNode(node, null); }
curNode = NodeUtils.getCanonicalNode(curNode); if (NodeUtils.isDereferenceable(curNode)) { curNode = NodeUtils.getDeref(curNode);
private boolean isDocument(Node node) throws RepositoryException { if (NodeUtils.isNodeType(node, "hippo:handle")) { return true; } else if (NodeUtils.isNodeType(node, "hippo:document")) { if (!session.getRootNode().isSame(node)) { Node parentNode = node.getParent(); if (NodeUtils.isNodeType(parentNode, "hippo:handle")) { return true; } } } return false; } }
Node canonicalNode = NodeUtils.getCanonicalNode(node); node = NodeUtils.getDeref(node); if( node == null ) { log.debug("Broken content internal link for '{}'. Cannot create a HstLink for it. Return an empty list for canonical links.", originalNodePath);
node = NodeUtils.getDeref(node); if (node == null) { log.debug("Broken content internal link for '{}'. Cannot create a HstLink for it. Return an empty list for canonical links.", originalNodePath);
canonicalNode = NodeUtils.getCanonicalNode(node); node = NodeUtils.getDeref(node); if (node == null) { log.info("Broken content internal link for '{}'. Cannot create a HstLink for it. Return null", originalNodePath);
private Node getCanonicalNode(Node folderNode) throws ObjectBeanPersistenceException { folderNode = NodeUtils.getCanonicalNode(folderNode); if(folderNode == null) { throw new ObjectBeanPersistenceException("Cannot perform workflow on a node that does not have a canonical version"); } return folderNode; }
Node canonicalFolderNode = NodeUtils.getCanonicalNode(candidateNode); if (NodeUtils.isDereferenceable(canonicalFolderNode)) { canonicalFolderNode = NodeUtils.getDeref(canonicalFolderNode);
private Node getHandleForDocumentWorkflow(Node node) throws RepositoryException { if (NodeUtils.isNodeType(node, "hippo:handle")) { NodeIterator nodeIt = node.getNodes(node.getName()); if (nodeIt.hasNext()) { Node child = nodeIt.nextNode(); if (NodeUtils.isNodeType(child,"hippostdpubwf:document")) { return node; } } } else if (NodeUtils.isNodeType(node, "hippostdpubwf:document")) { Node parent = session.getRootNode().isSame(node) ? null : node.getParent(); if (parent != null && NodeUtils.isNodeType(parent, "hippo:handle")) { return parent; } } else { Node parent = session.getRootNode().isSame(node) ? null : node.getParent(); if (parent != null && NodeUtils.isNodeType(parent, "hippo:handle")) { return getHandleForDocumentWorkflow(parent); } } return null; }
Node canonicalNode = NodeUtils.getCanonicalNode(bean.getNode());
HippoBean bean = (HippoBean) wpm.getObject(itemPath); Node contentNode = bean.getNode(); contentNode = NodeUtils.getCanonicalNode(contentNode, contentNode); Workflow workflow = wpm.getWorkflow(category, contentNode);
WorkflowPersistenceManager wpm = createWorkflowPersistenceManager(servletRequest); HippoBean contentBean = (HippoBean) wpm.getObject(itemPath); Workflow wf = wpm.getWorkflow(category, NodeUtils.getCanonicalNode(contentBean.getNode()));
Node canonicalParentNode = NodeUtils.getCanonicalNode(bean.getNode());
curNode = NodeUtils.getCanonicalNode(curNode, curNode);
HippoBean contentBean = (HippoBean) content; Node contentNode = contentBean.getNode(); contentNode = NodeUtils.getCanonicalNode(contentNode, contentNode); binder = contentNodeBinders.get(contentNode.getPrimaryNodeType().getName()); } catch (Exception e) {
protected void createNodeByWorkflow(Node folderNode, String nodeTypeName, String name) throws ObjectBeanPersistenceException { try { folderNode = NodeUtils.getCanonicalNode(folderNode, folderNode); Workflow wf = getWorkflow(folderNodeWorkflowCategory, folderNode); if (wf instanceof FolderWorkflow) { FolderWorkflow fwf = (FolderWorkflow) wf; String category = documentAdditionWorkflowCategory; if (nodeTypeName.equals(folderNodeTypeName)) { category = folderAdditionWorkflowCategory; } String added = fwf.add(category, nodeTypeName, name); if (added == null) { throw new ObjectBeanPersistenceException("Failed to add document/folder for type '" + nodeTypeName + "'. Make sure there is a prototype."); } } else { throw new ObjectBeanPersistenceException("The workflow is not a FolderWorkflow for " + folderNode.getPath() + ": " + wf); } } catch (RepositoryException e) { throw new ObjectBeanPersistenceException(e); } catch (RemoteException e) { throw new ObjectBeanPersistenceException(e); } catch (WorkflowException e) { throw new ObjectBeanPersistenceException(e); } }
Node canonical = NodeUtils.getCanonicalNode(contentBean.getNode()); Node handleNode = canonical.getParent(); String nodeName = handleNode.getName(); HippoBean folderBean = contentBean.getParentBean(); Node folderNode = NodeUtils.getCanonicalNode(folderBean.getNode());
Node contentNode = contentBean.getNode(); path = contentNode.getPath(); contentNode = NodeUtils.getCanonicalNode(contentNode, contentNode); Workflow wf = getWorkflow(documentNodeWorkflowCategory, contentNode);
jcrItem = jcrItem.getParent(); Node canonical = NodeUtils.getCanonicalNode((Node) jcrItem); if(canonical == null || !canonical.isSame(jcrItem)) { log.warn("An event handler will be registered for a virtual node. Virtual nodes never have events. You should take the canonical location most likely. Virtual path = " + absolutePath);