protected void setKimType(String kimTypeId, IdentityManagementRoleDocumentForm roleDocumentForm) {
   if (StringUtils.isNotBlank(kimTypeId)) {
     roleDocumentForm.setKimType(
         KimApiServiceLocator.getKimTypeInfoService().getKimType(kimTypeId));
     if (roleDocumentForm.getRoleDocument() != null) {
       roleDocumentForm.getRoleDocument().setKimType(roleDocumentForm.getKimType());
     }
   } else if (roleDocumentForm.getRoleDocument() != null
       && StringUtils.isNotBlank(roleDocumentForm.getRoleDocument().getRoleTypeId())) {
     roleDocumentForm.setKimType(
         KimApiServiceLocator.getKimTypeInfoService()
             .getKimType(roleDocumentForm.getRoleDocument().getRoleTypeId()));
     roleDocumentForm.getRoleDocument().setKimType(roleDocumentForm.getKimType());
   }
 }
  /**
   * This overridden method ...
   *
   * @see
   *     org.kuali.rice.krad.web.struts.action.KualiDocumentActionBase#createDocument(org.kuali.rice.krad.web.struts.form.KualiDocumentFormBase)
   */
  @Override
  protected void createDocument(KualiDocumentFormBase form) throws WorkflowException {
    super.createDocument(form);
    IdentityManagementRoleDocumentForm roleDocumentForm = (IdentityManagementRoleDocumentForm) form;

    if (roleDocumentForm.getRoleId() == null) {
      roleDocumentForm.getRoleDocument().setKimType(roleDocumentForm.getKimType());
      roleDocumentForm.getRoleDocument().initializeDocumentForNewRole();
      roleDocumentForm.setRoleId(roleDocumentForm.getRoleDocument().getRoleId());
      // roleDocumentForm.setKimType(KimApiServiceLocator.getKimTypeInfoService().getKimType(roleDocumentForm.getRoleDocument().getRoleTypeId()));
    } else {
      loadRoleIntoDocument(roleDocumentForm.getRoleId(), roleDocumentForm);
    }

    roleDocumentForm.setMember(roleDocumentForm.getRoleDocument().getBlankMember());
    roleDocumentForm.setDelegationMember(
        roleDocumentForm.getRoleDocument().getBlankDelegationMember());

    KualiTableRenderFormMetadata memberTableMetadata = roleDocumentForm.getMemberTableMetadata();
    if (roleDocumentForm.getMemberRows() != null) {
      memberTableMetadata.jumpToFirstPage(
          roleDocumentForm.getMemberRows().size(), roleDocumentForm.getRecordsPerPage());
    }
  }