forked from spring-petclinic/spring-petclinic-reactive
-
Notifications
You must be signed in to change notification settings - Fork 55
/
VetEntity.java
147 lines (126 loc) 路 3.33 KB
/
VetEntity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package com.datastax.workshop.petclinic.vet.db;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import com.datastax.oss.driver.api.mapper.annotations.CqlName;
import com.datastax.oss.driver.api.mapper.annotations.Entity;
import com.datastax.oss.driver.api.mapper.annotations.PartitionKey;
/**
* Represents a Veterinarians (Vet) in the Data Accesslayer (Cassandra)
*
* @author Cedrick LUNVEN (@clunven)
*/
@Entity
@CqlName(VetTableDefinition.TABLE_NAME)
public class VetEntity implements VetTableDefinition, Serializable {
/** Serial. */
private static final long serialVersionUID = 7407715795842376538L;
@PartitionKey
@CqlName(COLUMN_ID)
private UUID id;
@CqlName(COLUMN_FIRST_NAME)
private String firstName;
@CqlName(COLUMN_LAST_NAME)
private String lastName;
@CqlName(COLUMN_SPECIALTIES)
private Set<String> specialties = new HashSet<>();
/**
* Defaut constructor
*/
public VetEntity() {
}
/**
* Constructor with initialized uid
*/
public VetEntity(String uid) {
this.id = UUID.fromString(uid);
}
/**
* Contructor
* @param uid
* @param firstname
* @param lastname
* @param specialties
*/
public VetEntity(String uid, String firstname, String lastname, String...specialties) {
this(uid);
this.firstName = firstname;
this.lastName = lastname;
this.specialties = Set.of(specialties);
}
public VetEntity(UUID uid, String firstname, String lastname, Set<String> specialties) {
this.id = uid;
this.firstName = firstname;
this.lastName = lastname;
this.specialties = specialties;
}
/**
* Getter accessor for attribute 'id'.
*
* @return
* current value of 'id'
*/
public UUID getId() {
return id;
}
/**
* Setter accessor for attribute 'id'.
* @param id
* new value for 'id '
*/
public void setId(UUID id) {
this.id = id;
}
/**
* Getter accessor for attribute 'firstName'.
*
* @return
* current value of 'firstName'
*/
public String getFirstName() {
return firstName;
}
/**
* Setter accessor for attribute 'firstName'.
* @param firstName
* new value for 'firstName '
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}
/**
* Getter accessor for attribute 'lastName'.
*
* @return
* current value of 'lastName'
*/
public String getLastName() {
return lastName;
}
/**
* Setter accessor for attribute 'lastName'.
* @param lastName
* new value for 'lastName '
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}
/**
* Getter accessor for attribute 'specialties'.
*
* @return
* current value of 'specialties'
*/
public Set<String> getSpecialties() {
return specialties;
}
/**
* Setter accessor for attribute 'specialties'.
* @param specialties
* new value for 'specialties '
*/
public void setSpecialties(Set<String> specialties) {
this.specialties = specialties;
}
}