source: src/main/java/com/example/rezevirajmasa/demo/model/Customer.java@ 748b7f6

main
Last change on this file since 748b7f6 was 748b7f6, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

RetaurantServiceImpl problemi
isAvailable od tableEntity...

  • Property mode set to 100644
File size: 3.8 KB
Line 
1package com.example.rezevirajmasa.demo.model;
2
3import jakarta.persistence.*;
4
5import java.util.Date;
6
7@Entity
8@Table(name = "customers")
9public class Customer {
10
11 @Id
12 @GeneratedValue(strategy = GenerationType.IDENTITY)
13 @Column(name = "CustomerID")
14 private Long customerId;
15
16 @Column(name = "FirstName", length = 50)
17 private String firstName;
18
19 @Column(name = "LastName", length = 50)
20 private String lastName;
21
22 @Column(name = "Email", length = 100, unique = true)
23 private String email;
24
25 @Column(name = "Password", length = 100)
26 private String password;
27
28 @Enumerated(EnumType.STRING)
29 private Role role;
30
31 @Column(name = "Phone", length = 20)
32 private String phone;
33
34 @Column(name = "Address", columnDefinition = "TEXT")
35 private String address;
36
37 @Enumerated(EnumType.STRING)
38 @Column(name = "MembershipLevel", length = 20)
39 private MembershipLevel membershipLevel;
40
41 @Column(name = "RegistrationDate", columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
42 @Temporal(TemporalType.TIMESTAMP)
43 private Date registrationDate;
44
45 public Customer(Long customerId, String firstName, String lastName, String email, String phone, String address, MembershipLevel membershipLevel, Date registrationDate, Role role) {
46 this.setCustomerId(customerId);
47 this.setFirstName(firstName);
48 this.setLastName(lastName);
49 this.setEmail(email);
50 this.setPhone(phone);
51 this.setAddress(address);
52 this.setMembershipLevel(membershipLevel);
53 this.setRegistrationDate(registrationDate);
54 this.setRole(Role.ROLE_USER);
55 }
56
57 public Customer() {
58
59 }
60
61 public Role getRole() {
62 return role;
63 }
64
65 public void setRole(Role role) {
66 this.role = role;
67 }
68
69 public String getFullName() {
70 return firstName + " " + lastName;
71 }
72 public Long getCustomerId() {
73 return customerId;
74 }
75
76 public void setCustomerId(Long customerId) {
77 this.customerId = customerId;
78 }
79
80 public String getFirstName() {
81 return firstName;
82 }
83
84 public void setFirstName(String firstName) {
85 this.firstName = firstName;
86 }
87
88 public String getLastName() {
89 return lastName;
90 }
91
92 public void setLastName(String lastName) {
93 this.lastName = lastName;
94 }
95
96 public String getEmail() {
97 return email;
98 }
99
100 public void setEmail(String email) {
101 this.email = email;
102 }
103
104 public String getPassword() {
105 return password;
106 }
107
108 public void setPassword(String password) {
109 this.password = password;
110 }
111
112 public String getPhone() {
113 return phone;
114 }
115
116 public void setPhone(String phone) {
117 this.phone = phone;
118 }
119
120 public String getAddress() {
121 return address;
122 }
123
124 public void setAddress(String address) {
125 this.address = address;
126 }
127
128 public Date getRegistrationDate() {
129 return registrationDate;
130 }
131 public MembershipLevel getMembershipLevel() {
132 return membershipLevel;
133 }
134
135 public void setMembershipLevel(MembershipLevel membershipLevel) {
136 this.membershipLevel = membershipLevel;
137 }
138 public void setRegistrationDate(Date registrationDate) {
139 this.registrationDate = registrationDate;
140 }
141
142 @Override
143 public String toString() {
144 return "Customer{" +
145 "customerId=" + customerId +
146 ", firstName='" + firstName + '\'' +
147 ", lastName='" + lastName + '\'' +
148 ", email='" + email + '\'' +
149 ", phone='" + phone + '\'' +
150 ", address='" + address + '\'' +
151 ", membershipLevel=" + membershipLevel +
152 ", registrationDate=" + registrationDate +
153 '}';
154 }
155
156}
Note: See TracBrowser for help on using the repository browser.