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

ENDOC-771-Data-model #797

Merged
merged 2 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
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
42 changes: 31 additions & 11 deletions vuepress/docs/next/tutorials/create/ms/update-data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ sidebarDepth: 2
---

# Update the Project Data Model

## Overview

This tutorial explains how to use the [Entando Component Generator](../../../docs/create/component-gen-overview.md) powered by [JHipster](https://www.jhipster.tech/) to quickly update the data model for your Entando project.
This tutorial explains how to use the [Entando Component Generator](../../../docs/create/component-gen-overview.md) powered by [JHipster](https://www.jhipster.tech/) to quickly update the data model for your Entando Bundle project.

## Prerequisites
A [Blueprint-generated project](./generate-microservices-and-micro-frontends.md)

- [A working instance of Entando](../../../docs/getting-started/)
- Verify dependencies with the [Entando CLI](../../../docs/getting-started/entando-cli.md#check-the-environment): `ent check-env develop`
- A [Blueprint-generated bundle project](./generate-microservices-and-micro-frontends.md)

## Tutorial
The steps below assume you're working out of the root directory of the microservice, e.g. /microservices/conference-ms.
Steps 1 through 4 must be performed from the directory of the specific microservice, e.g. YOUR-BUNDLE-PROJECT/microservices/conference-ms.

1. Use JHipster to extract the current application description. The resulting JHipster Domain Language (JDL) file contains your project's application configuration and entity definitions:
```
Expand All @@ -22,9 +22,9 @@ ent jhipster export-jdl export.jdl
```
entity Conference {
name String
}
}
```
3. Enhance this definition by adding fields, entities, table mappings, field validation, etc. This is easily accomplished with the [online JDL-Studio or corresponding JHipster IDE plugins/extensions](https://www.jhipster.tech/jdl/intro). For example:
3. Enhance this definition by adding fields, entities, table mappings, field validation, etc. This can be accomplished with the [online JDL-Studio or corresponding JHipster IDE plugins/extensions](https://www.jhipster.tech/jdl/intro). For example:
```
entity Conference {
name String required
Expand All @@ -45,17 +45,37 @@ relationship OneToMany {
Conference to Session
}
```
This file content adds two fields to the Conference entity, introduces the Session entity plus an enum, and creates a mapping between the two entities. Below is the updated data model in JDL-Studio:
This content adds two fields to the Conference entity, creates the Session entity and an enumeration, and defines the relationship between the two entities. Below is the updated data model in JDL-Studio:

![conference.jdl](./img/jhipster-jdl.png)

4. Import the JDL file into your application. You will be prompted with the option to generate MFEs if this was requested during project generation.
```
ent jhipster import-jdl conference.jdl
```
If the default project structure has been retained, this step will update your data model, add entries to Liquibase to upgrade database schema during deployment, add service methods to your microservice, add fields to your MFEs, etc.

5. You can now build your updated project and [run it locally](./run-local.md) or [deploy it to Entando](../pb/publish-project-bundle.md). Definition enhancement through build and test can be repeated as many times as needed.
If the default project structure has been retained, this step updates your data model, adds entries to Liquibase to upgrade the database schema during deployment, adds service methods to your microservice, adds fields to your MFEs, etc.

- For pre-existing micro frontends, the component files need to be moved because they have been regenerated. From the bundle root directory:

```shell
mv microservices/conference-ms/ui/widgets/conference/tableWidget/{.,}* microfrontends/conference-table
```

- For each new micro frontend, use the ent CLI to add it to the bundle descriptor, relocate the component files, and add an API claim to extablish the connection. From the bundle root directory:
1. Add the new MFE and move it to the `microfrontends/YOUR-NEW-MFE` folder:
```
ent bundle mfe add YOUR-NEW-MFE
mv microservices/conference-ms/ui/widgets/conference/YOUR-NEW-MFE/{.,}* microfrontends/YOUR-NEW-MFE
```

2. Add an API claim to connect the new MFE to the pertinent microservice. If this is an extension of the Blueprint generated project, an API claim should connect the new MFE to the `conference-ms` microservice.
```
ent bundle api add YOUR-NEW-MFE conference-api --serviceName=conference-ms --serviceUrl=http://localhost:8081
alepintus marked this conversation as resolved.
Show resolved Hide resolved
```

See the [Generate Microservices and Micro Frontends](./generate-microservices-and-micro-frontends.md#configure-the-components) tutorial for step by step instructions to adjust the bundle.

5. You can now build your updated project and [run it locally](./run-local.md) or [deploy it to Entando](../pb/publish-project-bundle.md). Definition enhancement through build and test can be repeated as many times as needed.


42 changes: 31 additions & 11 deletions vuepress/docs/v7.3/tutorials/create/ms/update-data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ sidebarDepth: 2
---

# Update the Project Data Model

## Overview

This tutorial explains how to use the [Entando Component Generator](../../../docs/create/component-gen-overview.md) powered by [JHipster](https://www.jhipster.tech/) to quickly update the data model for your Entando project.
This tutorial explains how to use the [Entando Component Generator](../../../docs/create/component-gen-overview.md) powered by [JHipster](https://www.jhipster.tech/) to quickly update the data model for your Entando Bundle project.

## Prerequisites
A [Blueprint-generated project](./generate-microservices-and-micro-frontends.md)

- [A working instance of Entando](../../../docs/getting-started/)
- Verify dependencies with the [Entando CLI](../../../docs/getting-started/entando-cli.md#check-the-environment): `ent check-env develop`
- A [Blueprint-generated bundle project](./generate-microservices-and-micro-frontends.md)

## Tutorial
The steps below assume you're working out of the root directory of the microservice, e.g. /microservices/conference-ms.
Steps 1 through 4 must be performed from the directory of the specific microservice, e.g. YOUR-BUNDLE-PROJECT/microservices/conference-ms.

1. Use JHipster to extract the current application description. The resulting JHipster Domain Language (JDL) file contains your project's application configuration and entity definitions:
```
Expand All @@ -22,9 +22,9 @@ ent jhipster export-jdl export.jdl
```
entity Conference {
name String
}
}
```
3. Enhance this definition by adding fields, entities, table mappings, field validation, etc. This is easily accomplished with the [online JDL-Studio or corresponding JHipster IDE plugins/extensions](https://www.jhipster.tech/jdl/intro). For example:
3. Enhance this definition by adding fields, entities, table mappings, field validation, etc. This can be accomplished with the [online JDL-Studio or corresponding JHipster IDE plugins/extensions](https://www.jhipster.tech/jdl/intro). For example:
```
entity Conference {
name String required
Expand All @@ -45,17 +45,37 @@ relationship OneToMany {
Conference to Session
}
```
This file content adds two fields to the Conference entity, introduces the Session entity plus an enum, and creates a mapping between the two entities. Below is the updated data model in JDL-Studio:
This content adds two fields to the Conference entity, creates the Session entity and an enumeration, and defines the relationship between the two entities. Below is the updated data model in JDL-Studio:

![conference.jdl](./img/jhipster-jdl.png)

4. Import the JDL file into your application. You will be prompted with the option to generate MFEs if this was requested during project generation.
```
ent jhipster import-jdl conference.jdl
```
If the default project structure has been retained, this step will update your data model, add entries to Liquibase to upgrade database schema during deployment, add service methods to your microservice, add fields to your MFEs, etc.

5. You can now build your updated project and [run it locally](./run-local.md) or [deploy it to Entando](../pb/publish-project-bundle.md). Definition enhancement through build and test can be repeated as many times as needed.
If the default project structure has been retained, this step updates your data model, adds entries to Liquibase to upgrade the database schema during deployment, adds service methods to your microservice, adds fields to your MFEs, etc.

- For pre-existing micro frontends, the component files need to be moved because they have been regenerated. From the bundle root directory:

```shell
mv microservices/conference-ms/ui/widgets/conference/tableWidget/{.,}* microfrontends/conference-table
```

- For each new micro frontend, use the ent CLI to add it to the bundle descriptor, relocate the component files, and add an API claim to extablish the connection. From the bundle root directory:
1. Add the new MFE and move it to the `microfrontends/YOUR-NEW-MFE` folder:
```
ent bundle mfe add YOUR-NEW-MFE
mv microservices/conference-ms/ui/widgets/conference/YOUR-NEW-MFE/{.,}* microfrontends/YOUR-NEW-MFE
```

2. Add an API claim to connect the new MFE to the pertinent microservice. If this is an extension of the Blueprint generated project, an API claim should connect the new MFE to the `conference-ms` microservice.
```
ent bundle api add YOUR-NEW-MFE conference-api --serviceName=conference-ms --serviceUrl=http://localhost:8081
```

See the [Generate Microservices and Micro Frontends](./generate-microservices-and-micro-frontends.md#configure-the-components) tutorial for step by step instructions to adjust the bundle.

5. You can now build your updated project and [run it locally](./run-local.md) or [deploy it to Entando](../pb/publish-project-bundle.md). Definition enhancement through build and test can be repeated as many times as needed.