1 package org.kuali.ole.deliver.api;
2
3 import org.kuali.rice.kim.api.identity.address.EntityAddressContract;
4 import org.kuali.rice.kim.api.identity.email.EntityEmailContract;
5 import org.kuali.rice.kim.api.identity.entity.Entity;
6 import org.kuali.rice.kim.api.identity.entity.EntityContract;
7 import org.kuali.rice.kim.api.identity.name.EntityName;
8 import org.kuali.rice.kim.api.identity.name.EntityNameContract;
9 import org.kuali.rice.kim.api.identity.phone.EntityPhoneContract;
10 import org.kuali.rice.kim.api.identity.type.EntityTypeContactInfo;
11
12 import java.sql.Timestamp;
13 import java.util.Arrays;
14 import java.util.Date;
15 import java.util.List;
16 import java.util.UUID;
17
18
19
20
21
22
23
24
25 public class OlePatronDefintionHelper {
26
27 private static final String PATRON_ID = "P1001";
28 private static final String BARCODE = "1234";
29 private static final Date EXPIRATION_DATE =new java.sql.Date((new Timestamp(System.currentTimeMillis())).getTime());
30 private static final Date ACTIVATION_DATE =new java.sql.Date((new Timestamp(System.currentTimeMillis())).getTime());
31
32 private static final boolean GENERAL_BLOCK = true;
33 private static final String PATRON_GENERAL_BLOCK_NOTES ="General Block notes";
34 private static final boolean DELIVERY_PRIVILEGE = true;
35 private static final boolean COURTESY_NOTICE = true;
36 private static final boolean PAGING_PRIVILEGE = true;
37 private static final boolean ACTIVE = true;
38 private static final Long VERSION_NUMBER = new Long(1);
39 private static final String OBJECT_ID = String.valueOf(UUID.randomUUID());
40
41 private static final EntityTypeContactInfo ENTITY_TYPE_CONTACT = EntityTypeContactInfoHelper.create();
42 private static final Entity ENTITY = EntityHelper.create();
43 private static final EntityName ENTITY_NAME = EntityNameHelper.create();
44
45 private static final String BORROWER_ID = "7" ;
46 private static final String BORR_CODE = "UGRAD";
47 private static final String BORR_NAME = "UnderGrad";
48 private static final String BORR_DESC = "UnderGrad";
49 private static final Long BORR_VERSION_NUMBER = new Long(1);
50 private static final String BORR_OBJECT_ID = String.valueOf(UUID.randomUUID());
51
52 private static final String PATRON_NOTE_ID="P2";
53 private static final String PATRON_NOTE_TEXT="Patron Test";
54 private static final String PATRON_NOTE_TYPE_ID="2";
55 private static final String PATRON_NOTE_TYPE_NAME="Note Test";
56 private static final String PATRON_NOTE_TYPE_CODE="NT";
57 private static final Long NOTE_VERSION_NUMBER = new Long(1);
58 private static final String NOTE_OBJECT_ID = String.valueOf(UUID.randomUUID());
59
60 private static final String PROXY_PATRON_ID="P1002";
61 private static final String PROXY_PATRON_DOC_ID = "11";
62 private static final Date PROXY_EXPIRATION_DATE =new java.sql.Date((new Timestamp(System.currentTimeMillis())).getTime());
63 private static final Date PROXY_ACTIVATION_DATE =new java.sql.Date((new Timestamp(System.currentTimeMillis())).getTime());
64 private static final Long PROXY_VERSION_NUMBER = new Long(1);
65 private static final OlePatronDefinition OLE_PATRON = OlePatronDefintionHelper.create();
66 private static final String PROXY_OBJECT_ID = String.valueOf(UUID.randomUUID());
67
68 private static final String PATRON_ADDRESS_ID = "1";
69 private static final boolean PATRON_ADDRESS_VERIFIED = true;
70 private static final Date PATRON_ADDRESS_VALID_FROM = new java.sql.Date((new Timestamp(System.currentTimeMillis())).getTime());
71 private static final Date PATRON_ADDRESS_VALID_TO = new java.sql.Date((new Timestamp(System.currentTimeMillis())).getTime());
72 private static final Long PATRON_ADDRESS_VERSION_NUMBER = new Long(1);
73 private static final String PATRON_ADDRESS_OBJECT_ID = String.valueOf(UUID.randomUUID());
74
75 private static final String PATRON_ADDRESS_SOURCE_ID = "1";
76 private static final String PATRON_ADDRESS_SOURCE_CODE = "REG";
77 private static final String PATRON_ADDRESS_SOURCE_NAME = "Registrar";
78 private static final String PATRON_ADDRESS_SOURCE_DESC = "Registrar";
79 private static final Long PATRON_ADDRESS_SOURCE_VERSION_NUMBER = new Long(1);
80 private static final String PATRON_ADDRESS_SOURCE_OBJECT_ID = String.valueOf(UUID.randomUUID());
81
82 private static final String PATRON_SOURCE_ID = "1";
83 private static final String PATRON_SOURCE_CODE = "HR";
84 private static final String PATRON_SOURCE_NAME = "Human Resource";
85 private static final String PATRON_SOURCE_DESC = "Human Resource";
86 private static final Long PATRON_SOURCE_VERSION_NUMBER = new Long(1);
87 private static final String PATRON_SOURCE_OBJECT_ID = String.valueOf(UUID.randomUUID());
88
89 private static final String PATRON_STATISTICAL_CATEGORY_ID = "1";
90 private static final String PATRON_STATISTICAL_CATEGORY_CODE = "REG";
91 private static final String PATRON_STATISTICAL_CATEGORY_NAME = "Registrar";
92 private static final String PATRON_STATISTICAL_CATEGORY_DESC = "Registrar";
93 private static final Long PATRON_STATISTICAL_CATEGORY_VERSION_NUMBER = new Long(1);
94 private static final String PATRON_STATISTICAL_CATEGORY_OBJECT_ID = String.valueOf(UUID.randomUUID());
95
96 private static final String PATRON_LOST_BARCODE_ID = "P11";
97 private static final String PATRON_LOST_BARCODE = "222222";
98 private static final Date PATRON_LOST_BARCODE_EFF_DATE= new java.sql.Date((new Timestamp(System.currentTimeMillis())).getTime());
99 private static final Long PATRON_LOST_BARCODE_VERSION_NUMBER = new Long(1);
100
101 private static final String PATRON_LOCAL_SEQ_ID = "P10";
102 private static final String LOCAL_ID = "222222";
103 private static final Long PATRON_LOCAL_ID_VERSION_NUMBER = new Long(1);
104 private static final String PATRON_LOCAL_ID_OBJECT_ID = String.valueOf(UUID.randomUUID());
105
106 public static OlePatronDefinition create() {
107 return OlePatronDefinition.Builder.create(new OlePatronContract() {
108 @Override
109 public String getOlePatronId() {
110 return PATRON_ID;
111 }
112
113 @Override
114 public String getBarcode() {
115 return BARCODE;
116 }
117
118 @Override
119 public String getBorrowerType() {
120 return BORROWER_ID ;
121 }
122
123 @Override
124 public boolean isGeneralBlock() {
125 return GENERAL_BLOCK;
126 }
127
128 @Override
129 public boolean isPagingPrivilege() {
130 return PAGING_PRIVILEGE;
131 }
132
133 @Override
134 public boolean isCourtesyNotice() {
135 return COURTESY_NOTICE;
136 }
137
138 @Override
139 public boolean isDeliveryPrivilege() {
140 return DELIVERY_PRIVILEGE;
141 }
142
143 @Override
144 public Date getExpirationDate() {
145 return EXPIRATION_DATE;
146 }
147
148 @Override
149 public Date getActivationDate() {
150 return ACTIVATION_DATE;
151 }
152
153 @Override
154 public List<? extends EntityAddressContract> getAddresses() {
155 return ENTITY_TYPE_CONTACT.getAddresses();
156 }
157
158 @Override
159 public List<? extends EntityEmailContract> getEmails() {
160 return ENTITY_TYPE_CONTACT.getEmailAddresses();
161 }
162
163 @Override
164 public EntityNameContract getName() {
165 return ENTITY_NAME;
166 }
167
168 @Override
169 public List<? extends EntityPhoneContract> getPhones() {
170 return ENTITY_TYPE_CONTACT.getPhoneNumbers();
171 }
172
173 @Override
174 public EntityContract getEntity() {
175 return ENTITY;
176 }
177
178 @Override
179 public boolean isActiveIndicator() {
180 return ACTIVE;
181 }
182
183 @Override
184 public List<? extends OlePatronNotesContract> getNotes() {
185 return Arrays.asList(OlePatronNotesDefinition.Builder.create(new OlePatronNotesContract() {
186 @Override
187 public String getObjectId() {
188 return NOTE_OBJECT_ID;
189 }
190
191 @Override
192 public String getPatronNoteId() {
193 return PATRON_NOTE_ID;
194 }
195
196 @Override
197 public String getOlePatronId() {
198 return PATRON_ID;
199 }
200
201 @Override
202 public String getPatronNoteText() {
203 return PATRON_NOTE_TEXT;
204 }
205
206 @Override
207 public OlePatronNoteTypeContract getOlePatronNoteType() {
208 return OlePatronNoteTypeDefinition.Builder.create(new OlePatronNoteTypeContract() {
209 @Override
210 public String getPatronNoteTypeId() {
211 return PATRON_NOTE_TYPE_ID;
212 }
213
214 @Override
215 public String getPatronNoteTypeCode() {
216 return PATRON_NOTE_TYPE_CODE;
217 }
218
219 @Override
220 public String getPatronNoteTypeName() {
221 return PATRON_NOTE_TYPE_NAME;
222 }
223
224 @Override
225 public String getId() {
226 return PATRON_NOTE_TYPE_ID;
227 }
228
229 @Override
230 public boolean isActive() {
231 return ACTIVE;
232 }
233
234 }).build();
235 }
236
237
238 @Override
239 public String getId() {
240 return PATRON_NOTE_ID;
241 }
242
243 @Override
244 public Long getVersionNumber() {
245 return NOTE_VERSION_NUMBER;
246 }
247
248 @Override
249 public boolean isActive() {
250 return ACTIVE;
251 }
252 }).build());
253 }
254
255 @Override
256 public List<? extends OleEntityAddressContract> getOleEntityAddressBo() {
257 return Arrays.asList(OleEntityAddressDefinition.Builder.create(new OleEntityAddressContract() {
258
259 @Override
260 public OleAddressContract getOleAddressBo() {
261 return OleAddressDefinition.Builder.create(new OleAddressContract() {
262
263
264 @Override
265 public String getOleAddressId() {
266 return PATRON_ADDRESS_ID;
267 }
268
269 @Override
270 public boolean isAddressVerified() {
271 return PATRON_ADDRESS_VERIFIED;
272 }
273
274 @Override
275 public String getOlePatronId() {
276 return PATRON_ID;
277 }
278
279 @Override
280 public String getId() {
281 return PATRON_ADDRESS_ID;
282 }
283
284 @Override
285 public Date getAddressValidFrom() {
286 return PATRON_ADDRESS_VALID_FROM;
287 }
288
289 @Override
290 public Date getAddressValidTo() {
291 return PATRON_ADDRESS_VALID_TO;
292 }
293
294 @Override
295 public String getAddressSource() {
296 return PATRON_ADDRESS_SOURCE_ID;
297 }
298
299 @Override
300 public OleAddressSourceContract getAddressSourceBo() {
301 return OleAddressSourceDefinition.Builder.create(new OleAddressSourceContract() {
302
303
304 @Override
305 public String getId() {
306 return PATRON_ADDRESS_SOURCE_ID;
307 }
308
309 @Override
310 public String getOleAddressSourceId() {
311 return PATRON_ADDRESS_SOURCE_ID;
312 }
313
314 @Override
315 public String getOleAddressSourceCode() {
316 return PATRON_ADDRESS_SOURCE_CODE;
317 }
318
319 @Override
320 public String getOleAddressSourceName() {
321 return PATRON_ADDRESS_SOURCE_NAME;
322 }
323
324 @Override
325 public String getOleAddressSourceDesc() {
326 return PATRON_ADDRESS_SOURCE_DESC;
327 }
328
329 @Override
330 public boolean isActive() {
331 return ACTIVE;
332 }
333
334 @Override
335 public Long getVersionNumber() {
336 return PATRON_ADDRESS_SOURCE_VERSION_NUMBER;
337 }
338 }).build();
339 }
340
341
342
343
344
345
346 @Override
347 public Long getVersionNumber() {
348 return PATRON_ADDRESS_VERSION_NUMBER;
349 }
350 }).build();
351 }
352 @Override
353 public EntityAddressContract getEntityAddressBo() {
354 return ENTITY_TYPE_CONTACT.getAddresses().get(0);
355 }
356
357 }).build());
358 }
359
360
361
362 @Override
363 public List<? extends OlePatronAffiliationContract> getPatronAffiliations() {
364 return null;
365 }
366
367 @Override
368 public List<? extends OleProxyPatronContract> getOleProxyPatronDocuments() {
369 return Arrays.asList(OleProxyPatronDefinition.Builder.create(new OleProxyPatronContract() {
370
371 @Override
372 public String getOleProxyPatronDocumentId() {
373 return PROXY_PATRON_DOC_ID;
374 }
375
376 @Override
377 public String getProxyPatronId() {
378 return PROXY_PATRON_ID;
379 }
380
381 @Override
382 public String getOlePatronId() {
383 return PATRON_ID;
384 }
385
386
387
388
389
390
391 @Override
392 public Date getProxyPatronExpirationDate() {
393 return PROXY_EXPIRATION_DATE;
394 }
395
396 @Override
397 public Date getProxyPatronActivationDate() {
398 return PROXY_ACTIVATION_DATE;
399 }
400
401 @Override
402 public boolean isActive() {
403 return ACTIVE;
404 }
405
406 @Override
407 public String getId() {
408 return PROXY_PATRON_DOC_ID;
409 }
410
411 @Override
412 public Long getVersionNumber() {
413 return PROXY_VERSION_NUMBER;
414 }
415 }).build());
416 }
417
418
419
420
421
422
423 @Override
424 public List<? extends OlePatronLostBarcodeContract> getLostBarcodes() {
425 return Arrays.asList(OlePatronLostBarcodeDefinition.Builder.create(new OlePatronLostBarcodeContract() {
426
427 @Override
428 public String getOlePatronLostBarcodeId() {
429 return PATRON_LOST_BARCODE_ID;
430 }
431
432 @Override
433 public String getOlePatronId() {
434 return PATRON_ID;
435 }
436
437 @Override
438 public Date getInvalidOrLostBarcodeEffDate() {
439 return PATRON_LOST_BARCODE_EFF_DATE;
440 }
441
442 @Override
443 public String getInvalidOrLostBarcodeNumber() {
444 return PATRON_LOST_BARCODE;
445 }
446
447 @Override
448 public String getObjectId() {
449 return NOTE_OBJECT_ID;
450 }
451
452 @Override
453 public String getId() {
454 return PATRON_LOST_BARCODE_ID;
455 }
456
457 @Override
458 public Long getVersionNumber() {
459 return PATRON_LOST_BARCODE_VERSION_NUMBER;
460 }
461 }).build());
462 }
463
464 @Override
465 public String getGeneralBlockNotes() {
466 return PATRON_GENERAL_BLOCK_NOTES;
467 }
468
469 @Override
470 public String getSource() {
471 return PATRON_SOURCE_ID;
472 }
473
474 @Override
475 public String getStatisticalCategory() {
476 return PATRON_STATISTICAL_CATEGORY_ID;
477 }
478
479 @Override
480 public List<? extends OleAddressContract> getOleAddresses() {
481
482 return Arrays.asList(OleAddressDefinition.Builder.create(new OleAddressContract() {
483
484
485 @Override
486 public String getOleAddressId() {
487 return PATRON_ADDRESS_ID;
488 }
489
490 @Override
491 public boolean isAddressVerified() {
492 return PATRON_ADDRESS_VERIFIED;
493 }
494
495 @Override
496 public String getOlePatronId() {
497 return PATRON_ID;
498 }
499
500 @Override
501 public String getId() {
502 return PATRON_ADDRESS_ID;
503 }
504
505 @Override
506 public Date getAddressValidFrom() {
507 return PATRON_ADDRESS_VALID_FROM;
508 }
509
510 @Override
511 public Date getAddressValidTo() {
512 return PATRON_ADDRESS_VALID_TO;
513 }
514
515 @Override
516 public String getAddressSource() {
517 return PATRON_ADDRESS_SOURCE_ID;
518 }
519
520 @Override
521 public OleAddressSourceContract getAddressSourceBo() {
522 return OleAddressSourceDefinition.Builder.create(new OleAddressSourceContract() {
523
524
525 @Override
526 public String getId() {
527 return PATRON_ADDRESS_SOURCE_ID;
528 }
529
530 @Override
531 public String getOleAddressSourceId() {
532 return PATRON_ADDRESS_SOURCE_ID;
533 }
534
535 @Override
536 public String getOleAddressSourceCode() {
537 return PATRON_ADDRESS_SOURCE_CODE;
538 }
539
540 @Override
541 public String getOleAddressSourceName() {
542 return PATRON_ADDRESS_SOURCE_NAME;
543 }
544
545 @Override
546 public String getOleAddressSourceDesc() {
547 return PATRON_ADDRESS_SOURCE_DESC;
548 }
549
550 @Override
551 public boolean isActive() {
552 return ACTIVE;
553 }
554
555 @Override
556 public Long getVersionNumber() {
557 return PATRON_ADDRESS_SOURCE_VERSION_NUMBER;
558 }
559 }).build();
560 }
561
562
563
564
565
566
567 @Override
568 public Long getVersionNumber() {
569 return PATRON_ADDRESS_VERSION_NUMBER;
570 }
571 }).build());
572 }
573
574 @Override
575 public List<? extends OlePatronLocalIdentificationContract> getOlePatronLocalIds() {
576 return Arrays.asList(OlePatronLocalIdentificationDefinition.Builder.create(new OlePatronLocalIdentificationContract() {
577
578 @Override
579 public String getPatronLocalSeqId() {
580 return PATRON_LOCAL_SEQ_ID;
581 }
582
583 @Override
584 public String getLocalId() {
585 return LOCAL_ID;
586 }
587
588 @Override
589 public String getOlePatronId() {
590 return PATRON_ID;
591 }
592
593 @Override
594 public String getObjectId() {
595 return PATRON_LOCAL_ID_OBJECT_ID;
596 }
597
598 @Override
599 public String getId() {
600 return PATRON_LOCAL_SEQ_ID;
601 }
602
603 @Override
604 public Long getVersionNumber() {
605 return PATRON_LOCAL_ID_VERSION_NUMBER;
606 }
607 }).build());
608 }
609
610
611 public OleBorrowerTypeContract getOleBorrowerType() {
612 return OleBorrowerTypeDefinition.Builder.create(new OleBorrowerTypeContract() {
613 @Override
614 public String getBorrowerTypeId() {
615 return BORROWER_ID;
616 }
617
618 @Override
619 public String getBorrowerTypeCode() {
620 return BORR_CODE;
621 }
622
623 @Override
624 public String getBorrowerTypeDescription() {
625 return BORR_DESC;
626 }
627
628 @Override
629 public String getBorrowerTypeName() {
630 return BORR_NAME;
631 }
632
633 @Override
634 public String getId() {
635 return BORROWER_ID;
636 }
637
638 @Override
639 public Long getVersionNumber() {
640 return BORR_VERSION_NUMBER;
641 }
642 }).build();
643 }
644
645 @Override
646 public String getId() {
647 return PATRON_ID;
648 }
649
650 @Override
651 public Long getVersionNumber() {
652 return VERSION_NUMBER;
653 }
654 }) .build();
655 }
656
657 public OleSourceContract getSourceBo() {
658 return OleSourceDefinition.Builder.create(new OleSourceContract() {
659
660 @Override
661 public String getOleSourceId() {
662 return PATRON_SOURCE_ID;
663 }
664
665 @Override
666 public String getOleSourceCode() {
667 return PATRON_SOURCE_CODE;
668 }
669
670 @Override
671 public String getOleSourceName() {
672 return PATRON_SOURCE_NAME;
673 }
674
675 @Override
676 public String getOleSourceDesc() {
677 return PATRON_SOURCE_DESC;
678 }
679
680 @Override
681 public boolean isActive() {
682 return ACTIVE;
683 }
684
685 @Override
686 public String getId() {
687 return PATRON_SOURCE_ID;
688 }
689
690 @Override
691 public Long getVersionNumber() {
692 return PATRON_SOURCE_VERSION_NUMBER;
693 }
694 }).build();
695 }
696
697 public OleStatisticalCategoryContract getStatisticalCategoryBo() {
698 return OleStatisticalCategoryDefinition.Builder.create(new OleStatisticalCategoryContract() {
699
700
701 @Override
702 public String getOleStatisticalCategoryId() {
703 return PATRON_STATISTICAL_CATEGORY_ID;
704 }
705
706 @Override
707 public String getOleStatisticalCategoryCode() {
708 return PATRON_STATISTICAL_CATEGORY_CODE;
709 }
710
711 @Override
712 public String getOleStatisticalCategoryName() {
713 return PATRON_STATISTICAL_CATEGORY_NAME;
714 }
715
716 @Override
717 public String getOleStatisticalCategoryDesc() {
718 return PATRON_STATISTICAL_CATEGORY_DESC;
719 }
720
721 @Override
722 public boolean isActive() {
723 return ACTIVE;
724 }
725
726 @Override
727 public String getId() {
728 return PATRON_STATISTICAL_CATEGORY_ID;
729 }
730
731 @Override
732 public Long getVersionNumber() {
733 return PATRON_STATISTICAL_CATEGORY_VERSION_NUMBER;
734 }
735 }).build();
736 }
737
738 }