Skip to content

fuinorg/ddd-4-java

Repository files navigation

ddd-4-java

Domain Driven Design for Java

Base classes for Domain Driven Design (DDD) with Java.

Java Maven Build Coverage Status Maven Central LGPLv3 License Java Development Kit 17

Versions

  • 0.5.x (or later) = Java 17 with new jakarta namespace
  • 0.3.x/0.4.x = Java 11 before namespace change from 'javax' to 'jakarta'
  • 0.2.1 = Java 8

Documentation

You can find the documentation of the project at gitbook (Work in progress - Just started!).

Presentation

http://de.slideshare.net/michael-schnell/ddd-4java/ (Rather old - The git book above is a bit more up-to-date)

Example

See ddd-cqrs-4-java-example for example microservices using the classes of this library.

Additional information

EncryptedData

For example the GDPR data protection rules requires to "delete" personal data on request. This can be done by encrypting the personal data in the event with a secret key. When the user is deleted, you can simply throw away that key and it is no longer possible to access the personal data in the stored events.

The EncryptedData class provides a basic structure with the relevant information to encrypt/decrypt such personal data in events.

Here is an example of an event with "personal-data" of type EncryptedData:

{
	"event-id": "518efad9-fb09-419e-acb6-50f1bc0c1e3e",
	"event-timestamp": "2022-01-22T09:04:18.811501046+01:00[Europe/Luxembourg]",
	"entity-id-path": "USER 5c09fc35-11e8-49d0-87ef-47c1d2738998",
	"personal-data": {
		"key-id": "secret/user/5c09fc35-11e8-49d0-87ef-47c1d2738998",
		"key-version": "1",
		"content-type": "application/json; encoding=UTF-8; version=1",
		"data-type": "PersonalData",
		"encrypted-data": "gK1UpxAwislfXCcB3yAPo83uxCPxdIJsf1x64lWckEi21oZiwIjHudEoeJge7KksfougPkHKl08/1ZW/iU7tqnVF8uv5a3Fh79lHPcHBkePhCOzoDnIh05IfVA2IrTQ6"
	}
}

EncryptedDataService

The EncryptedDataService interface defines for encrypting/decrypting EncryptedData and handling versioned secret keys.

There are two implementations that can be used for tests:

Snapshots

Snapshots can be found on the OSS Sonatype Snapshots Repository.

Add the following to your .m2/settings.xml to enable snapshots in your Maven build:

<repository>
    <id>sonatype.oss.snapshots</id>
    <name>Sonatype OSS Snapshot Repository</name>
    <url>http://oss.sonatype.org/content/repositories/snapshots</url>
    <releases>
        <enabled>false</enabled>
    </releases>
    <snapshots>
        <enabled>true</enabled>
    </snapshots>
</repository>

About

Base classes for Domain Driven Design (DDD) with Java

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages