Kuali Rice Development
  1. Kuali Rice Development
  2. KULRICE-9892

Enhance PeopleFlowTypeService and PeopleFlowRequestGeneratorImpl to allow resolving/accepting multiple maps of role qualifiers

    Details

    • Type: Task Task
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.3
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Similar issues:
      KULRICE-1470KIM Qualified Role with multiple qualifications
      KULRICE-5593Create PeopleFlowTypeService interface
      KULRICE-7082KIM role document not handling missing qualifiers on role members
      KULRICE-12836Role qualifiers lost on role maintenance document
      KULRICE-7063Role document stops rending midway - mapped property names not allowed on document.members.qualifier.attrVal
      KULRICE-9165Person document not displaying role qualifiers
      KULRICE-5245Fix context selection so that it can query on multiple attributes
      KULRICE-4405Adding check to role qualifiers in ResponsibilityService
      KULRICE-7711Role qualifier validation being ignored when assigning a role as a member
      KULRICE-7263Passing Collections.emptyMap() as role qualifier causes failures in KIM
    • Rice Module:
      KRMS
    • Application Requirement:
      KPME
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      We have the case where we have get a list of work areas for a document, and need to route to approvers to each of these work areas. So we have a kim role set up, (Work area approver). I need people flow/krms to somehow have a route stop for each. I was hoping I could use an agenda to set this up, but I'm not sure if that is possible. How can we loop people flows with the different attribute values? Single kim role, different attributes...

      (time passes)

      [09:24:15] Peter Giles: So... how did you make it happen?
      [09:24:28] Jeremy Hanson: I emailed you the patch file
      [09:25:30] Jeremy Hanson: it was essentially adding a new method to PeopleFlowTypeService to allow resolving attributes to a List<Map<String, String>>, and then modifying PeopleFlowRequestGeneratorImpl to read that, and loop through them and make requests.
      09:29:46] Peter Giles: How soon do you need that patch integrated?
      [09:30:31] Jeremy Hanson: need, or want? (devil)
      [09:31:08] Jeremy Hanson: quickly as possible, but I'm not sure how it fits into Rice priorities. KPME does need it in the rice 2.3 release.

        Activity

        Hide
        Peter Giles (Inactive) added a comment -

        Attaching the patch that Jeremy provided

        Show
        Peter Giles (Inactive) added a comment - Attaching the patch that Jeremy provided
        Hide
        Corey Pedersen (Inactive) added a comment -

        Patch application causes two failures in IT. PeopleFlowRoutingTest.test_FirstApproveRolePeopleFlow & .test_AllApproveRolePeopleFlow. Researching cause.

        Show
        Corey Pedersen (Inactive) added a comment - Patch application causes two failures in IT. PeopleFlowRoutingTest.test_FirstApproveRolePeopleFlow & .test_AllApproveRolePeopleFlow. Researching cause.
        Hide
        Jeremy Hanson added a comment -

        In PeopleFlowRequestGeneratorImpl, change generateRequestForRoleMember to:

            protected void generateRequestForRoleMember(Context context, PeopleFlowMember member, String actionRequestPolicyCode) {
                List<Map<String, String>> roleQualifierList = loadRoleQualifiers(context, member);
                Role role = getRoleService().getRole(member.getMemberId());
                if (role == null) {
                    throw new IllegalStateException("Failed to locate a role with the given role id of '" + member.getMemberId() + "'");
                }
                if (CollectionUtils.isEmpty(roleQualifierList)) {
                    addKimRoleRequest(context, role, member, Collections.<String, String>emptyMap(), actionRequestPolicyCode );
                } else {
                    for (Map<String, String> roleQualifiers : roleQualifierList) {
                        addKimRoleRequest(context, role, member, roleQualifiers, actionRequestPolicyCode );
                    }
                }
                // TODO - KULRICE-5726 - still need to implement support for ignoring built-in kim delegates whenever peopleflow delegate(s) are defined
            }
        
            private void addKimRoleRequest(Context context, Role role, PeopleFlowMember member, Map<String, String> roleQualifiers, String actionRequestPolicyCode) {
                List<RoleMembership> memberships = getRoleService().getRoleMembers(Collections.singletonList(
                        member.getMemberId()), roleQualifiers);
                if (!CollectionUtils.isEmpty(memberships)) {
                    context.getActionRequestFactory().addKimRoleRequest(context.getActionRequested().getCode(), member.getPriority(),
                            role, memberships, null, member.getResponsibilityId(), true, actionRequestPolicyCode, null);
                }
            }
        
        
        Show
        Jeremy Hanson added a comment - In PeopleFlowRequestGeneratorImpl, change generateRequestForRoleMember to: protected void generateRequestForRoleMember(Context context, PeopleFlowMember member, String actionRequestPolicyCode) { List<Map< String , String >> roleQualifierList = loadRoleQualifiers(context, member); Role role = getRoleService().getRole(member.getMemberId()); if (role == null ) { throw new IllegalStateException( "Failed to locate a role with the given role id of '" + member.getMemberId() + "'" ); } if (CollectionUtils.isEmpty(roleQualifierList)) { addKimRoleRequest(context, role, member, Collections.< String , String >emptyMap(), actionRequestPolicyCode ); } else { for (Map< String , String > roleQualifiers : roleQualifierList) { addKimRoleRequest(context, role, member, roleQualifiers, actionRequestPolicyCode ); } } // TODO - KULRICE-5726 - still need to implement support for ignoring built-in kim delegates whenever peopleflow delegate(s) are defined } private void addKimRoleRequest(Context context, Role role, PeopleFlowMember member, Map< String , String > roleQualifiers, String actionRequestPolicyCode) { List<RoleMembership> memberships = getRoleService().getRoleMembers(Collections.singletonList( member.getMemberId()), roleQualifiers); if (!CollectionUtils.isEmpty(memberships)) { context.getActionRequestFactory().addKimRoleRequest(context.getActionRequested().getCode(), member.getPriority(), role, memberships, null , member.getResponsibilityId(), true , actionRequestPolicyCode, null ); } }
        Hide
        Corey Pedersen (Inactive) added a comment -

        Committed revision 40252. Thanks Jeremy.

        Show
        Corey Pedersen (Inactive) added a comment - Committed revision 40252. Thanks Jeremy.

          People

          • Assignee:
            Corey Pedersen (Inactive)
            Reporter:
            Jeremy Hanson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Structure Helper Panel