Package javax.jcr.query

Examples of javax.jcr.query.QueryManager.createQuery()


     */
    private RowIterator execute() {
        try {
            String stmt = translateStatement();
            QueryManager qm = session.getWorkspace().getQueryManager();
            RowIterator nodes = qm.createQuery(stmt, Query.XPATH).execute().getRows();
            if (filter != null) {
                nodes = new FilteredRowIterator(nodes);
            }
            if (offset > 0) {
                try {
View Full Code Here


        QueryManager qMgr = session.getWorkspace().getQueryManager();

        // apply namespace mappings to session
        Map<String, String> previous = setNamespaceMappings(session, namespaces);
        try {
            return qMgr.createQuery(statement, language);
        } finally {
            // reset namespace mappings
            setNamespaceMappings(session, previous);
        }
    }
View Full Code Here

        try {
            // assume chunks are stored in the default workspace
            admin = repository.loginAdministrative(null);
            QueryManager qm = admin.getWorkspace().getQueryManager();

            QueryResult queryres = qm.createQuery(
                "SELECT * FROM [sling:chunks] ", Query.JCR_SQL2).execute();
            NodeIterator nodeItr = queryres.getNodes();
            while (nodeItr.hasNext()) {
                Node node = nodeItr.nextNode();
                if (isEligibleForCleanUp(node)) {
View Full Code Here

    /** Helper method to execute a JCR query */
    public static QueryResult query(Session session, String query,
            String language) throws RepositoryException {
        QueryManager qManager = session.getWorkspace().getQueryManager();
        Query q = qManager.createQuery(query, language);
        return q.execute();
    }

    /** Converts a JCR Value to a corresponding Java Object */
    public static Object toJavaObject(Value value) throws RepositoryException {
View Full Code Here

        String stmt = "//*/@bogus:title";
        String language = Query.XPATH;

        sessionControl.expectAndReturn(session.getWorkspace(), ws);
        wsCtrl.expectAndReturn(ws.getQueryManager(), qm);
        qmCtrl.expectAndReturn(qm.createQuery(stmt, language), query);
        queryCtrl.expectAndReturn(query.execute(), result);
       
        sfControl.replay();
        sessionControl.replay();
        wsCtrl.replay();
View Full Code Here

        MockControl resultCtrl = MockControl.createControl(QueryResult.class);
        QueryResult result = (QueryResult) resultCtrl.getMock();

        sessionControl.expectAndReturn(session.getWorkspace(), ws);
        wsCtrl.expectAndReturn(ws.getQueryManager(), qm);
        qmCtrl.expectAndReturn(qm.createQuery(stmt1, language), query);
        qmCtrl.expectAndReturn(qm.createQuery(stmt2, language), query);
        queryCtrl.expectAndReturn(query.execute(), result);
        queryCtrl.expectAndReturn(query.execute(), result);
       
        sfControl.replay();
View Full Code Here

        QueryResult result = (QueryResult) resultCtrl.getMock();

        sessionControl.expectAndReturn(session.getWorkspace(), ws);
        wsCtrl.expectAndReturn(ws.getQueryManager(), qm);
        qmCtrl.expectAndReturn(qm.createQuery(stmt1, language), query);
        qmCtrl.expectAndReturn(qm.createQuery(stmt2, language), query);
        queryCtrl.expectAndReturn(query.execute(), result);
        queryCtrl.expectAndReturn(query.execute(), result);
       
        sfControl.replay();
        sessionControl.replay();
View Full Code Here

        // get query manager
        QueryManager manager = session.getWorkspace().getQueryManager();
        if (debug)
          logger.debug("retrieved manager " + manager);

        Query query = manager.createQuery(statement, lang);
        if (debug)
          logger.debug("created query " + query);

        return query.execute();
      }
View Full Code Here

        if (debug)
          logger.debug("retrieved manager " + manager);
        for (Iterator iter = list.iterator(); iter.hasNext();) {
          String statement = (String) iter.next();

          Query query = manager.createQuery(statement, lang);
          if (debug)
            logger.debug("created query " + query);

          QueryResult result;
          try {
View Full Code Here

        Node world = hello.addNode("world");
        world.setProperty("x", 2);
        session.save();
        QueryManager qm = session.getWorkspace().getQueryManager();
        Query q;
        q = qm.createQuery(
                "SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE(s,[/hello])",
                Query.JCR_SQL2);
        assertEquals("/hello/world", getPaths(q));
        q = qm.createQuery(
                "SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE(s,\"/hello\")",
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.