1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.service.impl; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.kuali.rice.kim.bo.Group; |
22 | |
import org.kuali.rice.kim.service.KIMServiceLocator; |
23 | |
import org.kuali.rice.kns.bo.AdHocRoutePerson; |
24 | |
import org.kuali.rice.kns.bo.AdHocRouteWorkgroup; |
25 | |
import org.kuali.rice.kns.document.Document; |
26 | |
import org.kuali.rice.kns.service.BusinessObjectService; |
27 | |
import org.kuali.rice.kns.service.DocumentAdHocService; |
28 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
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 = KIMServiceLocator.getIdentityManagementService().getGroup(adHocRouteWorkgroup.getId()); |
61 | 0 | adHocRouteWorkgroup.setRecipientName(group.getGroupName()); |
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 KNSServiceLocator.getBusinessObjectService(); |
70 | |
} |
71 | |
|
72 | |
} |