Package javax.jcr.query

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


        // lowercase "or" mean search for the term "or"
        sql2 = "select [jcr:path] as [path] from [nt:base] " +
                "where contains([text], 'hello or hallo') order by [jcr:path]";
        q = qm.createQuery(sql2, Query.JCR_SQL2);
        assertEquals("",
                getResult(q.execute(), "path"));

    }
   
    static String getResult(QueryResult result, String propertyName) throws RepositoryException {
        StringBuilder buff = new StringBuilder();
View Full Code Here


        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

            StringBuilder stmt = new StringBuilder();
            stmt.append("//*[@").append(ISO9075.encode(name));
            stmt.append(" = '").append(data.getId()).append("']");
            Query q = session.getWorkspace().getQueryManager().createQuery(
                    stmt.toString(), Query.XPATH);
            QueryResult result = q.execute();
            ArrayList<Property> l = new ArrayList<Property>();
            for (NodeIterator nit = result.getNodes(); nit.hasNext();) {
                Node n = nit.nextNode();
                l.add(n.getProperty(name));
            }
View Full Code Here

     * @see SearchResource#search(org.apache.jackrabbit.webdav.search.SearchInfo)
     */
    public MultiStatus search(SearchInfo sInfo) throws DavException {
        try {
            Query q = getQuery(sInfo);
            QueryResult qR = q.execute();
            return queryResultToMultiStatus(qR);

        } catch (RepositoryException e) {
            throw new JcrDavException(e);
        }
View Full Code Here

            //         so if the user has more than one session, locks from other
            //         sessions will be delivered as well.
            Query q = qm.createQuery(
                "/jcr:root//element(*,mix:lockable)[@jcr:lockOwner='"
                    + session.getUserID() + "']", Query.XPATH);
            NodeIterator ni = q.execute().getNodes();
            while (ni.hasNext()) {
                Node node = ni.nextNode();
                String path = node.getPath();
                try {
                    final Lock lock = node.getLock();
View Full Code Here

  protected Iterator<Node> _getReferents(Node referenced, String propertyName) throws RepositoryException {
    String path = referenced.getPath();
    QueryManager queryMgr = session.getWorkspace().getQueryManager();
    Query query = queryMgr.createQuery("SELECT * FROM nt:base WHERE " + propertyName + "='" + path + "'", Query.SQL);
    QueryResult result = query.execute();
    @SuppressWarnings("unchecked") Iterator<Node> nodes = result.getNodes();
    return new AbstractFilterIterator<Node, Node>(nodes) {
      private Node current;
      protected Node adapt(Node node) {
        current = node;
View Full Code Here

            Query q = node.getSession().getWorkspace().getQueryManager().createQuery( sql, Query.SQL );


            long time = System.currentTimeMillis();
            QueryResult res = q.execute();

            NodeIterator it = res.getNodes();
            long taken = System.currentTimeMillis() - time;
            if (taken > 2000) {
                log.debug("QueryExec time is: " + (System.currentTimeMillis() - time));
View Full Code Here

            sql += " AND " + AssetItem.CONTENT_PROPERTY_ARCHIVE_FLAG + " = 'true'";

            Query q = this.session.getWorkspace().getQueryManager().createQuery( sql,
                                                                                 Query.SQL );

            QueryResult res = q.execute();

            return new AssetItemIterator( res.getNodes(),
                                          this );
        } catch ( RepositoryException e ) {
            throw new RulesRepositoryException( e );
View Full Code Here

            }

            Query q = this.session.getWorkspace().getQueryManager().createQuery( sql,
                                                                                 Query.SQL );

            QueryResult res = q.execute();

            return new AssetItemIterator( res.getNodes(),
                                          this );
        } catch ( RepositoryException e ) {
            throw new RulesRepositoryException( e );
View Full Code Here

            } else {
                searchPath += "[jcr:contains(., '" + qry + "') and " + AssetItem.CONTENT_PROPERTY_ARCHIVE_FLAG + " = 'false']";
            }
            Query q = this.session.getWorkspace().getQueryManager().createQuery( searchPath,
                                                                                 Query.XPATH );
            QueryResult res = q.execute();
            return new AssetItemIterator( res.getNodes(),
                                          this );
        } catch ( RepositoryException e ) {
            throw new RulesRepositoryException( 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.