Java Code Examples for com.querydsl.core.BooleanBuilder#and()
The following examples show how to use
com.querydsl.core.BooleanBuilder#and() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AccountingService.java From radman with MIT License | 5 votes |
private Predicate buildAccountingSearchPredicate(@NonNull AccountingFilter filter) { BooleanBuilder booleanBuilder = new BooleanBuilder(); if (!(StringUtils.isEmpty(filter.getSearchText()))) { booleanBuilder.or(QRadAcct.radAcct.acctSessionId.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.acctUniqueId.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.username.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.realm.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.nasIpAddress.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.nasPortId.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.nasPortType.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.acctInterval.stringValue().contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.acctSessionTime.stringValue().contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.acctAuthentic.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.connectInfoStart.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.connectInfoStop.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.acctInputOctets.stringValue().contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.acctOutputOctets.stringValue().contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.calledStationId.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.callingStationId.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.acctTerminateCause.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.serviceType.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.framedProtocol.contains(filter.getSearchText())); booleanBuilder.or(QRadAcct.radAcct.framedIpAddress.contains(filter.getSearchText())); } if (filter.isSearchOnlyActiveSessions()) { booleanBuilder.and(QRadAcct.radAcct.acctStartTime.isNotNull()); booleanBuilder.and(QRadAcct.radAcct.acctStopTime.isNull()); } return booleanBuilder.getValue(); }
Example 2
Source File: PersonController.java From blog-tutorials with MIT License | 5 votes |
@GetMapping public Page<Person> getPersons( @RequestParam(name = "page", defaultValue = "0") int page, @RequestParam(name = "size", defaultValue = "500") int size, @RequestParam(name = "firstname", required = false) String firstname, @RequestParam(name = "lastname", required = false) String lastname, @RequestParam(name = "budget", required = false) Integer budget, @RequestParam(name = "dobLimit", required = false) Long dobLimit) { BooleanBuilder booleanBuilder = new BooleanBuilder(); if (firstname != null && !firstname.isEmpty()) { booleanBuilder.and(QPerson.person.firstname.eq(firstname)); } if (lastname != null && !lastname.isEmpty()) { booleanBuilder.and(QPerson.person.lastname.eq(lastname)); } if (budget != null && budget != 0) { booleanBuilder.and(QPerson.person.budget.goe(budget)); } if (dobLimit != null && dobLimit != 0) { booleanBuilder.and( QPerson.person.dob.before(Instant.ofEpochSecond(dobLimit))); } return personRepository.findAll(booleanBuilder.getValue(), PageRequest.of(page, size, Sort.by(Sort.Direction.ASC, "id"))); }
Example 3
Source File: UserService.java From eds-starter6-jpa with Apache License 2.0 | 5 votes |
public static boolean isEmailUnique(JPAQueryFactory jpaQueryFactory, Long userId, String email) { if (StringUtils.hasText(email)) { BooleanBuilder bb = new BooleanBuilder( QUser.user.email.equalsIgnoreCase(email)); if (userId != null) { bb.and(QUser.user.id.ne(userId)); } return jpaQueryFactory.select(Expressions.ONE).from(QUser.user).where(bb) .fetchFirst() == null; } return true; }
Example 4
Source File: UserService.java From eds-starter6-jpa with Apache License 2.0 | 5 votes |
public static boolean isLoginNameUnique(JPAQueryFactory jpaQueryFactory, Long userId, String loginName) { if (StringUtils.hasText(loginName)) { BooleanBuilder bb = new BooleanBuilder( QUser.user.loginName.equalsIgnoreCase(loginName)); if (userId != null) { bb.and(QUser.user.id.ne(userId)); } return jpaQueryFactory.select(Expressions.ONE).from(QUser.user).where(bb) .fetchFirst() == null; } return true; }
Example 5
Source File: PredicateBuilder.java From spring-data-jpa-datatables with Apache License 2.0 | 5 votes |
private Predicate createFinalPredicate() { BooleanBuilder predicate = new BooleanBuilder(); for (Predicate columnPredicate : columnPredicates) { predicate = predicate.and(columnPredicate); } if (!globalPredicates.isEmpty()) { predicate = predicate.andAnyOf(globalPredicates.toArray(new Predicate[0])); } return predicate; }
Example 6
Source File: QueryDslPredicates.java From spring4-sandbox with Apache License 2.0 | 5 votes |
public static Predicate pastConferences(Date _past) { QConference conf = QConference.conference; final Date now = new Date(); BooleanBuilder builder = new BooleanBuilder(); builder.and(conf.endedDate.before(now)); if (_past != null) { builder.and(conf.startedDate.after(_past)); } return builder.getValue(); }