Commit Graph

84 Commits

Author SHA1 Message Date
jo
6a23723f07 Remove punctuation in all exception messages.
Closes #2603.
2022-06-07 12:53:13 -07:00
Mark Paluch
0e5e869cbf Reintroduce explicit local variable types.
We now reinstate local variable types instead of var as general var usage removes contextual detail that cannot be omitted generally.

See #2465
2022-03-28 08:55:29 +02:00
Mark Paluch
9a3a38dc22 Accept Object values in QuerydslPredicateBuilder.
We now accept Object-typed values to allow broader reuse of QuerydslPredicateBuilder. The conversion into the actual value considers the origin type and checks assignability before employing the ConversionService.

Closes #2573
2022-03-10 10:22:28 +01:00
Christoph Strobl
01291619f4 Update copyright year to 2022.
See: #2552
2022-02-17 12:46:14 +01:00
Mark Paluch
9146357b51 Polishing.
Let List… interface variants extend their base parent so that List-based variants participate in the type hierarchy.

See #2538
Original pull request: #2538.
2022-02-11 10:37:46 +01:00
Jens Schauder
f92a117b15 Add List-based repository interfaces.
This introduces the interfaces
* `ListCrudRepository`
* `ListQuerydslPredicateExecutor`
* `ListQueryByExampleExecutor`

They return `List` instead of `Iterable` when returning multiple entities.
They can be used in the same way the interfaces without the `List` prefix can be used.

Closes #2535.
Original pull request: #2538.
2022-02-11 10:37:35 +01:00
Jens Schauder
38f50e3da8 Remove Eclipse Non-Javadoc comments.
Closes #2522
2022-01-13 18:51:02 +01:00
Mark Paluch
c735b58607 Migrate code to Java 17 style.
Use var instead of explicit local types where applicable. Use pattern variable instead instanceof and cast. Prefer loops and nullable types over Stream and Optional. Convert classes to records where applicable.

See #2465
2022-01-13 18:49:07 +01:00
Mark Paluch
511181193e Add FluentQuery support to QueryByExampleExecutor and ReactiveQueryByExampleExecutor.
FluentQuery allows extending a query specification initially defined by a Example probe or a Querydsl Predicate and fetching the actual result through a functional programming model:

interface PersonRepository extends QuerydslPredicateExecutor<Person> {
  <S extends T, R> R findBy(Predicate predicate, Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction);
}

PersonRepository repo = …;

List<PersonProjection> result = repo.findBy(QPerson.person.name.eq("Walter"), q -> q.sort(Sort.by("lastname")).as(PersonProjection.class).all());

Closes: #2228
Original pull request: #2421.
2021-10-08 09:17:38 +02:00
Mark Paluch
9fbf39154f Fix Javadoc.
Fix invalid links. Replace Javadoc links to JSR-305 with code annotations.

Replace self-enclosing tags with simple ones.

See #2423
2021-09-21 11:11:30 +02:00
Mark Paluch
bb3898add3 Consider property path root in QuerydslBindings.
We now consider a qualified property path when registering and querying `QuerydslBindings` to ensure that paths matching various domain types do not accidentally get applied for a different type than they were registered for.
Previously, a binding for `Address.description` would be also applied to `User.description` as only the property path `description` was considered when looking up bindings.

Closes: #2418
Original Pull Request: #2422
2021-09-14 16:06:12 +02:00
Mark Paluch
242a71ca56 Avoid Iterator allocations when calling Sort.isSorted().
Closes #2445
2021-09-07 16:07:24 +02:00
Mark Paluch
394187a03b Revise QuerydslPredicateBuilder nullability behavior.
We now no longer return a null Predicate from QuerydslPredicateBuilder.getPredicate(…) if the input values are empty or if the constraints are empty. Instead, we return an empty BooleanBuilder instance to avoid null handling on the calling side.

HandlerMethodArgumentsResolvers for QuerydslBindings retain their null/Optional.empty semantics.

Closes #2396
2021-06-29 10:12:34 +02:00
Christoph Strobl
ee004b0f10 Rename DefaultQuerydslBinderCustomizer to QuerydslBinderCustomizerDefaults.
See #206.
Original Pull Request: #2292
2021-02-09 12:50:23 +01:00
Mark Paluch
4e07b85934 Add support for providing default Querydsl bindings.
We now consider default Querydsl bindings when registering a DefaultQuerydslBinderCustomizer bean. The default bindings are applied before applying type-specific bindings.

Closes #206.
Original Pull Request: #2292
2021-02-09 12:49:31 +01:00
Mark Paluch
130db32194 Polishing.
Introduce factory methods on Pageable, PageRequest, and QPageRequest to construct PageRequest objects. Replace builder with with…(…) methods.

Closes #322.
2021-01-28 15:47:52 +01:00
Mark Paluch
8bd2f9bf34 Update copyright year to 2021.
Closes #2268.
2021-01-07 13:42:27 +01:00
Phillip Webb
86bda64daa DATACMNS-1755 - Declare each variable in its own statement.
Update classes so that each member is declared on its own line. This
help to make them slightly easier to see when not using an IDE.

Original pull request: #448.
2020-06-25 11:20:28 +02:00
Mark Paluch
f93a66fdbc DATACMNS-1744 - Drop the use of the term white list. 2020-06-15 13:45:12 +02:00
Mark Paluch
4be5aae181 DATACMNS-1726 - Delombok source files. 2020-05-15 08:46:58 +02:00
Mark Paluch
eed7658ce5 DATACMNS-1643 - Update copyright years to 2020. 2020-01-07 08:32:25 +01:00
Oliver Drotbohm
664e661783 DATACMNS-1593, DATACMNS-1635 - Overhauled null handling in QuerydslPredicateArgumentResolver.
QuerydslPredicateArgumentResolver now properly handles predicate lookups that result in null values. The semantics of a handler method parameter of type of Querydsl's Predicate have been tightened to always see a non-null Predicate by default. Users that want to handle the absence of predicates explicitly can opt into seeing null by annotating the parameter with @Nullable or use Optional<Predicate>.

QuerydslPredicateBuilder now consistently returns null in case the original parameter map is entirely empty or consists of only keys with empty value arrays as empty form submissions do. This partially reverts the work of DATACMNS-1168, which moved into the direction of returning a default Predicate value for empty maps in the first place. That however prevents us from producing empty Optionals.

Related tickets: DATACMNS-1168.
2019-12-10 14:52:06 +01:00
Oliver Drotbohm
d1d5fa085d DATACMNS-1583 - Introduced QPageRequest.of(…) factory methods.
These methods are introduced for consistency with PageRequest. Constructors have been deprecated fro removal in 2.2.
2019-09-25 13:58:39 +02:00
Oliver Drotbohm
725d88811c DATACMNS-1581 - Polishing.
Javadoc on (Q)PageRequest.
2019-09-25 13:45:20 +02:00
Oliver Drotbohm
221ad9353e DATACMNS-1581 - Tighten nullability constraints for Sort parameters in PageRequest factory methods.
We now explicitly rejects null values for the Sort parameters in the constructor of PageRequest to avoid the creation of invalid instances if the IDE validation of nullability constraints is not in use.
2019-09-25 13:45:14 +02:00
Oliver Drotbohm
ac3fc2bddd DATACMNS-1578 - Polishing. 2019-09-05 17:35:15 +02:00
Colin Gao
30dbac1bce DATACMNS-1578 - Proper handling of null values in QuerydslDefaultBinding.
We now properly use an ….isNull() binding if the value to be compared to is null.
2019-09-05 17:34:51 +02:00
Oliver Drotbohm
dcb08cfaed DATACMNS-1569 - Updated Javadoc in Querydsl APIs for nullability rules on paging and sorting. 2019-08-22 12:47:36 +02:00
Mark Paluch
efa529a7a6 DATACMNS-1540 - Use thread-safe path cache in QuerydslPredicateBuilder.
We now use ConcurrentHashMap instead of HashMap to cache Path instances by PathInformation.
2019-05-27 08:41:51 +02:00
Spring Operator
48c9297118 DATACMNS-1500 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/ with 1 occurrences migrated to:
  https://www.apache.org/licenses/ ([https](https://www.apache.org/licenses/) result 200).
* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 701 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).

Original Pull Request: #387
2019-03-22 11:00:44 +01:00
Spring Operator
38c2ec0ae3 DATACMNS-1500 - URL Cleanup.
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# HTTP URLs that Could Not Be Fixed
These URLs were unable to be fixed. Please review them to see if they can be manually resolved.

* [ ] http://help.eclipse.org/oxygen/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/task-using_external_null_annotations.htm (200) with 1 occurrences could not be migrated:
   ([https](https://help.eclipse.org/oxygen/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/task-using_external_null_annotations.htm) result SSLException).
* [ ] http://www.querydsl.com (200) with 2 occurrences could not be migrated:
   ([https](https://www.querydsl.com) result AnnotatedConnectException).
* [ ] http://www.querydsl.com/ (200) with 2 occurrences could not be migrated:
   ([https](https://www.querydsl.com/) result AnnotatedConnectException).
* [ ] http://xml.org/sax/features/external-general-entities (301) with 1 occurrences could not be migrated:
   ([https](https://xml.org/sax/features/external-general-entities) result SSLHandshakeException).

# Fixed URLs

## Fixed But Review Recommended
These URLs were fixed, but the https status was not OK. However, the https status was the same as the http request or http redirected to an https URL, so they were migrated. Your review is recommended.

* [ ] http://www.w3.org/2001/03/xml.xsd (ReadTimeoutException) with 1 occurrences migrated to:
  https://www.w3.org/2001/03/xml.xsd ([https](https://www.w3.org/2001/03/xml.xsd) result SSLException).
* [ ] http://www.w3.org/XML/1998/namespace (ReadTimeoutException) with 1 occurrences migrated to:
  https://www.w3.org/XML/1998/namespace ([https](https://www.w3.org/XML/1998/namespace) result SSLException).
* [ ] http://foo:9090 (UnknownHostException) with 2 occurrences migrated to:
  https://foo:9090 ([https](https://foo:9090) result UnknownHostException).
* [ ] http://http://www.querydsl.com (UnknownHostException) with 1 occurrences migrated to:
  https://http://www.querydsl.com ([https](https://https://www.querydsl.com) result UnknownHostException).
* [ ] http://apache.org/xml/features/disallow-doctype-decl (404) with 1 occurrences migrated to:
  https://apache.org/xml/features/disallow-doctype-decl ([https](https://apache.org/xml/features/disallow-doctype-decl) result 404).

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html with 1 occurrences migrated to:
  https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html ([https](https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html) result 200).
* [ ] http://docs.spring.io/spring/docs/ with 1 occurrences migrated to:
  https://docs.spring.io/spring/docs/ ([https](https://docs.spring.io/spring/docs/) result 200).
* [ ] http://github.com/spring-projects/spring-data-commons with 1 occurrences migrated to:
  https://github.com/spring-projects/spring-data-commons ([https](https://github.com/spring-projects/spring-data-commons) result 200).
* [ ] http://goessner.net/articles/JsonPath/ with 1 occurrences migrated to:
  https://goessner.net/articles/JsonPath/ ([https](https://goessner.net/articles/JsonPath/) result 200).
* [ ] http://projects.spring.io/spring-data/ with 2 occurrences migrated to:
  https://projects.spring.io/spring-data/ ([https](https://projects.spring.io/spring-data/) result 200).
* [ ] http://stackoverflow.com/questions/tagged/spring-data with 2 occurrences migrated to:
  https://stackoverflow.com/questions/tagged/spring-data ([https](https://stackoverflow.com/questions/tagged/spring-data) result 200).
* [ ] http://www.regular-expressions.info/unicode.html with 2 occurrences migrated to:
  https://www.regular-expressions.info/unicode.html ([https](https://www.regular-expressions.info/unicode.html) result 200).
* [ ] http://www.springframework.org/schema/beans/spring-beans.xsd with 4 occurrences migrated to:
  https://www.springframework.org/schema/beans/spring-beans.xsd ([https](https://www.springframework.org/schema/beans/spring-beans.xsd) result 200).
* [ ] http://www.springframework.org/schema/context/spring-context.xsd with 8 occurrences migrated to:
  https://www.springframework.org/schema/context/spring-context.xsd ([https](https://www.springframework.org/schema/context/spring-context.xsd) result 200).
* [ ] http://www.springframework.org/schema/data/repository/spring-repository.xsd with 2 occurrences migrated to:
  https://www.springframework.org/schema/data/repository/spring-repository.xsd ([https](https://www.springframework.org/schema/data/repository/spring-repository.xsd) result 200).
* [ ] http://www.vavr.io/ with 2 occurrences migrated to:
  https://www.vavr.io/ ([https](https://www.vavr.io/) result 200).
* [ ] http://contributor-covenant.org with 1 occurrences migrated to:
  https://contributor-covenant.org ([https](https://contributor-covenant.org) result 301).
* [ ] http://contributor-covenant.org/version/1/3/0/ with 1 occurrences migrated to:
  https://contributor-covenant.org/version/1/3/0/ ([https](https://contributor-covenant.org/version/1/3/0/) result 301).
* [ ] http://docs.spring.io/spring-data/data-commons/docs/current/reference/html/ with 1 occurrences migrated to:
  https://docs.spring.io/spring-data/data-commons/docs/current/reference/html/ ([https](https://docs.spring.io/spring-data/data-commons/docs/current/reference/html/) result 301).
* [ ] http://help.github.com/forking/ with 1 occurrences migrated to:
  https://help.github.com/forking/ ([https](https://help.github.com/forking/) result 301).
* [ ] http://projects.spring.io/spring-data with 1 occurrences migrated to:
  https://projects.spring.io/spring-data ([https](https://projects.spring.io/spring-data) result 301).
* [ ] http://www.atomenabled.org/developers/syndication/atom-format-spec.php with 1 occurrences migrated to:
  https://www.atomenabled.org/developers/syndication/atom-format-spec.php ([https](https://www.atomenabled.org/developers/syndication/atom-format-spec.php) result 301).
* [ ] http://www.springframework.org/schema/data/jpa/spring-jpa.xsd with 2 occurrences migrated to:
  https://www.springframework.org/schema/data/jpa/spring-jpa.xsd ([https](https://www.springframework.org/schema/data/jpa/spring-jpa.xsd) result 301).
* [ ] http://www.springframework.org/schema/oxm/spring-oxm.xsd with 1 occurrences migrated to:
  https://www.springframework.org/schema/oxm/spring-oxm.xsd ([https](https://www.springframework.org/schema/oxm/spring-oxm.xsd) result 301).
* [ ] http://www.threeten.org/threetenbp with 2 occurrences migrated to:
  https://www.threeten.org/threetenbp ([https](https://www.threeten.org/threetenbp) result 301).
* [ ] http://www.xmlbeam.org with 2 occurrences migrated to:
  https://www.xmlbeam.org ([https](https://www.xmlbeam.org) result 301).
* [ ] http://www.springsource.org/download with 1 occurrences migrated to:
  https://www.springsource.org/download ([https](https://www.springsource.org/download) result 302).

# Ignored
These URLs were intentionally ignored.

* http://localhost:8080/persons with 1 occurrences
* http://localhost:8080/persons?page=1&size=20 with 1 occurrences
* http://localhost:8080?page=0&size=10 with 1 occurrences
* http://www.springframework.org/schema/beans with 8 occurrences
* http://www.springframework.org/schema/context with 16 occurrences
* http://www.springframework.org/schema/data/jaxb with 3 occurrences
* http://www.springframework.org/schema/data/jpa with 4 occurrences
* http://www.springframework.org/schema/data/repository with 20 occurrences
* http://www.springframework.org/schema/oxm with 2 occurrences
* http://www.springframework.org/schema/tool with 16 occurrences
* http://www.w3.org/1999/xhtml with 1 occurrences
* http://www.w3.org/2001/XMLSchema with 10 occurrences
* http://www.w3.org/2001/XMLSchema-instance with 4 occurrences
* http://www.w3.org/2005/Atom with 4 occurrences

Original Pull Request: #367
2019-03-21 08:26:30 +01:00
Christoph Strobl
0c1811946d DATACMNS-1081 - Polishing.
Update Javadoc.

Original Pull Request: #331
2019-01-23 10:24:43 +01:00
Mark Paluch
73eb4ca928 DATACMNS-1081 - Add ReactiveQuerydslPredicateExecutor.
We now ship with a common interface for reactive repositories that want to support Querydsl.

Original Pull Request: #331
2019-01-23 10:23:34 +01:00
Mark Paluch
1969f4bcdc DATACMNS-1459 - Update copyright years to 2019. 2019-01-02 12:12:19 +01:00
Oliver Drotbohm
f2967a919e DATACMNS-1443 - Fixed Querydsl web data binding for blank strings.
We now use StringUtils.hasLength(…) in the check whether to drop request elements from binding instead of ….hasText(…) as the latter drops blank strings so that's impossible to search for properties that contain a blank.
2018-12-10 16:55:26 +01:00
Mark Paluch
666447a4c8 DATACMNS-1293 - Polishing.
Fix leftovers pointing to legacy Querydsl packages in Javadoc. Reformat code.

Original pull request: #284.
2018-04-12 14:34:24 +02:00
Oliver Gierke
408b9abd88 DATACMNS-1235 - Polishing.
Original pull request: #265.
2018-01-10 12:07:22 +01:00
Jens Schauder
9ae4216650 DATACMNS-1235 - Support for package suffix in SimpleEntityPathResolver.
SimpleEntityPathResolver is now a normal class and takes a package suffix in the constructor.

Original pull request: #265.
2018-01-10 12:07:07 +01:00
Mark Paluch
51e7e1b7f5 DATACMNS-1240 - Update copyright years to 2018.
Also, remove some trailing whitespaces and align outdated license header format.
2018-01-08 16:04:34 +01:00
Mark Paluch
fc02b4fd08 DATACMNS-1184 - Fix Javadoc for non-null parameters in QuerydslPredicateExecutor.
Align Javadoc to reflect the non-null contract for Predicate arguments.

Mention unpaged/unsorted factory methods for Pageable/Sort arguments.

Related ticket: DATACMNS-1114.
2017-10-02 10:04:42 +02:00
Oliver Gierke
404610ebb4 DATACMNS-1168 - QuerydslPredicateBuilder now returns empty predicate by default. 2017-09-21 16:23:40 +02:00
Oliver Gierke
049970874d DATACMNS-1114 - Introduced usage of nullable annotations for API validation.
Marked all packages with Spring Frameworks @NonNullApi. Added Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fixed Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances.

Removed null handling from converters for JodaTime and ThreeTenBP. Introduced factory methods Page.empty() and Page.empty(Pageable). Introduced default methods getRequiredGetter(), …Setter() and …Field() on PersistentProperty to allow non-nullable lookups of members. The same for TypeInformation.getrequiredActualType(), …SuperTypeInformation().

Tweaked PersistentPropertyCreator.addPropertiesForRemainingDescriptors() to filter unsuitable PropertyDescriptors before actually trying to create a Property instance from them as the new stronger nullability requirements would cause exceptions downstream.

Lazy.get() now expects a non-null return value. Clients being able to cope with null need to call ….orElse(…).

Original pull request: #232.
2017-07-24 10:47:28 +02:00
Oliver Gierke
d9b16d8a27 DATACMNS-1085 - Fixed typos in Javadoc.
Original pull request: #229.
2017-07-24 10:32:19 +02:00
Oliver Gierke
17af937194 DATACMNS-1059 - Polishing.
Original pull request: #215.
2017-05-19 09:22:23 +02:00
Christoph Strobl
8c028c3115 DATACMNS-1059 - Alter QuerydslPredicateExecutor.findOne(…) to return Optional<T>.
We now return Optional<T> for QuerydslPredicateExecutor.findOne(Predicate) aligning the return type to the ones used in CrudRepository.

Original pull request: #215.
2017-05-19 09:22:23 +02:00
Oliver Gierke
3fb7c870fb DATACMNS-1057 - SingleValueBinding now returns a non-Optional again.
The binding is populated with a value so we can also expect a predicate to be returned.
2017-05-04 23:14:43 +02:00
Oliver Gierke
727ab8384c DATACMNS-944 - Moved to more consistent naming scheme for CrudRepository methods.
We now follow a more consistent naming scheme for the methods in repository that are driven by the following guidelines:

* Methods referring to an identifier now all end on …ById(…).
* Methods taking or returning a collection are named …All(…)

That results in the following renames:

* findOne(…) -> findById(…)
* save(Iterable) -> saveAll(Iterable)
* findAll(Iterable<ID>) -> findAllById(…)
* delete(ID) -> deleteById(ID)
* delete(Iterable<T>) -> deleteAll(Iterable<T>)
* exists() -> existsById(…)

As a side-effect of that, we can now drop the Serializable requirement for identifiers.

Updated CRUD method detection to use the new naming scheme and moved the code to Java 8 streams and Optional. Adapted RepositoryInvoker API to reflect method name changes as well.
2017-05-03 17:49:50 +02:00
Mark Paluch
14647f9192 DATACMNS-1021 - Add Order.asc(…) and Order.desc(…) factory methods.
We now support Order creation with Order.asc(String) and Order.desc(String) factory methods as shortcut to constructor creation via new Order(Direction, String).

Sort.by(Order.asc("age"), Order.desc("name"));

Deprecated Order(String) constructor in favor of the Order.by(String) factory method. Replace references to new Order(String) with Order.by(String).

Original pull request: #211.
2017-04-26 16:48:40 +02:00
Oliver Gierke
ba875187cd DATACMNS-867 - RepositoryInvoker.invokeQueryMethod(…) now returns an Optional. 2017-03-24 08:00:46 +01:00
Oliver Gierke
fee153f724 DATACMNS-867 - RepositoryInvoker now returns an Optional for invokeFindOne(…).
Adapted ReflectionRepositoryInvoker to transparently unwrap other potentially used wrapper types to then convert the result into an Optional.
2017-03-24 08:00:46 +01:00