1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.bremersee.groupman.model;
18
19 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
20 import com.fasterxml.jackson.annotation.JsonProperty;
21 import io.swagger.v3.oas.annotations.media.Schema;
22 import io.swagger.v3.oas.annotations.media.Schema.AccessMode;
23 import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
24 import jakarta.validation.Valid;
25 import java.io.Serial;
26 import java.io.Serializable;
27 import java.time.OffsetDateTime;
28 import java.util.ArrayList;
29 import java.util.List;
30 import jakarta.validation.constraints.NotNull;
31 import jakarta.validation.constraints.Size;
32 import lombok.Builder;
33 import lombok.EqualsAndHashCode;
34 import lombok.NoArgsConstructor;
35 import lombok.ToString;
36
37
38
39
40
41
42 @Schema(description = "The group.")
43 @JsonIgnoreProperties(ignoreUnknown = true)
44 @EqualsAndHashCode
45 @ToString
46 @NoArgsConstructor
47 @Valid
48 public class Group implements Serializable {
49
50 @Serial
51 private static final long serialVersionUID = 1L;
52
53 @JsonProperty("id")
54 private String id = null;
55
56 @JsonProperty("version")
57 private Long version = null;
58
59 @JsonProperty("createdBy")
60 private String createdBy = null;
61
62 @JsonProperty("createdAt")
63 private OffsetDateTime createdAt = null;
64
65 @JsonProperty("modifiedAt")
66 private OffsetDateTime modifiedAt = null;
67
68 @JsonProperty("source")
69 private Source source = null;
70
71 @JsonProperty(value = "name", required = true)
72 private String name = null;
73
74 @JsonProperty("description")
75 private String description = null;
76
77 @JsonProperty("members")
78 private List<String> members = null;
79
80 @JsonProperty("owners")
81 private List<String> owners = null;
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 @Builder(toBuilder = true)
98 public Group(String id, Long version, String createdBy, OffsetDateTime createdAt,
99 OffsetDateTime modifiedAt, Source source, String name, String description,
100 List<String> members, List<String> owners) {
101 this.id = id;
102 this.version = version;
103 this.createdBy = createdBy;
104 this.createdAt = createdAt;
105 this.modifiedAt = modifiedAt;
106 this.source = source;
107 this.name = name;
108 this.description = description;
109 this.members = members;
110 this.owners = owners;
111 }
112
113
114
115
116
117
118 @Schema(
119 description = "Unique identifier of the group.",
120 accessMode = AccessMode.READ_ONLY,
121 maxLength = 255)
122 @Size(max = 255)
123 public String getId() {
124 return id;
125 }
126
127
128
129
130
131
132 public void setId(String id) {
133 this.id = id;
134 }
135
136
137
138
139
140
141 @Schema(description = "The database version number.", accessMode = AccessMode.READ_ONLY)
142 public Long getVersion() {
143 return version;
144 }
145
146
147
148
149
150
151 public void setVersion(Long version) {
152 this.version = version;
153 }
154
155
156
157
158
159
160 @Schema(description = "The user who created the group.", maxLength = 255)
161 @Size(max = 255)
162 public String getCreatedBy() {
163 return createdBy;
164 }
165
166
167
168
169
170
171 public void setCreatedBy(String createdBy) {
172 this.createdBy = createdBy;
173 }
174
175
176
177
178
179
180 @Schema(description = "The creation time.", accessMode = AccessMode.READ_ONLY)
181 public OffsetDateTime getCreatedAt() {
182 return createdAt;
183 }
184
185
186
187
188
189
190 public void setCreatedAt(OffsetDateTime createdAt) {
191 this.createdAt = createdAt;
192 }
193
194
195
196
197
198
199 @Schema(description = "The last modification time.", accessMode = AccessMode.READ_ONLY)
200 public OffsetDateTime getModifiedAt() {
201 return modifiedAt;
202 }
203
204
205
206
207
208
209 public void setModifiedAt(OffsetDateTime modifiedAt) {
210 this.modifiedAt = modifiedAt;
211 }
212
213
214
215
216
217
218 @Schema(description = "The source.", accessMode = AccessMode.READ_ONLY)
219 public Source getSource() {
220 return source;
221 }
222
223
224
225
226
227
228 public void setSource(Source source) {
229 this.source = source;
230 }
231
232
233
234
235
236
237 @Schema(
238 description = "The name of the group.",
239 requiredMode = RequiredMode.REQUIRED,
240 minLength = 3,
241 maxLength = 75)
242 @NotNull
243 @Size(min = 3, max = 75)
244 public String getName() {
245 return name;
246 }
247
248
249
250
251
252
253 public void setName(String name) {
254 this.name = name;
255 }
256
257
258
259
260
261
262 @Schema(description = "The description of the group.", maxLength = 255)
263 @Size(max = 255)
264 public String getDescription() {
265 return description;
266 }
267
268
269
270
271
272
273 public void setDescription(String description) {
274 this.description = description;
275 }
276
277
278
279
280
281
282 @Schema(description = "The members of the group.")
283 public List<String> getMembers() {
284 if (members == null) {
285 members = new ArrayList<>();
286 }
287 return members;
288 }
289
290
291
292
293
294
295 public void setMembers(List<String> members) {
296 this.members = members;
297 }
298
299
300
301
302
303
304 @Schema(description = "The owners of the group.")
305 public List<String> getOwners() {
306 if (owners == null) {
307 owners = new ArrayList<>();
308 }
309 return owners;
310 }
311
312
313
314
315
316
317 public void setOwners(List<String> owners) {
318 this.owners = owners;
319 }
320
321 }
322