1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.service.impl; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; |
20 | |
import org.kuali.rice.kim.api.KimConstants; |
21 | |
import org.kuali.rice.kim.api.permission.Permission; |
22 | |
import org.kuali.rice.kim.framework.permission.PermissionTypeService; |
23 | |
import org.kuali.rice.kim.impl.permission.PermissionBo; |
24 | |
import org.kuali.rice.krad.service.impl.DocumentTypePermissionTypeServiceImpl; |
25 | |
|
26 | |
import java.util.ArrayList; |
27 | |
import java.util.Collections; |
28 | |
import java.util.List; |
29 | |
import java.util.Map; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | 0 | public class AdhocReviewPermissionTypeServiceImpl extends DocumentTypePermissionTypeServiceImpl implements PermissionTypeService { |
39 | |
|
40 | |
@Override |
41 | |
protected List<String> getRequiredAttributes() { |
42 | 0 | final List<String> attrs = new ArrayList<String>(super.getRequiredAttributes()); |
43 | 0 | attrs.add(KimConstants.AttributeConstants.ACTION_REQUEST_CD); |
44 | 0 | return Collections.unmodifiableList(attrs); |
45 | |
} |
46 | |
|
47 | |
@Override |
48 | |
public List<Permission> performPermissionMatches( |
49 | |
Map<String, String> requestedDetails, |
50 | |
List<Permission> permissionsList) { |
51 | |
|
52 | 0 | if (permissionsList == null) { |
53 | 0 | throw new RiceIllegalArgumentException("permissionsList was null or blank"); |
54 | |
} |
55 | |
|
56 | 0 | if (requestedDetails == null) { |
57 | 0 | throw new RiceIllegalArgumentException("requestedDetails was null"); |
58 | |
} |
59 | |
|
60 | 0 | List<Permission> matchingPermissions = new ArrayList<Permission>(); |
61 | |
|
62 | 0 | for (Permission kpi : permissionsList) { |
63 | 0 | PermissionBo bo = PermissionBo.from(kpi); |
64 | 0 | if (!bo.getDetails().containsKey(KimConstants.AttributeConstants.ACTION_REQUEST_CD) |
65 | |
|| StringUtils.equals(bo.getDetails(). |
66 | |
get(KimConstants.AttributeConstants.ACTION_REQUEST_CD), requestedDetails |
67 | |
.get(KimConstants.AttributeConstants.ACTION_REQUEST_CD))) { |
68 | 0 | matchingPermissions.add(kpi); |
69 | |
} |
70 | 0 | } |
71 | |
|
72 | 0 | matchingPermissions = super.performPermissionMatches(requestedDetails,matchingPermissions); |
73 | 0 | return matchingPermissions; |
74 | |
} |
75 | |
} |