Examples of storeAsNode()


Examples of javax.jcr.query.Query.storeAsNode()

     */
    public void testGetPersistentQueryPath() throws RepositoryException {
        String statement = "/" + jcrRoot;
        Query q = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        String path = testRoot + "/" + nodeName1;
        q.storeAsNode(path);
        assertEquals("Query.getPersistentQueryPath() does not return the correct path.",
                path,
                q.getStoredQueryPath());
    }
}
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

            }
            String path = queryStore.getPath() + "/" + name;
            if (contentManager.checkExistence(path, currentUserSession)) {
                throw new ExistingFileException("The node " + path + " alreadey exists.");
            }
            q.storeAsNode(path);
            user.getSession().save();
            return navigation.getGWTJahiaNode(currentUserSession.getNode(path));
        } catch (RepositoryException e) {
            logger.error(e.getMessage(), e);
            throw new GWTJahiaServiceException("Could not store query");
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

            final String saveSearchPath = parent.getPath() + "/" + contentManager.findAvailableName(parent, name);
            parent.checkout();
            logger.debug("Save search path: " + saveSearchPath);
            Query q = createQuery(search, session);

            q.storeAsNode(saveSearchPath);

            session.save();

            return navigation.getGWTJahiaNode(session.getNode(saveSearchPath));
        } catch (RepositoryException e) {
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

        /* test if resource path does not exist -> thus indicating that
        the query must be made persistent by calling Query.save(String) */
        if (!getRepositorySession().itemExists(itemPath)) {
            try {
                q.storeAsNode(itemPath);
            } catch (RepositoryException e) {
                // ItemExistsException should never occur.
                new JcrDavException(e);
            }
        }
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

        /* test if resource path does not exist -> thus indicating that
        the query must be made persistent by calling Query.save(String) */
        if (itemPath != null && !getRepositorySession().itemExists(itemPath)) {
            try {
                q.storeAsNode(itemPath);
            } catch (RepositoryException e) {
                // ItemExistsException should never occur.
                new JcrDavException(e);
            }
        }
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

        for (Iterator<Query> it = queries.iterator(); it.hasNext(); ) {
            Query q = it.next();
            String lang = q.getLanguage();
            checkResult(q.execute(), new Node[]{n});

            Node stored = q.storeAsNode(testRoot + "/" + nodeName1);
            q = qm.getQuery(stored);
            assertEquals("language of stored query does not match", lang, q.getLanguage());
            checkResult(q.execute(), new Node[]{n});
            stored.remove();
        }
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

     * @throws NotExecutableException if nt:query is not supported.
     */
    public void testSave() throws RepositoryException, NotExecutableException {
        checkNtQuery();
        Query query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        query.storeAsNode(testRoot + "/" + nodeName1);

        assertTrue("Node has not been stored", testRootNode.hasNode(nodeName1));

        Node queryNode = testRootNode.getNode(nodeName1);
        assertTrue("Query node is not of type nt:query", queryNode.isNodeType(ntQuery));
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

     * @throws NotExecutableException if nt:query is not supported.
     */
    public void testItemExistsException() throws RepositoryException, NotExecutableException {
        checkNtQuery();
        Query query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        Node qNode = query.storeAsNode(testRoot + "/" + nodeName1);

        // create another one
        query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        try {
            query.storeAsNode(testRoot + "/" + nodeName1);
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

        Node qNode = query.storeAsNode(testRoot + "/" + nodeName1);

        // create another one
        query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        try {
            query.storeAsNode(testRoot + "/" + nodeName1);
            if (!qNode.getDefinition().allowsSameNameSiblings()) {
                // must throw if same name siblings are not allowed
                fail("Query.storeAsNode() did not throw ItemExistsException");
            }
        } catch (ItemExistsException e) {
View Full Code Here

Examples of javax.jcr.query.Query.storeAsNode()

     */
    public void testPathNotFoundException() throws RepositoryException, NotExecutableException {
        checkNtQuery();
        Query query = superuser.getWorkspace().getQueryManager().createQuery(statement, Query.XPATH);
        try {
            query.storeAsNode(testRoot + "/" + nodeName1 + "/" + nodeName1);
            fail("Query.storeAsNode() must throw PathNotFoundException on invalid path");
        } catch (PathNotFoundException e) {
            // expected behaviour
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.