Skip to content
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

fix(In a Nutshell): Fix class name for catalog service handler #1066

Merged
merged 3 commits into from
Jun 27, 2024
Merged
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
10 changes: 5 additions & 5 deletions get-started/in-a-nutshell.md
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,10 @@ 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}

::: code-group
```java [srv/src/main/java/customer/bookshop/handlers/CatalogService.java]
```java [srv/src/main/java/customer/bookshop/handlers/CatalogServiceHandler.java]
@Component
@ServiceName(CatalogService_.CDS_NAME)
public class CatalogHandler implements EventHandler {
public class CatalogServiceHandler implements EventHandler {
// your custom code will go here
}
```
Expand Down Expand Up @@ -645,7 +645,7 @@ module.exports = function (){
Now that you have created the classes for your custom handlers it's time to add the actual logic. You can achieve this by adding methods annotated with CAP's `@Before`, `@On`, or `@After` to your new class. The annotation takes two arguments: the event that shall be handled and the entity name for which the event is handled.

::: code-group
```java [srv/src/main/java/customer/bookshop/handlers/CatalogService.java]
```java [srv/src/main/java/customer/bookshop/handlers/CatalogServiceHandler.java]
@After(event = CqnService.EVENT_READ, entity = Books_.CDS_NAME)
public void addDiscountIfApplicable(List<Books> books) {
for (Books book : books) {
Expand All @@ -659,7 +659,7 @@ Now that you have created the classes for your custom handlers it's time to add

:::details Code including imports
::: code-group
```java [srv/src/main/java/customer/bookshop/handlers/CatalogService.java]
```java [srv/src/main/java/customer/bookshop/handlers/CatalogServiceHandler.java]
package customer.bookshop.handlers;

import java.util.List;
Expand All @@ -677,7 +677,7 @@ import cds.gen.catalogservice.CatalogService_;

@Component
@ServiceName(CatalogService_.CDS_NAME)
public class CatalogHandler implements EventHandler {
public class CatalogServiceHandler implements EventHandler {
@After(event = CqnService.EVENT_READ, entity = Books_.CDS_NAME)
public void addDiscountIfApplicable(List<Books> books) {
for (Books book : books) {
Expand Down