Skip to content

Commit ca72c5e

Browse files
authored
Merge pull request #11 from qbicsoftware/development
Prepare Release 1.0.0-alpha
2 parents a08085c + 772ac17 commit ca72c5e

File tree

97 files changed

+3957
-25954
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3957
-25954
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,15 @@
1010
# The following files are generated/updated by vaadin-maven-plugin
1111
node_modules/
1212
frontend/generated/
13+
frontend/index.html
1314
pnpmfile.js
1415
vite.generated.ts
16+
webapp/frontend/index.html
17+
package.json
18+
tsconfig.json
19+
types.d.ts
20+
webpack.config.js
21+
webpack.generated.js
1522

1623
# Browser drivers for local integration tests
1724
drivers/

README.md

+73-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ type `mvnw` (Windows), or `./mvnw` (Mac & Linux), then open
1010
http://localhost:8080 in your browser.
1111

1212
You can also import the project to your IDE of choice as you would with any
13-
Maven project. Read more on [how to import Vaadin projects to different
14-
IDEs](https://vaadin.com/docs/latest/flow/guide/step-by-step/importing) (Eclipse, IntelliJ IDEA, NetBeans, and VS Code).
13+
Maven project. Read more on [how to import Vaadin projects to different
14+
IDEs](https://vaadin.com/docs/latest/flow/guide/step-by-step/importing) (Eclipse, IntelliJ IDEA,
15+
NetBeans, and VS Code).
1516

1617
## Deploying to Production
1718

@@ -23,6 +24,64 @@ ready to be deployed. The file can be found in the `target` folder after the bui
2324
Once the JAR file is built, you can run it using
2425
`java -jar target/datamanager-1.0-SNAPSHOT.jar`
2526

27+
### Configuration
28+
29+
#### Properties
30+
31+
The default configuration of the app binds to the local port 8080 to the systems localhost:
32+
33+
```
34+
http://localhost:8080
35+
```
36+
37+
#### Environment Variables
38+
39+
The env variables contain information about the salt and the secret. Both of them are used to
40+
encrypt and decrypt user information.
41+
42+
| environment variable | description |
43+
|----------------------------|---------------------------|
44+
| `USER_DB_URL` | The database host address |
45+
| `USER_DB_USER_NAME` | The database user name |
46+
| `USER_DB_USER_PW` | The database password |
47+
48+
The application properties file could look like the following:
49+
50+
```properties
51+
spring.datasource.url=${USER_DB_URL:localhost}
52+
spring.datasource.username=${USER_DB_USER_NAME:myusername}
53+
spring.datasource.password=${USER_DB_USER_PW:astrongpassphrase!}
54+
```
55+
56+
To change the port or the driver those can be added as environmental variables as well. Both are
57+
preset with default values and
58+
are therefore not mandatory to set
59+
60+
| environment variable | description |
61+
|----------------------|----------------------|
62+
| `PORT` | The application port |
63+
| `USER_DB_DRIVER` | The database driver |
64+
65+
```properties
66+
server.port=${PORT:8080}
67+
spring.datasource.driver-class-name=${USER_DB_DRIVER:com.mysql.cj.jdbc.Driver}
68+
```
69+
70+
As the application needs to send emails, you have to configure an smtp server as well.
71+
72+
| environment variable | description |
73+
|----------------------|------------------------------------------------------|
74+
| `MAIL_HOST` | The smtp server host (e.g. smtp.gmail.com) |
75+
| `MAIL_PASSWORD` | The password to authenticate against the mail server |
76+
| `Mail_USERNAME` | The username to authenticate against the mail server |
77+
78+
```properties
79+
spring.mail.username=${MAIL_USERNAME}
80+
spring.mail.password=${MAIL_PASSWORD}
81+
spring.mail.host=${MAIL_HOST:smtp.gmail.com}
82+
spring.mail.port=${MAIL_PORT:587}
83+
```
84+
2685
## Project structure
2786

2887
- `MainLayout.java` in `src/main/java` contains the navigation setup (i.e., the
@@ -36,12 +95,18 @@ Once the JAR file is built, you can run it using
3695

3796
- Read the documentation at [vaadin.com/docs](https://vaadin.com/docs).
3897
- Follow the tutorials at [vaadin.com/tutorials](https://vaadin.com/tutorials).
39-
- Watch training videos and get certified at [vaadin.com/learn/training](https://vaadin.com/learn/training).
98+
- Watch training videos and get certified
99+
at [vaadin.com/learn/training](https://vaadin.com/learn/training).
40100
- Create new projects at [start.vaadin.com](https://start.vaadin.com/).
41-
- Search UI components and their usage examples at [vaadin.com/components](https://vaadin.com/components).
42-
- View use case applications that demonstrate Vaadin capabilities at [vaadin.com/examples-and-demos](https://vaadin.com/examples-and-demos).
43-
- Discover Vaadin's set of CSS utility classes that enable building any UI without custom CSS in the [docs](https://vaadin.com/docs/latest/ds/foundation/utility-classes).
44-
- Find a collection of solutions to common use cases in [Vaadin Cookbook](https://cookbook.vaadin.com/).
101+
- Search UI components and their usage examples
102+
at [vaadin.com/components](https://vaadin.com/components).
103+
- View use case applications that demonstrate Vaadin capabilities
104+
at [vaadin.com/examples-and-demos](https://vaadin.com/examples-and-demos).
105+
- Discover Vaadin's set of CSS utility classes that enable building any UI without custom CSS in
106+
the [docs](https://vaadin.com/docs/latest/ds/foundation/utility-classes).
107+
- Find a collection of solutions to common use cases
108+
in [Vaadin Cookbook](https://cookbook.vaadin.com/).
45109
- Find Add-ons at [vaadin.com/directory](https://vaadin.com/directory).
46-
- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/vaadin) or join our [Discord channel](https://discord.gg/MYFq5RTbBn).
110+
- Ask questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/vaadin) or join
111+
our [Discord channel](https://discord.gg/MYFq5RTbBn).
47112
- Report issues, create pull requests in [GitHub](https://github.com/vaadin/platform).

domain/pom.xml

+99-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,105 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<parent>
6-
<artifactId>datamanager</artifactId>
7-
<groupId>life.qbic</groupId>
8-
<version>0.1.0</version>
9-
</parent>
10-
<modelVersion>4.0.0</modelVersion>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>datamanager</artifactId>
7+
<groupId>life.qbic</groupId>
8+
<version>0.1.0</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
1111

12-
<artifactId>domain</artifactId>
13-
<name>Data Manager Domain</name>
12+
<artifactId>domain</artifactId>
13+
<name>Data Manager Domain</name>
1414

15-
<properties>
16-
<maven.compiler.source>17</maven.compiler.source>
17-
<maven.compiler.target>17</maven.compiler.target>
18-
</properties>
15+
<properties>
16+
<maven.compiler.source>17</maven.compiler.source>
17+
<maven.compiler.target>17</maven.compiler.target>
18+
</properties>
1919

20+
<dependencyManagement>
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.spockframework</groupId>
24+
<artifactId>spock-bom</artifactId>
25+
<version>2.0-groovy-3.0</version>
26+
<type>pom</type>
27+
<scope>import</scope>
28+
</dependency>
29+
<dependency>
30+
<groupId>javax.persistence</groupId>
31+
<artifactId>javax.persistence-api</artifactId>
32+
<version>2.2</version>
33+
</dependency>
34+
</dependencies>
35+
</dependencyManagement>
36+
<dependencies>
37+
<!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
38+
<dependency>
39+
<groupId>javax.persistence</groupId>
40+
<artifactId>javax.persistence-api</artifactId>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.spockframework</groupId>
44+
<artifactId>spock-core</artifactId>
45+
<scope>test</scope>
46+
</dependency>
47+
</dependencies>
48+
<build>
49+
<plugins>
50+
<plugin>
51+
<groupId>org.codehaus.gmavenplus</groupId>
52+
<artifactId>gmavenplus-plugin</artifactId>
53+
<version>1.13.1</version>
54+
<executions>
55+
<execution>
56+
<id>default</id>
57+
<goals>
58+
<goal>addSources</goal>
59+
<goal>addTestSources</goal>
60+
<goal>generateStubs</goal>
61+
<goal>compile</goal>
62+
<goal>generateTestStubs</goal>
63+
<goal>compileTests</goal>
64+
<goal>removeStubs</goal>
65+
<goal>removeTestStubs</goal>
66+
</goals>
67+
</execution>
68+
<execution>
69+
<id>site</id>
70+
<phase>site</phase>
71+
<goals>
72+
<goal>generateStubs</goal>
73+
<goal>generateTestStubs</goal>
74+
<goal>groovydoc</goal>
75+
<goal>groovydocTests</goal>
76+
</goals>
77+
</execution>
78+
</executions>
79+
<configuration>
80+
<groovyDocOutputDirectory>${project.build.directory}/site/gapidocs
81+
</groovyDocOutputDirectory>
82+
<testGroovyDocOutputDirectory>${project.build.directory}/site/testgapidocs
83+
</testGroovyDocOutputDirectory>
84+
</configuration>
85+
</plugin>
86+
<plugin>
87+
<artifactId>maven-surefire-plugin</artifactId>
88+
<version>3.0.0-M5</version>
89+
<configuration>
90+
<includes>
91+
<include>**/*Spec</include>
92+
</includes>
93+
</configuration>
94+
</plugin>
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-compiler-plugin</artifactId>
98+
<configuration>
99+
<source>16</source>
100+
<target>16</target>
101+
</configuration>
102+
</plugin>
103+
</plugins>
104+
</build>
20105
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package life.qbic.apps.datamanager.events;
2+
3+
import life.qbic.domain.events.DomainEvent;
4+
5+
import java.util.Set;
6+
7+
public interface EventStore {
8+
9+
void append(DomainEvent event);
10+
11+
public Set<DomainEvent> findAllByType(Class<DomainEvent> type);
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package life.qbic.apps.datamanager.notifications;
2+
3+
public interface MessageBusInterface {
4+
5+
void submit(String message, MessageParameters messageParameters);
6+
7+
void subscribe(MessageSubscriber subscriber, String notificationType);
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package life.qbic.apps.datamanager.notifications;
2+
3+
import java.time.Instant;
4+
5+
/**
6+
* <b>Message Parameters</b>
7+
*
8+
* <p>Provides quick access to important message properties, such as the message type, its id and
9+
* when it the event it reports has happened.
10+
*
11+
* @since 1.0.0
12+
*/
13+
public final class MessageParameters {
14+
15+
public final String messageType;
16+
17+
public final String messageId;
18+
19+
public final String occurredOn;
20+
21+
private MessageParameters(String messageType, String messageId, String occurredOn) {
22+
super();
23+
this.messageId = messageId;
24+
this.messageType = messageType;
25+
this.occurredOn = occurredOn;
26+
}
27+
28+
public static MessageParameters durableTextParameters(
29+
String messageType, String messageId, Instant occurredOn) {
30+
String occurredOnString = occurredOn.toString();
31+
return new MessageParameters(messageType, messageId, occurredOnString);
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package life.qbic.apps.datamanager.notifications;
2+
3+
/**
4+
* Interface for notification subscribers. This interface needs to be implemented, when a client
5+
* wants to subscribe to certain event types.
6+
*
7+
* <p>This follows the classic Publish/Subscribe pattern using an exchange instance to decouple the
8+
* publisher from the subscribers.
9+
*
10+
* @since 1.0.0
11+
*/
12+
public interface MessageSubscriber {
13+
14+
/**
15+
* Receive notifications that are passed from clients such as i.e. an exchange to broadcast
16+
* notifications.
17+
*
18+
* @param message a message with encoded information.
19+
* @since 1.0.0
20+
*/
21+
void receive(String message, MessageParameters messageParameters);
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package life.qbic.apps.datamanager.notifications;
2+
3+
import java.time.Instant;
4+
import life.qbic.domain.events.DomainEvent;
5+
6+
/**
7+
* <b>Notification</b>
8+
*
9+
* <p>This class is intended to ship {@link DomainEvent}s and provide quick access information like
10+
* the event type, the time-point of the event and a unique notification id.
11+
*
12+
* @since 1.0.0
13+
*/
14+
public class Notification {
15+
16+
final String eventType;
17+
18+
final Instant occurredOn;
19+
20+
final String notificationId;
21+
22+
final DomainEvent event;
23+
24+
/**
25+
* Creates a new {@link Notification} instance.
26+
*
27+
* @param eventType the event type
28+
* @param occurredOn the time-point of the event
29+
* @param notificationId a unique notification id
30+
* @param event the domain event
31+
* @return a notification with the arguments provided
32+
*/
33+
public static Notification create(
34+
String eventType, Instant occurredOn, String notificationId, DomainEvent event) {
35+
return new Notification(eventType, occurredOn, notificationId, event);
36+
}
37+
38+
protected Notification(
39+
String eventType, Instant occurredOn, String notificationId, DomainEvent event) {
40+
this.eventType = eventType;
41+
this.occurredOn = occurredOn;
42+
this.notificationId = notificationId;
43+
this.event = event;
44+
}
45+
}

0 commit comments

Comments
 (0)