org.rhq.enterprise.server.util
Class CriteriaQueryGenerator

java.lang.Object
  extended by org.rhq.enterprise.server.util.CriteriaQueryGenerator

public final class CriteriaQueryGenerator
extends java.lang.Object

A query generator used to generate queries with specific filtering, prefetching, or sorting requirements.

Author:
Joseph Marques

Nested Class Summary
static class CriteriaQueryGenerator.AuthorizationTokenType
           
 
Constructor Summary
CriteriaQueryGenerator(Criteria criteria)
           
 
Method Summary
 javax.persistence.Query getCountQuery(javax.persistence.EntityManager em)
           
static java.lang.String getEscapeCharacter()
           
 java.util.List<java.lang.reflect.Field> getPersistentBagFields()
          Note: This method should only be called after getQueryString(boolean)} because it is that method where the persistentBagFields property is initialized.
 javax.persistence.Query getQuery(javax.persistence.EntityManager em)
           
 java.lang.String getQueryString(boolean countQuery)
           
static void main(java.lang.String[] args)
           
 void setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType type, int subjectId)
           
 void setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType type, java.lang.String fragment, int subjectId)
           
static void testAlertCriteria()
           
static void testInheritanceCriteria()
           
static void testResourceCriteria()
           
static void testSubjectCriteria()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CriteriaQueryGenerator

public CriteriaQueryGenerator(Criteria criteria)
Method Detail

setAuthorizationResourceFragment

public void setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType type,
                                             int subjectId)

setAuthorizationResourceFragment

public void setAuthorizationResourceFragment(CriteriaQueryGenerator.AuthorizationTokenType type,
                                             java.lang.String fragment,
                                             int subjectId)

getQueryString

public java.lang.String getQueryString(boolean countQuery)

getPersistentBagFields

public java.util.List<java.lang.reflect.Field> getPersistentBagFields()
Note: This method should only be called after getQueryString(boolean)} because it is that method where the persistentBagFields property is initialized.

Returns:
Returns a list of fields from the persistent class to which the criteria class corresponds. The fields in the list are themselves instances of List and have "bag" semantics.

getQuery

public javax.persistence.Query getQuery(javax.persistence.EntityManager em)

getCountQuery

public javax.persistence.Query getCountQuery(javax.persistence.EntityManager em)

getEscapeCharacter

public static java.lang.String getEscapeCharacter()

main

public static void main(java.lang.String[] args)

testSubjectCriteria

public static void testSubjectCriteria()

testAlertCriteria

public static void testAlertCriteria()

testInheritanceCriteria

public static void testInheritanceCriteria()

testResourceCriteria

public static void testResourceCriteria()


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.