/** * Copy the source node to the destination. When the source node is null, null will be returned. * * @param session the JCR session * @param source the node to copy * @param destination the absolute path to copy node to * @return the copied destination node or null when source is not available * @throws RepositoryException generic repository exception */ public static Node copyNode(final Session session, final Node source, final String destination) throws RepositoryException { if (source == null) { return null; } final HippoSession hs = (HippoSession) session; return hs.copy(source, destination); }
/** * @inheritDoc */ public NodeIterator pendingChanges() throws RepositoryException { return session.pendingChanges(this, null); }
/** * @inheritDoc */ public boolean holdsLock() throws RepositoryException { final LockManager lockManager = session.getWorkspace().getLockManager(); return lockManager.holdsLock(node.getPath()); }
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 void validate() throws RepositoryException { int totalCount = 0, changedCount = 0; Node derivatesFolder = session.getNode(DERIVATIVES_PATH); Query query = session.getWorkspace().getQueryManager().createQuery("SELECT * FROM hippo:derived", Query.SQL); QueryResult result = query.execute(); for (Node node : new NodeIterable(result.getNodes())) { ++totalCount; if (compute(derivatesFolder, node)) { ++changedCount; if ((changedCount % LocalHippoRepository.batchThreshold) == 0) { session.save(); } } } log.warn("Validated " + totalCount + " nodes, and reset " + changedCount + " nodes"); session.save(); }
if (session.itemExists(path)) { throw new StoreException("type already exists"); Node nsNode = (Node) session.getItem(info.getNamespace().getPath()); WorkflowManager workflowManager = ((HippoWorkspace) session.getWorkspace()).getWorkflowManager(); Workflow workflow = workflowManager.getWorkflow("editor", nsNode);
public byte[] exportDereferencedView(String path, boolean binaryAsLink, boolean noRecurse) throws IOException, RepositoryException, RemoteException { try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); session.exportDereferencedView(path, buffer, binaryAsLink, noRecurse); return buffer.toByteArray(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public ImportResult importEnhancedSystemViewXML(String path, byte[] xml, int uuidBehavior, int referenceBehavior) throws IOException, RepositoryException, RemoteException { try { return session.importEnhancedSystemViewXML(path, new ByteArrayInputStream(xml), uuidBehavior, referenceBehavior, null); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
if (session instanceof HippoSession) { HippoSession hippoSession = (HippoSession) session; hippoSession.importDereferencedXML(UPDATE_UTIL_PATH + type.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, ImportReferenceBehavior.IMPORT_REFERENCE_NOT_FOUND_REMOVE, ImportMergeBehavior.IMPORT_MERGE_ADD_OR_SKIP); } else {
public boolean compute(Node node) throws RepositoryException { final Node derivativesFolder = session.getNode(DERIVATIVES_PATH); return compute(derivativesFolder, node); }
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 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 byte[] exportDereferencedView(String path, boolean binaryAsLink, boolean noRecurse) throws IOException, RepositoryException, RemoteException { try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); session.exportDereferencedView(path, buffer, binaryAsLink, noRecurse); return buffer.toByteArray(); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public ImportResult importEnhancedSystemViewXML(String path, byte[] xml, int uuidBehavior, int referenceBehavior) throws IOException, RepositoryException, RemoteException { try { return session.importEnhancedSystemViewXML(path, new ByteArrayInputStream(xml), uuidBehavior, referenceBehavior, null); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
if (session instanceof HippoSession) { HippoSession hippoSession = (HippoSession) session; hippoSession.importDereferencedXML(UPDATE_UTIL_PATH + type.getPath(), in, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, ImportReferenceBehavior.IMPORT_REFERENCE_NOT_FOUND_REMOVE, ImportMergeBehavior.IMPORT_MERGE_ADD_OR_SKIP); } else {
@Override protected InputStream getContent() { final HippoSession session = (HippoSession) UserSession.get().getJcrSession(); try { final ConfigurationService service = HippoServiceRegistry.getService(ConfigurationService.class); final Node nodeToExport = session.getNode(getModelObject().getPath()); file = service.exportZippedContent(nodeToExport); return new FileInputStream(file); } catch (RepositoryException e) { error("Repository exception during export: " + e.getMessage()); } catch (IOException e) { error("IOException during export: " + e.getMessage()); } return null; } }
/** * @inheritDoc */ public NodeIterator pendingChanges(String nodeType) throws RepositoryException { return session.pendingChanges(this, nodeType); }
/** * Copy the source node to the destination. When the source node is null, null will be returned. * * @param session the JCR session * @param source the node to copy * @param destination the absolute path to copy node to * @return the copied destination node or null when source is not available * @throws RepositoryException generic repository exception */ public static Node copyNode(final Session session, final Node source, final String destination) throws RepositoryException { if (source == null) { return null; } final HippoSession hs = (HippoSession) session; return hs.copy(source, destination); }
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); } }