Coverage Report - org.kuali.rice.kim.service.impl.ResponsibilityServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ResponsibilityServiceImpl
0%
0/188
0%
0/78
2.567
 
 1  
 /*
 2  
  * Copyright 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.kim.service.impl;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collection;
 20  
 import java.util.HashMap;
 21  
 import java.util.List;
 22  
 import java.util.Map;
 23  
 import java.util.Map.Entry;
 24  
 
 25  
 import org.apache.commons.lang.StringUtils;
 26  
 import org.apache.commons.lang.exception.ExceptionUtils;
 27  
 import org.apache.log4j.Logger;
 28  
 import org.kuali.rice.core.xml.dto.AttributeSet;
 29  
 import org.kuali.rice.kim.bo.Role;
 30  
 import org.kuali.rice.kim.bo.impl.ResponsibilityImpl;
 31  
 import org.kuali.rice.kim.bo.role.dto.KimResponsibilityInfo;
 32  
 import org.kuali.rice.kim.bo.role.dto.KimResponsibilityTemplateInfo;
 33  
 import org.kuali.rice.kim.bo.role.dto.ResponsibilityActionInfo;
 34  
 import org.kuali.rice.kim.bo.role.dto.RoleMembershipInfo;
 35  
 import org.kuali.rice.kim.bo.role.impl.KimResponsibilityImpl;
 36  
 import org.kuali.rice.kim.bo.role.impl.KimResponsibilityTemplateImpl;
 37  
 import org.kuali.rice.kim.bo.role.impl.RoleResponsibilityActionImpl;
 38  
 import org.kuali.rice.kim.bo.role.impl.RoleResponsibilityImpl;
 39  
 import org.kuali.rice.kim.dao.KimResponsibilityDao;
 40  
 import org.kuali.rice.kim.service.KIMServiceLocator;
 41  
 import org.kuali.rice.kim.service.KIMServiceLocatorInternal;
 42  
 import org.kuali.rice.kim.service.ResponsibilityService;
 43  
 import org.kuali.rice.kim.service.RoleService;
 44  
 import org.kuali.rice.kim.service.support.KimResponsibilityTypeService;
 45  
 import org.kuali.rice.kim.util.KimConstants;
 46  
 import org.kuali.rice.kns.lookup.CollectionIncomplete;
 47  
 import org.kuali.rice.kns.lookup.Lookupable;
 48  
 import org.kuali.rice.kns.service.KNSServiceLocatorWeb;
 49  
 import org.kuali.rice.kns.util.KNSPropertyConstants;
 50  
 
 51  
 /**
 52  
  * This is a description of what this class does - kellerj don't forget to fill this in. 
 53  
  * 
 54  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 55  
  *
 56  
  */
 57  0
 public class ResponsibilityServiceImpl extends ResponsibilityServiceBase implements ResponsibilityService {
 58  0
         private static final Logger LOG = Logger.getLogger( ResponsibilityServiceImpl.class );
 59  
         private RoleService roleService;
 60  
         private KimResponsibilityDao responsibilityDao;   
 61  
         private KimResponsibilityTypeService responsibilityTypeService;
 62  
         
 63  
 
 64  
         // --------------------------
 65  
     // Responsibility Methods
 66  
     // --------------------------
 67  
     
 68  
     /**
 69  
      * @see org.kuali.rice.kim.service.ResponsibilityService#getResponsibility(java.lang.String)
 70  
      */
 71  
     public KimResponsibilityInfo getResponsibility(String responsibilityId) {
 72  0
             KimResponsibilityImpl impl = getResponsibilityImpl( responsibilityId );
 73  0
             if ( impl != null ) {
 74  0
                     return impl.toSimpleInfo();
 75  
             }
 76  0
             return null;
 77  
     }
 78  
     
 79  
     /**
 80  
      * @see org.kuali.rice.kim.service.ResponsibilityService#getResponsibilitiesByName(String,java.lang.String)
 81  
      */
 82  
     public List<KimResponsibilityInfo> getResponsibilitiesByName( String namespaceCode, String responsibilityName) {
 83  0
             List<KimResponsibilityImpl> impls = getResponsibilityImplsByName( namespaceCode, responsibilityName );
 84  0
             List<KimResponsibilityInfo> results = new ArrayList<KimResponsibilityInfo>( impls.size() );
 85  0
             for ( KimResponsibilityImpl impl : impls ) {
 86  0
                     results.add( impl.toSimpleInfo() );
 87  
             }
 88  0
             return results;
 89  
     }
 90  
     
 91  
     public KimResponsibilityImpl getResponsibilityImpl(String responsibilityId) {
 92  0
             if ( StringUtils.isBlank( responsibilityId ) ) {
 93  0
                     return null;
 94  
             }
 95  0
             HashMap<String,Object> pk = new HashMap<String,Object>( 1 );
 96  0
             pk.put( KimConstants.PrimaryKeyConstants.RESPONSIBILITY_ID, responsibilityId );
 97  0
             return getBusinessObjectService().findByPrimaryKey( KimResponsibilityImpl.class, pk );
 98  
     }
 99  
 
 100  
     public KimResponsibilityTemplateInfo getResponsibilityTemplate(
 101  
                     String responsibilityTemplateId) {
 102  0
             KimResponsibilityTemplateImpl impl = getResponsibilityTemplateImpl(responsibilityTemplateId);
 103  0
             if ( impl != null ) {
 104  0
                     return impl.toInfo();
 105  
             }
 106  0
             return null;
 107  
     }
 108  
     
 109  
     public KimResponsibilityTemplateInfo getResponsibilityTemplateByName(
 110  
                     String namespaceCode, String responsibilityTemplateName) {
 111  0
             KimResponsibilityTemplateImpl impl = getResponsibilityTemplateImplsByName(namespaceCode, responsibilityTemplateName);
 112  0
             if ( impl != null ) {
 113  0
                     return impl.toInfo();
 114  
             }
 115  0
             return null;
 116  
     }
 117  
     
 118  
     public KimResponsibilityTemplateImpl getResponsibilityTemplateImpl(
 119  
                     String responsibilityTemplateId) {
 120  0
             return getBusinessObjectService().findBySinglePrimaryKey(KimResponsibilityTemplateImpl.class, responsibilityTemplateId);
 121  
     }
 122  
     
 123  
         public KimResponsibilityTemplateImpl getResponsibilityTemplateImplsByName(
 124  
                     String namespaceCode, String responsibilityTemplateName) {
 125  0
             HashMap<String,Object> pk = new HashMap<String,Object>( 3 );
 126  0
             pk.put( KimConstants.UniqueKeyConstants.NAMESPACE_CODE, namespaceCode );
 127  0
             pk.put( KimConstants.UniqueKeyConstants.RESPONSIBILITY_TEMPLATE_NAME, responsibilityTemplateName );
 128  0
                 pk.put( KNSPropertyConstants.ACTIVE, "Y");
 129  0
             return getBusinessObjectService().findByPrimaryKey( KimResponsibilityTemplateImpl.class, pk );
 130  
     }
 131  
     
 132  
     public RoleResponsibilityImpl getRoleResponsibilityImpl(String roleResponsibilityId) {
 133  0
             if ( StringUtils.isBlank( roleResponsibilityId ) ) {
 134  0
                     return null;
 135  
             }
 136  0
             HashMap<String,Object> pk = new HashMap<String,Object>( 1 );
 137  0
             pk.put( KimConstants.PrimaryKeyConstants.ROLE_RESPONSIBILITY_ID, roleResponsibilityId );
 138  0
             return getBusinessObjectService().findByPrimaryKey( RoleResponsibilityImpl.class, pk );
 139  
     }
 140  
     
 141  
     
 142  
     @SuppressWarnings("unchecked")
 143  
         protected List<KimResponsibilityImpl> getResponsibilityImplsByName( String namespaceCode, String responsibilityName ) {
 144  0
             HashMap<String,Object> pk = new HashMap<String,Object>( 3 );
 145  0
             pk.put( KimConstants.UniqueKeyConstants.NAMESPACE_CODE, namespaceCode );
 146  0
             pk.put( KimConstants.UniqueKeyConstants.RESPONSIBILITY_NAME, responsibilityName );
 147  0
                 pk.put( KNSPropertyConstants.ACTIVE, "Y");
 148  0
             return (List<KimResponsibilityImpl>)getBusinessObjectService().findMatching( KimResponsibilityImpl.class, pk );
 149  
     }
 150  
 
 151  
     @SuppressWarnings("unchecked")
 152  
         protected List<KimResponsibilityImpl> getResponsibilityImplsByTemplateName( String namespaceCode, String responsibilityTemplateName ) {
 153  0
             String cacheKey = getResponsibilityImplByTemplateNameCacheKey(namespaceCode, responsibilityTemplateName);
 154  0
             List<KimResponsibilityImpl> result = (List<KimResponsibilityImpl>)getCacheAdministrator().getFromCache(cacheKey);
 155  0
             if ( result == null ) {
 156  0
                     HashMap<String,Object> pk = new HashMap<String,Object>( 4 );
 157  0
                     pk.put( "template."+KimConstants.UniqueKeyConstants.NAMESPACE_CODE, namespaceCode );
 158  0
                     pk.put( "template."+KimConstants.UniqueKeyConstants.RESPONSIBILITY_TEMPLATE_NAME, responsibilityTemplateName );
 159  0
                         pk.put( "template."+KNSPropertyConstants.ACTIVE, "Y");
 160  0
                         pk.put( KNSPropertyConstants.ACTIVE, "Y");
 161  0
                         result = (List<KimResponsibilityImpl>)getBusinessObjectService().findMatching( KimResponsibilityImpl.class, pk );
 162  0
                     getCacheAdministrator().putInCache(cacheKey, result, RESPONSIBILITY_IMPL_CACHE_GROUP);
 163  
             }
 164  0
             return result;
 165  
     }
 166  
     
 167  
     
 168  
     
 169  
     /**
 170  
      * @see org.kuali.rice.kim.service.ResponsibilityService#hasResponsibility(java.lang.String, String, java.lang.String, AttributeSet, AttributeSet)
 171  
      */
 172  
     public boolean hasResponsibility(String principalId, String namespaceCode,
 173  
                     String responsibilityName, AttributeSet qualification,
 174  
                     AttributeSet responsibilityDetails) {
 175  
             // get all the responsibility objects whose name match that requested
 176  0
             List<KimResponsibilityImpl> responsibilities = getResponsibilityImplsByName( namespaceCode, responsibilityName );
 177  
             // now, filter the full list by the detail passed
 178  0
             List<KimResponsibilityInfo> applicableResponsibilities = getMatchingResponsibilities( responsibilities, responsibilityDetails );            
 179  0
             List<String> roleIds = getRoleIdsForResponsibilities( applicableResponsibilities, qualification );
 180  0
             return getRoleService().principalHasRole( principalId, roleIds, qualification );
 181  
     }
 182  
 
 183  
     /**
 184  
      * This overridden method ...
 185  
      * 
 186  
      * @see org.kuali.rice.kim.service.ResponsibilityService#hasResponsibilityByTemplateName(java.lang.String, java.lang.String, java.lang.String, org.kuali.rice.core.xml.dto.AttributeSet, org.kuali.rice.core.xml.dto.AttributeSet)
 187  
      */
 188  
     public boolean hasResponsibilityByTemplateName(String principalId,
 189  
                     String namespaceCode, String responsibilityTemplateName,
 190  
                     AttributeSet qualification, AttributeSet responsibilityDetails) {
 191  
             // get all the responsibility objects whose name match that requested
 192  0
             List<KimResponsibilityImpl> responsibilities = getResponsibilityImplsByTemplateName( namespaceCode, responsibilityTemplateName );
 193  
             // now, filter the full list by the detail passed
 194  0
             List<KimResponsibilityInfo> applicableResponsibilities = getMatchingResponsibilities( responsibilities, responsibilityDetails );            
 195  0
             List<String> roleIds = getRoleIdsForResponsibilities( applicableResponsibilities, qualification );
 196  0
             return getRoleService().principalHasRole( principalId, roleIds, qualification );
 197  
     }
 198  
 
 199  
     /**
 200  
      * @see org.kuali.rice.kim.service.ResponsibilityService#getResponsibilityActions(String, java.lang.String, AttributeSet, AttributeSet)
 201  
      */
 202  
     public List<ResponsibilityActionInfo> getResponsibilityActions( String namespaceCode, String responsibilityName,
 203  
                     AttributeSet qualification, AttributeSet responsibilityDetails) {
 204  
             // get all the responsibility objects whose name match that requested
 205  0
             List<KimResponsibilityImpl> responsibilities = getResponsibilityImplsByName( namespaceCode, responsibilityName );
 206  
             // now, filter the full list by the detail passed
 207  0
             List<KimResponsibilityInfo> applicableResponsibilities = getMatchingResponsibilities( responsibilities, responsibilityDetails );            
 208  0
             List<ResponsibilityActionInfo> results = new ArrayList<ResponsibilityActionInfo>();
 209  0
             for ( KimResponsibilityInfo r : applicableResponsibilities ) {
 210  0
                     List<String> roleIds = getRoleIdsForResponsibility( r, qualification );
 211  0
                     results.addAll( getActionsForResponsibilityRoles( r, roleIds, qualification) );
 212  0
             }
 213  0
             return results;
 214  
     }
 215  
 
 216  
     protected void logResponsibilityCheck(String namespaceCode, String responsibilityName, AttributeSet responsibilityDetails, AttributeSet qualification ) {
 217  0
                 StringBuilder sb = new StringBuilder();
 218  0
                 sb.append(  '\n' );
 219  0
                 sb.append( "Get Resp Actions: " ).append( namespaceCode ).append( "/" ).append( responsibilityName ).append( '\n' );
 220  0
                 sb.append( "             Details:\n" );
 221  0
                 if ( responsibilityDetails != null ) {
 222  0
                         sb.append( responsibilityDetails.formattedDump( 25 ) );
 223  
                 } else {
 224  0
                         sb.append( "                         [null]\n" );
 225  
                 }
 226  0
                 sb.append( "             Qualifiers:\n" );
 227  0
                 if ( qualification != null ) {
 228  0
                         sb.append( qualification.formattedDump( 25 ) );
 229  
                 } else {
 230  0
                         sb.append( "                         [null]\n" );
 231  
                 }
 232  0
                 if (LOG.isTraceEnabled()) { 
 233  0
                         LOG.trace( sb.append(ExceptionUtils.getStackTrace(new Throwable())));
 234  
                 } else {
 235  0
                         LOG.debug(sb.toString());
 236  
                 }
 237  0
     }
 238  
     
 239  
     /**
 240  
      * @see org.kuali.rice.kim.service.ResponsibilityService#getResponsibilityActions(String, java.lang.String, AttributeSet, AttributeSet)
 241  
      */
 242  
     public List<ResponsibilityActionInfo> getResponsibilityActionsByTemplateName( String namespaceCode, String responsibilityTemplateName,
 243  
                     AttributeSet qualification, AttributeSet responsibilityDetails) {
 244  0
             if ( LOG.isDebugEnabled() ) {
 245  0
                     logResponsibilityCheck( namespaceCode, responsibilityTemplateName, responsibilityDetails, qualification );
 246  
             }
 247  
             // get all the responsibility objects whose name match that requested
 248  0
             List<KimResponsibilityImpl> responsibilities = getResponsibilityImplsByTemplateName( namespaceCode, responsibilityTemplateName );
 249  
             // now, filter the full list by the detail passed
 250  0
             List<KimResponsibilityInfo> applicableResponsibilities = getMatchingResponsibilities( responsibilities, responsibilityDetails );
 251  0
             List<ResponsibilityActionInfo> results = new ArrayList<ResponsibilityActionInfo>();
 252  0
             for ( KimResponsibilityInfo r : applicableResponsibilities ) {
 253  0
                     List<String> roleIds = getRoleIdsForResponsibility( r, qualification );
 254  0
                     results.addAll( getActionsForResponsibilityRoles( r, roleIds, qualification) );
 255  0
             }
 256  0
             if ( LOG.isDebugEnabled() ) {
 257  0
                     LOG.debug("Found " + results.size() + " matching ResponsibilityActionInfo objects");
 258  0
                     if ( LOG.isTraceEnabled() ) {
 259  0
                             LOG.trace( results );
 260  
                     }
 261  
             }
 262  0
             return results;
 263  
     }
 264  
     
 265  
     protected List<ResponsibilityActionInfo> getActionsForResponsibilityRoles( KimResponsibilityInfo responsibility, List<String> roleIds, AttributeSet qualification ) {
 266  0
             List<ResponsibilityActionInfo> results = new ArrayList<ResponsibilityActionInfo>();
 267  0
             Collection<RoleMembershipInfo> roleMembers = getRoleService().getRoleMembers( roleIds, qualification );
 268  0
             for ( RoleMembershipInfo rm : roleMembers ) {
 269  
                 // only add them to the list if the member ID has been populated
 270  0
                 if ( StringUtils.isNotBlank( rm.getMemberId() ) ) {
 271  
                         ResponsibilityActionInfo rai;
 272  0
                         if ( rm.getMemberTypeCode().equals( Role.PRINCIPAL_MEMBER_TYPE ) ) {
 273  0
                                 rai = new ResponsibilityActionInfo( rm.getMemberId(), null, rm.getEmbeddedRoleId(), responsibility, rm.getRoleId(), rm.getQualifier(), rm.getDelegates() );
 274  
                         } else {
 275  0
                                 rai = new ResponsibilityActionInfo( null, rm.getMemberId(), rm.getEmbeddedRoleId(), responsibility, rm.getRoleId(), rm.getQualifier(), rm.getDelegates() );
 276  
                         }
 277  
                         // get associated resp resolution objects
 278  0
                         RoleResponsibilityActionImpl action = responsibilityDao.getResponsibilityAction( rm.getRoleId(), responsibility.getResponsibilityId(), rm.getRoleMemberId() );
 279  0
                         if ( action == null ) {
 280  0
                                 LOG.error( "Unable to get responsibility action record for role/responsibility/roleMember: " 
 281  
                                                 + rm.getRoleId() + "/" + responsibility.getResponsibilityId() + "/" + rm.getRoleMemberId() );
 282  0
                                 LOG.error( "Skipping this role member in getActionsForResponsibilityRoles()");
 283  0
                                 continue;
 284  
                         }
 285  
                         // add the data to the ResponsibilityActionInfo objects
 286  0
                         rai.setActionTypeCode( action.getActionTypeCode() );
 287  0
                         rai.setActionPolicyCode( action.getActionPolicyCode() );
 288  0
                         rai.setPriorityNumber(action.getPriorityNumber() == null ? DEFAULT_PRIORITY_NUMBER : action.getPriorityNumber());
 289  0
                         rai.setForceAction( action.isForceAction() );
 290  0
                         rai.setParallelRoutingGroupingCode( (rm.getRoleSortingCode()==null)?"":rm.getRoleSortingCode() );
 291  0
                         rai.setRoleResponsibilityActionId( action.getRoleResponsibilityActionId() );
 292  0
                         results.add( rai );
 293  0
                 }
 294  
             }
 295  0
             return results;
 296  
     }
 297  
     
 298  
     
 299  
     protected Map<String,KimResponsibilityTypeService> getResponsibilityTypeServicesByTemplateId(Collection<KimResponsibilityImpl> responsibilities) {
 300  0
             Map<String,KimResponsibilityTypeService> responsibilityTypeServices = new HashMap<String, KimResponsibilityTypeService>(responsibilities.size());
 301  0
             for ( KimResponsibilityImpl responsibility : responsibilities ) {
 302  0
                     String serviceName = responsibility.getTemplate().getKimType().getKimTypeServiceName();
 303  0
                     if ( serviceName != null ) {
 304  0
                             KimResponsibilityTypeService responsibiltyTypeService = (KimResponsibilityTypeService) KIMServiceLocatorInternal.getService(serviceName);
 305  0
                             if ( responsibiltyTypeService != null ) {
 306  0
                                 responsibilityTypeServices.put(responsibility.getTemplateId(), responsibiltyTypeService);                                    
 307  
                             } else {
 308  0
                                     responsibilityTypeServices.put(responsibility.getTemplateId(), getDefaultResponsibilityTypeService());
 309  
                             }
 310  
                     }
 311  0
             }
 312  0
             return responsibilityTypeServices;
 313  
     }
 314  
     
 315  
     protected Map<String,List<KimResponsibilityInfo>> groupResponsibilitiesByTemplate(Collection<KimResponsibilityImpl> responsibilities) {
 316  0
             Map<String,List<KimResponsibilityInfo>> results = new HashMap<String,List<KimResponsibilityInfo>>();
 317  0
             for (KimResponsibilityImpl responsibility : responsibilities) {
 318  0
                     List<KimResponsibilityInfo> responsibilityInfos = results.get( responsibility.getTemplateId() );
 319  0
                     if ( responsibilityInfos == null ) {
 320  0
                             responsibilityInfos = new ArrayList<KimResponsibilityInfo>();
 321  0
                             results.put( responsibility.getTemplateId(), responsibilityInfos );
 322  
                     }
 323  0
                     responsibilityInfos.add(responsibility.toSimpleInfo());
 324  0
             }
 325  0
             return results;
 326  
     }
 327  
     
 328  
     /**
 329  
      * Compare each of the passed in responsibilities with the given responsibilityDetails.  Those that
 330  
      * match are added to the result list.
 331  
      */
 332  
     protected List<KimResponsibilityInfo> getMatchingResponsibilities( List<KimResponsibilityImpl> responsibilities, AttributeSet responsibilityDetails ) {
 333  0
             List<KimResponsibilityInfo> applicableResponsibilities = new ArrayList<KimResponsibilityInfo>();            
 334  0
             if ( responsibilityDetails == null || responsibilityDetails.isEmpty() ) {
 335  
                     // if no details passed, assume that all match
 336  0
                     for ( KimResponsibilityImpl responsibility : responsibilities ) {
 337  0
                             applicableResponsibilities.add(responsibility.toSimpleInfo());
 338  
                     }
 339  
             } else {
 340  
                     // otherwise, attempt to match the permission details
 341  
                     // build a map of the template IDs to the type services
 342  0
                     Map<String,KimResponsibilityTypeService> responsibilityTypeServices = getResponsibilityTypeServicesByTemplateId(responsibilities);
 343  
                     // build a map of permissions by template ID
 344  0
                     Map<String,List<KimResponsibilityInfo>> responsibilityMap = groupResponsibilitiesByTemplate(responsibilities);
 345  
                     // loop over the different templates, matching all of the same template against the type
 346  
                     // service at once
 347  0
                     for ( Entry<String,List<KimResponsibilityInfo>> respEntry : responsibilityMap.entrySet() ) {
 348  0
                             KimResponsibilityTypeService responsibilityTypeService = responsibilityTypeServices.get( respEntry.getKey() );
 349  0
                             List<KimResponsibilityInfo> responsibilityInfos = respEntry.getValue();
 350  0
                             if (responsibilityTypeService == null) {
 351  0
                                     responsibilityTypeService = getDefaultResponsibilityTypeService();
 352  
                             }
 353  0
                                 applicableResponsibilities.addAll(responsibilityTypeService.getMatchingResponsibilities(responsibilityDetails, responsibilityInfos));                                    
 354  0
                     }
 355  
             }
 356  0
             return applicableResponsibilities;
 357  
     }
 358  
         
 359  
     protected List<String> getRoleIdsForResponsibilities( List<KimResponsibilityInfo> responsibilities, AttributeSet qualification ) {
 360  
             // CHECKME: is this right? - the role qualifiers are not being checked
 361  0
             return responsibilityDao.getRoleIdsForResponsibilities( responsibilities );            
 362  
     }
 363  
 
 364  
     public List<String> getRoleIdsForResponsibility( KimResponsibilityInfo responsibility, AttributeSet qualification ) {
 365  
             // CHECKME: is this right? - the role qualifiers are not being checked
 366  0
             return responsibilityDao.getRoleIdsForResponsibility( responsibility );            
 367  
     }
 368  
 
 369  
     protected boolean areActionsAtAssignmentLevel( KimResponsibilityImpl responsibility ) {
 370  0
             AttributeSet details = responsibility.getDetails();
 371  0
             if ( details == null ) {
 372  0
                     return false;
 373  
             }
 374  0
             String actionDetailsAtRoleMemberLevel = details.get( KimConstants.AttributeConstants.ACTION_DETAILS_AT_ROLE_MEMBER_LEVEL );
 375  0
             return Boolean.valueOf(actionDetailsAtRoleMemberLevel);
 376  
     }
 377  
 
 378  
     /**
 379  
      * @see org.kuali.rice.kim.service.ResponsibilityService#areActionsAtAssignmentLevel(org.kuali.rice.kim.bo.role.dto.KimResponsibilityInfo)
 380  
      */
 381  
     public boolean areActionsAtAssignmentLevel( KimResponsibilityInfo responsibility ) {
 382  0
             AttributeSet details = responsibility.getDetails();
 383  0
             if ( details == null ) {
 384  0
                     return false;
 385  
             }
 386  0
             String actionDetailsAtRoleMemberLevel = details.get( KimConstants.AttributeConstants.ACTION_DETAILS_AT_ROLE_MEMBER_LEVEL );
 387  0
             return Boolean.valueOf(actionDetailsAtRoleMemberLevel);
 388  
     }
 389  
 
 390  
     /**
 391  
      * @see org.kuali.rice.kim.service.ResponsibilityService#areActionsAtAssignmentLevelById(String)
 392  
      */
 393  
     public boolean areActionsAtAssignmentLevelById( String responsibilityId ) {
 394  0
             KimResponsibilityImpl responsibility = getResponsibilityImpl(responsibilityId);
 395  0
             if ( responsibility == null ) {
 396  0
                     return false;
 397  
             }
 398  0
             return areActionsAtAssignmentLevel(responsibility);
 399  
     }
 400  
     
 401  
     @SuppressWarnings("unchecked")
 402  
         public List<? extends KimResponsibilityInfo> lookupResponsibilityInfo( Map<String,String> searchCriteria, boolean unbounded ) {
 403  
 
 404  0
                 Lookupable responsibilityLookupable = KNSServiceLocatorWeb.getLookupable(
 405  
                 KNSServiceLocatorWeb.getBusinessObjectDictionaryService().getLookupableID(ResponsibilityImpl.class)
 406  
         );
 407  0
                 responsibilityLookupable.setBusinessObjectClass(ResponsibilityImpl.class);
 408  
                 final Collection baseResults;
 409  0
         if ( unbounded ) {
 410  0
                         baseResults = responsibilityLookupable.getSearchResultsUnbounded( searchCriteria );
 411  
                 } else {
 412  0
                         baseResults = responsibilityLookupable.getSearchResults(searchCriteria);
 413  
                 }
 414  0
                 List<KimResponsibilityInfo> results = new ArrayList<KimResponsibilityInfo>( baseResults.size() );
 415  0
                 for ( ResponsibilityImpl resp : (Collection<ResponsibilityImpl>)baseResults ) {
 416  0
                         results.add( resp.toSimpleInfo() );
 417  
                 }
 418  0
                 if ( baseResults instanceof CollectionIncomplete ) {
 419  0
                         results = new CollectionIncomplete<KimResponsibilityInfo>( results, ((CollectionIncomplete<KimResponsibilityInfo>)baseResults).getActualSizeIfTruncated() ); 
 420  
                 }                
 421  0
                 return results;
 422  
             
 423  
     }
 424  
 
 425  
  
 426  
     
 427  
     
 428  
 
 429  
     
 430  
     
 431  
     // --------------------
 432  
     // Support Methods
 433  
     // --------------------
 434  
         
 435  
         
 436  
 
 437  
         protected RoleService getRoleService() {
 438  0
                 if ( roleService == null ) {
 439  0
                         roleService = KIMServiceLocator.getRoleManagementService();
 440  
                 }
 441  
 
 442  0
                 return roleService;
 443  
         }
 444  
 
 445  
         public void setRoleService(RoleService roleService) {
 446  0
                 this.roleService = roleService;
 447  0
         }
 448  
 
 449  
         public KimResponsibilityDao getResponsibilityDao() {
 450  0
                 return this.responsibilityDao;
 451  
         }
 452  
 
 453  
         public void setResponsibilityDao(KimResponsibilityDao responsibilityDao) {
 454  0
                 this.responsibilityDao = responsibilityDao;
 455  0
         }
 456  
 
 457  
         protected KimResponsibilityTypeService getDefaultResponsibilityTypeService() {
 458  0
                 if (responsibilityTypeService == null) {
 459  0
                         responsibilityTypeService = (KimResponsibilityTypeService) KIMServiceLocatorInternal.getBean(DEFAULT_RESPONSIBILITY_TYPE_SERVICE);
 460  
                 }
 461  0
                 return responsibilityTypeService;
 462  
         }
 463  
 
 464  
 
 465  
         
 466  
         
 467  
 }