use of org.rembx.jeeshop.catalog.model.QCatalogItem in project jeeshop by remibantos.
the class CatalogItemFinder method findBySearchCriteria.
public <T extends CatalogItem> List<T> findBySearchCriteria(EntityPath<T> entityPath, String searchCriteria, Integer offset, Integer limit, String orderBy, Boolean isDesc) {
QCatalogItem qCatalogItem = new QCatalogItem(entityPath);
JPAQuery<T> query = new JPAQueryFactory(entityManager).selectFrom(entityPath).where(buildSearchPredicate(searchCriteria, qCatalogItem));
addOffsetAndLimitToQuery(offset, limit, query, orderBy, isDesc, qCatalogItem);
return query.fetch();
}
use of org.rembx.jeeshop.catalog.model.QCatalogItem in project jeeshop by remibantos.
the class CatalogItemFinder method countBySearchCriteria.
public Long countBySearchCriteria(EntityPath<? extends CatalogItem> entityPath, String searchCriteria) {
QCatalogItem qCatalogItem = new QCatalogItem(entityPath);
JPAQuery query = new JPAQueryFactory(entityManager).selectFrom(qCatalogItem).where(buildSearchPredicate(searchCriteria, qCatalogItem));
return query.fetchCount();
}
use of org.rembx.jeeshop.catalog.model.QCatalogItem in project jeeshop by remibantos.
the class CatalogItemFinder method findVisibleCatalogItems.
public <T extends CatalogItem> List<T> findVisibleCatalogItems(EntityPath<T> entityPath, List<T> items, String locale) {
QCatalogItem qCatalogItem = new QCatalogItem(entityPath);
Date now = new Date();
List<T> results = new JPAQueryFactory(entityManager).selectFrom(entityPath).where(qCatalogItem.disabled.isFalse(), qCatalogItem.endDate.after(now).or(qCatalogItem.endDate.isNull()), qCatalogItem.startDate.before(now).or(qCatalogItem.startDate.isNull()), qCatalogItem.in(items)).fetch();
results.forEach((catalogItem) -> catalogItem.setLocalizedPresentation(locale));
return results;
}
use of org.rembx.jeeshop.catalog.model.QCatalogItem in project jeeshop by remibantos.
the class CatalogItemFinder method findAll.
public <T extends CatalogItem> List<T> findAll(EntityPath<T> entityPath, Integer offset, Integer limit, String orderBy, Boolean isDesc) {
QCatalogItem qCatalogItem = new QCatalogItem(entityPath);
JPAQuery<T> query = new JPAQueryFactory(entityManager).selectFrom(entityPath);
addOffsetAndLimitToQuery(offset, limit, query, orderBy, isDesc, qCatalogItem);
return query.fetch();
}
use of org.rembx.jeeshop.catalog.model.QCatalogItem in project jeeshop by remibantos.
the class CatalogItemFinder method countAll.
public Long countAll(EntityPath<? extends CatalogItem> entityPath) {
QCatalogItem qCatalogItem = new QCatalogItem(entityPath);
JPAQuery query = new JPAQueryFactory(entityManager).selectFrom(qCatalogItem);
return query.fetchCount();
}
Aggregations