2023-11-10 17:09:39 +01:00
|
|
|
package catering.staff;
|
|
|
|
|
2023-11-16 17:24:49 +01:00
|
|
|
import jakarta.persistence.Entity;
|
|
|
|
import jakarta.persistence.GeneratedValue;
|
|
|
|
import jakarta.persistence.Id;
|
|
|
|
|
|
|
|
@Entity
|
2023-11-23 16:57:44 +01:00
|
|
|
public class Employee {
|
2023-11-10 17:09:39 +01:00
|
|
|
|
2023-11-21 16:02:42 +01:00
|
|
|
private String name;
|
|
|
|
private JobType job;
|
2023-11-16 17:24:49 +01:00
|
|
|
private @Id @GeneratedValue Long id;
|
|
|
|
|
2023-11-23 16:57:44 +01:00
|
|
|
protected Employee() {
|
2023-11-16 17:24:49 +01:00
|
|
|
// No-argument constructor for JPA
|
|
|
|
}
|
2023-11-10 17:09:39 +01:00
|
|
|
|
2023-11-23 16:57:44 +01:00
|
|
|
public Employee(String name, JobType job) {
|
2023-11-10 17:09:39 +01:00
|
|
|
this.name = name;
|
|
|
|
this.job = job;
|
|
|
|
}
|
|
|
|
|
2023-11-16 17:24:49 +01:00
|
|
|
public Long getId() {
|
2023-11-10 17:09:39 +01:00
|
|
|
return id;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getName() {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
2023-11-21 16:02:42 +01:00
|
|
|
public JobType getJob() {
|
2023-11-10 17:09:39 +01:00
|
|
|
return job;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setName(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
|
2023-11-21 16:02:42 +01:00
|
|
|
public void setJob(JobType job) {
|
2023-11-10 17:09:39 +01:00
|
|
|
this.job = job;
|
|
|
|
}
|
2023-11-26 16:59:50 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj) {
|
2023-11-23 16:57:44 +01:00
|
|
|
if (obj instanceof Employee other) {
|
2023-11-26 16:59:50 +01:00
|
|
|
return id.equals(other.id);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2023-11-10 17:09:39 +01:00
|
|
|
}
|