com.querydsl.core.types.dsl.StringPath Java Examples
The following examples show how to use
com.querydsl.core.types.dsl.StringPath.
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: QueryDslRepositorySupportExt.java From springlets with Apache License 2.0 | 6 votes |
/** * Adds a global contains text filter on the provided attributes. * WARNING: this creates a very inefficient query. If you have many entity * instances to query, use instead an indexed text search solution for better * performance. * @param text the text to look for * @param query * @param globalSearchAttributes the list of attributes to perform the * filter on * @return the updated query */ protected JPQLQuery<T> applyGlobalSearch(String text, JPQLQuery<T> query, Path<?>... globalSearchAttributes) { if (text != null && !StringUtils.isEmpty(text) && globalSearchAttributes.length > 0) { BooleanBuilder searchCondition = new BooleanBuilder(); for (int i = 0; i < globalSearchAttributes.length; i++) { Path<?> path = globalSearchAttributes[i]; if (path instanceof StringPath) { StringPath stringPath = (StringPath) path; searchCondition.or(stringPath.containsIgnoreCase(text)); } else if (path instanceof NumberExpression) { searchCondition.or(((NumberExpression<?>) path).like("%".concat(text).concat("%"))); } } return query.where(searchCondition); } return query; }
Example #2
Source File: UserRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QUser root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); bindings.excluding(root.password); }
Example #3
Source File: MyUserRepository.java From tutorials with MIT License | 4 votes |
@Override default public void customize(final QuerydslBindings bindings, final QMyUser root) { bindings.bind(String.class) .first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); bindings.excluding(root.email); }
Example #4
Source File: UserRepository.java From tutorials with MIT License | 4 votes |
@Override default void customize(final QuerydslBindings bindings, final QUser root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::eq); }
Example #5
Source File: AddressRepository.java From tutorials with MIT License | 4 votes |
@Override default void customize(final QuerydslBindings bindings, final QAddress root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::eq); }
Example #6
Source File: UserRepository.java From spring-data-examples with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QUser root) { bindings.bind(String.class).first((StringPath path, String value) -> path.containsIgnoreCase(value)); bindings.excluding(root.password); }
Example #7
Source File: DashboardRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QDashboard root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #8
Source File: DashboardBoxTypeRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QDashboardBoxType root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #9
Source File: DashboardBoxRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QDashboardBox root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #10
Source File: AuthorityRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QAuthority root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #11
Source File: RoleRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QRole root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #12
Source File: GroupRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QGroup root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #13
Source File: UserRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QUser root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); bindings.excluding(root.password); }
Example #14
Source File: ContactRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QContact root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #15
Source File: CustomerRepository.java From SMSC with Apache License 2.0 | 4 votes |
@Override default public void customize(QuerydslBindings bindings, QCustomer root) { bindings.bind(String.class).first((SingleValueBinding<StringPath, String>) StringExpression::startsWithIgnoreCase); bindings.bind(Long.class).first((SingleValueBinding<NumberPath<Long>, Long>) NumberExpression::in); }
Example #16
Source File: PatientRepository.java From spring-boot-jpa with Apache License 2.0 | 3 votes |
/** * Override default QueryDsl bindings. * TODO explain what and why? * This customizes QueryDsl to ignore case on queries involving String values * * @param bindings a QueryDslBindings to use * @param root the QPatient root */ @Override default void customize(QuerydslBindings bindings, QPatient root) { bindings.excluding(root.id); //bindings.excluding(root.patientId); bindings.bind(String.class) .first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }
Example #17
Source File: MedicationRepository.java From spring-boot-jpa with Apache License 2.0 | 3 votes |
/** * Override default QueryDsl bindings. * TODO explain what and why? * * @param bindings a QueryDslBindings to use * @param root the QPatient root */ @Override default void customize(QuerydslBindings bindings, QMedication root) { bindings.excluding(root.id); bindings.bind(String.class) .first((SingleValueBinding<StringPath, String>) StringExpression::containsIgnoreCase); }