View Javadoc
1   /*
2    * Copyright (c) 2023. Roland T. Lichti, Kaiserpfalz EDV-Service.
3    *
4    * This program is free software: you can redistribute it and/or modify
5    * it under the terms of the GNU General Public License as published by
6    * the Free Software Foundation, either version 3 of the License, or
7    * (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16   */
17  
18  package de.kaiserpfalzedv.commons.core.workflow;
19  
20  import java.util.UUID;
21  
22  import org.eclipse.microprofile.openapi.annotations.media.Schema;
23  
24  import com.fasterxml.jackson.annotation.JsonInclude;
25  
26  import de.kaiserpfalzedv.commons.api.workflow.WorkflowInfo;
27  import jakarta.annotation.Nullable;
28  import jakarta.validation.constraints.NotNull;
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   * WorkflowInfo -- Default workflow information of a request.
39   *
40   * This info should be generated on the northbound interface of a system. It should be passed to other system calls.
41   * Normally as out-of-band information. So the encoding may change (HTTP-Headers, JMS properties, ...).
42   *
43   * @author klenkes74 {@literal <rlichti@kaiserpfalz-edv.de>}
44   * @since 2.0.0  2022-01-04
45   */
46  @Jacksonized
47  @Builder(toBuilder = true)
48  @AllArgsConstructor
49  @NoArgsConstructor
50  @ToString
51  @EqualsAndHashCode
52  @Getter
53  @JsonInclude(JsonInclude.Include.NON_ABSENT)
54  @Schema(name = "WorkflowInfo", description = "Information of a workflow call.")
55  public class WorkflowInfoImpl implements WorkflowInfo {
56      private static final long serialVersionUID = 0L;
57  
58      @Schema(
59          description = "The complete (perhaps even long running) workflow",
60          required = false
61      )
62      @Builder.Default
63      @Nullable
64      private final WorkflowDetailInfoImpl workflow = WorkflowDetailInfoImpl.builder().build();
65  
66      @Schema(
67              description = "The action within the workflow this call belongs to.",
68              required = true
69      )
70      @NotNull
71      @Builder.Default
72      private final WorkflowDetailInfoImpl action = WorkflowDetailInfoImpl.builder().build();
73  
74      @Schema(
75              description = "The actual service call.",
76              required = true
77      )
78      @NotNull
79      @Builder.Default
80      private final WorkflowDetailInfoImpl call = WorkflowDetailInfoImpl.builder().build();
81  
82      @Schema(
83              description = "The owner of this request. Can be an ID, a name or anything else. Please keep GDPR in mind!",
84              defaultValue = "A random UUID",
85              required = false,
86              minLength = 1,
87              maxLength = 100
88      )
89      @Nullable
90      @Builder.Default
91      private final String user = UUID.randomUUID().toString();
92  }