You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2023/03/03 18:36:00 UTC

[causeway] branch CAUSEWAY-3367 created (now 08d13b9133)

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a change to branch CAUSEWAY-3367
in repository https://gitbox.apache.org/repos/asf/causeway.git


      at 08d13b9133 CAUSEWAY-3367: removes config prop, always persist commands

This branch includes the following new commits:

     new 08d13b9133 CAUSEWAY-3367: removes config prop, always persist commands

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[causeway] 01/01: CAUSEWAY-3367: removes config prop, always persist commands

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch CAUSEWAY-3367
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 08d13b9133f2bf303fa542b7b6a5148ee21e2a48
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Mar 3 18:35:54 2023 +0000

    CAUSEWAY-3367: removes config prop, always persist commands
---
 .../ROOT/pages/2023/2.0.0-RC1/mignotes.adoc        | 14 ++++++---
 .../causeway/applib/services/command/Command.java  | 36 ----------------------
 .../services/publishing/log/CommandLogger.java     |  3 +-
 .../core/config/CausewayConfiguration.java         | 24 ---------------
 .../subscriber/CommandSubscriberForCommandLog.java |  6 ----
 .../changetracking/EntityChangeTrackerDefault.java |  1 -
 6 files changed, 11 insertions(+), 73 deletions(-)

diff --git a/antora/components/relnotes/modules/ROOT/pages/2023/2.0.0-RC1/mignotes.adoc b/antora/components/relnotes/modules/ROOT/pages/2023/2.0.0-RC1/mignotes.adoc
index 14478ae788..483c123893 100644
--- a/antora/components/relnotes/modules/ROOT/pages/2023/2.0.0-RC1/mignotes.adoc
+++ b/antora/components/relnotes/modules/ROOT/pages/2023/2.0.0-RC1/mignotes.adoc
@@ -6,8 +6,8 @@
 This page will be added to as development progresses.
 
 == Project Rename
-Any occurrences of `isis` within source code, including configuration resources,
-have been replaced with `causeway` while keeping variants:
+
+Any occurrences of `isis` within source code, including configuration resources, have been replaced with `causeway` while keeping variants:
 
 * lower-case `isis` -> `causeway`
 * upper-case `ISIS` -> `CAUSEWAY`
@@ -92,8 +92,7 @@ Adjust the locations in your `.layout.xml` files accordingly:
 
 The following configuration properties have been changed:
 
-[cols="2a,3a", options="header"]
-
+[cols="2m,3m", options="header"]
 |===
 
 | previously
@@ -116,6 +115,13 @@ The following configuration properties have been changed:
 
 |===
 
+The following configuration properties have been removed (with no replacement):
+
+* `causeway.extensions.command-log.publish-policy`
++
+As a result, commands for actions that do _not_ change state (eg queries) are now also persisted.
+
+
 == Maven Artifacts
 
 The following changed:
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/services/command/Command.java b/api/applib/src/main/java/org/apache/causeway/applib/services/command/Command.java
index 49e4828f88..f03d85f9ca 100644
--- a/api/applib/src/main/java/org/apache/causeway/applib/services/command/Command.java
+++ b/api/applib/src/main/java/org/apache/causeway/applib/services/command/Command.java
@@ -232,30 +232,6 @@ public class Command implements HasInteractionId, HasUsername, HasCommandDto {
     @Getter
     private Throwable exception;
 
-    /**
-     * Whether this command resulted in a change of state to the system.
-     *
-     * <p>
-     *     This can be used as a hint to decide whether to persist the command
-     *     to a datastore, for example for auditing (though
-     *     {@link org.apache.causeway.applib.services.publishing.spi.ExecutionSubscriber} is
-     *     an alternative for that use case) or so that it can be retrieved
-     *     and replayed on another system, eg for regression testing.
-     * </p>
-     *
-     * <p>
-     *     Note that this flag will only be accurate if the <i>Audit Trail</i> extension (or equivalent) is configured
-     *     to actually set it.
-     * </p>
-     *
-     * <p>
-     *     See also the <code>causeway.extensions.command-log.publish-policy</code> configuration property, that controls
-     *     whether the <i>Command Log</i> extension checks this flag or not.
-     * </p>
-     *
-     */
-    @Getter
-    private boolean systemStateChanged;
 
     public static enum CommandPublishingPhase {
         /** initial state: do not publish (yet) */
@@ -342,18 +318,6 @@ public class Command implements HasInteractionId, HasUsername, HasCommandDto {
             Command.this.exception = resultBookmark.getFailure().orElse(null);
         }
 
-        /**
-         * <b>NOT API</b>: intended to be called only by the framework.
-         *
-         * <p>
-         * Hint that this {@link Command} has resulted in a change of state to the system.
-         * Implementations can use this to persist the command, for example.
-         * </p>
-         */
-        public void setSystemStateChanged(final boolean systemStateChanged) {
-            Command.this.systemStateChanged = systemStateChanged;
-        }
-
         /**
          * <b>NOT API</b>: intended to be called only by the framework.
          */
diff --git a/api/applib/src/main/java/org/apache/causeway/applib/services/publishing/log/CommandLogger.java b/api/applib/src/main/java/org/apache/causeway/applib/services/publishing/log/CommandLogger.java
index 9f58187d69..ce062b3c73 100644
--- a/api/applib/src/main/java/org/apache/causeway/applib/services/publishing/log/CommandLogger.java
+++ b/api/applib/src/main/java/org/apache/causeway/applib/services/publishing/log/CommandLogger.java
@@ -59,9 +59,8 @@ public class CommandLogger implements CommandSubscriber {
         val commandDto = command.getCommandDto();
         val xml = CommandDtoUtils.dtoMapper().toString(commandDto);
 
-        log.debug("completed: {}, systemStateChanged {} \n{}",
+        log.debug("completed: {} \n{}",
                 command.getLogicalMemberIdentifier(),
-                command.isSystemStateChanged(),
                 xml);
     }
 
diff --git a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
index 0b60c19814..b75de4f1e6 100644
--- a/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
+++ b/core/config/src/main/java/org/apache/causeway/core/config/CausewayConfiguration.java
@@ -2942,30 +2942,6 @@ public class CausewayConfiguration {
              */
             private PersistPolicy persist = PersistPolicy.ENABLED;
 
-            public enum PublishPolicy {
-                ALWAYS,
-                ONLY_IF_SYSTEM_CHANGED,
-                ;
-                public boolean isAlways() { return this == ALWAYS; }
-                public boolean isOnlyIfSystemChanged() { return this == ONLY_IF_SYSTEM_CHANGED; }
-
-            }
-            /**
-             * Whether commands should be published always, or only if a change in the system's state has been detected.
-             *
-             * <p>
-             * In general, the default of {@link PublishPolicy#ALWAYS} should be used, <i>unless</i> the
-             * <i>Audit Trail</i> extension is also in use, which is able to advise on whether the systems state has
-             * changed.
-             * </p>
-             *
-             * <p>
-             *     Put another way, if this policy is set to {@link PublishPolicy#ONLY_IF_SYSTEM_CHANGED} but the
-             *     <i>Audit Trail</i> extension is <i>not</i> enabled, then nothing will be logged.
-             * </p>
-             */
-            private PublishPolicy publishPolicy = PublishPolicy.ALWAYS;
-
         }
 
         private final CommandReplay commandReplay = new CommandReplay();
diff --git a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/subscriber/CommandSubscriberForCommandLog.java b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/subscriber/CommandSubscriberForCommandLog.java
index 931a44f35f..50f8c56a78 100644
--- a/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/subscriber/CommandSubscriberForCommandLog.java
+++ b/extensions/core/commandlog/applib/src/main/java/org/apache/causeway/extensions/commandlog/applib/subscriber/CommandSubscriberForCommandLog.java
@@ -71,12 +71,6 @@ public class CommandSubscriberForCommandLog implements CommandSubscriber {
             return;
         }
 
-        // skip if no changes AND skipping is allowed
-        if (causewayConfiguration.getExtensions().getCommandLog().getPublishPolicy().isOnlyIfSystemChanged()
-                && !command.isSystemStateChanged()) {
-            return;
-        }
-
         val existingCommandLogEntryIfAny =
                 commandLogEntryRepository.findByInteractionId(command.getInteractionId());
         if(existingCommandLogEntryIfAny.isPresent()) {
diff --git a/persistence/commons/src/main/java/org/apache/causeway/persistence/jpa/integration/changetracking/EntityChangeTrackerDefault.java b/persistence/commons/src/main/java/org/apache/causeway/persistence/jpa/integration/changetracking/EntityChangeTrackerDefault.java
index 54ed0b64bb..a3c71b03f2 100644
--- a/persistence/commons/src/main/java/org/apache/causeway/persistence/jpa/integration/changetracking/EntityChangeTrackerDefault.java
+++ b/persistence/commons/src/main/java/org/apache/causeway/persistence/jpa/integration/changetracking/EntityChangeTrackerDefault.java
@@ -270,7 +270,6 @@ implements
         val alreadySet = persistentChangesEncountered.getAndSet(true);
         if(!alreadySet) {
             val command = currentInteraction().getCommand();
-            command.updater().setSystemStateChanged(true);
         }
     }