Uploaded image for project: 'Causeway'
  1. Causeway
  2. CAUSEWAY-852

Derived property cannot be written properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • viewer-wicket-1.6.0
    • core-1.7.0
    • Viewer Wicket
    • None

    Description

      when using the proposed modifyXxx syntax to make a derived property writable, it is rendered as "disabled" in wicket viewer.

      demo
          public LocalDate getDerivedDate() { ... }
          public void modifyDerivedDate(final LocalDate date) { ... }
      

      when using the alternative setXxx syntax, the UI component is writable. but in this case, the value of the derived property is not written to the persisted property.

      demo
          // {{ BeginAt (property)
          @javax.jdo.annotations.Persistent
          private DateTime beginAt;
      
          @Disabled
          @javax.jdo.annotations.Column(allowsNull = "false")
          public DateTime getBeginAt() {
              return beginAt;
          }
      
          public void setBeginAt(final DateTime beginAt) {
              this.beginAt = beginAt;
          }
          // }}
      
          // {{ DerivedDate (property)
          @NotPersisted
          @NotPersistent
          public LocalDate getDerivedDate() {
              return getBeginAt().toLocalDate();
          }
      
          public void setDerivedDate(final LocalDate beginDate) {
              setBeginAt(getBeginAt().withDate(beginDate.getYear(), beginDate.getMonthOfYear(), beginDate.getDayOfMonth()));
          }
          // }}
      

      it seems like the value set by the derived property gets overwritten by the original/old value of the persisted property that is displayed in the wicket component.
      therefore it might only be an issue, if original and derived properties are members of the same entity and displayed via wicket viewer.

      some background:
      i try to use 3 ui components (= derived properties: date, hour, minute) to set a single persisted DateTime property.

      Attachments

        Activity

          People

            Unassigned Unassigned
            thomaskoren Thomas Koren
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: