Skip to content

Commit 20f0726

Browse files
authored
Update README.md
1 parent 2456cbc commit 20f0726

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

README.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ implementation 'org.contextmapper:context-map-generator:1.0.0'
2626
### Preconditions
2727
**Important note:** The generator requires [Graphviz](https://www.graphviz.org/) to be installed on the machine on which you run it.
2828

29-
## Example
30-
The following Java programm illustrates how you can create a Context Map (png file in this case):
29+
## Examples
30+
The following Java programs illustrates how you can create a Context Map (png file in these cases). They generate Context Maps for our [insurance example](https://github.com/ContextMapper/context-mapper-examples/tree/master/src/main/cml/insurance-example) and the [DDD "Cargo" sample application](https://github.com/ContextMapper/context-mapper-examples/tree/master/src/main/cml/ddd-sample) (CML examples can be found in our [examples repository](https://github.com/ContextMapper/context-mapper-examples)).
3131

32+
### Insurance Example
3233
```java
3334
BoundedContext customerManagement = new BoundedContext("Customer Management Context");
3435
BoundedContext customerSelfService = new BoundedContext("Customer Self-Service Context");
@@ -79,6 +80,32 @@ The program above generates the following Context Map:
7980

8081
<a href="https://raw.githubusercontent.com/ContextMapper/context-map-generator/master/context-map-example-1.png" target="_blank"><img src="https://raw.githubusercontent.com/ContextMapper/context-map-generator/master/context-map-example-1.png" alt="Example Context Map" /></a>
8182

83+
### DDD "Cargo" Sample Application
84+
```java
85+
BoundedContext cargoBookingContext = new BoundedContext("Cargo Booking Context");
86+
BoundedContext voyagePlanningContext = new BoundedContext("Voyage Planning Context");
87+
BoundedContext locationContext = new BoundedContext("Location Context");
88+
89+
ContextMap contextMap = new ContextMap()
90+
.addBoundedContext(cargoBookingContext)
91+
.addBoundedContext(voyagePlanningContext)
92+
.addBoundedContext(locationContext)
93+
94+
.addRelationship(new SharedKernel(cargoBookingContext, voyagePlanningContext))
95+
.addRelationship(new UpstreamDownstreamRelationship(locationContext, cargoBookingContext)
96+
.setUpstreamPatterns(OPEN_HOST_SERVICE, PUBLISHED_LANGUAGE))
97+
.addRelationship(new UpstreamDownstreamRelationship(locationContext, voyagePlanningContext)
98+
.setUpstreamPatterns(OPEN_HOST_SERVICE, PUBLISHED_LANGUAGE));
99+
100+
// generate the Context Map
101+
new ContextMapGenerator().setLabelSpacingFactor(10)
102+
.generateContextMapGraphic(contextMap, Format.PNG, "/home/user/myContextMap.png");
103+
```
104+
105+
The result:
106+
107+
<a href="https://raw.githubusercontent.com/ContextMapper/context-map-generator/master/context-map-example-2.png" target="_blank"><img src="https://raw.githubusercontent.com/ContextMapper/context-map-generator/master/context-map-example-2.png" alt="Example Context Map" /></a>
108+
82109
## Parameters
83110
With the following methods you can parameterize the `ContextMapGenerator`:
84111

0 commit comments

Comments
 (0)