use of io.crnk.jpa.query.criteria.JpaCriteriaExpressionFactory in project crnk-framework by crnk-project.
the class JpaCriteriaQueryBackend method doJoin.
@SuppressWarnings("unchecked")
@Override
public From<?, ?> doJoin(MetaAttribute targetAttr, JoinType joinType, From<?, ?> parent) {
if (targetAttr instanceof MetaComputedAttribute) {
MetaComputedAttribute projAttr = (MetaComputedAttribute) targetAttr;
@SuppressWarnings("rawtypes") JpaCriteriaExpressionFactory expressionFactory = (JpaCriteriaExpressionFactory<?>) queryImpl.getComputedAttrs().get(projAttr);
return (From<?, ?>) expressionFactory.getExpression(parent, getCriteriaQuery());
} else {
return parent.join(targetAttr.getName(), joinType);
}
}
use of io.crnk.jpa.query.criteria.JpaCriteriaExpressionFactory in project crnk-framework by crnk-project.
the class JpaCriteriaQueryBackend method getAttribute.
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public Expression<?> getAttribute(Expression<?> currentCriteriaPath, MetaAttribute pathElement) {
if (pathElement instanceof MetaComputedAttribute) {
MetaComputedAttribute projAttr = (MetaComputedAttribute) pathElement;
JpaCriteriaExpressionFactory expressionFactory = (JpaCriteriaExpressionFactory<?>) queryImpl.getComputedAttrs().get(projAttr);
From from = (From) currentCriteriaPath;
return expressionFactory.getExpression(from, getCriteriaQuery());
} else {
return ((Path<?>) currentCriteriaPath).get(pathElement.getName());
}
}
Aggregations