source: src/main/java/edu/gjoko/schedlr/entity/Stakeholder.java

Last change on this file was 77205be, checked in by gjoko kostadinov <gjokokostadinov@…>, 11 months ago

Add entire code

  • Property mode set to 100755
File size: 1.7 KB
Line 
1package edu.gjoko.schedlr.entity;
2
3import com.fasterxml.jackson.annotation.JsonIgnore;
4import com.fasterxml.jackson.annotation.JsonManagedReference;
5import lombok.AllArgsConstructor;
6import lombok.Getter;
7import lombok.NoArgsConstructor;
8import lombok.Setter;
9import org.springframework.data.annotation.CreatedDate;
10import org.springframework.data.annotation.LastModifiedDate;
11import org.springframework.data.jpa.domain.support.AuditingEntityListener;
12
13import javax.persistence.*;
14import java.time.LocalDateTime;
15import java.util.List;
16
17@Entity
18@EntityListeners(AuditingEntityListener.class)
19@Table(name = "stakeholder")
20@Getter
21@Setter
22@NoArgsConstructor
23@AllArgsConstructor
24public class Stakeholder {
25
26 @Id
27 @GeneratedValue(strategy = GenerationType.SEQUENCE)
28 private Long id;
29
30 @Column(name = "stakeholder_type")
31 @Enumerated(EnumType.STRING)
32 private StakeholderType stakeholderType;
33
34 @Column(name = "first_name")
35 private String firstName;
36
37 @Column(name = "last_name")
38 private String lastName;
39
40 @Column(name = "email")
41 private String email;
42
43 @Column(name = "phone_number")
44 private String phoneNumber;
45
46 @Column(name = "username")
47 private String username;
48
49 @Column(name = "password")
50 private String password;
51
52 @OneToMany(mappedBy = "customer")
53 @JsonManagedReference(value = "customerAppointments")
54 private List<Appointment> appointments;
55
56 @Column(name = "created")
57 @CreatedDate
58 @JsonIgnore
59 private LocalDateTime created;
60
61 @Column(name = "modified")
62 @LastModifiedDate
63 @JsonIgnore
64 private LocalDateTime modified;
65
66 public String getFullName() {
67 return firstName + " " + lastName;
68 }
69}
Note: See TracBrowser for help on using the repository browser.