1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.kpme.pm.positionappointment.web;
17
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.apache.commons.lang.StringUtils;
24 import org.kuali.kpme.core.api.groupkey.HrGroupKey;
25 import org.kuali.kpme.core.lookup.KPMELookupableImpl;
26 import org.kuali.kpme.core.service.HrServiceLocator;
27 import org.kuali.kpme.core.util.TKUtils;
28 import org.kuali.kpme.pm.api.positionappointment.PositionAppointment;
29 import org.kuali.kpme.pm.api.positionappointment.PositionAppointmentContract;
30 import org.kuali.kpme.pm.positionappointment.PositionAppointmentBo;
31 import org.kuali.kpme.pm.positionappointment.authorization.PositionAppointmentAuthorizer;
32 import org.kuali.kpme.pm.service.base.PmServiceLocator;
33 import org.kuali.rice.core.api.mo.ModelObjectUtils;
34 import org.kuali.rice.kim.api.identity.Person;
35 import org.kuali.rice.krad.util.GlobalVariables;
36 import org.kuali.rice.krad.web.form.LookupForm;
37
38 public class PositionAppointmentLookupableImpl extends KPMELookupableImpl {
39
40 private static final long serialVersionUID = 4826886027602440306L;
41
42 private static final ModelObjectUtils.Transformer<PositionAppointment, PositionAppointmentBo> toPositionAppointmentBo =
43 new ModelObjectUtils.Transformer<PositionAppointment, PositionAppointmentBo>() {
44 public PositionAppointmentBo transform(PositionAppointment input) {
45 return PositionAppointmentBo.from(input);
46 };
47 };
48
49 protected List<PositionAppointmentBo> filterLookupPositionAppointments(List<PositionAppointmentBo> rawResults, Person user)
50 {
51 List<PositionAppointmentBo> returnList = new ArrayList<PositionAppointmentBo>();
52 for (PositionAppointmentBo positionAppointmentObj : rawResults)
53 {
54 if (((PositionAppointmentAuthorizer)(getDocumentDictionaryService().getDocumentAuthorizer(this.getMaintenanceDocumentTypeName()))).canView((Object) positionAppointmentObj, user))
55 {
56 returnList.add(positionAppointmentObj);
57 }
58 }
59 return returnList;
60 }
61
62 @Override
63 public List<?> getSearchResults(LookupForm form, Map<String, String> searchCriteria, boolean bounded) {
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81 List<PositionAppointmentBo> posApptContrasts = (List<PositionAppointmentBo>)super.getSearchResults(form, searchCriteria, bounded);
82
83 List<PositionAppointmentBo> filteredResults = filterLookupPositionAppointments(posApptContrasts, GlobalVariables.getUserSession().getPerson());
84
85
86 return filteredResults;
87 }
88
89 }