Coverage Report - org.kuali.rice.krad.service.impl.DocumentTypeAndAttachmentTypePermissionTypeService
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentTypeAndAttachmentTypePermissionTypeService
0%
0/11
0%
0/8
6
 
 1  
 /*
 2  
  * Copyright 2007-2008 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.krad.service.impl;
 17  
 
 18  
 import org.kuali.rice.kim.api.permission.Permission;
 19  
 import org.kuali.rice.kim.impl.permission.PermissionBo;
 20  
 import org.kuali.rice.kim.util.KimConstants;
 21  
 
 22  
 import java.util.ArrayList;
 23  
 import java.util.List;
 24  
 import java.util.Map;
 25  
 
 26  
 /**
 27  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 28  
  */
 29  0
 public class DocumentTypeAndAttachmentTypePermissionTypeService extends
 30  
                 DocumentTypePermissionTypeServiceImpl {
 31  
 
 32  
         @Override
 33  
         public List<Permission> performPermissionMatches(
 34  
                         Map<String, String> requestedDetails,
 35  
                         List<Permission> permissionsList) {
 36  
                 
 37  0
                 List<Permission> matchingPermissions = new ArrayList<Permission>();
 38  0
                 if (requestedDetails == null) {
 39  0
                         return matchingPermissions; // empty list
 40  
                 }
 41  
                 // loop over the permissions, checking the non-document-related ones
 42  0
                 for (Permission kimPermissionInfo : permissionsList) {
 43  0
             PermissionBo bo = PermissionBo.from(kimPermissionInfo);
 44  0
                         if (!bo.getDetails().containsKey(
 45  
                                                 KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE)
 46  
                           || bo.getDetails().get(KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE)
 47  
                                  .equals(requestedDetails.get(KimConstants.AttributeConstants.ATTACHMENT_TYPE_CODE)))
 48  
                         {
 49  0
                                 matchingPermissions.add(kimPermissionInfo);
 50  
                         }
 51  
 
 52  0
                 }
 53  
                 // now, filter the list to just those for the current document
 54  0
                 matchingPermissions = super.performPermissionMatches(requestedDetails,
 55  
                                 matchingPermissions);
 56  0
                 return matchingPermissions;
 57  
         }
 58  
 }