View Javadoc
1   /*
2    * Copyright (c) 2022-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.api.resources;
19  
20  import java.time.OffsetDateTime;
21  
22  import org.eclipse.microprofile.openapi.annotations.media.Schema;
23  
24  import jakarta.validation.constraints.NotNull;
25  
26  /**
27   * HasTimestamps --
28   *
29   * @author klenkes74 {@literal <rlichti@kaiserpfalz-edv.de>}
30   * @version 3.3.3-3  2024-09-08
31   * @since 3.3.3-3    2024-09-08
32   */
33  public interface HasTimestamps {
34      String VALID_PATTERN = "^[0-9]{4}(-[0-9]{2}){2}T([0-9]{2}:){2}[0-9]{2}.[0-9]{6}+[0-9]{2}:[0-9]{2}$";
35      String VALID_PATTERN_MSG = "The timestamp must match the pattern '" + VALID_PATTERN + "'";
36      int VALID_LENGTH = 32;
37      String VALID_LENGTH_MSG = "The timestamp must be exactly 32 characters long.";
38      String VALID_EXAMPLE = "2022-01-04T21:51:00.000000+01:00";
39  
40      @Schema(
41              name = "created",
42              description = "The creation date of this resource.",
43              maxLength = HasTimestamps.VALID_LENGTH,
44              pattern = HasTimestamps.VALID_PATTERN
45      )
46      @NotNull
47      OffsetDateTime getCreated();
48  
49      @Schema(
50              name = "modified",
51              description = "The modified date of this resource.",
52              maxLength = HasTimestamps.VALID_LENGTH,
53              pattern = HasTimestamps.VALID_PATTERN
54      )
55      @NotNull
56      OffsetDateTime getModified();
57  
58      @Schema(
59              name = "deleted",
60              description = "The deletion date of this resource.",
61              maxLength = HasTimestamps.VALID_LENGTH,
62              pattern = HasTimestamps.VALID_PATTERN
63      )
64      @NotNull
65      OffsetDateTime getDeleted();
66  }