Uploaded image for project: 'Isis'
  1. Isis
  2. ISIS-1874

Parented checkboxes fails - NPEs and incorrect facets.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.16.1
    • Fix Version/s: 1.16.2
    • Component/s: None
    • Labels:
      None

      Description

      Two separate issues:

      1. NPE for a parented collection with no toggle box column (the AssociatedWithProvider is always created, but may return a null toggle box column; this isn't guarded for.
      2. When a choices facet is installed for a parameter, doesn't check the type of the parameter against the collection, meaning cannot invoke action.

      Workaround: disable the "associateWith" or memberOrder

      Example of (1) - fails with NPE (though action is executed)

      @Getter @Setter
      private SortedSet<Occupancy> occupancies = new TreeSet<>();
      
      // associated via .layout.xml
      public Occupancy newOccupancy(
              final @Parameter(optionality = Optionality.OPTIONAL) LocalDate startDate,
              final Unit unit) {
          Occupancy occupancy = occupancyRepository.newOccupancy(this, unit, startDate);
          occupancies.add(occupancy);
          return occupancy;
      }
      
      public LocalDate default0NewOccupancy() {
          return getTenancyStartDate();
      }
      
      public List<Unit> choices1NewOccupancy() {
          return getProperty()!=null ? unitRepository.findByProperty(getProperty()) : unitRepository.allUnits();
      }
      

       

      Example of (2) - fails with AgreementRole incompatible with Party.  Workaround is to ensure there's an explicit autoComplete or choices

      
      @javax.jdo.annotations.Persistent(mappedBy = "agreement", defaultFetchGroup = "true")
      @Collection(editing = Editing.DISABLED)
      @CollectionLayout(render = RenderType.EAGERLY)
      @Getter @Setter
      private SortedSet<AgreementRole> roles = new TreeSet<>();
      
      @MemberOrder(name = "roles", sequence = "1")
      public Agreement newRole(
              final AgreementRoleType type,
              final Party party,
              final @Parameter(optionality = Optionality.OPTIONAL) LocalDate startDate,
              final @Parameter(optionality = Optionality.OPTIONAL) LocalDate endDate) {
          createRole(type, party, startDate, endDate);
          return this;
      }
      public List<AgreementRoleType> choices0NewRole() {
          return agreementRoleTypeRepository.findApplicableTo(getType());
      }
      
      public LocalDate default2NewRole() {
          return getEffectiveInterval().startDate();
      }
      
      public LocalDate default3NewRole() {
          return getEffectiveInterval().endDate();
      }
      

      ^^^ the problem triggers on Party, not on AgreementRoleType, because the latter has an explicit choices method.

       

        Attachments

        1. 2-b.png
          365 kB
          Dan Haywood
        2. 2-a.png
          273 kB
          Dan Haywood
        3. 1-b.png
          277 kB
          Dan Haywood
        4. 1-a.png
          272 kB
          Dan Haywood

          Activity

            People

            • Assignee:
              danhaywood Dan Haywood
              Reporter:
              danhaywood Dan Haywood
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: