Package javax.jcr.query

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


        assertEquals("[nt:base] as [nt:base] /* " +
                "aggregate Not yet implemented " +
                "where (contains([nt:base].[node1/text], cast('hello' as string))) " +
                "and (contains([nt:base].[node2/text], cast('hallo' as string))) */",
                getResult(q.execute(), "plan"));
        q = qm.createQuery(sql2, Query.JCR_SQL2);
        // assertEquals("/testroot",
        //        getResult(q.execute(), "path"));           
       
    }
   
View Full Code Here


    uniq.add("");
   
    try {
      Session session = ((JackConnection)parent.getConnection()).getSession();
      QueryManager qm = session.getWorkspace().getQueryManager();
      Query query = qm.createQuery("/jcr:root/apps//element(*,sling:Folder)", Query.XPATH);
      QueryResult res = query.execute();
      for (RowIterator iter = res.getRows(); iter.hasNext();) {
        Row row = iter.nextRow();
        Value path = row.getValue("jcr:path");
       
View Full Code Here

        public void run() {
            try {
                // run the queries
                QueryManager qm = s.getWorkspace().getQueryManager();
                Query q = qm.createQuery(query, Query.XPATH);
                for (;;) {
                    long time = System.currentTimeMillis();
                    NodeIterator nodes = q.execute().getNodes();
                    long size = nodes.getSize();
                    if (size == -1) {
View Full Code Here

            testRootNode.save();
        }

        QueryManager qm = superuser.getWorkspace().getQueryManager();
        String stmt = testPath + "//*[jcr:contains(., '*foo')]";
        QueryResult res = qm.createQuery(stmt, Query.XPATH).execute();
        checkResult(res, 2000);

        stmt = testPath + "//*[jcr:contains(., 'bar*')]";
        res = qm.createQuery(stmt, Query.XPATH).execute();
        checkResult(res, 2000);
View Full Code Here

        String stmt = testPath + "//*[jcr:contains(., '*foo')]";
        QueryResult res = qm.createQuery(stmt, Query.XPATH).execute();
        checkResult(res, 2000);

        stmt = testPath + "//*[jcr:contains(., 'bar*')]";
        res = qm.createQuery(stmt, Query.XPATH).execute();
        checkResult(res, 2000);
    }
}
View Full Code Here

            testRootNode.save();
        }

        QueryManager qm = superuser.getWorkspace().getQueryManager();
        String stmt = testPath + "//*[@foo >= 0]";
        QueryResult res = qm.createQuery(stmt, Query.XPATH).execute();
        checkResult(res, 2000);
    }
}
View Full Code Here

        acMgr.setPolicy(tmpl.getPath(), tmpl);
        adminSession.save();

        Session anonymousSession = getRepository().login(new GuestCredentials());
        QueryManager qm = anonymousSession.getWorkspace().getQueryManager();
        Query q = qm.createQuery("/jcr:root/home//social/relationships/following//*[@id='aaron.mcdonald@mailinator.com']", Query.XPATH);
        QueryResult r = q.execute();
        RowIterator it = r.getRows();
        Assert.assertTrue(it.hasNext());
    }

View Full Code Here

            //      "org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024"
//            String whereClause = "WHERE ISDESCENDANTNODE([/repositories/" + repositoryId + "/content])";
//            Query query = queryManager.createQuery( "SELECT size FROM [archiva:artifact] " + whereClause,
//                                                    Query.JCR_SQL2 );
            String whereClause = "WHERE jcr:path LIKE '/repositories/" + repositoryId + "/content/%'";
            Query query = queryManager.createQuery( "SELECT size FROM archiva:artifact " + whereClause, Query.SQL );

            QueryResult queryResult = query.execute();

            Map<String, Integer> totalByType = new HashMap<String, Integer>();
            long totalSize = 0, totalArtifacts = 0;
View Full Code Here

                repositoryStatistics.setTotalCountForType( entry.getKey(), entry.getValue() );
            }

            // The query ordering is a trick to ensure that the size is correct, otherwise due to lazy init it will be -1
//            query = queryManager.createQuery( "SELECT * FROM [archiva:project] " + whereClause, Query.JCR_SQL2 );
            query = queryManager.createQuery( "SELECT * FROM archiva:project " + whereClause + " ORDER BY jcr:score",
                                              Query.SQL );
            repositoryStatistics.setTotalProjectCount( query.execute().getRows().getSize() );

//            query = queryManager.createQuery(
//                "SELECT * FROM [archiva:namespace] " + whereClause + " AND namespace IS NOT NULL", Query.JCR_SQL2 );
View Full Code Here

                                              Query.SQL );
            repositoryStatistics.setTotalProjectCount( query.execute().getRows().getSize() );

//            query = queryManager.createQuery(
//                "SELECT * FROM [archiva:namespace] " + whereClause + " AND namespace IS NOT NULL", Query.JCR_SQL2 );
            query = queryManager.createQuery(
                "SELECT * FROM archiva:namespace " + whereClause + " AND namespace IS NOT NULL ORDER BY jcr:score",
                Query.SQL );
            repositoryStatistics.setTotalGroupCount( query.execute().getRows().getSize() );
        }
        catch ( RepositoryException e )
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.