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

Uif-MaintenanceTableCollectionSection appers to be broken

    Details

    • Type: Bug Fix
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.3.0-m2, 2.3
    • Component/s: Development
    • Security Level: Public (Public: Anyone can view)
    • Labels:
      None
    • Rice Module:
      KRAD
    • KRAD Feature Area:
      Maintenance
    • KAI Review Status:
      Not Required
    • KTI Review Status:
      Not Required
    • Include in Release Notes?:
      Yes

      Description

      It appears to me that collection maintenance is broken in at least version 2.2.1 when using a table-based collection instead of a stacked collection.

      For example, if I have a Book data object with a collection of Chapters and I have the following specified on my Uif-MaintenanceView:

      <bean parent="Uif-MaintenanceTableCollectionSection">
        <property name="headerText" value="Chapters"/>
        <property name="collectionObjectClass" value="trnapp.bookstore.Chapter"/>
        <property name="propertyName" value="chapters"/>
        <property name="items">
          <list>
            <bean parent="Uif-InputField" p:propertyName="number" p:required="true"/>
            <bean parent="Uif-InputField" p:propertyName="title" p:required="true"/>
          </list>
        </property>
      </bean>
      

      When I fill out the collection row and hit the "add" button, I get the following exception:

      2013-03-03 19:30:09,399 [http-bio-8080-exec-9] u:admin/d: ERROR org.kuali.rice.krad.web.controller.UifHandlerExceptionResolver - The following error was caught by the UifHandlerExceptionResolver : 
      java.lang.RuntimeException: Error getting property 'document.newMaintainableObject.dataObject.chapters[0].null' from org.kuali.rice.krad.web.form.MaintenanceDocumentForm@73d6c269
      	at org.kuali.rice.krad.uif.util.ObjectPropertyUtils.getPropertyValue(ObjectPropertyUtils.java:61)
      	at org.kuali.rice.krad.uif.widget.Inquiry.performFinalize(Inquiry.java:116)
      	at org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl.performComponentFinalize(ViewHelperServiceImpl.java:1228)
      	at org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl.performComponentFinalize(ViewHelperServiceImpl.java:1247)
      	at org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl.performComponentFinalize(ViewHelperServiceImpl.java:1247)
      	at org.kuali.rice.krad.uif.service.impl.ViewHelperServiceImpl.performComponentLifecycle(ViewHelperServiceImpl.java:303)
      	at org.kuali.rice.krad.web.controller.UifControllerHelper.prepareViewForRendering(UifControllerHelper.java:226)
      	at org.kuali.rice.krad.web.controller.UifControllerHelper.postControllerHandle(UifControllerHelper.java:98)
      	at org.kuali.rice.krad.web.controller.UifControllerHandlerInterceptor.postHandle(UifControllerHandlerInterceptor.java:82)
      	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:911)
      	...
      

      If I simply change my parent bean from Uif-MaintenanceTableCollectionSection to Uif-MaintenanceStackedCollectionSection I'm able to add chapters and submit the maintenance document no problem.

      Full stack trace is attached.

        Attachments

          Activity

          Hide
          jkneal Jerry Neal (Inactive) added a comment -

          Hi Shannon,

          I thought we did but was unable to find it. We can just use this one. The problem is the sequence field is setup by default in the base bean as a data field, so you can easily do sequenceField.propertyName="foo" to setup the sequence. However, if you don't do this, turn the sequence off, or specify to use the auto sequence you get this exception. I think we should just change the default to use an auto-sequence and take out the data field. Then if they want to use a sequence that is actually from the model, they can setup the data field from scratch.

          Jerry

          Show
          jkneal Jerry Neal (Inactive) added a comment - Hi Shannon, I thought we did but was unable to find it. We can just use this one. The problem is the sequence field is setup by default in the base bean as a data field, so you can easily do sequenceField.propertyName="foo" to setup the sequence. However, if you don't do this, turn the sequence off, or specify to use the auto sequence you get this exception. I think we should just change the default to use an auto-sequence and take out the data field. Then if they want to use a sequence that is actually from the model, they can setup the data field from scratch. Jerry
          Hide
          shahess Shannon Hess added a comment -

          Jerry,

          I’ve been struggling with this a bit. You mentioned taking out the data field, but can you give some additional clarification? At first I was thinking you meant sequencePropertyName in the TableLayoutManager.java, but this is used fairly heavily so that doesn’t really make sense to me.

          /**

          • Attribute name to use as sequence value. For each collection line the
          • value of this field on the line will be retrieved and used as the
          • sequence value
            *
          • @return sequence property name
            */
            @BeanTagAttribute(name = "sequencePropertyName")
            public String getSequencePropertyName() {
            if ((getSequenceFieldPrototype() != null) && (getSequenceFieldPrototype() instanceof DataField)) { return ((DataField) getSequenceFieldPrototype()).getPropertyName(); }

          return null;
          }

          Thanks,
          Shannon

          Show
          shahess Shannon Hess added a comment - Jerry, I’ve been struggling with this a bit. You mentioned taking out the data field, but can you give some additional clarification? At first I was thinking you meant sequencePropertyName in the TableLayoutManager.java, but this is used fairly heavily so that doesn’t really make sense to me. /** Attribute name to use as sequence value. For each collection line the value of this field on the line will be retrieved and used as the sequence value * @return sequence property name */ @BeanTagAttribute(name = "sequencePropertyName") public String getSequencePropertyName() { if ((getSequenceFieldPrototype() != null) && (getSequenceFieldPrototype() instanceof DataField)) { return ((DataField) getSequenceFieldPrototype()).getPropertyName(); } return null; } Thanks, Shannon
          Hide
          jkneal Jerry Neal (Inactive) added a comment -

          Shannon,

          I was suggesting in UifLayoutManagerDefinition.xml, bean 'Uif-TableCollectionLayout', removing the property 'sequenceFieldPrototype' that initializes the value as an input field. This is causing the problems because the property name is not set and must be set by beans using the layout. We'll just take that out then they will have to explicitly create the input field in child beans. When you take this out, you'll need to look for any places that are setting the nested property 'sequenceFieldPrototype.propertyName', and change those to initialize the sequenceFieldPrototype to an input field with the given property name.

          Jerry

          Show
          jkneal Jerry Neal (Inactive) added a comment - Shannon, I was suggesting in UifLayoutManagerDefinition.xml, bean 'Uif-TableCollectionLayout', removing the property 'sequenceFieldPrototype' that initializes the value as an input field. This is causing the problems because the property name is not set and must be set by beans using the layout. We'll just take that out then they will have to explicitly create the input field in child beans. When you take this out, you'll need to look for any places that are setting the nested property 'sequenceFieldPrototype.propertyName', and change those to initialize the sequenceFieldPrototype to an input field with the given property name. Jerry
          Hide
          shahess Shannon Hess added a comment -

          That makes sense, thanks Jerry!

          Show
          shahess Shannon Hess added a comment - That makes sense, thanks Jerry!
          Hide
          shahess Shannon Hess added a comment -

          This has been fixed. To test locally, I added the following:

          Added to TravelAccount.java

          private List<Author> authors = new ArrayList<Author>();
          
          public List<Author> getAuthors() {
              return authors;
          }
          
          public void setAuthors(List<Author> authors) {
              this.authors = authors;
          }
          

          Added to TravelAccountMaintenance.xml

          <bean parent="Uif-MaintenanceTableCollectionSection">
             <property name="headerText" value="Add an Author"/>
             <property name="collectionObjectClass" value="org.kuali.rice.krad.demo.travel.account.TravelAccount"/>
             <property name="propertyName" value="authors"/>
             <property name="items">
               <list>
                 <bean parent="Uif-InputField" p:propertyName="number"/>
               </list>
             </property>
          </bean>
          
          Show
          shahess Shannon Hess added a comment - This has been fixed. To test locally, I added the following: Added to TravelAccount.java private List<Author> authors = new ArrayList<Author>(); public List<Author> getAuthors() { return authors; } public void setAuthors(List<Author> authors) { this .authors = authors; } Added to TravelAccountMaintenance.xml <bean parent= "Uif-MaintenanceTableCollectionSection" > <property name= "headerText" value= "Add an Author" /> <property name= "collectionObjectClass" value= "org.kuali.rice.krad.demo.travel.account.TravelAccount" /> <property name= "propertyName" value= "authors" /> <property name= "items" > <list> <bean parent= "Uif-InputField" p:propertyName= "number" /> </list> </property> </bean>

            People

            • Assignee:
              shahess Shannon Hess
              Reporter:
              ewestfal Eric Westfall
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: