View Javadoc
1   package org.kuali.ole.deliver.api;
2   
3   import org.joda.time.DateTime;
4   import org.kuali.rice.kim.api.identity.CodedAttribute;
5   import org.kuali.rice.kim.api.identity.CodedAttributeContract;
6   import org.kuali.rice.kim.api.identity.address.EntityAddress;
7   import org.kuali.rice.kim.api.identity.address.EntityAddressContract;
8   import org.kuali.rice.kim.api.identity.email.EntityEmail;
9   import org.kuali.rice.kim.api.identity.email.EntityEmailContract;
10  import org.kuali.rice.kim.api.identity.phone.EntityPhone;
11  import org.kuali.rice.kim.api.identity.phone.EntityPhoneContract;
12  import org.kuali.rice.kim.api.identity.type.EntityTypeContactInfo;
13  import org.kuali.rice.kim.api.identity.type.EntityTypeContactInfoContract;
14  
15  import java.util.Arrays;
16  import java.util.List;
17  import java.util.UUID;
18  
19  /**
20   * Created with IntelliJ IDEA.
21   * User: ?
22   * Date: 5/29/12
23   * Time: 2:21 PM
24   * To change this template use File | Settings | File Templates.
25   */
26  public class EntityTypeContactInfoHelper {
27      private static final String ENTITY_TYPE_CODE = "PERSON";
28      private static final String ENTITY_TYPE_NAME = "PERSON";
29      private static final String ENTITY_ID = "190192";
30      private static final String TYPE_SORT_CODE = "0";
31      private static final boolean TYPE_ACTIVE = true ;
32      private static final Long TYPE_VERSION_NUMBER = new Long(1) ;
33      private static final String TYPE_OBJECT_ID = String.valueOf(UUID.randomUUID());
34      private static final boolean DEFAULT = true ;
35  
36      private static final String TYPE_CODE = "HM" ;
37      private static final String TYPE_NAME = "Home";
38  
39  
40  
41      // ADDRESS stuff
42      private static final String ADDR_ID = "1";
43      private static final Long ADDR_TYPE_VERSION_NUMBER = new Long(1);
44      private static final String ADDR_TYPE_OBJECT_ID = String.valueOf(UUID.randomUUID());
45      private static final String ATTENTION_LINE= "Attn Line";
46      private static final String ADDR_LINE1 = "Line 1";
47      private static final String ADDR_LINE2 = "Line 2";
48      private static final String ADDR_LINE3 = "Line 3";
49      private static final String ADDR_CITY = "Super Sweet City";
50      private static final String ADDR_STATE_PROVINCE_CODE = "CA";
51      private static final String ADDR_POSTAL_CODE = "55555" ;
52      private static final String ADDR_COUNTRY_CODE = "US" ;
53      private static final boolean ADDR_SUPPRESS = false ;
54      private static final boolean ADDR_DEFAULT = true;
55      private static final boolean ADDR_ACTIVE = true;
56      private static final String ADDR_FMT = "address format" ;
57      private static final DateTime MODIFIED_DATE = new DateTime();
58      private static final DateTime VALIDATED_DATE = new DateTime() ;
59      private static final boolean VALIDATED = true ;
60      private static final String NOTE_MESSAGE = "note message" ;
61      private static final Long ADDR_VERSION_NUMBER = new Long(1);
62      private static final String ADDR_OBJECT_ID = String.valueOf(UUID.randomUUID());
63  
64  
65      //PHONE stuff
66      private static final String PHONE_ID = "1";
67      private static final String PHONE_NUMBER = "439-0116";
68      private static final String PHONE_COUNTRY_CODE = "1";
69      private static final String PHONE_EXTENSION_NUMBER ="12" ;
70      private static final boolean PHONE_SUPPRESS = false;
71      private static final boolean PHONE_ACTIVE = true ;
72      private static final Long PHONE_VERSION_NUMBER = new Long(1);
73      private static final boolean PHONE_DEFAULT = true;
74      private static final String PHONE_OBJECT_ID = String.valueOf(UUID.randomUUID());
75      private static final Long PHONE_TYPE_VERSION_NUMBER = new Long(1) ;
76      private static final String PHONE_TYPE_OBJECT_ID = String.valueOf(UUID.randomUUID());
77  
78      //email data
79      private static final String EMAIL_ID = "1";
80      private static final Long EMAIL_TYPE_VERSION_NUMBER = new Long(1) ;
81      private static final String EMAIL_TYPE_OBJECT_ID = String.valueOf(UUID.randomUUID());
82      private static final String EMAIL_ADDRESS = "test@kuali.org";
83      private static final boolean EMAIL_SUPPRESS = false ;
84      private static final boolean EMAIL_DEFAULT = true;
85      private static final boolean EMAIL_ACTIVE = true;
86      private static final Long EMAIL_VERSION_NUMBER = new Long(1);
87      private static final String EMAIL_OBJECT_ID = String.valueOf(UUID.randomUUID());
88  
89  
90      private static final Long VERSION_NUMBER = new Long(1);
91      private static final String OBJECT_ID = String.valueOf(UUID.randomUUID());
92      private static final boolean ACTIVE = true;
93  
94      public static EntityTypeContactInfo create () {
95          final EntityAddress addr = EntityAddress.Builder.create(new EntityAddressContract() {
96              @Override
97              public String getEntityId() {
98                  return EntityTypeContactInfoHelper.ENTITY_ID;
99              }
100 
101             @Override
102             public String getEntityTypeCode() {
103                 return EntityTypeContactInfoHelper.ENTITY_TYPE_CODE;
104             }
105 
106             @Override
107             public CodedAttributeContract getAddressType() {
108                 return CodedAttribute.Builder.create(new CodedAttributeContract() {
109                     @Override
110                     public String getName() {
111                         return EntityTypeContactInfoHelper.TYPE_NAME;
112                     }
113 
114                     @Override
115                     public String getSortCode() {
116                         return EntityTypeContactInfoHelper.TYPE_SORT_CODE;
117                     }
118 
119                     @Override
120                     public String getCode() {
121                         return EntityTypeContactInfoHelper.TYPE_CODE;
122                     }
123 
124                     @Override
125                     public String getObjectId() {
126                         return EntityTypeContactInfoHelper.ADDR_TYPE_OBJECT_ID;
127                     }
128 
129                     @Override
130                     public boolean isActive() {
131                         return EntityTypeContactInfoHelper.TYPE_ACTIVE;
132                     }
133 
134                     @Override
135                     public Long getVersionNumber() {
136                         return EntityTypeContactInfoHelper.ADDR_TYPE_VERSION_NUMBER;
137                     }
138                 }).build();
139             }
140 
141             @Override
142             public String getAttentionLine() {
143                 return EntityTypeContactInfoHelper.ATTENTION_LINE;
144             }
145 
146             @Override
147             public String getLine1() {
148                 return EntityTypeContactInfoHelper.ADDR_LINE1;
149             }
150 
151             @Override
152             public String getLine2() {
153                 return EntityTypeContactInfoHelper.ADDR_LINE2;
154             }
155 
156             @Override
157             public String getLine3() {
158                 return EntityTypeContactInfoHelper.ADDR_LINE3;
159             }
160 
161             @Override
162             public String getCity() {
163                 return EntityTypeContactInfoHelper.ADDR_CITY;
164             }
165 
166             @Override
167             public String getStateProvinceCode() {
168                 return EntityTypeContactInfoHelper.ADDR_STATE_PROVINCE_CODE;
169             }
170 
171             @Override
172             public String getPostalCode() {
173                 return EntityTypeContactInfoHelper.ADDR_POSTAL_CODE;
174             }
175 
176             @Override
177             public String getCountryCode() {
178                 return EntityTypeContactInfoHelper.ADDR_COUNTRY_CODE;
179             }
180 
181             @Override
182             public String getAttentionLineUnmasked() {
183                 return EntityTypeContactInfoHelper.ATTENTION_LINE;
184             }
185 
186             @Override
187             public String getLine1Unmasked() {
188                 return EntityTypeContactInfoHelper.ADDR_LINE1 ;
189             }
190 
191             @Override
192             public String getLine2Unmasked() {
193                 return EntityTypeContactInfoHelper.ADDR_LINE2;
194             }
195 
196             @Override
197             public String getLine3Unmasked() {
198                 return EntityTypeContactInfoHelper.ADDR_LINE3;
199             }
200 
201             @Override
202             public String getCityUnmasked() {
203                 return EntityTypeContactInfoHelper.ADDR_CITY;
204             }
205 
206             @Override
207             public String getStateProvinceCodeUnmasked() {
208                 return EntityTypeContactInfoHelper.ADDR_STATE_PROVINCE_CODE;
209             }
210 
211             @Override
212             public String getPostalCodeUnmasked() {
213                 return EntityTypeContactInfoHelper.ADDR_POSTAL_CODE;
214             }
215 
216             @Override
217             public String getCountryCodeUnmasked() {
218                 return EntityTypeContactInfoHelper.ADDR_COUNTRY_CODE;
219             }
220 
221             @Override
222             public String getAddressFormat() {
223                 return EntityTypeContactInfoHelper.ADDR_FMT;
224             }
225 
226             @Override
227             public DateTime getModifiedDate() {
228                 return EntityTypeContactInfoHelper.MODIFIED_DATE ;
229             }
230 
231             @Override
232             public DateTime getValidatedDate() {
233                 return EntityTypeContactInfoHelper.VALIDATED_DATE ;
234             }
235 
236             @Override
237             public boolean isValidated() {
238                 return EntityTypeContactInfoHelper.VALIDATED;
239             }
240 
241             @Override
242             public String getNoteMessage() {
243                 return EntityTypeContactInfoHelper.NOTE_MESSAGE;
244             }
245 
246             @Override
247             public boolean isSuppressAddress() {
248                 return EntityTypeContactInfoHelper.ADDR_SUPPRESS;
249             }
250 
251             @Override
252             public boolean isDefaultValue() {
253                 return EntityTypeContactInfoHelper.ADDR_DEFAULT;
254             }
255 
256             @Override
257             public String getObjectId() {
258                 return EntityTypeContactInfoHelper.ADDR_OBJECT_ID;
259             }
260 
261             @Override
262             public String getId() {
263                 return EntityTypeContactInfoHelper.ADDR_ID ;
264             }
265 
266             @Override
267             public boolean isActive() {
268                 return EntityTypeContactInfoHelper.ADDR_ACTIVE;
269             }
270 
271             @Override
272             public Long getVersionNumber() {
273                 return EntityTypeContactInfoHelper.ADDR_VERSION_NUMBER;
274             }
275         } ).build();
276         final EntityEmail email = EntityEmail.Builder.create(new EntityEmailContract() {
277                     @Override
278                     public String getEntityId() {
279                         return EntityTypeContactInfoHelper.ENTITY_ID;
280                     }
281 
282                     @Override
283                     public String getEntityTypeCode() {
284                         return EntityTypeContactInfoHelper.ENTITY_TYPE_CODE;
285                     }
286 
287                     @Override
288                     public CodedAttributeContract getEmailType() {
289                         return CodedAttribute.Builder.create(new CodedAttributeContract() {
290                             @Override
291                             public String getName() {
292                                 return EntityTypeContactInfoHelper.TYPE_NAME;
293                             }
294 
295                             @Override
296                             public String getSortCode() {
297                                 return EntityTypeContactInfoHelper.TYPE_SORT_CODE;
298                             }
299 
300                             @Override
301                             public String getCode() {
302                                 return EntityTypeContactInfoHelper.TYPE_CODE;
303                             }
304 
305                             @Override
306                             public String getObjectId() {
307                                 return EntityTypeContactInfoHelper.EMAIL_TYPE_OBJECT_ID;
308                             }
309 
310                             @Override
311                             public boolean isActive() {
312                                 return EntityTypeContactInfoHelper.TYPE_ACTIVE;
313                             }
314 
315                             @Override
316                             public Long getVersionNumber() {
317                                 return EntityTypeContactInfoHelper.EMAIL_TYPE_VERSION_NUMBER;
318                             }
319                         }).build();
320                     }
321 
322                     @Override
323                     public String getEmailAddress() {
324                         return EntityTypeContactInfoHelper.EMAIL_ADDRESS;
325                     }
326 
327                     @Override
328                     public String getEmailAddressUnmasked() {
329                         return EntityTypeContactInfoHelper.EMAIL_ADDRESS;
330                     }
331 
332                     @Override
333                     public boolean isSuppressEmail() {
334                         return EntityTypeContactInfoHelper.EMAIL_SUPPRESS;
335                     }
336 
337                     @Override
338                     public boolean isDefaultValue() {
339                         return EntityTypeContactInfoHelper.EMAIL_DEFAULT;
340                     }
341 
342                     @Override
343                     public String getObjectId() {
344                         return EntityTypeContactInfoHelper.EMAIL_OBJECT_ID;
345                     }
346 
347                     @Override
348                     public String getId() {
349                         return EntityTypeContactInfoHelper.EMAIL_ID;
350                     }
351 
352                     @Override
353                     public boolean isActive() {
354                         return EntityTypeContactInfoHelper.EMAIL_ACTIVE;
355                     }
356 
357                     @Override
358                     public Long getVersionNumber() {
359                         return EntityTypeContactInfoHelper.EMAIL_VERSION_NUMBER;
360                     }
361                 }).build();
362             final EntityPhone phone = EntityPhone.Builder.create(new EntityPhoneContract() {
363                     @Override
364                     public String getEntityId() {
365                         return EntityTypeContactInfoHelper.ENTITY_ID;
366                     }
367 
368                     @Override
369                     public String getEntityTypeCode() {
370                         return EntityTypeContactInfoHelper.ENTITY_TYPE_CODE;
371                     }
372 
373                     @Override
374                     public CodedAttributeContract getPhoneType() {
375                         return CodedAttribute.Builder.create(new CodedAttributeContract() {
376                             @Override
377                             public String getName() {
378                                 return EntityTypeContactInfoHelper.TYPE_NAME;
379                             }
380 
381                             @Override
382                             public String getSortCode() {
383                                 return EntityTypeContactInfoHelper.TYPE_SORT_CODE;
384                             }
385 
386                             @Override
387                             public String getCode() {
388                                 return EntityTypeContactInfoHelper.TYPE_CODE;
389                             }
390 
391                             @Override
392                             public String getObjectId() {
393                                 return EntityTypeContactInfoHelper.PHONE_TYPE_OBJECT_ID;
394                             }
395 
396                             @Override
397                             public boolean isActive() {
398                                 return EntityTypeContactInfoHelper.TYPE_ACTIVE;
399                             }
400 
401                             @Override
402                             public Long getVersionNumber() {
403                                 return EntityTypeContactInfoHelper.PHONE_TYPE_VERSION_NUMBER;
404                             }
405                         }).build();
406                     }
407 
408                     @Override
409                     public String getPhoneNumber() {
410                         return EntityTypeContactInfoHelper.PHONE_NUMBER;
411                     }
412 
413                     @Override
414                     public String getExtensionNumber() {
415                         return EntityTypeContactInfoHelper.PHONE_EXTENSION_NUMBER;
416                     }
417 
418                     @Override
419                     public String getCountryCode() {
420                         return EntityTypeContactInfoHelper.PHONE_COUNTRY_CODE;
421                     }
422 
423                     @Override
424                     public String getPhoneNumberUnmasked() {
425                         return EntityTypeContactInfoHelper.PHONE_NUMBER;
426                     }
427 
428                     @Override
429                     public String getExtensionNumberUnmasked() {
430                         return EntityTypeContactInfoHelper.PHONE_EXTENSION_NUMBER;
431                     }
432 
433                     @Override
434                     public String getCountryCodeUnmasked() {
435                         return EntityTypeContactInfoHelper.PHONE_COUNTRY_CODE;
436                     }
437 
438                     @Override
439                     public String getFormattedPhoneNumber() {
440                         return EntityTypeContactInfoHelper.PHONE_NUMBER + " x" + EntityTypeContactInfoHelper.PHONE_EXTENSION_NUMBER;
441                     }
442 
443                     @Override
444                     public String getFormattedPhoneNumberUnmasked() {
445                         return EntityTypeContactInfoHelper.PHONE_NUMBER + " x" + EntityTypeContactInfoHelper.PHONE_EXTENSION_NUMBER;
446                     }
447 
448                     @Override
449                     public boolean isSuppressPhone() {
450                         return EntityTypeContactInfoHelper.PHONE_SUPPRESS;
451                     }
452 
453                     @Override
454                     public boolean isDefaultValue() {
455                         return EntityTypeContactInfoHelper.PHONE_DEFAULT;
456                     }
457 
458                     @Override
459                     public String getObjectId() {
460                         return EntityTypeContactInfoHelper.PHONE_OBJECT_ID;
461                     }
462 
463                     @Override
464                     public String getId() {
465                         return EntityTypeContactInfoHelper.PHONE_ID;
466                     }
467 
468                     @Override
469                     public boolean isActive() {
470                         return EntityTypeContactInfoHelper.PHONE_ACTIVE;
471                     }
472 
473                     @Override
474                     public Long getVersionNumber() {
475                         return EntityTypeContactInfoHelper.PHONE_VERSION_NUMBER;
476                     }
477                 }).build();
478         return EntityTypeContactInfo.Builder.create(new EntityTypeContactInfoContract() {
479             @Override
480             public String getEntityId() {
481                 return EntityTypeContactInfoHelper.ENTITY_ID;
482             }
483 
484             @Override
485             public String getEntityTypeCode() {
486                 return EntityTypeContactInfoHelper.ENTITY_TYPE_CODE;
487             }
488 
489             @Override
490             public CodedAttributeContract getEntityType() {
491                 return CodedAttribute.Builder.create(new CodedAttributeContract() {
492                     @Override
493                     public String getName() {
494                         return EntityTypeContactInfoHelper.ENTITY_TYPE_NAME;
495                     }
496 
497                     @Override
498                     public String getSortCode() {
499                         return EntityTypeContactInfoHelper.TYPE_SORT_CODE;
500                     }
501 
502                     @Override
503                     public String getCode() {
504                         return EntityTypeContactInfoHelper.ENTITY_TYPE_CODE;
505                     }
506 
507                     @Override
508                     public String getObjectId() {
509                         return EntityTypeContactInfoHelper.TYPE_OBJECT_ID;
510                     }
511 
512                     @Override
513                     public boolean isActive() {
514                         return EntityTypeContactInfoHelper.TYPE_ACTIVE;
515                     }
516 
517                     @Override
518                     public Long getVersionNumber() {
519                         return EntityTypeContactInfoHelper.TYPE_VERSION_NUMBER;
520                     }
521                 }).build();
522             }
523 
524             @Override
525             public List<? extends EntityAddressContract> getAddresses() {
526                 return Arrays.asList(addr);
527             }
528 
529             @Override
530             public List<? extends EntityEmailContract> getEmailAddresses() {
531                 return Arrays.asList(email);
532             }
533 
534             @Override
535             public List<? extends EntityPhoneContract> getPhoneNumbers() {
536                 return Arrays.asList(phone);
537             }
538 
539             @Override
540             public EntityAddressContract getDefaultAddress() {
541                 return addr;
542             }
543 
544             @Override
545             public EntityEmailContract getDefaultEmailAddress() {
546                 return email;
547             }
548 
549             @Override
550             public EntityPhoneContract getDefaultPhoneNumber() {
551                 return phone;
552             }
553 
554             @Override
555             public String getObjectId() {
556                 return EntityTypeContactInfoHelper.OBJECT_ID;
557             }
558 
559             @Override
560             public boolean isActive() {
561                 return EntityTypeContactInfoHelper.ACTIVE;
562             }
563 
564             @Override
565             public Long getVersionNumber() {
566                 return EntityTypeContactInfoHelper.VERSION_NUMBER;
567             }
568         }).build();
569 
570     }
571 
572 }