Coverage Report - org.kuali.rice.krad.service.impl.DocumentTypeAndRelationshipToNoteAuthorPermissionTypeService
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentTypeAndRelationshipToNoteAuthorPermissionTypeService
0%
0/14
0%
0/10
7
 
 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.krad.service.impl;
 17  
 
 18  
 
 19  
 import org.kuali.rice.kim.api.permission.Permission;
 20  
 import org.kuali.rice.kim.impl.permission.PermissionBo;
 21  
 import org.kuali.rice.kim.util.KimConstants;
 22  
 
 23  
 import java.util.ArrayList;
 24  
 import java.util.List;
 25  
 import java.util.Map;
 26  
 
 27  
 /**
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  0
 public class DocumentTypeAndRelationshipToNoteAuthorPermissionTypeService
 31  
                 extends DocumentTypePermissionTypeServiceImpl {
 32  
 
 33  
         @Override
 34  
         protected List<Permission> performPermissionMatches(
 35  
                         Map<String, String> requestedDetails,
 36  
                         List<Permission> permissionsList) {
 37  
                                 
 38  0
                 List<Permission> matchingPermissions = new ArrayList<Permission>();
 39  0
                 if (requestedDetails == null) {
 40  0
                         return matchingPermissions; // empty list
 41  
                 }
 42  
                 
 43  
                 // loop over the permissions, checking the non-document-related ones
 44  0
                 for (Permission permission : permissionsList) {
 45  0
             PermissionBo bo = PermissionBo.from(permission);
 46  0
                         if (Boolean.parseBoolean(requestedDetails
 47  
                                         .get(KimConstants.AttributeConstants.CREATED_BY_SELF))) {
 48  0
                                 if(Boolean.parseBoolean(bo.getDetails().get(
 49  
                                                 KimConstants.AttributeConstants.CREATED_BY_SELF_ONLY))){
 50  0
                                         matchingPermissions.add(permission);
 51  
                                 }
 52  
                                 
 53  
                         }else{
 54  0
                                 if (!Boolean.parseBoolean(bo.getDetails().get(
 55  
                                                 KimConstants.AttributeConstants.CREATED_BY_SELF_ONLY))) {
 56  0
                                         matchingPermissions.add(permission);
 57  
                                 }
 58  
                         }
 59  
 
 60  0
                 }
 61  
                 
 62  0
                 matchingPermissions = super.performPermissionMatches(requestedDetails, matchingPermissions);
 63  0
                 return matchingPermissions;
 64  
         }
 65  
 }