1 package fr.tiogars.domaintemplate.domains.auth.role.entities;
2
3 import java.time.Instant;
4
5 import jakarta.persistence.Column;
6 import jakarta.persistence.Entity;
7 import jakarta.persistence.GeneratedValue;
8 import jakarta.persistence.GenerationType;
9 import jakarta.persistence.Id;
10 import jakarta.persistence.Table;
11
12
13 @Entity
14 @Table(name = "auth_roles")
15 public class RoleEntity {
16
17 @Id
18 @GeneratedValue(strategy = GenerationType.IDENTITY)
19 private Long id;
20
21 @Column(nullable = false, unique = true, updatable = false)
22 private String code;
23
24 @Column(nullable = false)
25 private String label;
26
27 @Column(nullable = false, updatable = false)
28 private Instant createdDate;
29
30 @Column(nullable = false)
31 private Instant lastModifiedDate;
32
33 protected RoleEntity() {
34
35 }
36
37 public RoleEntity(String code, String label, Instant createdDate, Instant lastModifiedDate) {
38 this.code = code;
39 this.label = label;
40 this.createdDate = createdDate;
41 this.lastModifiedDate = lastModifiedDate;
42 }
43
44 public void update(String label, Instant lastModifiedDate) {
45 this.label = label;
46 this.lastModifiedDate = lastModifiedDate;
47 }
48
49 public Long getId() {
50 return id;
51 }
52
53 public String getCode() {
54 return code;
55 }
56
57 public String getLabel() {
58 return label;
59 }
60
61 public Instant getCreatedDate() {
62 return createdDate;
63 }
64
65 public Instant getLastModifiedDate() {
66 return lastModifiedDate;
67 }
68 }