Skip to content

docs: update cds-data.md #1788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions java/cds-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ For the download scenario, as well, you don't need to implement any custom handl
If you want to override the default logic to process the uploaded stream with custom logic (for example, to parse a stream of CSV data), the best place to do that is in a custom `On` handler, as the following examples shows:

```java
@On(event = CdsService.EVENT_UPDATE)
@On(event = CqnService.EVENT_UPDATE)
public void processCoverImage(CdsUpdateEventContext context, List<Books> books) {
books.forEach(book -> {
InputStream is = book.getCoverImage();
Expand Down Expand Up @@ -1355,7 +1355,7 @@ For uploads, you can either use a custom `Before` or `On` handler to wrap the pr
Using a custom `Before` handler makes sense if the stream's final destination is the persistence layer of the CAP Java SDK, which writes the content to the database. Note that the pre-processing logic in this example is implemented in the `read()` methods of the `FilterInputStream` and is only called when the data is streamed, during the `On` phase of the request:

```java
@Before(event = CdsService.EVENT_UPDATE)
@Before(event = CqnService.EVENT_UPDATE)
public void preProcessCoverImage(CdsUpdateEventContext context, List<Books> books) {
books.forEach(book -> {
book.setCoverImage(new CoverImagePreProcessor(book.getCoverImage()));
Expand All @@ -1368,7 +1368,7 @@ The original `InputStream` is replaced by the proxy implementation in the `cover
Using a custom `On` handler makes sense if you want to prevent that the default `On` handler is executed and to control the final destination for the stream. You then have the option to pass the streamed data on to some other service for persistence:

```java
@On(event = CdsService.EVENT_UPDATE)
@On(event = CqnService.EVENT_UPDATE)
public Result processCoverImage(CdsUpdateEventContext context, List<Books> books) {
books.forEach(book -> {
book.setCoverImage(new CoverImagePreProcessor(book.getCoverImage()));
Expand Down