| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AdhocReviewPermissionTypeServiceImpl |
|
| 6.0;6 |
| 1 | /* | |
| 2 | * Copyright 2007-2009 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.kew.service.impl; | |
| 17 | ||
| 18 | import java.util.ArrayList; | |
| 19 | import java.util.List; | |
| 20 | ||
| 21 | import org.apache.commons.lang.StringUtils; | |
| 22 | import org.kuali.rice.kim.bo.impl.KimAttributes; | |
| 23 | import org.kuali.rice.kim.bo.role.dto.KimPermissionInfo; | |
| 24 | import org.kuali.rice.kim.bo.types.dto.AttributeSet; | |
| 25 | import org.kuali.rice.kim.service.support.KimPermissionTypeService; | |
| 26 | import org.kuali.rice.kns.service.impl.DocumentTypePermissionTypeServiceImpl; | |
| 27 | ||
| 28 | /** | |
| 29 | * This is a description of what this class does - jonathan don't forget to fill | |
| 30 | * this in. | |
| 31 | * | |
| 32 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
| 33 | * | |
| 34 | */ | |
| 35 | 0 | public class AdhocReviewPermissionTypeServiceImpl extends DocumentTypePermissionTypeServiceImpl implements KimPermissionTypeService{ |
| 36 | ||
| 37 | { | |
| 38 | 0 | requiredAttributes.add( KimAttributes.ACTION_REQUEST_CD ); |
| 39 | 0 | } |
| 40 | ||
| 41 | /** | |
| 42 | * @see org.kuali.rice.kns.service.impl.DocumentTypePermissionTypeServiceImpl#performPermissionMatches(org.kuali.rice.kim.bo.types.dto.AttributeSet, | |
| 43 | * java.util.List) | |
| 44 | */ | |
| 45 | @Override | |
| 46 | public List<KimPermissionInfo> performPermissionMatches( | |
| 47 | AttributeSet requestedDetails, | |
| 48 | List<KimPermissionInfo> permissionsList) { | |
| 49 | 0 | List<KimPermissionInfo> matchingPermissions = new ArrayList<KimPermissionInfo>(); |
| 50 | 0 | if (requestedDetails == null) { |
| 51 | 0 | return matchingPermissions; // empty list |
| 52 | } | |
| 53 | // loop over the permissions, checking the non-document-related ones | |
| 54 | 0 | for (KimPermissionInfo kpi : permissionsList) { |
| 55 | 0 | if (!kpi.getDetails().containsKey(KimAttributes.ACTION_REQUEST_CD) |
| 56 | || StringUtils.equals(kpi.getDetails(). | |
| 57 | get(KimAttributes.ACTION_REQUEST_CD), requestedDetails | |
| 58 | .get(KimAttributes.ACTION_REQUEST_CD))) { | |
| 59 | 0 | matchingPermissions.add(kpi); |
| 60 | } | |
| 61 | } | |
| 62 | // now, filter the list to just those for the current document | |
| 63 | 0 | matchingPermissions = super.performPermissionMatches(requestedDetails, |
| 64 | matchingPermissions); | |
| 65 | 0 | return matchingPermissions; |
| 66 | } | |
| 67 | } |