public ActionForward addResponsibility(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    IdentityManagementRoleDocumentForm roleDocumentForm = (IdentityManagementRoleDocumentForm) form;
    KimDocumentRoleResponsibility newResponsibility = roleDocumentForm.getResponsibility();
    if (newResponsibility != null
        && StringUtils.isNotBlank(newResponsibility.getResponsibilityId())) {
      ResponsibilityBo responsibilityImpl =
          KradDataServiceLocator.getDataObjectService()
              .find(ResponsibilityBo.class, newResponsibility.getResponsibilityId());
      newResponsibility.setKimResponsibility(responsibilityImpl);
    }

    if (KRADServiceLocatorWeb.getKualiRuleService()
        .applyRules(
            new AddResponsibilityEvent(
                "", roleDocumentForm.getRoleDocument(), newResponsibility))) {
      if (newResponsibility != null) {
        newResponsibility.setDocumentNumber(roleDocumentForm.getDocument().getDocumentNumber());
      }
      roleDocumentForm.getRoleDocument().addResponsibility(newResponsibility);
      roleDocumentForm.setResponsibility(new KimDocumentRoleResponsibility());
      roleDocumentForm.getRoleDocument().updateMembers(newResponsibility);
    }
    return mapping.findForward(RiceConstants.MAPPING_BASIC);
  }
  public ActionForward addDelegationMember(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    IdentityManagementRoleDocumentForm roleDocumentForm = (IdentityManagementRoleDocumentForm) form;
    RoleDocumentDelegationMember newDelegationMember = roleDocumentForm.getDelegationMember();

    // See if possible to add with just Group Details filled in (not returned from lookup)
    if (StringUtils.isEmpty(newDelegationMember.getMemberId())
        && StringUtils.isNotEmpty(newDelegationMember.getMemberName())
        && StringUtils.isNotEmpty(newDelegationMember.getMemberNamespaceCode())
        && StringUtils.equals(
            newDelegationMember.getMemberTypeCode(),
            KimConstants.KimGroupMemberTypes.GROUP_MEMBER_TYPE.getCode())) {
      Group tempGroup =
          KimApiServiceLocator.getGroupService()
              .getGroupByNamespaceCodeAndName(
                  newDelegationMember.getMemberNamespaceCode(),
                  newDelegationMember.getMemberName());
      if (tempGroup != null) {
        newDelegationMember.setMemberId(tempGroup.getId());
      }
    }

    // See if possible to grab details for Principal
    if (StringUtils.isEmpty(newDelegationMember.getMemberId())
        && StringUtils.isNotEmpty(newDelegationMember.getMemberName())
        && StringUtils.equals(
            newDelegationMember.getMemberTypeCode(),
            KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE.getCode())) {
      Principal principal =
          KimApiServiceLocator.getIdentityService()
              .getPrincipalByPrincipalName(newDelegationMember.getMemberName());
      if (principal != null) {
        newDelegationMember.setMemberId(principal.getPrincipalId());
      }
    }

    if (checkDelegationMember(newDelegationMember)
        && KRADServiceLocatorWeb.getKualiRuleService()
            .applyRules(
                new AddDelegationMemberEvent(
                    "", roleDocumentForm.getRoleDocument(), newDelegationMember))) {
      newDelegationMember.setDocumentNumber(roleDocumentForm.getDocument().getDocumentNumber());
      if (StringUtils.isEmpty(newDelegationMember.getDelegationTypeCode())) {
        newDelegationMember.setDelegationTypeCode(DelegationType.SECONDARY.getCode());
      }
      roleDocumentForm.getRoleDocument().addDelegationMember(newDelegationMember);
      roleDocumentForm.setDelegationMember(
          roleDocumentForm.getRoleDocument().getBlankDelegationMember());
    }
    return mapping.findForward(RiceConstants.MAPPING_BASIC);
  }
 public ActionForward addPermission(
     ActionMapping mapping,
     ActionForm form,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   IdentityManagementRoleDocumentForm roleDocumentForm = (IdentityManagementRoleDocumentForm) form;
   KimDocumentRolePermission newPermission = roleDocumentForm.getPermission();
   if (KRADServiceLocatorWeb.getKualiRuleService()
       .applyRules(
           new AddPermissionEvent("", roleDocumentForm.getRoleDocument(), newPermission))) {
     newPermission.setDocumentNumber(roleDocumentForm.getDocument().getDocumentNumber());
     newPermission.setRoleId(roleDocumentForm.getRoleDocument().getRoleId());
     roleDocumentForm.getRoleDocument().getPermissions().add(newPermission);
     roleDocumentForm.setPermission(new KimDocumentRolePermission());
   }
   return mapping.findForward(RiceConstants.MAPPING_BASIC);
 }