info.magnolia.cms.util
Class QueryUtil

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

public class QueryUtil
extends Object

Util to execute queries as simple as possible.

Version:
$Id: QueryUtil.java 41135 2011-01-06 18:12:01Z gjoseph $
Author:
Philipp Bracher

Constructor Summary
QueryUtil()
           
 
Method Summary
static String createDateExpression(Calendar calendar)
          Expression representing a date.
static String createDateExpression(int year, int month, int day)
           
static String createDateTimeExpression(Calendar calendar)
          Expression representing a date and time.
static String createDateTimeExpression(int year, int month, int day, int hour, int minutes, int seconds)
           
static String createDateTimeExpressionIgnoreTimeZone(Calendar calendar)
          Do not consider the timezone.
static String createDateTimeExpressionIgnoreTimeZone(int year, int month, int day, int hour, int minutes, int seconds)
           
static Collection<Content> exceptionThrowingQuery(String repository, String statement, String language, String returnItemType)
           
static Collection<Content> exceptionThrowingQuery(String repository, String statement, String language, String returnItemType, long maxResultSize)
          Executes a query, throwing any exceptions that arise as a result.
static Collection<Content> query(String repository, String statement)
          Executes a query.
static Collection<Content> query(String repository, String statement, String language)
          Executes a query.
static Collection<Content> query(String repository, String statement, String language, String returnItemType)
           
static Collection<Content> query(String repository, String statement, String language, 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 Collection<Content> query(String repository,
                                        String statement)
Executes a query.


query

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


exceptionThrowingQuery

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

exceptionThrowingQuery

public static Collection<Content> exceptionThrowingQuery(String repository,
                                                         String statement,
                                                         String language,
                                                         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 Collection<Content> query(String repository,
                                        String statement,
                                        String language,
                                        String returnItemType)

query

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


createDateExpression

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

createDateExpression

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


createDateTimeExpression

public static 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 String createDateTimeExpression(Calendar calendar)
Expression representing a date and time.


createDateTimeExpressionIgnoreTimeZone

public static 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 String createDateTimeExpressionIgnoreTimeZone(Calendar calendar)
Do not consider the timezone.



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