@Test public void testCreateRootQuery_Ordering() { Ordering o1 = E1.NAME.asc(); Ordering o2 = E1.NAME.desc(); SelectQuery<E1> query = new SelectQuery<>(E1.class); query.addOrdering(o1); RootResourceEntity<E1> resourceEntity = getResourceEntity(E1.class); resourceEntity.getOrderings().add(o2); SelectContext<E1> context = new SelectContext<>(E1.class); resourceEntity.setSelect(query); context.setEntity(resourceEntity); SelectQuery<E1> amended = queryAssembler.createRootQuery(context); assertSame(query, amended); assertEquals(2, amended.getOrderings().size()); assertSame(o1, amended.getOrderings().get(0)); assertSame(o2, amended.getOrderings().get(1)); }
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);  }