Skip to content

Commit 9a96f07

Browse files
sven1103KochTobi
andauthored
Introduce reference Id in persons (#338)
* Add referenceId * Add snapshot tag Co-authored-by: Tobias Koch <KochTobi@users.noreply.github.com>
1 parent 2e95187 commit 9a96f07

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>life.qbic</groupId>
99
<artifactId>data-model-lib</artifactId>
10-
<version>2.22.0</version>
10+
<version>2.23.0-SNAPSHOT</version>
1111
<name>data-model-lib</name>
1212
<url>http://github.com/qbicsoftware/data-model-lib</url>
1313
<description>Data models. A collection of QBiC's central data models and DTOs. </description>

src/main/groovy/life/qbic/datamodel/dtos/general/Person.groovy

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ abstract class Person {
2727
*/
2828
final int id
2929

30+
/**
31+
* Unique entity identifier (UUID)
32+
* @since 2.22.0
33+
*/
34+
final String referenceId
35+
3036
/**
3137
* The person's first name
3238
*/
@@ -66,12 +72,15 @@ abstract class Person {
6672

6773
List<Affiliation> affiliations
6874

75+
String referenceId
76+
6977
Builder(String firstName, String lastName, String emailAddress) {
7078
this.firstName = Objects.requireNonNull(firstName, "First name must not be null")
7179
this.lastName = Objects.requireNonNull(lastName, "Last name must not be null")
7280
this.emailAddress = Objects.requireNonNull(emailAddress, "Email must not be null")
7381
this.title = AcademicTitle.NONE
7482
this.affiliations = new ArrayList<>()
83+
this.referenceId = UUID.randomUUID().toString()
7584
}
7685

7786
T id(int id) {
@@ -94,6 +103,11 @@ abstract class Person {
94103
return self()
95104
}
96105

106+
T referenceId(UUID id) {
107+
this.referenceId = id.toString()
108+
return self()
109+
}
110+
97111
abstract Person build()
98112

99113
/**
@@ -111,6 +125,7 @@ abstract class Person {
111125
emailAddress = builder.emailAddress
112126
title = builder.title
113127
affiliations = builder.affiliations
128+
referenceId = builder.referenceId
114129
}
115130

116131
/**

0 commit comments

Comments
 (0)