From 74b50c6e841f5f04ced019eeeb9a0c6fd95bcd6e Mon Sep 17 00:00:00 2001 From: Andre Meyering Date: Fri, 26 Jul 2024 15:16:32 +0200 Subject: [PATCH] docs(Java): Fix typos, format snippets, improve guides (#1072) * docs(Java): Fix typos, format snippets, improve guides * !lint * use cds add --------- Co-authored-by: Mahati Shankar <93712176+smahati@users.noreply.github.com> --- get-started/in-a-nutshell.md | 11 ++-- get-started/jumpstart.md | 2 +- get-started/troubleshooting.md | 2 +- java/cds-data.md | 7 ++- java/cqn-services/persistence-services.md | 64 ++++++++++++-------- java/cqn-services/remote-services.md | 2 +- java/developing-applications/properties.md | 1 + java/developing-applications/running.md | 4 ++ java/event-handlers/index.md | 6 +- java/operating-applications/observability.md | 2 +- java/reflection-api.md | 13 +++- java/security.md | 2 +- 12 files changed, 73 insertions(+), 43 deletions(-) diff --git a/get-started/in-a-nutshell.md b/get-started/in-a-nutshell.md index 84ec348e5..ff947d292 100644 --- a/get-started/in-a-nutshell.md +++ b/get-started/in-a-nutshell.md @@ -595,7 +595,7 @@ In Node.js, the easiest way to provide implementations for services is through e
-In CAP Java, you can add custom handlers for your service as so called EventHandlers. As CAP Java integrates with Spring Boot, you need to provide your custom code in classes, annotated with `@Component`or `@Service`, for example. Use your favorite Java IDE to add a class like the following to the `srv/src/main/java/` folder of your application. {.impl .java} +In CAP Java, you can add custom handlers for your service as so called EventHandlers. As CAP Java integrates with Spring Boot, you need to provide your custom code in classes, annotated with `@Component`, for example. Use your favorite Java IDE to add a class like the following to the `srv/src/main/java/` folder of your application. {.impl .java} ::: code-group ```java [srv/src/main/java/customer/bookshop/handlers/CatalogServiceHandler.java] @@ -745,12 +745,13 @@ public class SubmitOrderHandler implements EventHandler { this.persistenceService = persistenceService; } - @On() + @On public void onSubmitOrder(SubmitOrderContext context) { Select byId = Select.from(cds.gen.catalogservice.Books_.class).byId(context.getBook()); Books book = persistenceService.run(byId).single().as(Books.class); - if (context.getQuantity() > book.getStock()) - throw new IllegalArgumentException(context.getQuantity() + " exceeds stock for book #" + book.getTitle()); + if (context.getQuantity() > book.getStock()) + throw new IllegalArgumentException(context.getQuantity() + " exceeds stock for book #" + book.getTitle()); + book.setStock(book.getStock() - context.getQuantity()); persistenceService.run(Update.entity(Books_.CDS_NAME).data(book)); @@ -790,7 +791,7 @@ public class SubmitOrderHandler implements EventHandler { this.persistenceService = persistenceService; } - @On() + @On public void onSubmitOrder(SubmitOrderContext context) { Select byId = Select.from(cds.gen.catalogservice.Books_.class).byId(context.getBook()); Books book = persistenceService.run(byId).single().as(Books.class); diff --git a/get-started/jumpstart.md b/get-started/jumpstart.md index ea3adf4d8..010c26121 100644 --- a/get-started/jumpstart.md +++ b/get-started/jumpstart.md @@ -9,7 +9,7 @@ synopsis: Start with a minimal setup and a grow-as-you-go approach. CAP promotes getting started with **minimal upfront setup**, based on **convention over configuration**, and a **grow-as-you-go** approach, adding settings and tools later on, only when you need them. So, let's get started… > Looking for other ways to set up and start projects? -> See the _Get Started_ menu in the left-hand sidebar. +> See the _Getting Started_ menu in the left-hand sidebar. [[toc]] diff --git a/get-started/troubleshooting.md b/get-started/troubleshooting.md index ced98b681..3ff33093b 100644 --- a/get-started/troubleshooting.md +++ b/get-started/troubleshooting.md @@ -289,7 +289,7 @@ We recommend to implement a proper thread pool and not to rely on these workarou ## OData -### How Do I Generate an OData Response for Error 404? +### How Do I Generate an OData Response in Node.js for Error 404? If your application(s) endpoints are served with OData and you want to change the standard HTML response to an OData response, adapt the following snippet to your needs and add it in your [custom _server.js_ file](../node.js/cds-serve#custom-server-js). diff --git a/java/cds-data.md b/java/cds-data.md index 2fe9d5ede..9120bbcb0 100644 --- a/java/cds-data.md +++ b/java/cds-data.md @@ -6,7 +6,7 @@ redirect_from: java/data uacp: Used as link target from Help Portal at https://help.sap.com/products/BTP/65de2977205c403bbc107264b8eccf4b/9186ed9ab00842e1a31309ff1be38792.html --- -# Working with Data +# Working with CDS Data