Search in sources :

Example 1 with QueryModel

use of org.qi4j.sample.dcicargo.sample_a.infrastructure.model.QueryModel in project qi4j-sdk by Qi4j.

the class TrackingQueries method events.

public IModel<List<HandlingEventDTO>> events(final String trackingIdString) {
    return new QueryModel<HandlingEventDTO, HandlingEventEntity>(HandlingEventDTO.class) {

        public Query<HandlingEventEntity> getQuery() {
            HandlingEvent eventTemplate = templateFor(HandlingEvent.class);
            QueryBuilder<HandlingEventEntity> qb = qbf.newQueryBuilder(HandlingEventEntity.class).where(QueryExpressions.eq(eventTemplate.trackingId().get().id(), trackingIdString));
            return uowf.currentUnitOfWork().newQuery(qb).orderBy(orderBy(eventTemplate.completionTime()));
        }
    };
}
Also used : HandlingEventEntity(org.qi4j.sample.dcicargo.sample_a.data.entity.HandlingEventEntity) HandlingEvent(org.qi4j.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent) QueryModel(org.qi4j.sample.dcicargo.sample_a.infrastructure.model.QueryModel)

Aggregations

HandlingEventEntity (org.qi4j.sample.dcicargo.sample_a.data.entity.HandlingEventEntity)1 HandlingEvent (org.qi4j.sample.dcicargo.sample_a.data.shipping.handling.HandlingEvent)1 QueryModel (org.qi4j.sample.dcicargo.sample_a.infrastructure.model.QueryModel)1