use of com.querydsl.jpa.impl.JPAQuery in project kylo by Teradata.
the class OpsFeedManagerFeedProvider method findFeedsWithFilter.
public List<OpsManagerFeed> findFeedsWithFilter(String filter) {
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
BooleanBuilder where = GenericQueryDslFilter.buildFilter(feed, filter);
JPAQuery query = factory.select(feed).from(feed).where(where);
return query.fetch();
}
use of com.querydsl.jpa.impl.JPAQuery in project kylo by Teradata.
the class NifiFeedProcessorStatisticsProvider method findFeedProcessorStatisticsByProcessorId.
@Override
public List<? extends JpaNifiFeedProcessorStats> findFeedProcessorStatisticsByProcessorId(String feedName, DateTime start, DateTime end) {
QJpaNifiFeedProcessorStats stats = QJpaNifiFeedProcessorStats.jpaNifiFeedProcessorStats;
QJpaOpsManagerFeed feed = QJpaOpsManagerFeed.jpaOpsManagerFeed;
JPAQuery query = factory.select(Projections.bean(JpaNifiFeedProcessorStats.class, stats.feedName, stats.processorId, stats.processorName, stats.bytesIn.sum().as("bytesIn"), stats.bytesOut.sum().as("bytesOut"), stats.duration.sum().as("duration"), stats.jobsStarted.sum().as("jobsStarted"), stats.jobsFinished.sum().as("jobsFinished"), stats.jobDuration.sum().as("jobDuration"), stats.flowFilesStarted.sum().as("flowFilesStarted"), stats.flowFilesFinished.sum().as("flowFilesFinished"), stats.totalCount.sum().as("totalCount"), stats.maxEventTime.max().as("maxEventTime"), stats.minEventTime.min().as("minEventTime"), stats.jobsFailed.sum().as("jobsFailed"), stats.failedCount.sum().as("failedCount"), stats.count().as("resultSetCount"))).from(stats).innerJoin(feed).on(feed.name.eq(stats.feedName)).where(stats.feedName.eq(feedName).and(FeedAclIndexQueryAugmentor.generateExistsExpression(feed.id, accessController.isEntityAccessControlled())).and(stats.minEventTime.goe(start).and(stats.maxEventTime.loe(end)))).groupBy(stats.feedName, stats.processorId, stats.processorName).orderBy(stats.processorName.asc());
return (List<JpaNifiFeedProcessorStats>) query.fetch();
}
use of com.querydsl.jpa.impl.JPAQuery in project Settler by EmhyrVarEmreis.
the class TransactionService method getMostUsedUsers.
public ResponseEntity<List<UserListDTO>> getMostUsedUsers(Long count) {
QUser user = QUser.user;
QTransaction transaction = QTransaction.transaction;
QRedistribution redistribution = QRedistribution.redistribution;
List<User> userList = new JPAQuery<>(entityManager).from(user).select(user).where(user.id.in(JPAExpressions.selectFrom(transaction).select(redistribution.id.user.id).leftJoin(redistribution).on(redistribution.id.parent.id.eq(transaction.id)).where(transaction.creator.id.eq(Security.currentUser().getId())).groupBy(redistribution.id.user.id).orderBy(redistribution.id.user.id.count().desc()).limit(count))).fetch();
Type listType = new TypeToken<List<UserListDTO>>() {
}.getType();
List<UserListDTO> userListDTOList = getModelMapper().map(userList, listType);
return new ResponseEntity<>(userListDTOList, HttpStatus.OK);
}
use of com.querydsl.jpa.impl.JPAQuery in project Settler by EmhyrVarEmreis.
the class UserService method getUsersWithValue.
public ResponseEntity<List<UserWithValueDTO>> getUsersWithValue(Long userId) {
getPermissionManager().authorizeGlobalAdmin();
if (Objects.isNull(userId) || userId < 0) {
userId = Security.currentUser().getId();
}
QUser user = QUser.user;
QTransaction transaction = QTransaction.transaction;
List<Tuple> fetch = new JPAQuery<>(entityManager).from(user, transaction).select(user, transaction.value.sum()).where(transaction.creator.id.eq(userId)).where(user.id.ne(userId)).where(transaction.owners.any().id.user.eq(user).or(transaction.contractors.any().id.user.eq(user))).groupBy(user.id, user.firstName, user.lastName, user.email, user.created, user.avatar, user.login, user.accountExpireDate).orderBy(transaction.value.sum().desc()).fetch();
ModelMapper preparedModelMapper = getModelMapper();
List<UserWithValueDTO> userWithValueDTOList = new ArrayList<>(fetch.size());
for (Tuple tuple : fetch) {
User u = tuple.get(user);
Double d = tuple.get(transaction.value.sum());
if (Objects.nonNull(u)) {
userWithValueDTOList.add(new UserWithValueDTO(userId, preparedModelMapper.map(u, String.class), d));
}
}
return new ResponseEntity<>(userWithValueDTOList, HttpStatus.OK);
}
use of com.querydsl.jpa.impl.JPAQuery 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