Skip to content

Commit edfd341

Browse files
committed
DATACMNS-567 - Fixed some glitches in the Asciidoctor files.
Added missing closing backtick in auditing.adoc. Added copyright line to index.adoc and switched to relative level offsets. Use two blank lines at the end of each file consistently. Extracted preface document and added project metadata.
1 parent c9dd679 commit edfd341

7 files changed

+54
-27
lines changed

src/main/asciidoc/auditing.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ class Customer {
2626
----
2727
====
2828

29-
As you can see, the annotations can be applied selectively, depending on which information you'd like to capture. For the annotations capturing the points in time can be used on properties of type `org.joda.time.DateTime`, `java.util.Date` as well as `long`/`Long`.
29+
As you can see, the annotations can be applied selectively, depending on which information you'd like to capture. For the annotations capturing the points in time can be used on properties of type JodaTimes `DateTime`, legacy Java `Date` and `Calendar`, JDK8 date/time types as well as `long`/`Long`.
3030

3131
[[auditing.interfaces]]
3232
=== Interface-based auditing metadata
33-
In case you don't want to use annotations to define auditing metadata you can let your domain class implement the Auditable interface. It exposes setter methods for all of the auditing properties.
33+
In case you don't want to use annotations to define auditing metadata you can let your domain class implement the `Auditable` interface. It exposes setter methods for all of the auditing properties.
3434

3535
There's also a convenience base class `AbstractAuditable` which you can extend to avoid the need to manually implement the interface methods. Be aware that this increases the coupling of your domain classes to Spring Data which might be something you want to avoid. Usually the annotation based way of defining auditing metadata is preferred as it is less invasive and more flexible.
3636

@@ -41,7 +41,7 @@ In case you use either `@CreatedBy` or `@LastModifiedBy`, the auditing infrastru
4141

4242
Here's an example implementation of the interface using Spring Security's `Authentication` object:
4343

44-
.Implementation of `AuditorAware` based on Spring Security
44+
.Implementation of AuditorAware based on Spring Security
4545
====
4646
[source, java]
4747
----
@@ -61,4 +61,5 @@ class SpringSecurityAuditorAware implements AuditorAware<User> {
6161
----
6262
====
6363

64-
The implementation is accessing the `Authentication` object provided by Spring Security and looks up the custom `UserDetails` instance from it that you have created in your `UserDetailsService` implementation. We're assuming here that you are exposing the domain user through that `UserDetails` implementation but you could also look it up from anywhere based on the `Authentication found.
64+
The implementation is accessing the `Authentication` object provided by Spring Security and looks up the custom `UserDetails` instance from it that you have created in your `UserDetailsService` implementation. We're assuming here that you are exposing the domain user through that `UserDetails` implementation but you could also look it up from anywhere based on the `Authentication` found.
65+

src/main/asciidoc/index.adoc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
= Spring Data Commons - Reference Documentation
22
Oliver Gierke; Thomas Darimont; Christoph Strobl; Mark Pollack; Thomas Risberg;
3-
{version}
3+
:revnumber: {version}
4+
:revdate: {localdate}
45
:toc:
5-
:spring-framework-docs: http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html
6+
:toc-placement!:
7+
8+
(C) 2008-2014 The original authors.
69

710
NOTE: Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
811

9-
[[preface]]
10-
[preface]
11-
= Preface
12-
The Spring Data Commons project applies core Spring concepts to the development of solutions using many relational and non-relational data stores.
12+
toc::[]
13+
14+
include::preface.adoc[]
1315

1416
[[reference-documentation]]
1517
= Reference documentation
16-
:leveloffset: 1
18+
19+
:leveloffset: +1
1720
include::repositories.adoc[]
1821
include::auditing.adoc[]
22+
:leveloffset: -1
1923

20-
:leveloffset: 0
2124
[[appendix]]
2225
= Appendix
2326

24-
:leveloffset: 1
2527
:numbered!:
28+
:leveloffset: +1
2629
include::repository-namespace-reference.adoc[]
2730
include::repository-populator-namespace-reference.adoc[]
2831
include::repository-query-keywords-reference.adoc[]
29-
:leveloffset: 0
32+
:leveloffset: -1
33+

src/main/asciidoc/preface.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[[preface]]
2+
= Preface
3+
The Spring Data Commons project applies core Spring concepts to the development of solutions using many relational and non-relational data stores.
4+
5+
[[project]]
6+
[preface]
7+
== Project metadata
8+
9+
* Version control - http://github.com/spring-projects/spring-data-commons
10+
* Bugtracker - https://jira.spring.io/browse/DATACMNS
11+
* Release repository - https://repo.spring.io/libs-release
12+
* Milestone repository - https://repo.spring.io/libs-milestone
13+
* Snapshot repository - https://repo.spring.io/libs-snapshot

src/main/asciidoc/repositories.adoc

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:spring-framework-docs: http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html
2+
13
[[repositories]]
24
= Working with Spring Data Repositories
35

@@ -280,7 +282,7 @@ If your property names contain underscores (e.g. `first_name`) you can escape th
280282
=== Special parameter handling
281283
To handle parameters in your query you simply define method parameters as already seen in the examples above. Besides that the infrastructure will recognize certain specific types like `Pageable` and `Sort` to apply pagination and sorting to your queries dynamically.
282284

283-
.Using `Pageable` and Sort in query methods
285+
.Using Pageable, Slice and Sort in query methods
284286
====
285287
[source, java]
286288
----
@@ -301,11 +303,11 @@ Sorting options are handled through the `Pageable` instance too. If you only nee
301303
NOTE: To find out how many pages you get for a query entirely you have to trigger an additional count query. By default this query will be derived from the query you actually trigger.
302304

303305
[[repositories.create-instances]]
304-
=== Creating repository instances
306+
== Creating repository instances
305307
In this section you create instances and bean definitions for the repository interfaces defined. One way to do so is using the Spring namespace that is shipped with each Spring Data module that supports the repository mechanism although we generally recommend to use the Java-Config style configuration.
306308

307309
[[repositories.create-instances.spring]]
308-
==== XML configuration
310+
=== XML configuration
309311
Each Spring Data module includes a repositories element that allows you to simply define a base package that Spring scans for you.
310312

311313
.Enabling Spring Data repositories via XML
@@ -329,7 +331,7 @@ Each Spring Data module includes a repositories element that allows you to simpl
329331

330332
In the preceding example, Spring is instructed to scan `com.acme.repositories` and all its sub-packages for interfaces extending `Repository` or one of its sub-interfaces. For each interface found, the infrastructure registers the persistence technology-specific `FactoryBean` to create the appropriate proxies that handle invocations of the query methods. Each bean is registered under a bean name that is derived from the interface name, so an interface of `UserRepository` would be registered under `userRepository`. The `base-package` attribute allows wildcards, so that you can define a pattern of scanned packages.
331333

332-
===== Using filters
334+
==== Using filters
333335
By default the infrastructure picks up every interface extending the persistence technology-specific `Repository` sub-interface located under the configured base package and creates a bean instance for it. However, you might want more fine-grained control over which interfaces bean instances get created for. To do this you use `<include-filter />` and `<exclude-filter />` elements inside `<repositories />`. The semantics are exactly equivalent to the elements in Spring's context namespace. For details, see link:{spring-framework-docs}/beans.html#beans-scanning-filters[Spring reference documentation] on these elements.
334336

335337
For example, to exclude certain interfaces from instantiation as repository, you could use the following configuration:
@@ -371,7 +373,7 @@ class ApplicationConfiguration {
371373
NOTE: The sample uses the JPA-specific annotation, which you would change according to the store module you actually use. The same applies to the definition of the `EntityManagerFactory` bean. Consult the sections covering the store-specific configuration.
372374

373375
[[repositories.create-instances.standalone]]
374-
==== Standalone usage
376+
=== Standalone usage
375377
You can also use the repository infrastructure outside of a Spring container, e.g. in CDI environments. You still need some Spring libraries in your classpath, but generally you can set up repositories programmatically as well. The Spring Data modules that provide repository support ship a persistence technology-specific RepositoryFactory that you can use as follows.
376378

377379
.Standalone usage of repository factory
@@ -572,7 +574,7 @@ This section documents a set of Spring Data extensions that enable Spring Data u
572574

573575
NOTE: This section contains the documentation for the Spring Data web support as it is implemented as of Spring Data Commons in the 1.6 range. As it the newly introduced support changes quite a lot of things we kept the documentation of the former behavior in <<web.legacy>>.
574576

575-
Spring Data modules ships with a variety of web support if the module supports the repository programming model. The web related stuff requires Spring MVC JARs on the classpath, some of them even provide integration with Spring HATEOAS footnote:[Spring HATEOAS - link:$$https://github.com/SpringSource/spring-hateoas$$[https://github.com/SpringSource/spring-hateoas]]. In general, the integration support is enabled by using the `@EnableSpringDataWebSupport annotation in your JavaConfig configuration class.
577+
Spring Data modules ships with a variety of web support if the module supports the repository programming model. The web related stuff requires Spring MVC JARs on the classpath, some of them even provide integration with Spring HATEOAS footnote:[Spring HATEOAS - link:$$https://github.com/SpringSource/spring-hateoas$$[https://github.com/SpringSource/spring-hateoas]]. In general, the integration support is enabled by using the `@EnableSpringDataWebSupport` annotation in your JavaConfig configuration class.
576578

577579
.Enabling Spring Data web support
578580
====
@@ -658,10 +660,11 @@ public class UserController {
658660
This method signature will cause Spring MVC try to derive a Pageable instance from the request parameters using the following default configuration:
659661

660662
.Request parameters evaluated for Pageable instances
663+
[options = "autowidth"]
661664
|===============
662665
|`page`|Page you want to retrieve.
663666
|`size`|Size of the page you want to retrieve.
664-
|`sort`|Properties that should be sorted by in the format `property,property(,ASC|DESC)`. Default sort direction is ascending. Use multiple sort` parameters if you want to switch directions, e.g. `?sort=firstname&amp;sort=lastname,asc`.
667+
|`sort`|Properties that should be sorted by in the format `property,property(,ASC\|DESC)`. Default sort direction is ascending. Use multiple `sort` parameters if you want to switch directions, e.g. `?sort=firstname&sort=lastname,asc`.
665668
|===============
666669

667670
To customize this behavior extend either `SpringDataWebConfiguration` or the HATEOAS-enabled equivalent and override the `pageableResolver()` or `sortResolver()` methods and import your customized configuration file instead of using the `@Enable`-annotation.
@@ -972,21 +975,24 @@ public class UserController {
972975

973976
The `PageableArgumentResolver` automatically resolves request parameters to build a `PageRequest` instance. By default it expects the following structure for the request parameters.
974977

975-
.Request parameters evaluated by `PageableHandlerMethodArgumentResolver`
976-
978+
.Request parameters evaluated by PageableHandlerMethodArgumentResolver
979+
[options = "autowidth"]
977980
|===============
978981
|`page`|Page you want to retrieve, 0 indexed and defaults to 0.
979982
|`size`|Size of the page you want to retrieve, defaults to 20.
980-
|`sort`|A collection of sort directives in the format `($propertyname,)[asc|desc]?`.
983+
|`sort`|A collection of sort directives in the format `($propertyname,)[asc\|desc]?`.
981984
|===============
982985

983-
.Pagination URL Parameter Examples
984-
====
986+
.Pagination URL parameter examples
987+
985988
To retrieve the third page with a maximum page size of 100 with the data sorted by the email property in ascending order use the following url parameter:
989+
====
986990
----
987991
?page=2&size=100&sort=email,asc
988992
----
993+
====
989994
To sort the data by multiple properties in different sort order use the following URL parameter:
995+
====
990996
----
991997
?sort=foo,asc&sort=bar,desc
992998
----
@@ -1003,7 +1009,7 @@ public String showUsers(Model model,
10031009

10041010
you have to populate `foo_page` and `bar_page` and the related subproperties.
10051011

1006-
Configuring a global default on bean declaration the `PageableArgumentResolver` will use a `PageRequest` with the first page and a page size of 10 by default. It will use that value if it cannot resolve a `PageRequest` from the request (because of missing parameters, for example). You can configure a global default on the bean declaration directly. If you might need controller method specific defaults for the `Pageable`, annotate the method parameter with @PageableDefaults and specify page (through `pageNumber`), page size (through `value`), `sort` (list of properties to sort by), and `sortDir` (the direction to sort by) as annotation attributes:
1012+
Configuring a global default on bean declaration the `PageableArgumentResolver` will use a `PageRequest` with the first page and a page size of 10 by default. It will use that value if it cannot resolve a `PageRequest` from the request (because of missing parameters, for example). You can configure a global default on the bean declaration directly. If you might need controller method specific defaults for the `Pageable`, annotate the method parameter with `@PageableDefaults` and specify page (through `pageNumber`), page size (through `value`), `sort` (list of properties to sort by), and `sortDir` (the direction to sort by) as annotation attributes:
10071013

10081014
[source, java]
10091015
----

src/main/asciidoc/repository-namespace-reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ The `<repositories />` element triggers the setup of the Spring Data repository
1616
|`named-queries-location`|Defines the location to look for a Properties file containing externally defined queries.
1717
|`consider-nested-repositories`|Controls whether nested repository interface definitions should be considered. Defaults to `false`.
1818
|===============
19+

src/main/asciidoc/repository-populator-namespace-reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ The `<populator />` element allows to populate the a data store via the Spring D
1212
|Name|Description
1313
|`locations`|Where to find the files to read the objects from the repository shall be populated with.
1414
|===============
15+

src/main/asciidoc/repository-query-keywords-reference.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ The following table lists the keywords generally supported by the Spring Data re
3636
|`TRUE`|`True`, `IsTrue`
3737
|`WITHIN`|`Within`, `IsWithin`
3838
|===============
39+

0 commit comments

Comments
 (0)