本文整理汇总了Java中com.mysema.query.types.path.PathBuilder.get方法的典型用法代码示例。如果您正苦于以下问题:Java PathBuilder.get方法的具体用法?Java PathBuilder.get怎么用?Java PathBuilder.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysema.query.types.path.PathBuilder
的用法示例。
在下文中一共展示了PathBuilder.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareQueryAssociationMap
import com.mysema.query.types.path.PathBuilder; //导入方法依赖的package包/类
/**
* Prepares associationMap for findByCriteria
*
* @param entity
* @param filterByAssociations
* @param datatablesCriterias
* @param findInAllColumns
* @param query
* @param associationMap
* @return
*/
public static <T> JPAQuery prepareQueryAssociationMap(
PathBuilder<T> entity,
Map<String, List<String>> filterByAssociations,
DatatablesCriterias datatablesCriterias, boolean findInAllColumns,
JPAQuery query, Map<String, PathBuilder<?>> associationMap) {
LOGGER.debug("Preparing associationMap and joins for entity {}...",
entity.getType());
for (ColumnDef column : datatablesCriterias.getColumnDefs()) {
// true if the search must include this column
boolean findInColumn = StringUtils.isNotEmpty(column.getSearch());
// If no joins given for this column, don't add the JOIN to query
// to improve performance
String associationName = unescapeDot(column.getName());
if (!filterByAssociations.containsKey(associationName)) {
continue;
}
// If column is not sortable and is not filterable, don't add the
// JOIN to query to improve performance
if (!column.isSortable() && !column.isFilterable()) {
continue;
}
// If column is not sortable and no search value provided,
// don't add the JOIN to query to improve performance
if (!column.isSortable() && !findInColumn && !findInAllColumns) {
continue;
}
// Here the column is sortable or it is filterable and column search
// value or all-column search value is provided
PathBuilder<?> associationPath = entity.get(associationName);
query = query.join(associationPath);
// Store join path for later use in where
associationMap.put(associationName, associationPath);
LOGGER.trace("Added join {} -> {} as {}...", entity.getType(),
associationPath, associationName);
}
return query;
}
示例2: prepareQueryAssociationMap
import com.mysema.query.types.path.PathBuilder; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public <T> JPAQuery prepareQueryAssociationMap(PathBuilder<T> entity,
Map<String, List<String>> filterByAssociations,
DatatablesCriterias datatablesCriterias, boolean findInAllColumns,
JPAQuery query, Map<String, PathBuilder<?>> associationMap) {
LOGGER.debug("Preparing associationMap and joins for entity {}...",
entity.getType());
for (ColumnDef column : datatablesCriterias.getColumnDefs()) {
// true if the search must include this column
boolean findInColumn = StringUtils.isNotEmpty(column.getSearch());
// If no joins given for this column, don't add the JOIN to query
// to improve performance
String associationName = unescapeDot(column.getName());
if (!filterByAssociations.containsKey(associationName)) {
continue;
}
// If column is not sortable and is not filterable, don't add the
// JOIN to query to improve performance
if (!column.isSortable() && !column.isFilterable()) {
continue;
}
// If column is not sortable and no search value provided,
// don't add the JOIN to query to improve performance
if (!column.isSortable() && !findInColumn && !findInAllColumns) {
continue;
}
// Here the column is sortable or it is filterable and column search
// value or all-column search value is provided
PathBuilder<?> associationPath = entity.get(associationName);
query = query.join(associationPath);
// Store join path for later use in where
associationMap.put(associationName, associationPath);
LOGGER.trace("Added join {} -> {} as {}...", entity.getType(),
associationPath, associationName);
}
return query;
}