public static void appendPendingChangesFromNodeToBuffer(final HippoSession session, final StringBuilder buf, final String delimiter) throws RepositoryException { // we do *not* prune the pending changes as typically the number of changes in the hst config editor are small final NodeIterator it = session.pendingChanges(session.getRootNode(), "nt:base", true); while (it.hasNext()) { Node node = it.nextNode(); buf.append(node.getPath()); if (it.hasNext()) { buf.append(delimiter); } } }
public RemoteNode copy(String originalPath, String absPath) throws RepositoryException, RemoteException { try { return getRemoteNode(session.copy(session.getRootNode().getNode(originalPath.substring(1)), absPath)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public RemoteNode copy(String originalPath, String absPath) throws RepositoryException, RemoteException { try { return getRemoteNode(session.copy(session.getRootNode().getNode(originalPath.substring(1)), absPath)); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public RemoteIterator pendingChanges(String absPath, String nodeType, boolean prune) throws NamespaceException, NoSuchNodeTypeException, RepositoryException, RemoteException { try { Node node = (absPath == null || "/".equals(absPath)) ? session.getRootNode() : session.getRootNode().getNode(absPath.substring(1)); return getFactory().getRemoteNodeIterator(session.pendingChanges(node, nodeType, prune)); } catch (NamespaceException ex) { throw getRepositoryException(ex); } catch (NoSuchNodeTypeException ex) { throw getRepositoryException(ex); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public RemoteIterator pendingChanges(String absPath, String nodeType, boolean prune) throws NamespaceException, NoSuchNodeTypeException, RepositoryException, RemoteException { try { Node node = (absPath == null || "/".equals(absPath)) ? session.getRootNode() : session.getRootNode().getNode(absPath.substring(1)); return getFactory().getRemoteNodeIterator(session.pendingChanges(node, nodeType, prune)); } catch (NamespaceException ex) { throw getRepositoryException(ex); } catch (NoSuchNodeTypeException ex) { throw getRepositoryException(ex); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
private static void tryLocks(final HippoSession session) throws RepositoryException, IllegalStateException { // we can prune: We only need to 'highest' changed nodes final NodeIterator it = session.pendingChanges(session.getRootNode(), "nt:base", false); while (it.hasNext()) { Node node = it.nextNode(); Node hstRootConfigNode = findRootConfigurationNode(node); if (hstRootConfigNode == null || node.isSame(hstRootConfigNode)) { continue; } String relativeNodePath = node.getPath().substring(hstRootConfigNode.getPath().length() + 1); // mainConfigNodeName is for example "hst:sitemap", "hst:pages", "hst:components" etc String mainConfigNodeName; int index = relativeNodePath.indexOf("/"); if (index > -1) { mainConfigNodeName = relativeNodePath.substring(0, index); } else { mainConfigNodeName = relativeNodePath; } Node mainConfigNode = hstRootConfigNode.getNode(mainConfigNodeName); for (String lockSupportedNodetype : LOCK_SUPPORTED_NODETYPES) { if (mainConfigNode.isNodeType(lockSupportedNodetype)) { tryLockIfNeeded(mainConfigNode); return; } } } }
public K create(JcrNodeModel model, String name) { try { String newPath = model.getItemModel().getPath() + "/" + name; HippoSession session = (HippoSession)model.getNode().getSession(); Node prototype = session.getRootNode().getNode(prototypePath); Node node = session.copy(prototype, newPath); HstConfigurationUtils.persistChanges(session); return load(new JcrNodeModel(node)); } catch (RepositoryException e) { log.error("Error creating new node", e); } return null; }