com.atlassian.crowd.search.hibernate
Class HQLQueryTranslater
java.lang.Object
com.atlassian.crowd.search.hibernate.HQLQueryTranslater
public class HQLQueryTranslater
- extends Object
Translates implementation agnostic Queries into executable
Hibernate Query Language code.
Before you think this is an epic fail due the the existence of
Hibernate criteria queries (CBQ), criteria queries can't do
the join we want with user and user attribute classes without
explicitly mapping the join in Hibernate (AFAIK). Experience has
shown mapping joins for unbounded collections results in a
performance nightmare when mutating the collection.
|
Method Summary |
protected void |
appendBooleanTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<Boolean> restriction,
String attributeSharedAlias)
|
protected void |
appendComparableValueAsHQL(HQLQuery hql,
PropertyRestriction restriction)
|
protected void |
appendDateTermRestriction(HQLQuery hql,
Entity entityType,
PropertyRestriction<? extends Date> restriction,
String attributeSharedAlias)
|
protected void |
appendDirectoryPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction)
|
protected void |
appendEntityPropertyAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction restriction,
String attributeSharedAlias)
|
protected void |
appendEnumTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<Enum> restriction,
String attributeSharedAlias)
|
protected void |
appendGroupPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction,
String attributeSharedAlias)
|
protected void |
appendGroupTypeRestrictionAsHQL(HQLQuery hql,
GroupType groupType)
|
protected void |
appendIsNullTermRestrictionAsHSQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<?> restriction,
String attributeSharedAlias)
|
protected void |
appendMultiTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
BooleanRestriction booleanRestriction)
|
protected void |
appendPropertyRestrictionAsHQL(HQLQuery hql,
Entity entityType,
SearchRestriction restriction,
String attributeSharedAlias)
|
protected void |
appendQueryAsHQL(EntityQuery query,
HQLQuery hql)
|
protected void |
appendStringTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<String> restriction,
String attributeSharedAlias)
|
protected void |
appendStringValueAsHQL(HQLQuery hql,
PropertyRestriction<String> restriction)
|
protected void |
appendTokenPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction)
|
protected void |
appendUserPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction,
String attributeSharedAlias)
|
HQLQuery |
asHQL(EntityQuery entityQuery)
Translates an entity query into a HQLQuery. |
HQLQuery |
asHQL(long directoryID,
EntityQuery entityQuery)
Translates an entity query into a HQLQuery. |
HQLQuery |
asHQL(long directoryID,
MembershipQuery query)
Translates a membership query into a HQLQuery. |
protected HQLQuery |
membershipEntityQueryAsHQL(long directoryID,
MembershipQuery query)
|
protected HQLQuery |
membershipNamesQueryAsHQL(long directoryID,
MembershipQuery query)
|
protected HQLQuery |
newQuery()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HQL_USER_NAME
protected static final String HQL_USER_NAME
- See Also:
- Constant Field Values
HQL_USER_EMAIL_ADDRESS
protected static final String HQL_USER_EMAIL_ADDRESS
- See Also:
- Constant Field Values
HQL_USER_FIRST_NAME
protected static final String HQL_USER_FIRST_NAME
- See Also:
- Constant Field Values
HQL_USER_LAST_NAME
protected static final String HQL_USER_LAST_NAME
- See Also:
- Constant Field Values
HQL_USER_DISPLAY_NAME
protected static final String HQL_USER_DISPLAY_NAME
- See Also:
- Constant Field Values
HQL_USER_ACTIVE
protected static final String HQL_USER_ACTIVE
- See Also:
- Constant Field Values
HQL_CREATED_DATE
protected static final String HQL_CREATED_DATE
- See Also:
- Constant Field Values
HQL_UPDATED_DATE
protected static final String HQL_UPDATED_DATE
- See Also:
- Constant Field Values
HQL_GROUP_NAME
protected static final String HQL_GROUP_NAME
- See Also:
- Constant Field Values
HQL_GROUP_DESCRIPTION
protected static final String HQL_GROUP_DESCRIPTION
- See Also:
- Constant Field Values
HQL_GROUP_ACTIVE
protected static final String HQL_GROUP_ACTIVE
- See Also:
- Constant Field Values
HQL_GROUP_TYPE
protected static final String HQL_GROUP_TYPE
- See Also:
- Constant Field Values
HQL_GROUP_LOCAL
protected static final String HQL_GROUP_LOCAL
- See Also:
- Constant Field Values
HQL_TOKEN_NAME
protected static final String HQL_TOKEN_NAME
- See Also:
- Constant Field Values
HQL_TOKEN_LAST_ACCESSED_TIME
protected static final String HQL_TOKEN_LAST_ACCESSED_TIME
- See Also:
- Constant Field Values
HQL_TOKEN_DIRECTORY_ID
protected static final String HQL_TOKEN_DIRECTORY_ID
- See Also:
- Constant Field Values
HQL_TOKEN_RANDOM_NUMBER
protected static final String HQL_TOKEN_RANDOM_NUMBER
- See Also:
- Constant Field Values
HQL_DIRECTORY_NAME
protected static final String HQL_DIRECTORY_NAME
- See Also:
- Constant Field Values
HQL_DIRECTORY_ACTIVE
protected static final String HQL_DIRECTORY_ACTIVE
- See Also:
- Constant Field Values
HQL_DIRECTORY_TYPE
protected static final String HQL_DIRECTORY_TYPE
- See Also:
- Constant Field Values
HQL_DIRECTORY_IMPLEMENTATION_CLASS
protected static final String HQL_DIRECTORY_IMPLEMENTATION_CLASS
- See Also:
- Constant Field Values
HQL_APPLICATION_NAME
protected static final String HQL_APPLICATION_NAME
- See Also:
- Constant Field Values
HQL_APPLICATION_ACTIVE
protected static final String HQL_APPLICATION_ACTIVE
- See Also:
- Constant Field Values
HQL_APPLICATION_TYPE
protected static final String HQL_APPLICATION_TYPE
- See Also:
- Constant Field Values
HQL_ALIAS_NAME
protected static final String HQL_ALIAS_NAME
- See Also:
- Constant Field Values
HQL_ALIAS_APPLICATION_ID
protected static final String HQL_ALIAS_APPLICATION_ID
- See Also:
- Constant Field Values
HQL_ALIAS_USERNAME
protected static final String HQL_ALIAS_USERNAME
- See Also:
- Constant Field Values
HQL_ATTRIBUTE_NAME
protected static final String HQL_ATTRIBUTE_NAME
- See Also:
- Constant Field Values
HQL_ATTRIBUTE_VALUE
protected static final String HQL_ATTRIBUTE_VALUE
- See Also:
- Constant Field Values
HQL_ATTRIBUTE_ALIAS
protected static final String HQL_ATTRIBUTE_ALIAS
- See Also:
- Constant Field Values
HQL_DIRECTORY_ID
protected static final String HQL_DIRECTORY_ID
- See Also:
- Constant Field Values
HQL_MEMBERSHIP_ALIAS
protected static final String HQL_MEMBERSHIP_ALIAS
- See Also:
- Constant Field Values
HQL_MEMBERSHIP_TYPE
protected static final String HQL_MEMBERSHIP_TYPE
- See Also:
- Constant Field Values
HQL_MEMBERSHIP_GROUP_TYPE
protected static final String HQL_MEMBERSHIP_GROUP_TYPE
- See Also:
- Constant Field Values
HQLQueryTranslater
public HQLQueryTranslater()
asHQL
public HQLQuery asHQL(long directoryID,
MembershipQuery query)
- Translates a membership query into a HQLQuery. Query parameters are translated to JPA-style
positional parameters (e.g., ?1, ?2...).
- Parameters:
directoryID - query - a membership query
- Returns:
- translated HQL query
membershipNamesQueryAsHQL
protected HQLQuery membershipNamesQueryAsHQL(long directoryID,
MembershipQuery query)
newQuery
protected HQLQuery newQuery()
- Returns:
- a fresh instance of a HQLQuery
membershipEntityQueryAsHQL
protected HQLQuery membershipEntityQueryAsHQL(long directoryID,
MembershipQuery query)
asHQL
public HQLQuery asHQL(EntityQuery entityQuery)
- Translates an entity query into a HQLQuery. Query parameters are translated to JPA-style
positional parameters (e.g., ?1, ?2...).
- Parameters:
entityQuery - an entity query
- Returns:
- translated HQL query
asHQL
public HQLQuery asHQL(long directoryID,
EntityQuery entityQuery)
- Translates an entity query into a HQLQuery. Query parameters are translated to JPA-style
positional parameters (e.g., ?1, ?2...).
- Parameters:
directoryID - entityQuery - an entity query
- Returns:
- translated HQL query
appendQueryAsHQL
protected void appendQueryAsHQL(EntityQuery query,
HQLQuery hql)
appendPropertyRestrictionAsHQL
protected void appendPropertyRestrictionAsHQL(HQLQuery hql,
Entity entityType,
SearchRestriction restriction,
@Nullable
String attributeSharedAlias)
appendIsNullTermRestrictionAsHSQL
protected void appendIsNullTermRestrictionAsHSQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<?> restriction,
@Nullable
String attributeSharedAlias)
appendDateTermRestriction
protected void appendDateTermRestriction(HQLQuery hql,
Entity entityType,
PropertyRestriction<? extends Date> restriction,
@Nullable
String attributeSharedAlias)
appendBooleanTermRestrictionAsHQL
protected void appendBooleanTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<Boolean> restriction,
@Nullable
String attributeSharedAlias)
appendEnumTermRestrictionAsHQL
protected void appendEnumTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<Enum> restriction,
@Nullable
String attributeSharedAlias)
appendMultiTermRestrictionAsHQL
protected void appendMultiTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
BooleanRestriction booleanRestriction)
appendStringTermRestrictionAsHQL
protected void appendStringTermRestrictionAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction<String> restriction,
@Nullable
String attributeSharedAlias)
appendEntityPropertyAsHQL
protected void appendEntityPropertyAsHQL(HQLQuery hql,
Entity entityType,
PropertyRestriction restriction,
@Nullable
String attributeSharedAlias)
appendDirectoryPropertyAsHQL
protected void appendDirectoryPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction)
appendTokenPropertyAsHQL
protected void appendTokenPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction)
appendGroupTypeRestrictionAsHQL
protected void appendGroupTypeRestrictionAsHQL(HQLQuery hql,
GroupType groupType)
appendGroupPropertyAsHQL
protected void appendGroupPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction,
@Nullable
String attributeSharedAlias)
appendUserPropertyAsHQL
protected void appendUserPropertyAsHQL(HQLQuery hql,
PropertyRestriction restriction,
@Nullable
String attributeSharedAlias)
appendStringValueAsHQL
protected void appendStringValueAsHQL(HQLQuery hql,
PropertyRestriction<String> restriction)
appendComparableValueAsHQL
protected void appendComparableValueAsHQL(HQLQuery hql,
PropertyRestriction restriction)
Copyright © 2016 Atlassian. All Rights Reserved.