1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package de.kaiserpfalzedv.commons.core.workflow;
19
20 import java.time.OffsetDateTime;
21 import java.time.ZoneId;
22 import java.util.UUID;
23
24 import org.eclipse.microprofile.openapi.annotations.media.Schema;
25
26 import com.fasterxml.jackson.annotation.JsonInclude;
27
28 import de.kaiserpfalzedv.commons.api.workflow.WorkflowDetailInfo;
29 import jakarta.annotation.Nullable;
30 import jakarta.validation.constraints.NotNull;
31 import lombok.AllArgsConstructor;
32 import lombok.Builder;
33 import lombok.EqualsAndHashCode;
34 import lombok.Getter;
35 import lombok.NoArgsConstructor;
36 import lombok.ToString;
37 import lombok.extern.jackson.Jacksonized;
38
39
40
41
42
43
44
45 @Jacksonized
46 @Builder(toBuilder = true)
47 @AllArgsConstructor
48 @NoArgsConstructor
49 @ToString
50 @EqualsAndHashCode
51 @Getter
52 @JsonInclude(JsonInclude.Include.NON_ABSENT)
53 @Schema(
54 name = "WorkflowDetailInfo",
55 description = "Identity and timing data of workflows, actions and calls.",
56 required = true,
57 defaultValue = "A workfow with random ID and current timestamps"
58 )
59 public class WorkflowDetailInfoImpl implements WorkflowDetailInfo {
60 private static final long serialVersionUID = 0L;
61
62 @Schema(
63 description = "A user understandable name.",
64 nullable = true,
65 minLength = 1,
66 maxLength = 100
67 )
68 @NotNull
69 private String name;
70
71 @Schema(
72 description = "The ID",
73 defaultValue = "Random UUID",
74 required = true,
75 minLength = 1,
76 maxLength = 100
77 )
78 @NotNull
79 @Builder.Default
80 private final String id = UUID.randomUUID().toString();
81
82 @Schema(
83 description = "The creation time.",
84 defaultValue = "now",
85 required = true
86 )
87 @NotNull
88 @Builder.Default
89 private final OffsetDateTime created = OffsetDateTime.now(ZoneId.of("UTC"));
90
91
92 @Schema(
93 description = "The time the result does not matter any more. Services may stop working on the answer and return an error instead.",
94 defaultValue = "10 Years in future",
95 required = true
96 )
97 @NotNull
98 @Builder.Default
99 private final OffsetDateTime ttl = OffsetDateTime.now(ZoneId.of("UTC")).plusYears(10);
100
101
102 @Schema(
103 description = "The response channel to use. Normally an URI containing the response channel for asynchronous answers.",
104 nullable = true
105 )
106 @Nullable
107 private String responseChannel;
108 }