Commit Graph

57 Commits

Author SHA1 Message Date
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
Oliver Gierke
dec820d6c2 DATACMNS-867 - Removed handling of null Pageables.
Pageable now exposes a dedicated null-object representing the absence of pagination so that all places that previously handled null values can now rather be more relaxed and assume that a non-null value is given.
2017-03-24 08:00:46 +01:00
Oliver Gierke
917c3e2889 DATACMNS-867 - Removed Optional from QuerydslBindingsFactory API. 2017-03-24 08:00:45 +01:00
Christoph Strobl
be347eaaab DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters.
Additionally remove unused imports and replace single element list initialization with dedicated singletonList.
Use Assertion overloads taking Supplier for dynamic assertion error messages.
2017-03-24 08:00:43 +01:00
Oliver Gierke
250b1cf613 DATACMNS-867 - Cleanups in Querydsl support. 2017-03-24 08:00:42 +01:00
Oliver Gierke
9c6f764131 DATACMNS-867 - Consistent non-capitalization of Querydsl. 2017-03-24 08:00:42 +01:00
Oliver Gierke
2210f2e8e9 DATACMNS-867 - Adapt codebase after rebase on forward ports. 2017-03-24 08:00:36 +01:00
Oliver Gierke
d4811e29d9 DATACMNS-867 - Second draft. 2017-03-24 08:00:23 +01:00
Oliver Gierke
cc63e5b7a4 DATACMNS-867 - First draft. 2017-03-24 08:00:23 +01:00
Mark Paluch
8bafe7964b DATACMNS-973 - Polishing.
Convert @see http://… links to valid format using @see <a href=…>…</a>.
2017-01-13 08:50:54 +01:00
Oliver Gierke
f93d2df4f1 DATACMNS-941 - Support for downcasts in Querydsl web bindings.
We now support downcasts (e.g. user.as(QSpecialUser.class).…) expressions in Querydsl web binding. We do so by skipping the introduced intermediate step in the path when calculating the dot path.

Refactored the internals of the binding to now work based on a PathInformation implementation for which either a Querydsl Path or a Spring Data PropertyPath can be used. This allows us to reuse the paths of predefined bindings.

A bit of Lombok cleanup in internal implementations.
2016-12-12 16:34:18 +01:00
Oliver Gierke
f2a6d63dbb DATACMNS-883 - Improved collection path binding for Querydsl-backed web requests.
Improved the dot-path translation of existing Querydsl Path instances by not relying on the toString() representation of the metadata but manually traversing the elements up to the root. Extracted the translation method into QueryDslUtils.

Furthermore, we now automatically insert an CollectionPathBase.any() step for Path instances of that type when reifying the paths from request attributes.
2016-07-15 11:39:43 +02:00
Oliver Gierke
3ed2f44e60 DATACMNS-787 - QuerydsBindings now allows aliasing of paths.
If a single path is now handed to QuerydslBindings.bind(…), a specialized AliasingPathBinder is returned which allows defining an alias the binding will be exposed under.

By default that alias will cause the original binding being black-listed and thus become unavailable for binding. This can be overridden by explicitly white-listing the properties to be bindable.
2015-11-23 13:07:19 +01:00
Oliver Gierke
c013c71e7a DATACMNS-670 - Upgraded to Querydsl 4.
Switched to new Querydsl 4 artifacts and adapted to changed package names and API changes.

Cleaned up some JavaDoc and APIs in QuerydslBindingsFactory and QuerydslBinderCustomizer.
2015-11-17 11:07:05 +01:00
Oliver Gierke
d3a194c408 DATACMNS-779 - Fixed JavaDoc in QuerydslPredicateBuilder.
Added JavaDoc to the constructor of QuerydslPredicateBuilder.
2015-10-22 11:45:17 +02:00
Oliver Gierke
8c90594e9e DATACMNS-760 - Removed cyclic dependency in Querydsl packages.
Moved @QuerydslPredicate into the non-web-related Querydsl package to avoid a cyclic dependency.
2015-09-01 09:23:04 +02:00
Oliver Gierke
cc2696fcc4 DATACMNS-755 - Fixed QSort property translation for plain paths.
If standard Querydsl StringPaths are used without any reference to a query class tree, we previously dropped the first segment of the path expression.

Moved to a completely different algorithm to determine the path by just using the Path's toString() representation and the root removed if necessary.
2015-08-18 13:53:02 +02:00
Oliver Gierke
8d2933f109 DATACMNS-669 - Introduced QuerydslBindingsFactory.
QuerydslBindingsFactory creates a completely build up and customized QuerydslBindings instance for a given QuerydslBinderCustomizer type and domain type.

This basically involves creating or obtaining an instance of the customizer with the following algorithm:

1. If an explicit customizer type is given and no BeanFactory is configured, we'll simply instantiate the configured type. This allows simple customizer implementations with a no-arg constructor.
2. If a BeanFactory is configured and a customizer type configured, we're trying to locate a bean of that type in the BeanFactory, falling back to creating an instance of the customizer through the BeanFactory if no existing bean definition can be found. This allows unique customizer bean definitions or complex prototype scoped customizer beans created on the fly.
3. If no customizer type is configured, we check whether the the repository of the domain type implements QuerydslBinderCustomizer and use it if so.

The extraction of that functionality allows that algorithm being used by Spring Data REST, although only step 3 is currently used there as no explicit customizer can currently be configured with Spring Data REST.
2015-08-03 15:34:47 +02:00
Oliver Gierke
e3668c621d DATACMNS-734 - Improved Querydsl predicate binding using formatters.
We now default to a FormattingConversionService to make sure comma-separated values are transformed into arrays correctly. Also, we now build up dedicated TypeDescriptor instances for the property or field about to be bound to potentially pick up formatting annotations on those.
2015-07-21 15:47:09 +02:00
Christoph Strobl
11056be292 DATACMNS-734 - Allow comma separated list of values to be bound to an array.
We now convert comma separated values for an array property by splitting values and converting each of them. This allows to convert address.location=40.740337,-73.995146 to 

class Address {
  Double[] location;
}
2015-07-21 15:47:09 +02:00
Oliver Gierke
c5e5244162 DATACMNS-669 - Moved some types for better code structure.
Introduced dedicated querydsl.bindings package to contain all non-web projects to make sure domain types and repositories don't have to depend on types in a web package.

Updated Sonargraph architecture description accordingly.

Original pull request: #132.
2015-07-20 08:12:28 +02:00
Oliver Gierke
cccfa5e5c5 DATACMNS-669 - Polishing.
Javadoc on MultiValueBinding. Hide QuerydslBindings.bind(…), ….include(…) and ….exclude(…) methods that take String arguments to reduce the probability of no query class being present.

Refined the value handling for empty request values which are represented as String[] containing an empty String. We now massage those into an empty Collection for MultiValueBindings and a null value for SingleValueInvocations.

We currently skip property values that match this pattern entirely but are prepared to allow a configuration flip switch to handle those scenarios in the future. We currently stick to skipping those values to prevent the bindings from having to deal with null values.

We now also allow the bindings to return null to indicate they don't want to get applied in the resulting predicate at all.

Switched to interface based customization to make it easier to use customizations with Spring Data REST. Added Querydsl-specific adapter of RepositoryInvoker to allow Spring Data REST to hook in the execution of the predicate obtained from request parameters.

Original pull request: #132.
2015-07-20 08:12:11 +02:00
Thomas Darimont
ec643d21cb DATACMNS-554 - Added QueryDslPredicateExecutor.findAll(Predicate, Sort).
We now support findAll on QueryDslPredicateExecutor that accepts a Querydsl Predicate and a Sort.

Original pull request: #115.
2015-02-24 09:40:16 +01:00
Thomas Darimont
0fb572b550 DATACMNS-636 - Add QueryDslPredicateExecutor.exists(…) which accepts a Querydsl predicate.
Original pull request: #112.
2015-01-26 11:03:13 +01:00
Oliver Gierke
b2251aa5b9 DATACMNS-621 - Polishing.
Simplified implementation of Path conversion. Inlined helper domain types to not to pollute the packages with types that are only used within that very one test class.

Original pull request: #111.
2015-01-20 16:31:30 +01:00
Christoph Strobl
95bda862e7 DATACMNS-621 - QSort now treats nested paths correctly.
We now inspect intermediate path elements to build sort order accordingly.

Original pull request: #111.
2015-01-20 16:25:52 +01:00
Oliver Gierke
90a9462221 DATACMNS-587 - Added findAll(OrderSpecifier… orders) to QueryDslPredicateExecutor.
QueryDslPredicateExecutor now has a findAll(…) method to take multiple OrderSpecifiers to order the results. Polished JavaDoc along the way.
2014-11-28 10:02:19 +01:00
Thomas Darimont
5448b3e63b DATACMNS-604 - Move QueryDsl helper methods from QueryDslUtils to KV package.
Moved to new class KeyValueQueryDslUtils in order to avoid class loading issues.

Original pull request: #107.
2014-11-27 12:29:34 +01:00