@Test public void testCreateRootQuery_Qualifier() { Expression extraQualifier = E1.NAME.eq("X"); RootResourceEntity<E1> resourceEntity = getResourceEntity(E1.class); resourceEntity.andQualifier(extraQualifier); SelectContext<E1> c1 = new SelectContext<>(E1.class); c1.setEntity(resourceEntity); SelectQuery<E1> query = queryAssembler.createRootQuery(c1); assertEquals(extraQualifier, query.getQualifier()); SelectQuery<E1> query2 = new SelectQuery<>(E1.class); query2.setQualifier(E1.NAME.in("a", "b")); SelectContext<E1> c2 = new SelectContext<>(E1.class); resourceEntity.setSelect(query2); c2.setEntity(resourceEntity); SelectQuery<E1> query2Amended = queryAssembler.createRootQuery(c2); assertEquals(E1.NAME.in("a", "b").andExp(E1.NAME.eq("X")), query2Amended.getQualifier()); }
public <T> SelectQuery<T> createRootQuery(SelectContext<T> context) { SelectQuery<T> query = context.getId() != null ? createRootIdQuery(context.getEntity(), context.getId()) : createQuery(context.getEntity()); if (context.getParent() != null) { query.andQualifier(CayenneUtil.parentQualifier(context.getParent(), cayenneEntityResolver)); } return query; }
CayenneQueryAssembler { public <T> SelectQuery<T> createRootQuery(SelectContext<T> context) { SelectQuery<T> query = context.getId() != null ? createRootIdQuery(context.getEntity(), context.getId()) : createQuery(context.getEntity()); if (context.getParent() != null) { query.andQualifier(CayenneUtil.parentQualifier(context.getParent(), cayenneEntityResolver)); } return query; } }
CayenneQueryAssembler { public <T> SelectQuery<T> createRootQuery(SelectContext<T> context) { SelectQuery<T> query = context.getId() != null ? createRootIdQuery(context.getEntity(), context.getId()) : createQuery(context.getEntity()); if (context.getParent() != null) { query.andQualifier(CayenneUtil.parentQualifier(context.getParent(), cayenneEntityResolver)); } return query; } CayenneQueryAssembler(EntityResolver cayenneEntityResolver); }
CayenneQueryAssembler { public <T> SelectQuery<T> createRootQuery(SelectContext<T> context) { SelectQuery<T> query = context.getId() != null ? createRootIdQuery(context.getEntity(), context.getId()) : createQuery(context.getEntity()); if (context.getParent() != null) { query.andQualifier(CayenneUtil.parentQualifier(context.getParent(), cayenneEntityResolver)); } return query; } CayenneQueryAssembler(EntityResolver cayenneEntityResolver); SelectQuery<T> createRootQuery(SelectContext<T> context); SelectQuery<T> createQueryWithParentQualifier(NestedResourceEntity<T> entity); SelectQuery<T> createQueryWithParentIdsQualifier(NestedResourceEntity<T> entity, Iterator<P> parentData); SelectQuery<T> createRootIdQuery(ResourceEntity<T> entity, AgObjectId rootId); SelectQuery<T> createQuery(ResourceEntity<T> entity); Expression buildIdQualifer(AgEntity<?> entity, AgObjectId id); }
CayenneQueryAssembler { public <T> SelectQuery<T> createRootQuery(SelectContext<T> context) { SelectQuery<T> query = context.getId() != null ? createRootIdQuery(context.getEntity(), context.getId()) : createQuery(context.getEntity()); if (context.getParent() != null) { query.andQualifier(CayenneUtil.parentQualifier(context.getParent(), cayenneEntityResolver)); } return query; } CayenneQueryAssembler(EntityResolver cayenneEntityResolver); SelectQuery<T> createRootQuery(SelectContext<T> context); SelectQuery<T> createQueryWithParentQualifier(NestedResourceEntity<T> entity); SelectQuery<T> createQueryWithParentIdsQualifier(NestedResourceEntity<T> entity, Iterator<P> parentData); SelectQuery<T> createRootIdQuery(ResourceEntity<T> entity, AgObjectId rootId); SelectQuery<T> createQuery(ResourceEntity<T> entity); Expression buildIdQualifer(AgEntity<?> entity, AgObjectId id);  }