1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.krad.service.impl; |
17 | |
|
18 | |
import org.kuali.rice.kim.api.group.Group; |
19 | |
import org.kuali.rice.kim.api.services.KimApiServiceLocator; |
20 | |
import org.kuali.rice.krad.bo.AdHocRoutePerson; |
21 | |
import org.kuali.rice.krad.bo.AdHocRouteWorkgroup; |
22 | |
import org.kuali.rice.krad.document.Document; |
23 | |
import org.kuali.rice.krad.service.BusinessObjectService; |
24 | |
import org.kuali.rice.krad.service.DocumentAdHocService; |
25 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
26 | |
|
27 | |
import java.util.HashMap; |
28 | |
import java.util.List; |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public class DocumentAdHocServiceImpl implements DocumentAdHocService { |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
public void addAdHocs(Document document) { |
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
List<AdHocRoutePerson> adHocRoutePersons; |
47 | |
List<AdHocRouteWorkgroup> adHocRouteWorkgroups; |
48 | 0 | HashMap criteriaPerson = new HashMap(); |
49 | 0 | HashMap criteriaWorkgroup = new HashMap(); |
50 | |
|
51 | 0 | criteriaPerson.put("documentNumber", document.getDocumentNumber()); |
52 | 0 | criteriaPerson.put("type", AdHocRoutePerson.PERSON_TYPE); |
53 | 0 | adHocRoutePersons = (List) getBusinessObjectService().findMatching(AdHocRoutePerson.class, criteriaPerson); |
54 | 0 | criteriaWorkgroup.put("documentNumber", document.getDocumentNumber()); |
55 | 0 | criteriaWorkgroup.put("type", AdHocRouteWorkgroup.WORKGROUP_TYPE); |
56 | 0 | adHocRouteWorkgroups = (List) getBusinessObjectService().findMatching(AdHocRouteWorkgroup.class, criteriaWorkgroup); |
57 | |
|
58 | |
|
59 | 0 | for (AdHocRouteWorkgroup adHocRouteWorkgroup : adHocRouteWorkgroups) { |
60 | 0 | Group group = KimApiServiceLocator.getGroupService().getGroup(adHocRouteWorkgroup.getId()); |
61 | 0 | adHocRouteWorkgroup.setRecipientName(group.getName()); |
62 | 0 | adHocRouteWorkgroup.setRecipientNamespaceCode(group.getNamespaceCode()); |
63 | 0 | } |
64 | 0 | document.setAdHocRoutePersons(adHocRoutePersons); |
65 | 0 | document.setAdHocRouteWorkgroups(adHocRouteWorkgroups); |
66 | 0 | } |
67 | |
|
68 | |
protected BusinessObjectService getBusinessObjectService() { |
69 | 0 | return KRADServiceLocator.getBusinessObjectService(); |
70 | |
} |
71 | |
|
72 | |
} |