public class HQLQueryTranslater extends Object
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.
Constructor and Description |
---|
HQLQueryTranslater() |
HQLQueryTranslater(int orBatchSize) |
Modifier and Type | Method and Description |
---|---|
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.
|
List<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.
|
HQLQuery |
asHQL(long directoryID,
MembershipQuery<?> query,
boolean selectEntityToMatch)
Translates a membership query into a HQLQuery.
|
int |
getOrBatchSize() |
protected HQLQuery |
newQuery() |
void |
setOrBatchSize(int orBatchSize) |
protected static final String HQL_USER_NAME
protected static final String HQL_USER_EMAIL_ADDRESS
protected static final String HQL_USER_FIRST_NAME
protected static final String HQL_USER_LAST_NAME
protected static final String HQL_USER_DISPLAY_NAME
protected static final String HQL_USER_ACTIVE
protected static final String HQL_CREATED_DATE
protected static final String HQL_UPDATED_DATE
protected static final String HQL_GROUP_NAME
protected static final String HQL_GROUP_DESCRIPTION
protected static final String HQL_GROUP_ACTIVE
protected static final String HQL_GROUP_TYPE
protected static final String HQL_GROUP_LOCAL
protected static final String HQL_GROUP_EXTERNAL_ID
protected static final String HQL_TOKEN_NAME
protected static final String HQL_TOKEN_LAST_ACCESSED_TIME
protected static final String HQL_TOKEN_DIRECTORY_ID
protected static final String HQL_TOKEN_RANDOM_NUMBER
protected static final String HQL_DIRECTORY_NAME
protected static final String HQL_DIRECTORY_ACTIVE
protected static final String HQL_DIRECTORY_TYPE
protected static final String HQL_DIRECTORY_IMPLEMENTATION_CLASS
protected static final String HQL_APPLICATION_NAME
protected static final String HQL_APPLICATION_ACTIVE
protected static final String HQL_APPLICATION_TYPE
protected static final String HQL_ALIAS_NAME
protected static final String HQL_ALIAS_APPLICATION_ID
protected static final String HQL_ALIAS_USERNAME
protected static final String HQL_ATTRIBUTE_NAME
protected static final String HQL_ATTRIBUTE_LOWER_VALUE
protected static final String HQL_ATTRIBUTE_NUMERIC_VALUE
protected static final String HQL_ATTRIBUTE_ALIAS
protected static final String HQL_DIRECTORY_ID
protected static final String HQL_MEMBERSHIP_ALIAS
protected static final String HQL_MEMBERSHIP_TYPE
protected static final String HQL_MEMBERSHIP_GROUP_TYPE
protected static final int DEFAULT_OR_BATCH_SIZE
public static final String HQL_AND
public HQLQueryTranslater()
public HQLQueryTranslater(int orBatchSize)
public HQLQuery asHQL(long directoryID, MembershipQuery query)
query
- a membership querypublic HQLQuery asHQL(long directoryID, MembershipQuery<?> query, boolean selectEntityToMatch)
query
- a membership queryselectEntityToMatch
- whether name of the entity to match should be returned, useful when there are multiple
MembershipQuery.getEntityNamesToMatch()
specified.protected HQLQuery newQuery()
public HQLQuery asHQL(EntityQuery entityQuery)
entityQuery
- an entity querypublic List<HQLQuery> asHQL(long directoryID, EntityQuery entityQuery)
entityQuery
- an entity queryprotected void appendQueryAsHQL(EntityQuery<?> query, HQLQuery hql)
protected void appendPropertyRestrictionAsHQL(HQLQuery hql, Entity entityType, SearchRestriction restriction, @Nullable String attributeSharedAlias)
protected void appendIsNullTermRestrictionAsHSQL(HQLQuery hql, Entity entityType, PropertyRestriction<?> restriction, @Nullable String attributeSharedAlias)
protected void appendDateTermRestriction(HQLQuery hql, Entity entityType, PropertyRestriction<? extends Date> restriction, @Nullable String attributeSharedAlias)
protected void appendBooleanTermRestrictionAsHQL(HQLQuery hql, Entity entityType, PropertyRestriction<Boolean> restriction, @Nullable String attributeSharedAlias)
protected void appendEnumTermRestrictionAsHQL(HQLQuery hql, Entity entityType, PropertyRestriction<Enum> restriction, @Nullable String attributeSharedAlias)
protected void appendMultiTermRestrictionAsHQL(HQLQuery hql, Entity entityType, BooleanRestriction booleanRestriction)
protected void appendStringTermRestrictionAsHQL(HQLQuery hql, Entity entityType, PropertyRestriction<String> restriction, @Nullable String attributeSharedAlias)
protected void appendEntityPropertyAsHQL(HQLQuery hql, Entity entityType, PropertyRestriction restriction, @Nullable String attributeSharedAlias)
protected void appendDirectoryPropertyAsHQL(HQLQuery hql, PropertyRestriction restriction)
protected void appendTokenPropertyAsHQL(HQLQuery hql, PropertyRestriction restriction)
protected void appendGroupTypeRestrictionAsHQL(HQLQuery hql, GroupType groupType)
protected void appendGroupPropertyAsHQL(HQLQuery hql, PropertyRestriction restriction, @Nullable String attributeSharedAlias)
protected void appendUserPropertyAsHQL(HQLQuery hql, PropertyRestriction restriction, @Nullable String attributeSharedAlias)
protected void appendStringValueAsHQL(HQLQuery hql, PropertyRestriction<String> restriction)
protected void appendComparableValueAsHQL(HQLQuery hql, PropertyRestriction restriction)
public void setOrBatchSize(int orBatchSize)
public int getOrBatchSize()
Copyright © 2021 Atlassian. All rights reserved.