1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.core.principal.web;
17
18 import java.util.Map;
19
20 import org.kuali.kpme.core.bo.HrBusinessObject;
21 import org.kuali.kpme.core.bo.HrBusinessObjectMaintainableImpl;
22 import org.kuali.kpme.core.cache.CacheUtils;
23 import org.kuali.kpme.core.principal.PrincipalHRAttributesBo;
24 import org.kuali.kpme.core.service.HrServiceLocator;
25 import org.kuali.kpme.core.util.HrConstants;
26 import org.kuali.rice.kim.api.identity.name.EntityName;
27 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
28 import org.kuali.rice.krad.maintenance.MaintenanceDocument;
29
30 public class PrincipalHRAttributesMaintainableImpl extends HrBusinessObjectMaintainableImpl {
31 private static final long serialVersionUID = 1L;
32
33 @Override
34 public void processAfterCopy(MaintenanceDocument document,
35 Map<String, String[]> parameters) {
36 super.processAfterCopy(document, parameters);
37 PrincipalHRAttributesBo principalHRAttributes = (PrincipalHRAttributesBo) document.getNewMaintainableObject().getDataObject();
38 principalHRAttributes.setPrincipalId(null);
39 }
40
41 @Override
42 public void saveBusinessObject() {
43 super.saveBusinessObject();
44 CacheUtils.flushCache(PrincipalHRAttributesBo.CACHE_NAME);
45 CacheUtils.flushCache(HrConstants.CacheNamespace.KPME_GLOBAL_CACHE_NAME);
46 }
47
48 @Override
49 public HrBusinessObject getObjectById(String id) {
50 return PrincipalHRAttributesBo.from(HrServiceLocator.getPrincipalHRAttributeService().getPrincipalHRAttributes(id));
51 }
52
53
54 public EntityName getName(String principalId) {
55 return KimApiServiceLocator.getIdentityService().getDefaultNamesForPrincipalId(principalId).getDefaultName();
56 }
57
58 }