Search in sources :

Example 1 with CargoEntity

use of org.qi4j.sample.dcicargo.sample_a.data.entity.CargoEntity in project qi4j-sdk by Qi4j.

the class HandlingQueries method cargoIds.

public List<String> cargoIds() {
    QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder(CargoEntity.class);
    Query<CargoEntity> cargos = uowf.currentUnitOfWork().newQuery(qb).orderBy(orderBy(templateFor(CargoEntity.class).trackingId().get().id()));
    List<String> cargoList = new ArrayList<String>();
    for (CargoEntity cargo : cargos) {
        cargoList.add(cargo.trackingId().get().id().get());
    }
    return cargoList;
}
Also used : CargoEntity(org.qi4j.sample.dcicargo.sample_a.data.entity.CargoEntity) ArrayList(java.util.ArrayList)

Example 2 with CargoEntity

use of org.qi4j.sample.dcicargo.sample_a.data.entity.CargoEntity in project qi4j-sdk by Qi4j.

the class TrackingQueries method routedCargos.

public List<String> routedCargos() {
    Cargo cargoEntity = templateFor(CargoEntity.class);
    QueryBuilder<CargoEntity> qb = qbf.newQueryBuilder(CargoEntity.class).where(isNotNull(cargoEntity.itinerary()));
    Query<CargoEntity> cargos = uowf.currentUnitOfWork().newQuery(qb).orderBy(orderBy(cargoEntity.trackingId().get().id()));
    List<String> cargoList = new ArrayList<String>();
    for (CargoEntity cargo : cargos) {
        cargoList.add(cargo.trackingId().get().id().get());
    }
    return cargoList;
}
Also used : Cargo(org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargo) CargoEntity(org.qi4j.sample.dcicargo.sample_a.data.entity.CargoEntity) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 CargoEntity (org.qi4j.sample.dcicargo.sample_a.data.entity.CargoEntity)2 Cargo (org.qi4j.sample.dcicargo.sample_a.data.shipping.cargo.Cargo)1