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.name.EntityName;
7   import org.kuali.rice.kim.api.identity.name.EntityNameContract;
8   
9   import java.util.UUID;
10  
11  /**
12   * Created with IntelliJ IDEA.
13   * User: ?
14   * Date: 5/29/12
15   * Time: 1:18 PM
16   * To change this template use File | Settings | File Templates.
17   */
18  public class EntityNameHelper {
19      private static final String ID = "1";
20      private static final String ENTITY_TYPE_CODE = "PERSON";
21      private static final String ENTITY_ID = "190192";
22      private static final String TYPE_CODE = "OTH";
23      private static final String TYPE_NAME = "Other";
24      private static final String TYPE_SORT_CODE = "b";
25      private static final boolean TYPE_ACTIVE = true;
26      private static final Long TYPE_VERSION_NUMBER = new Long(1);
27      private static final String TYPE_OBJECT_ID = String.valueOf(UUID.randomUUID()) ;
28      private static final String NAME_PREFIX = "Mr" ;
29      private static final String NAME_TITLE = "DVM";
30      private static final String FIRST_NAME = "Bob";
31      private static final String MIDDLE_NAME = "Mob";
32      private static final String LAST_NAME = "Sob" ;
33      private static final String NAME_SUFFIX = "Jr";
34      private static final String NOTE_MESSAGE = "note message";
35      private static final DateTime NAME_CHANGED_DATE = null;
36      private static final String COMPOSITE_NAME = LAST_NAME + ", " + FIRST_NAME + " " + MIDDLE_NAME;
37  
38      private static final boolean SUPPRESS = false ;
39      private static final boolean DEFAULT = true ;
40      private static final boolean ACTIVE = true ;
41      private static final Long VERSION_NUMBER = new Long(1);
42      private static final String OBJECT_ID = String.valueOf(UUID.randomUUID()) ;
43  
44  
45      public static EntityName create() {
46          return EntityName.Builder.create(new EntityNameContract() {
47                @Override
48              public String getEntityId() {
49                  return EntityNameHelper.ID;
50              }
51  
52              @Override
53              public CodedAttributeContract getNameType() {
54                  return CodedAttribute.Builder.create(new CodedAttributeContract() {
55                      @Override
56                      public String getName() {
57                          return EntityNameHelper.TYPE_NAME;
58                      }
59  
60                      @Override
61                      public String getSortCode() {
62                          return EntityNameHelper.TYPE_SORT_CODE;
63                      }
64  
65                      @Override
66                      public String getCode() {
67                          return EntityNameHelper.TYPE_CODE;
68                      }
69  
70                      @Override
71                      public String getObjectId() {
72                          return EntityNameHelper.TYPE_OBJECT_ID;
73                      }
74  
75                      @Override
76                      public boolean isActive() {
77                          return EntityNameHelper.TYPE_ACTIVE;
78                      }
79  
80                      @Override
81                      public Long getVersionNumber() {
82                          return EntityNameHelper.TYPE_VERSION_NUMBER;
83                      }
84                  }).build();
85              }
86  
87              @Override
88              public String getFirstName() {
89                  return EntityNameHelper.FIRST_NAME;
90              }
91  
92              @Override
93              public String getFirstNameUnmasked() {
94                  return EntityNameHelper.FIRST_NAME;
95              }
96  
97              @Override
98              public String getMiddleName() {
99                  return EntityNameHelper.MIDDLE_NAME;
100             }
101 
102             @Override
103             public String getMiddleNameUnmasked() {
104                 return EntityNameHelper.MIDDLE_NAME;
105             }
106 
107             @Override
108             public String getLastName() {
109                 return EntityNameHelper.LAST_NAME;
110             }
111 
112             @Override
113             public String getLastNameUnmasked() {
114                 return EntityNameHelper.LAST_NAME;
115             }
116 
117             @Override
118             public String getNamePrefix() {
119                 return EntityNameHelper.NAME_PREFIX;
120             }
121 
122             @Override
123             public String getNamePrefixUnmasked() {
124                 return EntityNameHelper.NAME_PREFIX;
125             }
126 
127             @Override
128             public String getNameTitle() {
129                 return EntityNameHelper.NAME_TITLE;
130             }
131 
132             @Override
133             public String getNameTitleUnmasked() {
134                 return EntityNameHelper.NAME_TITLE;
135             }
136 
137             @Override
138             public String getNameSuffix() {
139                 return EntityNameHelper.NAME_SUFFIX;
140             }
141 
142             @Override
143             public String getNameSuffixUnmasked() {
144                 return EntityNameHelper.NAME_SUFFIX;
145             }
146 
147             @Override
148             public String getCompositeName() {
149                 return EntityNameHelper.COMPOSITE_NAME ;
150             }
151 
152             @Override
153             public String getCompositeNameUnmasked() {
154                 return EntityNameHelper.COMPOSITE_NAME;
155             }
156 
157             @Override
158             public String getNoteMessage() {
159                 return EntityNameHelper.NOTE_MESSAGE;
160             }
161 
162             @Override
163             public DateTime getNameChangedDate() {
164                 return  EntityNameHelper.NAME_CHANGED_DATE;
165             }
166 
167             @Override
168             public boolean isSuppressName() {
169                 return EntityNameHelper.SUPPRESS;
170             }
171 
172             @Override
173             public boolean isDefaultValue() {
174                 return EntityNameHelper.DEFAULT;
175             }
176 
177             @Override
178             public String getObjectId() {
179                 return EntityNameHelper.OBJECT_ID;
180             }
181 
182             @Override
183             public String getId() {
184                 return EntityNameHelper.ENTITY_ID;
185             }
186 
187             @Override
188             public boolean isActive() {
189                 return EntityNameHelper.ACTIVE;
190             }
191 
192             @Override
193             public Long getVersionNumber() {
194                 return EntityNameHelper.VERSION_NUMBER;
195             }
196         }).build();
197 
198     }
199 }