Uploaded image for project: 'Kuali Rice Development'
  1. Kuali Rice Development
  2. KULRICE-10882

Read only property on collection items gets overridden

    Details

    • Type: Bug Fix
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Rice Module:
      KRAD
    • KRAD Feature Area:
      UIF Component
    • Sprint:
      2.4.0-rc1 Sprint 6, 2.4.0-rc1 Sprint 7, 2.4.0-rc1 Sprint 8
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Code Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      If you set a readonly condition on a collection group item, it gets ignored. The reason for this is in CollectionGroupBuilder there is a check to set read only line, based on whether the collection group is readonly. When this is true, the field read only property is not looked at.

        Attachments

          Activity

          Hide
          jkneal Jerry Neal (Inactive) added a comment -

          Shannon,

          I was looking at the change here and not quite following. What is the reasoning behind looking at the add line items? What about if render add line is false?

          Seems like what should be occurring is the following:

          Pass lineFields into checkEditLineAuthorization. Iterate through fields, and if read only flag is true set canEditLine to true (then check permissions).

          Also, the readOnly property on the fields might not be evaluated yet (look through the code previous to see if there is any evaluation). If not, it will need to be evaluated before checking.

          thanks,
          Jerry

          Show
          jkneal Jerry Neal (Inactive) added a comment - Shannon, I was looking at the change here and not quite following. What is the reasoning behind looking at the add line items? What about if render add line is false? Seems like what should be occurring is the following: Pass lineFields into checkEditLineAuthorization. Iterate through fields, and if read only flag is true set canEditLine to true (then check permissions). Also, the readOnly property on the fields might not be evaluated yet (look through the code previous to see if there is any evaluation). If not, it will need to be evaluated before checking. thanks, Jerry
          Hide
          shahess Shannon Hess added a comment -

          Reopening per Jerry's comments

          Show
          shahess Shannon Hess added a comment - Reopening per Jerry's comments
          Hide
          shahess Shannon Hess added a comment - - edited

          Jerry,

          I made the changes you suggested regarding passing lineFields into checkEditLineAuthorization and iterating through the fields. I'm not sure what you mean by the readOnly property on the fields not being evaluated yet - the readonly property is present on the Field and correct, but I'm not seeing anywhere in the previous code where the evaluation is done. If we could discuss what exactly I should be looking for that would be great.

          Thanks,
          Shannon

          Show
          shahess Shannon Hess added a comment - - edited Jerry, I made the changes you suggested regarding passing lineFields into checkEditLineAuthorization and iterating through the fields. I'm not sure what you mean by the readOnly property on the fields not being evaluated yet - the readonly property is present on the Field and correct, but I'm not seeing anywhere in the previous code where the evaluation is done. If we could discuss what exactly I should be looking for that would be great. Thanks, Shannon
          Hide
          jkneal Jerry Neal (Inactive) added a comment -

          Shannon,

          If the readOnly property had an expression "@

          {some expression}

          ", the expression gets pulled out and the boolean value set to false. The expressions don't get evaluated to apply model phase. This will happen on the fields after the collection builds the lines. So our check on the fields readOnly property might not be correct. See what I mean?

          When situations like this occur, we add code to explicitly evaluate the expression for the property. So you have to do something like:

          lineField.pushObjectToContext(UifConstants.ContextVariableNames.PARENT, collectionGroup);
          lineField.pushAllToContext(view.getContext());
          lineField.pushObjectToContext(UifConstants.ContextVariableNames.THEME_IMAGES,
          view.getTheme().getImageDirectory());
          lineField.pushObjectToContext(UifConstants.ContextVariableNames.COMPONENT, lineField);

          expressionEvaluator.evaluatePropertyExpression(view, lineField.getContext(), lineField,
          UifPropertyPaths.READ_ONLY, true);

          Show
          jkneal Jerry Neal (Inactive) added a comment - Shannon, If the readOnly property had an expression "@ {some expression} ", the expression gets pulled out and the boolean value set to false. The expressions don't get evaluated to apply model phase. This will happen on the fields after the collection builds the lines. So our check on the fields readOnly property might not be correct. See what I mean? When situations like this occur, we add code to explicitly evaluate the expression for the property. So you have to do something like: lineField.pushObjectToContext(UifConstants.ContextVariableNames.PARENT, collectionGroup); lineField.pushAllToContext(view.getContext()); lineField.pushObjectToContext(UifConstants.ContextVariableNames.THEME_IMAGES, view.getTheme().getImageDirectory()); lineField.pushObjectToContext(UifConstants.ContextVariableNames.COMPONENT, lineField); expressionEvaluator.evaluatePropertyExpression(view, lineField.getContext(), lineField, UifPropertyPaths.READ_ONLY, true);
          Hide
          shahess Shannon Hess added a comment -

          The code has been updated so that the readonly property is evaluated. For testing purposes, I updated the test collection in DemoTableLayoutDetails.xml to include an expression

          <bean parent="Uif-InputField" p:propertyName="field2" p:label="Read Only if not b" p:readOnly="@{#lp.field2 ne 'b'}"/>
          
          Show
          shahess Shannon Hess added a comment - The code has been updated so that the readonly property is evaluated. For testing purposes, I updated the test collection in DemoTableLayoutDetails.xml to include an expression <bean parent= "Uif-InputField" p:propertyName= "field2" p:label= "Read Only if not b" p:readOnly= "@{#lp.field2 ne 'b'}" />

            People

            • Assignee:
              shahess Shannon Hess
              Reporter:
              apotts Tony Potts (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 6 hours Original Estimate - 6 hours
                6h
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 7 hours
                7h