-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample_input.java
318 lines (266 loc) · 6.65 KB
/
sample_input.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
package com.hapticapps.amici.shared.data_models.org;
// Generated by mdo do not edit this file, see the .mdo file
import com.hapticapps.amici.shared.utils.Utils;
import org.bson.codecs.pojo.annotations.BsonProperty;
import org.bson.codecs.pojo.annotations.BsonProperty;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import com.mongodb.client.model.IndexOptions;
import org.bson.conversions.Bson;
import com.mongodb.BasicDBObject;
public class OrgPerson {
public static final String BSON_UUID = "u";
public static final String BSON_ORGID = "o";
public static final String BSON_NAME = "n";
public static final String BSON_EMAIL = "e";
public static final String BSON_STATUS = "st";
public static final String BSON_FRIENDIDS = "f";
public static final String BSON_ADDRESSES = "a";
@BsonProperty("u")
private String uuid = Utils.newUID();
@BsonProperty("o")
private String orgId;
@BsonProperty("n")
private String name;
@BsonProperty("e")
private String email;
@BsonProperty("st")
private Status status = Status.PENDING;
@BsonProperty("f")
private List<String> friendIds = new ArrayList<>();
@BsonProperty("a")
private List<Address> addresses = new ArrayList<>();
public String getUuid(){
return uuid;
}
public void setUuid(String data){
this.uuid = data;
}
public String getOrgId(){
return orgId;
}
public void setOrgId(String data){
this.orgId = data;
}
public String getName(){
return name;
}
public void setName(String data){
this.name = data;
}
public String getEmail(){
return email;
}
public void setEmail(String data){
this.email = data;
}
public Status getStatus(){
return status;
}
public void setStatus(Status data){
this.status = data;
}
public List<String> getFriendIds(){
return friendIds;
}
public void setFriendIds(List<String> data){
this.friendIds = data;
}
public List<Address> getAddresses(){
return addresses;
}
public void setAddresses(List<Address> data){
this.addresses = data;
}
public OrgPersonBuilder copy() {
return OrgPersonBuilder.from( this );
}
public static OrgPersonBuilder builder() {
return new OrgPersonBuilder();
}
public String toString() {
return "OrgPerson{" +
"orgId=" + orgId
+ ", " +
"name=" + name
+ ", " +
"email=" + email
+"}";
}
public static class OrgPersonBuilder {
private String uuid = Utils.newUID();
private String orgId;
private String name;
private String email;
private Status status = Status.PENDING;
private List<String> friendIds = new ArrayList<>();
private List<Address> addresses = new ArrayList<>();
public static OrgPersonBuilder from(OrgPerson source) {
var r = new OrgPersonBuilder();
r.uuid = source.getUuid();
r.orgId = source.getOrgId();
r.name = source.getName();
r.email = source.getEmail();
r.status = source.getStatus();
r.friendIds = source.getFriendIds();
r.addresses = source.getAddresses();
return r;
}
public OrgPersonBuilder withUuid(String uuid) {
this.uuid = uuid;
return this;
}
public OrgPersonBuilder withOrgId(String orgId) {
this.orgId = orgId;
return this;
}
public OrgPersonBuilder withName(String name) {
this.name = name;
return this;
}
public OrgPersonBuilder withEmail(String email) {
this.email = email;
return this;
}
public OrgPersonBuilder withStatus(Status status) {
this.status = status;
return this;
}
public OrgPersonBuilder withFriendIds(List<String> friendIds) {
this.friendIds = friendIds;
return this;
}
public OrgPersonBuilder withAddresses(List<Address> addresses) {
this.addresses = addresses;
return this;
}
public OrgPerson build() {
var r = new OrgPerson();
r.uuid = uuid;
r.orgId = orgId;
r.name = name;
r.email = email;
r.status = status;
r.friendIds = friendIds;
r.addresses = addresses;
return r;
}
}
public static class Address {
public static final String BSON_CITY = "ct";
public static final String BSON_STATE = "st";
public static final String BSON_ZIP = "zip";
public static final String BSON_ADDRESSTYPE = "at";
@BsonProperty("ct")
private String city;
@BsonProperty("st")
private String state;
private String zip;
@BsonProperty("at")
private AddressType addressType;
public String getCity(){
return city;
}
public void setCity(String data){
this.city = data;
}
public String getState(){
return state;
}
public void setState(String data){
this.state = data;
}
public String getZip(){
return zip;
}
public void setZip(String data){
this.zip = data;
}
public AddressType getAddressType(){
return addressType;
}
public void setAddressType(AddressType data){
this.addressType = data;
}
public AddressBuilder copy() {
return AddressBuilder.from( this );
}
public static AddressBuilder builder() {
return new AddressBuilder();
}
public String toString() {
return "Address{" +
"}";
}
public static class AddressBuilder {
private String city;
private String state;
private String zip;
private AddressType addressType;
public static AddressBuilder from(Address source) {
var r = new AddressBuilder();
r.city = source.getCity();
r.state = source.getState();
r.zip = source.getZip();
r.addressType = source.getAddressType();
return r;
}
public AddressBuilder withCity(String city) {
this.city = city;
return this;
}
public AddressBuilder withState(String state) {
this.state = state;
return this;
}
public AddressBuilder withZip(String zip) {
this.zip = zip;
return this;
}
public AddressBuilder withAddressType(AddressType addressType) {
this.addressType = addressType;
return this;
}
public Address build() {
var r = new Address();
r.city = city;
r.state = state;
r.zip = zip;
r.addressType = addressType;
return r;
}
}
}
public enum Status {
PENDING,
ACTIVE,
UNREGISTERED
}
public enum AddressType {
PRIMARY,
SECONDARY
}
public static class Indexes {
public static List<Bson> ikeys = new ArrayList<>();
public static List<IndexOptions> ioptions = new ArrayList<>();
static {
ikeys.add(new BasicDBObject( Map.of(
OrgPerson.BSON_UUID, 1
)));
ioptions.add(new IndexOptions().unique(true));
ikeys.add(new BasicDBObject( Map.of(
OrgPerson.BSON_NAME, 1
)));
ioptions.add(new IndexOptions().unique(true));
ikeys.add(new BasicDBObject( Map.of(
OrgPerson.BSON_EMAIL, 1
)));
ioptions.add(new IndexOptions().unique(true).sparse(true));
ikeys.add(new BasicDBObject( Map.of(
OrgPerson.BSON_FRIENDIDS, 1
)));
ioptions.add(new IndexOptions().sparse(true));
}
}
}