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 lombok.AllArgsConstructor;
30 import lombok.Builder;
31 import lombok.EqualsAndHashCode;
32 import lombok.Getter;
33 import lombok.NoArgsConstructor;
34 import lombok.ToString;
35 import lombok.extern.jackson.Jacksonized;
36
37
38
39
40
41
42
43 @Jacksonized
44 @Builder(toBuilder = true)
45 @AllArgsConstructor
46 @NoArgsConstructor
47 @ToString
48 @EqualsAndHashCode
49 @Getter
50 @JsonInclude(JsonInclude.Include.NON_ABSENT)
51 @Schema(
52 name = "WorkflowDetailInfo",
53 description = "Identity and timing data of workflows, actions and calls.",
54 required = true,
55 example = "{\"name\": \"create-user\", \"id\": \"37625db0-f418-4695-9f03-ccea94234399\", \"created\": \"2022-01-04T14:22:00.000000Z\", \"ttl\": \"2022-01-04T14:25:00.000000Z\"}",
56 defaultValue = "A workfow with random ID and current timestamps"
57 )
58 public class WorkflowDetailInfoImpl implements WorkflowDetailInfo {
59 private static final long serialVersionUID = 0L;
60
61 @Schema(
62 description = "A user understandable name.",
63 example = "create-user",
64 nullable = true,
65 minLength = 1,
66 maxLength = 100
67 )
68 private String name;
69
70 @Schema(
71 description = "The ID",
72 example = "b9fa12c5-16b6-4272-b504-1b4177815442",
73 defaultValue = "Random UUID",
74 required = true,
75 minLength = 1,
76 maxLength = 100
77 )
78 @Builder.Default
79 private final String id = UUID.randomUUID().toString();
80
81 @Schema(
82 description = "The creation time.",
83 example = "2022-01-04T14:07:00.1312321Z",
84 defaultValue = "now",
85 required = true
86 )
87 @Builder.Default
88 private final OffsetDateTime created = OffsetDateTime.now(ZoneId.of("UTC"));
89
90
91 @Schema(
92 description = "The time the result does not matter any more. Services may stop working on the answer and return an error instead.",
93 example = "2023-01-01T01:00:00.000000Z",
94 defaultValue = "10 Years in future",
95 required = true
96 )
97 @Builder.Default
98 private final OffsetDateTime ttl = OffsetDateTime.now(ZoneId.of("UTC")).plusYears(10);
99
100
101 @Schema(
102 description = "The response channel to use. Normally an URI containing the response channel for asynchronous answers.",
103 example = "https://invalid.invalid/invalid",
104 nullable = true
105 )
106 private String responseChannel;
107 }