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

Replace lifecycle methods with additional EventBus events.

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • core-1.5.0
    • 1.11.0
    • Core
    • None

    Description

      This issue is to remove a feature that is only partly implemented in the JDO objectstore, namely the lifecycle methods.

      Jeroen and I were discussing this, and think they are possibly an anti-pattern since they tend to lead to fragile code.

      Rather than have the object "pushing" changes to others, it would be better if an event were broadcast via the EventBus. That way a subscribing service could pull appropriate changes and do whatever is necessary.

      ~~~
      Possible implementation:

      @DomainObject(
      domainEventOnLoad = ...,
      domainEventOnSave = ...,
      domainEventOnUpdate = ...,
      domainEventOnDelete = ...,
      )

      By using the corresponding associated phases, ie EXECUTING and EXECUTED, the subscriber can act BEFORE and/or AFTER the domain object is loaded / initially saved-persisted / updated / deleted.

      The "domainEventOnLoad" event would allow the user to "veto" a specific domain entity instance (domain object) to be showed due to security or other business reasons.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            danhaywood Daniel Keir Haywood
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment