Tutorial
Prerequisites
JoinedWorkz Studio installed and setup as described in Getting Started.
Checkout
This tutorial explains basic concepts implemented by JoinedWorkz using small JoinedWorkz modules. They are available in Git and needs to be checked out first. For each step in the tutorial exists a separate branch in the tutorial repository.
You may clone the repository and switch to the according branch using your favorite Git client or utilize the Git client embedded in JoinedWorkz Studio.
Using the embedded Git client
Start the according wizard in the main menu:File > Import... > Git > Projects from Git (with smart import)
Using another Git client
After cloning the repository you need to import the cloned module into JoinedWorkz Studio. This can be done by starting the according wizard in the main menu:File > Import... > Maven > Existing Maven Projects
Step 1
Minimal JoinedWorkz project with a simple demo model.
Module definition and model:
- pom.xml: Configuration to build a JoinedWorkz module with Maven
- model/demo.cmn: Simple canonical demo model
- .gitignore: Specifies which files should be ignored by Git
- README.md: Information about this project
The platform 'base' specified for the demo model, so all cartridges for the platform common-base are applied when the module is built.
Generated artifacts
- diagram/lib: Copied libraries which are needed for diagrams
- diagram/org.joinedworkz.demo_cmn.html: Diagram of the demo package
Source in Git
Step 2
Generate an OpenAPI specification using the demo model.
Model changes:
- add unique identifier with name
id
of typeID
to the type person - create separate model package for the API
- import the demo package
org.joinedworkz.demo
in the new model package - import the predefined package
org.joinedworks.facilities.common.base.api
- create a model for the resource
persons
Additionally, generated artifacts
- src/generated/resources/openapi/org.joinedworkz.demo.api.yaml: OpenAPI specification
Source in Git
Step 3
Generate person persistence for the platform 'GenesisMutiny'.
Maven module changes
- change dependency from
common-base
tocommon-genesis-mutiny
- add compile time dependency
genesis-vertx-mutiny-sql
Model changes:
- import and set platform
GenesisMutiny
- add stereotype
entity
to the type person
Additionally, generated artifacts
- src/generated/java: Java classes needed for persistence
- src/generated/resources/database: SQL schema files
Source in Git
Step 4
Add custom finders for person.
Model changes:
- add finder methods to person
Changes in generated artifacts
- src/generated/java: Additional methods
Source in Git
Step 5
Create tests for generated Java sourcecode.
Maven configuration
Add dependencies needed for test execution.
Manual code
- Test-Class: Test class which invokes some repository methods
Source in Git
Step 6
Create domain model package and reference it in another model package.
Create complex types related to other complex types.
Model changes:
- add a domain model package (file)
- reference model from the (newly created) domain model
- create another entity for person
- create several complex types
Changes in generated artifacts
- src/generated/java: Additional classes
Source in Git
Step 7
Create a relation to another entity
Model changes:
- create relations
Changes in generated artifacts
- src/generated/java: Java classes for relations
- src/generated/resources/database: SQL schema files for relations
Manual code
- Test-Class: Create additional tests for relations