1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.service.impl; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.Collection; |
20 | |
import java.util.HashMap; |
21 | |
import java.util.List; |
22 | |
import java.util.Map; |
23 | |
|
24 | |
import javax.jws.WebService; |
25 | |
|
26 | |
import org.apache.commons.lang.StringUtils; |
27 | |
import org.kuali.rice.kim.bo.entity.KimEntityAffiliation; |
28 | |
import org.kuali.rice.kim.bo.entity.KimEntityEntityType; |
29 | |
import org.kuali.rice.kim.bo.entity.KimEntityExternalIdentifier; |
30 | |
import org.kuali.rice.kim.bo.entity.KimEntityPrivacyPreferences; |
31 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityAddressInfo; |
32 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityAffiliationInfo; |
33 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityDefaultInfo; |
34 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityEmailInfo; |
35 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityEmploymentInformationInfo; |
36 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityEntityTypeDefaultInfo; |
37 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityExternalIdentifierInfo; |
38 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityInfo; |
39 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityNameInfo; |
40 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityNamePrincipalNameInfo; |
41 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityPhoneInfo; |
42 | |
import org.kuali.rice.kim.bo.entity.dto.KimEntityPrivacyPreferencesInfo; |
43 | |
import org.kuali.rice.kim.bo.entity.dto.KimPrincipalInfo; |
44 | |
import org.kuali.rice.kim.bo.entity.impl.KimEntityImpl; |
45 | |
import org.kuali.rice.kim.bo.entity.impl.KimEntityNameImpl; |
46 | |
import org.kuali.rice.kim.bo.entity.impl.KimEntityPrivacyPreferencesImpl; |
47 | |
import org.kuali.rice.kim.bo.entity.impl.KimPrincipalImpl; |
48 | |
import org.kuali.rice.kim.bo.reference.dto.AddressTypeInfo; |
49 | |
import org.kuali.rice.kim.bo.reference.dto.AffiliationTypeInfo; |
50 | |
import org.kuali.rice.kim.bo.reference.dto.CitizenshipStatusInfo; |
51 | |
import org.kuali.rice.kim.bo.reference.dto.EmailTypeInfo; |
52 | |
import org.kuali.rice.kim.bo.reference.dto.EmploymentStatusInfo; |
53 | |
import org.kuali.rice.kim.bo.reference.dto.EmploymentTypeInfo; |
54 | |
import org.kuali.rice.kim.bo.reference.dto.EntityNameTypeInfo; |
55 | |
import org.kuali.rice.kim.bo.reference.dto.EntityTypeInfo; |
56 | |
import org.kuali.rice.kim.bo.reference.dto.ExternalIdentifierTypeInfo; |
57 | |
import org.kuali.rice.kim.bo.reference.dto.PhoneTypeInfo; |
58 | |
import org.kuali.rice.kim.bo.reference.impl.AddressTypeImpl; |
59 | |
import org.kuali.rice.kim.bo.reference.impl.AffiliationTypeImpl; |
60 | |
import org.kuali.rice.kim.bo.reference.impl.CitizenshipStatusImpl; |
61 | |
import org.kuali.rice.kim.bo.reference.impl.EmailTypeImpl; |
62 | |
import org.kuali.rice.kim.bo.reference.impl.EmploymentStatusImpl; |
63 | |
import org.kuali.rice.kim.bo.reference.impl.EmploymentTypeImpl; |
64 | |
import org.kuali.rice.kim.bo.reference.impl.EntityNameTypeImpl; |
65 | |
import org.kuali.rice.kim.bo.reference.impl.EntityTypeImpl; |
66 | |
import org.kuali.rice.kim.bo.reference.impl.ExternalIdentifierTypeImpl; |
67 | |
import org.kuali.rice.kim.bo.reference.impl.PhoneTypeImpl; |
68 | |
import org.kuali.rice.kim.service.IdentityService; |
69 | |
import org.kuali.rice.kim.service.IdentityUpdateService; |
70 | |
import org.kuali.rice.kim.util.KIMPropertyConstants; |
71 | |
import org.kuali.rice.kim.util.KIMWebServiceConstants; |
72 | |
import org.kuali.rice.kns.lookup.CollectionIncomplete; |
73 | |
import org.kuali.rice.kns.service.BusinessObjectService; |
74 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
75 | |
import org.kuali.rice.kns.util.ObjectUtils; |
76 | |
import org.springframework.transaction.annotation.Transactional; |
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | |
@WebService(endpointInterface = KIMWebServiceConstants.IdentityService.INTERFACE_CLASS, serviceName = KIMWebServiceConstants.IdentityService.WEB_SERVICE_NAME, portName = KIMWebServiceConstants.IdentityService.WEB_SERVICE_PORT, targetNamespace = KIMWebServiceConstants.MODULE_TARGET_NAMESPACE) |
86 | 0 | public class IdentityServiceImpl implements IdentityService, IdentityUpdateService { |
87 | |
|
88 | |
private BusinessObjectService businessObjectService; |
89 | |
|
90 | |
|
91 | |
|
92 | |
|
93 | |
public KimEntityInfo getEntityInfo(String entityId) { |
94 | 0 | KimEntityImpl entity = getEntityImpl( entityId ); |
95 | 0 | if ( entity == null ) { |
96 | 0 | return null; |
97 | |
} |
98 | 0 | return convertEntityImplToInfo( entity ); |
99 | |
} |
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
public KimEntityInfo getEntityInfoByPrincipalId(String principalId) { |
105 | 0 | KimEntityImpl entity = getEntityByPrincipalId(principalId); |
106 | 0 | if ( entity == null ) { |
107 | 0 | return null; |
108 | |
} |
109 | 0 | return convertEntityImplToInfo(entity); |
110 | |
} |
111 | |
|
112 | |
|
113 | |
|
114 | |
|
115 | |
public KimEntityInfo getEntityInfoByPrincipalName(String principalName) { |
116 | 0 | KimEntityImpl entity = getEntityByPrincipalName(principalName); |
117 | 0 | if ( entity == null ) { |
118 | 0 | return null; |
119 | |
} |
120 | 0 | return convertEntityImplToInfo(entity); |
121 | |
} |
122 | |
|
123 | |
|
124 | |
|
125 | |
|
126 | |
public KimEntityDefaultInfo getEntityDefaultInfo(String entityId) { |
127 | 0 | KimEntityImpl entity = getEntityImpl( entityId ); |
128 | 0 | if ( entity == null ) { |
129 | 0 | return null; |
130 | |
} |
131 | 0 | return convertEntityImplToDefaultInfo( entity ); |
132 | |
} |
133 | |
|
134 | |
|
135 | |
|
136 | |
|
137 | |
public KimEntityDefaultInfo getEntityDefaultInfoByPrincipalId(String principalId) { |
138 | 0 | KimEntityImpl entity = getEntityByPrincipalId(principalId); |
139 | 0 | if ( entity == null ) { |
140 | 0 | return null; |
141 | |
} |
142 | 0 | return convertEntityImplToDefaultInfo(entity); |
143 | |
} |
144 | |
|
145 | |
|
146 | |
|
147 | |
|
148 | |
public KimEntityDefaultInfo getEntityDefaultInfoByPrincipalName(String principalName) { |
149 | 0 | KimEntityImpl entity = getEntityByPrincipalName(principalName); |
150 | 0 | if ( entity == null ) { |
151 | 0 | return null; |
152 | |
} |
153 | 0 | return convertEntityImplToDefaultInfo(entity); |
154 | |
} |
155 | |
|
156 | |
|
157 | |
|
158 | |
|
159 | |
@SuppressWarnings("unchecked") |
160 | |
public KimPrincipalInfo getPrincipalByPrincipalNameAndPassword(String principalName, String password) { |
161 | 0 | Map<String,Object> criteria = new HashMap<String,Object>(3); |
162 | 0 | criteria.put(KIMPropertyConstants.Principal.PRINCIPAL_NAME, principalName); |
163 | 0 | criteria.put(KIMPropertyConstants.Principal.PASSWORD, password); |
164 | 0 | criteria.put(KIMPropertyConstants.Principal.ACTIVE, true); |
165 | 0 | Collection<KimPrincipalImpl> principals = (Collection<KimPrincipalImpl>)getBusinessObjectService().findMatching(KimPrincipalImpl.class, criteria); |
166 | 0 | if (!principals.isEmpty()) { |
167 | 0 | return new KimPrincipalInfo( principals.iterator().next() ); |
168 | |
} |
169 | 0 | return null; |
170 | |
} |
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
@SuppressWarnings("unchecked") |
176 | |
@Transactional(readOnly=true) |
177 | |
public List<KimEntityInfo> lookupEntityInfo( |
178 | |
Map<String,String> searchCriteria, boolean unbounded) { |
179 | 0 | Collection baseResults = lookupEntityImpls(searchCriteria, unbounded); |
180 | 0 | List<KimEntityInfo> results = new ArrayList<KimEntityInfo>( baseResults.size() ); |
181 | 0 | for ( KimEntityImpl entity : (Collection<KimEntityImpl>)baseResults ) { |
182 | 0 | results.add( convertEntityImplToInfo( entity ) ); |
183 | |
} |
184 | 0 | if ( baseResults instanceof CollectionIncomplete ) { |
185 | 0 | results = new CollectionIncomplete<KimEntityInfo>( results, ((CollectionIncomplete<KimEntityInfo>)baseResults).getActualSizeIfTruncated() ); |
186 | |
} |
187 | 0 | return results; |
188 | |
} |
189 | |
|
190 | |
|
191 | |
|
192 | |
@SuppressWarnings("unchecked") |
193 | |
@Transactional(readOnly=true) |
194 | |
public List<KimEntityDefaultInfo> lookupEntityDefaultInfo( |
195 | |
Map<String,String> searchCriteria, boolean unbounded) { |
196 | 0 | Collection baseResults = lookupEntityImpls(searchCriteria, unbounded); |
197 | 0 | List<KimEntityDefaultInfo> results = new ArrayList<KimEntityDefaultInfo>( baseResults.size() ); |
198 | 0 | for ( KimEntityImpl entity : (Collection<KimEntityImpl>)baseResults ) { |
199 | 0 | results.add( convertEntityImplToDefaultInfo( entity ) ); |
200 | |
} |
201 | 0 | if ( baseResults instanceof CollectionIncomplete ) { |
202 | 0 | results = new CollectionIncomplete<KimEntityDefaultInfo>( results, ((CollectionIncomplete<KimEntityDefaultInfo>)baseResults).getActualSizeIfTruncated() ); |
203 | |
} |
204 | 0 | return results; |
205 | |
} |
206 | |
|
207 | |
protected Collection lookupEntityImpls(Map<String,String> searchCriteria, boolean unbounded) { |
208 | 0 | if ( unbounded ) { |
209 | 0 | return KNSServiceLocator.getLookupService().findCollectionBySearchUnbounded( KimEntityImpl.class, searchCriteria ); |
210 | |
} else { |
211 | 0 | return KNSServiceLocator.getLookupService().findCollectionBySearch( KimEntityImpl.class, searchCriteria ); |
212 | |
} |
213 | |
} |
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
public int getMatchingEntityCount(Map<String,String> searchCriteria) { |
219 | 0 | return getBusinessObjectService().countMatching( KimEntityImpl.class, searchCriteria ); |
220 | |
} |
221 | |
|
222 | |
protected KimEntityInfo convertEntityImplToInfo( KimEntityImpl entity ) { |
223 | 0 | return new KimEntityInfo(entity); |
224 | |
} |
225 | |
|
226 | |
protected KimEntityDefaultInfo convertEntityImplToDefaultInfo( KimEntityImpl entity ) { |
227 | 0 | KimEntityDefaultInfo info = new KimEntityDefaultInfo(); |
228 | 0 | info.setEntityId( entity.getEntityId() ); |
229 | 0 | info.setActive( entity.isActive() ); |
230 | 0 | ArrayList<KimPrincipalInfo> principalInfo = new ArrayList<KimPrincipalInfo>( entity.getPrincipals().size() ); |
231 | 0 | info.setPrincipals( principalInfo ); |
232 | 0 | for ( KimPrincipalImpl p : entity.getPrincipals() ) { |
233 | 0 | principalInfo.add( new KimPrincipalInfo( p ) ); |
234 | |
} |
235 | 0 | KimEntityPrivacyPreferencesInfo privacy = null; |
236 | 0 | if ( ObjectUtils.isNotNull( entity.getPrivacyPreferences() ) ) { |
237 | 0 | privacy = new KimEntityPrivacyPreferencesInfo(entity.getPrivacyPreferences()); |
238 | |
} |
239 | |
|
240 | 0 | info.setPrivacyPreferences(privacy); |
241 | 0 | info.setDefaultName( new KimEntityNameInfo( entity.getDefaultName() ) ); |
242 | 0 | ArrayList<KimEntityEntityTypeDefaultInfo> entityTypesInfo = new ArrayList<KimEntityEntityTypeDefaultInfo>( entity.getEntityTypes().size() ); |
243 | 0 | info.setEntityTypes( entityTypesInfo ); |
244 | 0 | for ( KimEntityEntityType entityEntityType : entity.getEntityTypes() ) { |
245 | 0 | KimEntityEntityTypeDefaultInfo typeInfo = new KimEntityEntityTypeDefaultInfo(); |
246 | 0 | typeInfo.setEntityTypeCode( entityEntityType.getEntityTypeCode() ); |
247 | 0 | typeInfo.setDefaultAddress( new KimEntityAddressInfo( entityEntityType.getDefaultAddress()) ); |
248 | 0 | typeInfo.setDefaultEmailAddress( new KimEntityEmailInfo( entityEntityType.getDefaultEmailAddress()) ); |
249 | 0 | typeInfo.setDefaultPhoneNumber( new KimEntityPhoneInfo( entityEntityType.getDefaultPhoneNumber()) ); |
250 | 0 | entityTypesInfo.add( typeInfo ); |
251 | 0 | } |
252 | |
|
253 | 0 | ArrayList<KimEntityAffiliationInfo> affInfo = new ArrayList<KimEntityAffiliationInfo>( entity.getAffiliations().size() ); |
254 | 0 | info.setAffiliations( affInfo ); |
255 | 0 | for ( KimEntityAffiliation aff : entity.getAffiliations() ) { |
256 | 0 | affInfo.add( new KimEntityAffiliationInfo( aff ) ); |
257 | 0 | if ( aff.isActive() && aff.isDefault() ) { |
258 | 0 | info.setDefaultAffiliation( affInfo.get( affInfo.size() - 1 ) ); |
259 | |
} |
260 | |
} |
261 | 0 | info.setPrimaryEmployment( new KimEntityEmploymentInformationInfo( entity.getPrimaryEmployment() ) ); |
262 | 0 | ArrayList<KimEntityExternalIdentifierInfo> idInfo = new ArrayList<KimEntityExternalIdentifierInfo>( entity.getExternalIdentifiers().size() ); |
263 | 0 | info.setExternalIdentifiers( idInfo ); |
264 | 0 | for ( KimEntityExternalIdentifier id : entity.getExternalIdentifiers() ) { |
265 | 0 | idInfo.add( new KimEntityExternalIdentifierInfo( id ) ); |
266 | |
} |
267 | 0 | return info; |
268 | |
} |
269 | |
|
270 | |
|
271 | |
|
272 | |
|
273 | |
public KimEntityPrivacyPreferencesInfo getEntityPrivacyPreferences(String entityId) { |
274 | 0 | Map<String,String> criteria = new HashMap<String,String>(1); |
275 | 0 | criteria.put(KIMPropertyConstants.Entity.ENTITY_ID, entityId); |
276 | 0 | return new KimEntityPrivacyPreferencesInfo( (KimEntityPrivacyPreferences)getBusinessObjectService().findByPrimaryKey(KimEntityPrivacyPreferencesImpl.class, criteria) ); |
277 | |
} |
278 | |
|
279 | |
|
280 | |
|
281 | |
|
282 | |
public KimPrincipalInfo getPrincipal(String principalId) { |
283 | 0 | KimPrincipalImpl principal = getPrincipalImpl( principalId ); |
284 | 0 | if ( principal == null ) { |
285 | 0 | return null; |
286 | |
} |
287 | 0 | return new KimPrincipalInfo( principal ); |
288 | |
} |
289 | |
|
290 | |
public KimPrincipalImpl getPrincipalImpl(String principalId) { |
291 | 0 | Map<String,String> criteria = new HashMap<String,String>(1); |
292 | 0 | criteria.put(KIMPropertyConstants.Principal.PRINCIPAL_ID, principalId); |
293 | 0 | return (KimPrincipalImpl)getBusinessObjectService().findByPrimaryKey(KimPrincipalImpl.class, criteria); |
294 | |
} |
295 | |
|
296 | |
public KimEntityImpl getEntityImpl(String entityId) { |
297 | 0 | Map<String,String> criteria = new HashMap<String,String>(1); |
298 | 0 | criteria.put(KIMPropertyConstants.Entity.ENTITY_ID, entityId); |
299 | 0 | KimEntityImpl entityImpl = (KimEntityImpl)getBusinessObjectService().findByPrimaryKey(KimEntityImpl.class, criteria); |
300 | 0 | if(entityImpl!=null) |
301 | 0 | entityImpl.refresh(); |
302 | 0 | return entityImpl; |
303 | |
} |
304 | |
|
305 | |
|
306 | |
|
307 | |
|
308 | |
@SuppressWarnings("unchecked") |
309 | |
protected List<KimEntityImpl> lookupEntitys(Map<String, String> searchCriteria) { |
310 | 0 | return new ArrayList(KNSServiceLocator.getLookupService().findCollectionBySearchUnbounded( KimEntityImpl.class, searchCriteria )); |
311 | |
} |
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
public List<String> lookupEntityIds(Map<String,String> searchCriteria) { |
317 | 0 | List<KimEntityImpl> entities = lookupEntitys( searchCriteria ); |
318 | 0 | List<String> entityIds = new ArrayList<String>( entities.size() ); |
319 | 0 | for ( KimEntityImpl entity : entities ) { |
320 | 0 | entityIds.add( entity.getEntityId() ); |
321 | |
} |
322 | 0 | return entityIds; |
323 | |
} |
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
@SuppressWarnings("unchecked") |
329 | |
public KimPrincipalInfo getPrincipalByPrincipalName(String principalName) { |
330 | 0 | if ( StringUtils.isBlank(principalName) ) { |
331 | 0 | return null; |
332 | |
} |
333 | 0 | Map<String,Object> criteria = new HashMap<String,Object>(1); |
334 | 0 | criteria.put(KIMPropertyConstants.Principal.PRINCIPAL_NAME, principalName.toLowerCase()); |
335 | 0 | Collection<KimPrincipalImpl> principals = (Collection<KimPrincipalImpl>)getBusinessObjectService().findMatching(KimPrincipalImpl.class, criteria); |
336 | 0 | if (!principals.isEmpty() && principals.size() == 1) { |
337 | 0 | return new KimPrincipalInfo( principals.iterator().next() ); |
338 | |
} |
339 | 0 | return null; |
340 | |
} |
341 | |
|
342 | |
|
343 | |
|
344 | |
|
345 | |
protected KimEntityImpl getEntityByPrincipalName(String principalName) { |
346 | 0 | if ( StringUtils.isBlank( principalName ) ) { |
347 | 0 | return null; |
348 | |
} |
349 | 0 | return getEntityByKeyValue("principals." + KIMPropertyConstants.Principal.PRINCIPAL_NAME, principalName.toLowerCase()); |
350 | |
} |
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
protected KimEntityImpl getEntityByPrincipalId(String principalId) { |
356 | 0 | if ( StringUtils.isBlank( principalId ) ) { |
357 | 0 | return null; |
358 | |
} |
359 | 0 | return getEntityByKeyValue("principals." + KIMPropertyConstants.Principal.PRINCIPAL_ID, principalId); |
360 | |
} |
361 | |
|
362 | |
|
363 | |
|
364 | |
|
365 | |
public String getEntityIdByPrincipalId(String principalId) { |
366 | 0 | if ( StringUtils.isBlank( principalId ) ) { |
367 | 0 | return null; |
368 | |
} |
369 | 0 | KimPrincipalImpl principal = getPrincipalImpl(principalId); |
370 | 0 | return principal != null ? principal.getEntityId() : null; |
371 | |
} |
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | |
public String getEntityIdByPrincipalName(String principalName) { |
377 | 0 | if ( StringUtils.isBlank( principalName ) ) { |
378 | 0 | return null; |
379 | |
} |
380 | 0 | KimPrincipalInfo principal = getPrincipalByPrincipalName(principalName); |
381 | 0 | return principal != null ? principal.getEntityId() : null; |
382 | |
} |
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
public String getPrincipalIdByPrincipalName(String principalName) { |
388 | 0 | if ( StringUtils.isBlank( principalName ) ) { |
389 | 0 | return null; |
390 | |
} |
391 | 0 | KimPrincipalInfo principal = getPrincipalByPrincipalName( principalName ); |
392 | 0 | return principal != null ? principal.getPrincipalId() : null; |
393 | |
} |
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
public Map<String, KimEntityNameInfo> getDefaultNamesForEntityIds(List<String> entityIds) { |
399 | |
|
400 | 0 | Map<String, KimEntityNameInfo> result = new HashMap<String, KimEntityNameInfo>(entityIds.size()); |
401 | |
|
402 | 0 | for(String s : entityIds) { |
403 | 0 | Map<String,String> criteria = new HashMap<String,String>(); |
404 | 0 | criteria.put(KIMPropertyConstants.Entity.ENTITY_ID, s); |
405 | 0 | criteria.put("DFLT_IND", "Y"); |
406 | |
|
407 | 0 | KimEntityNameImpl name = (KimEntityNameImpl) getBusinessObjectService().findByPrimaryKey(KimEntityNameImpl.class, criteria); |
408 | |
|
409 | 0 | result.put(s, new KimEntityNameInfo( name ) ); |
410 | 0 | } |
411 | |
|
412 | 0 | return result; |
413 | |
} |
414 | |
|
415 | |
|
416 | |
|
417 | |
|
418 | |
public Map<String, KimEntityNamePrincipalNameInfo> getDefaultNamesForPrincipalIds(List<String> principalIds) { |
419 | |
|
420 | |
|
421 | 0 | Map<String, KimEntityNamePrincipalNameInfo> result = new HashMap<String, KimEntityNamePrincipalNameInfo>(principalIds.size()); |
422 | |
|
423 | 0 | for(String s : principalIds) { |
424 | 0 | KimEntityNamePrincipalNameInfo namePrincipal = new KimEntityNamePrincipalNameInfo(); |
425 | |
|
426 | 0 | Map<String,String> criteria = new HashMap<String,String>(); |
427 | 0 | criteria.put(KIMPropertyConstants.Principal.PRINCIPAL_ID, s); |
428 | 0 | KimPrincipalImpl principal = (KimPrincipalImpl) getBusinessObjectService().findByPrimaryKey(KimPrincipalImpl.class, criteria); |
429 | |
|
430 | 0 | if (null != principal) { |
431 | 0 | namePrincipal.setPrincipalName(principal.getPrincipalName()); |
432 | |
|
433 | 0 | criteria.clear(); |
434 | 0 | criteria.put(KIMPropertyConstants.Entity.ENTITY_ID, principal.getEntityId()); |
435 | 0 | criteria.put("DFLT_IND", "Y"); |
436 | 0 | KimEntityNameImpl name = (KimEntityNameImpl) getBusinessObjectService().findByPrimaryKey(KimEntityNameImpl.class, criteria); |
437 | |
|
438 | 0 | namePrincipal.setDefaultEntityName( new KimEntityNameInfo( name ) ); |
439 | |
|
440 | 0 | result.put(s, namePrincipal); |
441 | |
} |
442 | 0 | } |
443 | |
|
444 | 0 | return result; |
445 | |
} |
446 | |
|
447 | |
|
448 | |
|
449 | |
|
450 | |
@SuppressWarnings("unchecked") |
451 | |
protected KimEntityImpl getEntityByKeyValue(String key, String value) { |
452 | 0 | Map<String,String> criteria = new HashMap<String,String>(1); |
453 | 0 | criteria.put(key, value); |
454 | 0 | Collection<KimEntityImpl> entities = (Collection<KimEntityImpl>)getBusinessObjectService().findMatching(KimEntityImpl.class, criteria); |
455 | 0 | if (entities.size() >= 1) { |
456 | 0 | return entities.iterator().next(); |
457 | |
} |
458 | 0 | return null; |
459 | |
} |
460 | |
|
461 | |
protected BusinessObjectService getBusinessObjectService() { |
462 | 0 | if ( businessObjectService == null ) { |
463 | 0 | businessObjectService = KNSServiceLocator.getBusinessObjectService(); |
464 | |
} |
465 | 0 | return businessObjectService; |
466 | |
} |
467 | |
|
468 | |
public AddressTypeInfo getAddressType( String code ) { |
469 | 0 | AddressTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(AddressTypeImpl.class, code); |
470 | 0 | if ( impl == null ) { |
471 | 0 | return null; |
472 | |
} |
473 | 0 | return impl.toInfo(); |
474 | |
} |
475 | |
|
476 | |
public AffiliationTypeInfo getAffiliationType( String code ) { |
477 | 0 | AffiliationTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(AffiliationTypeImpl.class, code); |
478 | 0 | if ( impl == null ) { |
479 | 0 | return null; |
480 | |
} |
481 | 0 | return impl.toInfo(); |
482 | |
} |
483 | |
|
484 | |
public CitizenshipStatusInfo getCitizenshipStatus( String code ) { |
485 | 0 | CitizenshipStatusImpl impl = getBusinessObjectService().findBySinglePrimaryKey(CitizenshipStatusImpl.class, code); |
486 | 0 | if ( impl == null ) { |
487 | 0 | return null; |
488 | |
} |
489 | 0 | return impl.toInfo(); |
490 | |
} |
491 | |
|
492 | |
public EmailTypeInfo getEmailType( String code ) { |
493 | 0 | EmailTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(EmailTypeImpl.class, code); |
494 | 0 | if ( impl == null ) { |
495 | 0 | return null; |
496 | |
} |
497 | 0 | return impl.toInfo(); |
498 | |
} |
499 | |
|
500 | |
public EmploymentStatusInfo getEmploymentStatus( String code ) { |
501 | 0 | EmploymentStatusImpl impl = getBusinessObjectService().findBySinglePrimaryKey(EmploymentStatusImpl.class, code); |
502 | 0 | if ( impl == null ) { |
503 | 0 | return null; |
504 | |
} |
505 | 0 | return impl.toInfo(); |
506 | |
} |
507 | |
|
508 | |
public EmploymentTypeInfo getEmploymentType( String code ) { |
509 | 0 | EmploymentTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(EmploymentTypeImpl.class, code); |
510 | 0 | if ( impl == null ) { |
511 | 0 | return null; |
512 | |
} |
513 | 0 | return impl.toInfo(); |
514 | |
} |
515 | |
|
516 | |
public EntityNameTypeInfo getEntityNameType( String code ) { |
517 | 0 | EntityNameTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(EntityNameTypeImpl.class, code); |
518 | 0 | if ( impl == null ) { |
519 | 0 | return null; |
520 | |
} |
521 | 0 | return impl.toInfo(); |
522 | |
} |
523 | |
|
524 | |
public EntityTypeInfo getEntityType( String code ) { |
525 | 0 | EntityTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(EntityTypeImpl.class, code); |
526 | 0 | if ( impl == null ) { |
527 | 0 | return null; |
528 | |
} |
529 | 0 | return impl.toInfo(); |
530 | |
} |
531 | |
|
532 | |
public ExternalIdentifierTypeInfo getExternalIdentifierType( String code ) { |
533 | 0 | ExternalIdentifierTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(ExternalIdentifierTypeImpl.class, code); |
534 | 0 | if ( impl == null ) { |
535 | 0 | return null; |
536 | |
} |
537 | 0 | return impl.toInfo(); |
538 | |
} |
539 | |
|
540 | |
public PhoneTypeInfo getPhoneType( String code ) { |
541 | 0 | PhoneTypeImpl impl = getBusinessObjectService().findBySinglePrimaryKey(PhoneTypeImpl.class, code); |
542 | 0 | if ( impl == null ) { |
543 | 0 | return null; |
544 | |
} |
545 | 0 | return impl.toInfo(); |
546 | |
} |
547 | |
|
548 | |
|
549 | |
|
550 | |
|
551 | |
|
552 | |
|
553 | |
|
554 | |
|
555 | |
|
556 | |
|
557 | |
|
558 | |
|
559 | |
|
560 | |
|
561 | |
} |