use of io.crnk.jpa.internal.query.MetaComputedAttribute in project crnk-framework by crnk-project.
the class MetaComputedAttributeTest method getValueNotSupported.
@Test(expected = UnsupportedOperationException.class)
public void getValueNotSupported() {
MetaComputedAttribute attr = new MetaComputedAttribute();
attr.getValue(null);
}
use of io.crnk.jpa.internal.query.MetaComputedAttribute in project crnk-framework by crnk-project.
the class MetaComputedAttributeTest method setValueNotSupported.
@Test(expected = UnsupportedOperationException.class)
public void setValueNotSupported() {
MetaComputedAttribute attr = new MetaComputedAttribute();
attr.setValue(null, null);
}
use of io.crnk.jpa.internal.query.MetaComputedAttribute in project crnk-framework by crnk-project.
the class QuerydslQueryBackend method getAttribute.
@Override
public Expression<?> getAttribute(final Expression<?> expression, MetaAttribute pathElement) {
if (pathElement instanceof MetaComputedAttribute) {
ComputedAttributeRegistryImpl virtualAttrs = queryImpl.getComputedAttrs();
QuerydslExpressionFactory expressionFactory = (QuerydslExpressionFactory) virtualAttrs.get((MetaComputedAttribute) pathElement);
return expressionFactory.getExpression(expression, getQuery());
} else {
return QuerydslUtils.get(expression, pathElement.getName());
}
}
use of io.crnk.jpa.internal.query.MetaComputedAttribute in project crnk-framework by crnk-project.
the class QuerydslQueryBackend method doJoin.
@Override
public Expression<?> doJoin(MetaAttribute targetAttr, JoinType joinType, Expression<?> parent) {
if (targetAttr instanceof MetaComputedAttribute) {
MetaComputedAttribute computedAttr = (MetaComputedAttribute) targetAttr;
QuerydslExpressionFactory expressionFactory = (QuerydslExpressionFactory<?>) queryImpl.getComputedAttrs().get(computedAttr);
return expressionFactory.getExpression(parent, getQuery());
} else {
Expression<Object> expression = QuerydslUtils.get(parent, targetAttr.getName());
querydslQuery.getMetadata().addJoin(QuerydslUtils.convertJoinType(joinType), expression);
return expression;
}
}
use of io.crnk.jpa.internal.query.MetaComputedAttribute 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);
}
}
Aggregations