use of com.blazebit.persistence.parser.SimpleQueryGenerator in project blaze-persistence by Blazebit.
the class AbstractAttribute method renderExpression.
protected final void renderExpression(String parent, Expression expression, String aliasToSkip, ServiceProvider serviceProvider, StringBuilder sb) {
if (parent != null && !parent.isEmpty()) {
ExpressionFactory ef = serviceProvider.getService(ExpressionFactory.class);
SimpleQueryGenerator generator = new PrefixingQueryGenerator(ef, parent, aliasToSkip, aliasToSkip, declaringType.getEntityViewRootTypes().keySet(), true, false);
generator.setQueryBuffer(sb);
expression.accept(generator);
} else {
sb.append(expression);
}
}
use of com.blazebit.persistence.parser.SimpleQueryGenerator in project blaze-persistence by Blazebit.
the class TupleElementMapperBuilder method applyMapping.
private void applyMapping(StringBuilder sb, String prefixParts, String mapping) {
if (mapping.isEmpty()) {
if (prefixParts != null && !prefixParts.isEmpty()) {
sb.append(AbstractAttribute.stripThisFromMapping(prefixParts));
}
return;
}
if (prefixParts != null && !prefixParts.isEmpty()) {
Expression expr = ef.createSimpleExpression(mapping, false, false, true);
SimpleQueryGenerator generator = new PrefixingQueryGenerator(ef, prefixParts, null, null, rootTypes.keySet(), true, false);
generator.setQueryBuffer(sb);
expr.accept(generator);
} else {
sb.append(mapping);
}
}
use of com.blazebit.persistence.parser.SimpleQueryGenerator in project blaze-persistence by Blazebit.
the class PrefixingQueryGenerator method prefix.
public static String prefix(ExpressionFactory ef, Expression expression, String prefix, Set<String> queryAliases, boolean fromEmbeddingViewScope) {
SimpleQueryGenerator generator = new PrefixingQueryGenerator(ef, prefix, null, null, queryAliases, !fromEmbeddingViewScope, fromEmbeddingViewScope);
StringBuilder sb = new StringBuilder(20 + prefix.length());
generator.setQueryBuffer(sb);
expression.accept(generator);
return sb.toString();
}
use of com.blazebit.persistence.parser.SimpleQueryGenerator in project blaze-persistence by Blazebit.
the class TupleElementMapperBuilder method getMapping.
public String getMapping(Expression expression) {
StringBuilder sb = new StringBuilder();
if (mappingPrefix != null && !mappingPrefix.isEmpty()) {
SimpleQueryGenerator generator = new PrefixingQueryGenerator(ef, mappingPrefix, null, null, rootTypes.keySet(), true, false);
generator.setQueryBuffer(sb);
expression.accept(generator);
} else {
sb.append(expression);
}
return sb.toString().intern();
}
Aggregations