info.magnolia.cms.util
Class QueryUtil

java.lang.Object
  extended by info.magnolia.cms.util.QueryUtil

public class QueryUtil
extends java.lang.Object

Util to execute queries as simple as possible.

Version:
$Id: QueryUtil.java 41137 2011-01-06 18:19:25Z gjoseph $
Author:
Philipp Bracher

Constructor Summary
QueryUtil()
           
 
Method Summary
static java.lang.String createDateExpression(java.util.Calendar calendar)
          Expression representing a date.
static java.lang.String createDateExpression(int year, int month, int day)
           
static java.lang.String createDateTimeExpression(java.util.Calendar calendar)
          Expression representing a date and time.
static java.lang.String createDateTimeExpression(int year, int month, int day, int hour, int minutes, int seconds)
           
static java.lang.String createDateTimeExpressionIgnoreTimeZone(java.util.Calendar calendar)
          Do not consider the timezone.
static java.lang.String createDateTimeExpressionIgnoreTimeZone(int year, int month, int day, int hour, int minutes, int seconds)
           
static java.util.Collection<Content> exceptionThrowingQuery(java.lang.String repository, java.lang.String statement, java.lang.String language, java.lang.String returnItemType)
           
static java.util.Collection<Content> exceptionThrowingQuery(java.lang.String repository, java.lang.String statement, java.lang.String language, java.lang.String returnItemType, long maxResultSize)
          Executes a query, throwing any exceptions that arise as a result.
static java.util.Collection<Content> query(java.lang.String repository, java.lang.String statement)
          Executes a query.
static java.util.Collection<Content> query(java.lang.String repository, java.lang.String statement, java.lang.String language)
          Executes a query.
static java.util.Collection<Content> query(java.lang.String repository, java.lang.String statement, java.lang.String language, java.lang.String returnItemType)
           
static java.util.Collection<Content> query(java.lang.String repository, java.lang.String statement, java.lang.String language, java.lang.String returnItemType, long maxResultSize)
          Executes a query - if an exception is thrown, it is logged and an empty collection is returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryUtil

public QueryUtil()
Method Detail

query

public static java.util.Collection<Content> query(java.lang.String repository,
                                                  java.lang.String statement)
Executes a query.


query

public static java.util.Collection<Content> query(java.lang.String repository,
                                                  java.lang.String statement,
                                                  java.lang.String language)
Executes a query.


exceptionThrowingQuery

public static java.util.Collection<Content> exceptionThrowingQuery(java.lang.String repository,
                                                                   java.lang.String statement,
                                                                   java.lang.String language,
                                                                   java.lang.String returnItemType)
                                                            throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

exceptionThrowingQuery

public static java.util.Collection<Content> exceptionThrowingQuery(java.lang.String repository,
                                                                   java.lang.String statement,
                                                                   java.lang.String language,
                                                                   java.lang.String returnItemType,
                                                                   long maxResultSize)
                                                            throws javax.jcr.RepositoryException
Executes a query, throwing any exceptions that arise as a result.

Throws:
javax.jcr.RepositoryException

query

public static java.util.Collection<Content> query(java.lang.String repository,
                                                  java.lang.String statement,
                                                  java.lang.String language,
                                                  java.lang.String returnItemType)

query

public static java.util.Collection<Content> query(java.lang.String repository,
                                                  java.lang.String statement,
                                                  java.lang.String language,
                                                  java.lang.String returnItemType,
                                                  long maxResultSize)
Executes a query - if an exception is thrown, it is logged and an empty collection is returned.


createDateExpression

public static java.lang.String createDateExpression(int year,
                                                    int month,
                                                    int day)
Parameters:
month - 1-12 (as opposed to java.util.Calendar 0-11 notation)

createDateExpression

public static java.lang.String createDateExpression(java.util.Calendar calendar)
Expression representing a date.


createDateTimeExpression

public static java.lang.String createDateTimeExpression(int year,
                                                        int month,
                                                        int day,
                                                        int hour,
                                                        int minutes,
                                                        int seconds)
Parameters:
month - 1-12 (as opposed to java.util.Calendar 0-11 notation)

createDateTimeExpression

public static java.lang.String createDateTimeExpression(java.util.Calendar calendar)
Expression representing a date and time.


createDateTimeExpressionIgnoreTimeZone

public static java.lang.String createDateTimeExpressionIgnoreTimeZone(int year,
                                                                      int month,
                                                                      int day,
                                                                      int hour,
                                                                      int minutes,
                                                                      int seconds)
Parameters:
month - 1-12 (as opposed to java.util.Calendar 0-11 notation)

createDateTimeExpressionIgnoreTimeZone

public static java.lang.String createDateTimeExpressionIgnoreTimeZone(java.util.Calendar calendar)
Do not consider the timezone.



Copyright © 2003-2011 Magnolia International Ltd.. All Rights Reserved.