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

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

commit 40b884787ab00036581dc3fa9d20457998b89a68
Author: danhaywood <[email protected]>
AuthorDate: Mon Apr 3 17:43:44 2023 +0100

    CAUSEWAY-2485: completes @DomainObject#xxxLifecycleEvent example
---
 .../objects/DomainObject/DomainObjectMenu.java     |  6 +-
 .../aliased/DomainObjectAliasedPage_objects.java   |  3 +-
 ...=> DomainObjectLifecycleEvent-description.adoc} |  9 +-
 ...t.xml => DomainObjectLifecycleEvent.layout.xml} | 45 +++++++---
 ...Page.java => DomainObjectLifecycleEventVm.java} | 29 +++++--
 ...xml => DomainObjectLifecycleEventVm.layout.xml} | 44 +++++++---
 .../DomainObjectXxxLifecycleEvent.java             | 52 +++++++++++-
 ...ainObjectXxxLifecycleEventPage-description.adoc | 99 ++++++++++++++++++++++
 ...java => DomainObjectXxxLifecycleEventPage.java} | 27 +++---
 ...> DomainObjectXxxLifecycleEventPage.layout.xml} | 20 ++++-
 ...inObjectXxxLifecycleEventPage_clearEvents.java} | 38 +++++----
 ...inObjectXxxLifecycleEventPage_createEntity.java | 60 +++++++++++++
 ...nObjectXxxLifecycleEventPage_deleteEntity.java} | 38 +++++----
 ... DomainObjectXxxLifecycleEventPage_events.java} | 35 ++++----
 ...nObjectXxxLifecycleEventPage_updateEntity.java} | 42 ++++-----
 .../DomainObjectXxxLifecycleEventSubscriber.java   | 55 ++++++++++++
 ...mainObjectXxxLifecyleEventPage-description.adoc | 47 ----------
 ...mainObjectXxxLifecycleEventJpa-description.adoc |  4 +-
 .../jpa/DomainObjectXxxLifecycleEventJpa.java      |  4 +
 19 files changed, 481 insertions(+), 176 deletions(-)

diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java
index 541f28f8e6..6cc52e0f45 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/DomainObjectMenu.java
@@ -27,7 +27,7 @@ import 
demoapp.dom.domain.objects.DomainObject.introspection.DomainObjectIntrosp
 import 
demoapp.dom.domain.objects.DomainObject.mixinMethod.DomainObjectMixinMethodPage;
 import demoapp.dom.domain.objects.DomainObject.nature.DomainObjectNaturePage;
 import 
demoapp.dom.domain.objects.DomainObject.xxxDomainEvent.DomainObjectXxxDomainEventPage;
-import 
demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent.DomainObjectXxxLifecyleEventPage;
+import 
demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent.DomainObjectXxxLifecycleEventPage;
 import lombok.RequiredArgsConstructor;
 import lombok.val;
 
@@ -104,8 +104,8 @@ public class DomainObjectMenu {
 
     @Action(semantics = SemanticsOf.SAFE)
     @ActionLayout(cssClassFa="fa-redo", describedAs = "Class of the lifecycle 
event emitted when the domain entity transitions through its persistence 
lifecycle")
-    public DomainObjectXxxLifecyleEventPage lifecycleEvents() {
-        return new DomainObjectXxxLifecyleEventPage();
+    public DomainObjectXxxLifecycleEventPage lifecycleEvents() {
+        return new DomainObjectXxxLifecycleEventPage();
     }
 
 }
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java
index 7746ba055e..ca3fa353e8 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/aliased/DomainObjectAliasedPage_objects.java
@@ -24,7 +24,6 @@ public class DomainObjectAliasedPage_objects {
         return objectRepository.all();
     }
 
-    @Inject
-    ValueHolderRepository<String, ? extends DomainObjectAliased> 
objectRepository;
+    @Inject ValueHolderRepository<String, ? extends DomainObjectAliased> 
objectRepository;
 
 }
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEvent-description.adoc
similarity index 82%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa-description.adoc
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEvent-description.adoc
index 4b4548b0b1..3d3f72435a 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa-description.adoc
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEvent-description.adoc
@@ -1,11 +1,4 @@
 :Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or ag [...]
 
-This domain class ...
-
-[source,java,indent=0]
-.DomainObjectXxxLifecycleEvent.java
-----
-include::../DomainObjectXxxLifecycleEvent.java[tags=class]
-----
-<.> ...
+This domain class is a view model that contains the details of a lifecycle 
event emitted when interacting with a domain entity.
 
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEvent.layout.xml
similarity index 67%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEvent.layout.xml
index 2ca31ba597..691a0c6d47 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEvent.layout.xml
@@ -18,7 +18,6 @@
        <bs3:row>
                <bs3:col span="10" unreferencedActions="true">
                        <cpt:domainObject />
-                       <cpt:action id="toggleEvents"/>
                </bs3:col>
                <bs3:col span="2">
                        <cpt:fieldSet name="" id="sources" />
@@ -27,10 +26,37 @@
 
        <bs3:row>
                <bs3:col span="6">
-                       <cpt:fieldSet name="Other" id="other" 
unreferencedProperties="true"/>
-                       <cpt:collection id="objects">
-                               <cpt:action id="updateName"/>
-                       </cpt:collection>
+                       <bs3:tabGroup>
+                               <bs3:tab name="General">
+                                       <bs3:row>
+                                               <bs3:col span="12">
+                                                       <cpt:fieldSet 
name="General" id="general" >
+                                                               <cpt:property 
id="name"/>
+                                                               <cpt:property 
id="originalName"/>
+                                                               <cpt:property 
id="initialCharacter"/>
+                                                       </cpt:fieldSet>
+                                               </bs3:col>
+                                       </bs3:row>
+                               </bs3:tab>
+                               <bs3:tab name="Metadata">
+                                       <bs3:row>
+                                               <bs3:col span="12">
+                                                       <cpt:fieldSet 
name="Metadata" id="metadata" >
+                                                               <cpt:property 
id="id"/>
+                                                               <cpt:property 
id="logicalTypeName"/>
+                                                               <cpt:property 
id="version"/>
+                                                       </cpt:fieldSet>
+                                               </bs3:col>
+                                       </bs3:row>
+                               </bs3:tab>
+                               <bs3:tab name="Other">
+                                       <bs3:row>
+                                               <bs3:col span="12">
+                                                       <cpt:fieldSet 
name="Other" id="other" unreferencedProperties="true"/>
+                                               </bs3:col>
+                                       </bs3:row>
+                               </bs3:tab>
+                       </bs3:tabGroup>
                </bs3:col>
                <bs3:col span="6">
                        <cpt:fieldSet name="Description" id="description" >
@@ -40,15 +66,14 @@
                                <cpt:action id="inspectMetamodel"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="downloadMetamodelXml"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="downloadJdoMetamodel"  
position="PANEL_DROPDOWN"/>
-                <cpt:action id="recentCommands"  position="PANEL_DROPDOWN"/>
-                <cpt:action id="recentExecutions"  position="PANEL_DROPDOWN"/>
-                <cpt:action id="recentAuditTrailEntries"  
position="PANEL_DROPDOWN"/>
+                               <cpt:action id="recentCommands"  
position="PANEL_DROPDOWN"/>
+                               <cpt:action id="recentExecutions"  
position="PANEL_DROPDOWN"/>
+                               <cpt:action id="recentAuditTrailEntries"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="impersonateWithRoles"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="openRestApi" 
position="PANEL_DROPDOWN" />
                                <cpt:property id="description"/>
                        </cpt:fieldSet>
-               </bs3:col>
-       </bs3:row>
+               </bs3:col>      </bs3:row>
        <bs3:row>
                <bs3:col span="12" unreferencedCollections="true"/>
        </bs3:row>
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEventVm.java
similarity index 67%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEventVm.java
index c1d2d71ee6..a922a1b7a0 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEventVm.java
@@ -19,6 +19,9 @@
 package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
 
 import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
 
 import javax.inject.Named;
 import javax.xml.bind.annotation.XmlAccessType;
@@ -29,19 +32,33 @@ import javax.xml.bind.annotation.XmlType;
 import org.apache.causeway.applib.annotation.DomainObject;
 import org.apache.causeway.applib.annotation.Nature;
 import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Property;
 
 //tag::class[]
-@XmlRootElement(name = "root")
+@XmlRootElement(name = "demo.DomainObjectLifecycleEventVm")
 @XmlType
 @XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.DomainObjectXxxLifecyleEventPage")
-@DomainObject(
-        nature = Nature.VIEW_MODEL)
-public class DomainObjectXxxLifecyleEventPage implements 
HasAsciiDocDescription {
+@Named("demo.DomainObjectLifecycleEventVm")
+@DomainObject(nature = Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class DomainObjectLifecycleEventVm implements HasAsciiDocDescription {
+
+    public DomainObjectLifecycleEventVm(String eventType, String bookmark) {
+        this.eventType = eventType;
+        this.bookmark = bookmark;
+    }
 
     @ObjectSupport public String title() {
-        return "DomainObject#xxxLifecyleEvent";
+        return eventType + ": " + bookmark;
     }
 
+    @Property
+    @Getter @Setter
+    private String eventType;
+
+    @Property
+    @Getter @Setter
+    private String bookmark;
+
 }
 //end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEventVm.layout.xml
similarity index 68%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEventVm.layout.xml
index 2ca31ba597..1bd3dd289b 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectLifecycleEventVm.layout.xml
@@ -18,7 +18,6 @@
        <bs3:row>
                <bs3:col span="10" unreferencedActions="true">
                        <cpt:domainObject />
-                       <cpt:action id="toggleEvents"/>
                </bs3:col>
                <bs3:col span="2">
                        <cpt:fieldSet name="" id="sources" />
@@ -27,10 +26,36 @@
 
        <bs3:row>
                <bs3:col span="6">
-                       <cpt:fieldSet name="Other" id="other" 
unreferencedProperties="true"/>
-                       <cpt:collection id="objects">
-                               <cpt:action id="updateName"/>
-                       </cpt:collection>
+                       <bs3:tabGroup>
+                               <bs3:tab name="General">
+                                       <bs3:row>
+                                               <bs3:col span="12">
+                                                       <cpt:fieldSet 
name="General" id="general" >
+                                                               <cpt:property 
id="eventType"/>
+                                                               <cpt:property 
id="bookmark"/>
+                                                       </cpt:fieldSet>
+                                               </bs3:col>
+                                       </bs3:row>
+                               </bs3:tab>
+                               <bs3:tab name="Metadata">
+                                       <bs3:row>
+                                               <bs3:col span="12">
+                                                       <cpt:fieldSet 
name="Metadata" id="metadata" >
+                                                               <cpt:property 
id="id"/>
+                                                               <cpt:property 
id="logicalTypeName"/>
+                                                               <cpt:property 
id="version"/>
+                                                       </cpt:fieldSet>
+                                               </bs3:col>
+                                       </bs3:row>
+                               </bs3:tab>
+                               <bs3:tab name="Other">
+                                       <bs3:row>
+                                               <bs3:col span="12">
+                                                       <cpt:fieldSet 
name="Other" id="other" unreferencedProperties="true"/>
+                                               </bs3:col>
+                                       </bs3:row>
+                               </bs3:tab>
+                       </bs3:tabGroup>
                </bs3:col>
                <bs3:col span="6">
                        <cpt:fieldSet name="Description" id="description" >
@@ -40,15 +65,14 @@
                                <cpt:action id="inspectMetamodel"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="downloadMetamodelXml"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="downloadJdoMetamodel"  
position="PANEL_DROPDOWN"/>
-                <cpt:action id="recentCommands"  position="PANEL_DROPDOWN"/>
-                <cpt:action id="recentExecutions"  position="PANEL_DROPDOWN"/>
-                <cpt:action id="recentAuditTrailEntries"  
position="PANEL_DROPDOWN"/>
+                               <cpt:action id="recentCommands"  
position="PANEL_DROPDOWN"/>
+                               <cpt:action id="recentExecutions"  
position="PANEL_DROPDOWN"/>
+                               <cpt:action id="recentAuditTrailEntries"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="impersonateWithRoles"  
position="PANEL_DROPDOWN"/>
                                <cpt:action id="openRestApi" 
position="PANEL_DROPDOWN" />
                                <cpt:property id="description"/>
                        </cpt:fieldSet>
-               </bs3:col>
-       </bs3:row>
+               </bs3:col>      </bs3:row>
        <bs3:row>
                <bs3:col span="12" unreferencedCollections="true"/>
        </bs3:row>
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
index 6b846797ec..82a77cee6c 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
@@ -20,14 +20,60 @@ package 
demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
 
 import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
 import demoapp.dom._infra.values.ValueHolder;
+import 
demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent.jpa.DomainObjectXxxLifecycleEventJpa;
 
+import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.Nature;
 import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.events.lifecycle.*;
 
 @SuppressWarnings("CdiManagedBeanInconsistencyInspection")
-public abstract class DomainObjectXxxLifecycleEvent
+//tag::class[]
+@DomainObject(
+        nature = Nature.ENTITY,
+        createdLifecycleEvent = 
DomainObjectXxxLifecycleEventJpa.CreatedEvent.class,        // <.>
+        persistingLifecycleEvent = 
DomainObjectXxxLifecycleEventJpa.PersistingEvent.class,  // <.>
+        persistedLifecycleEvent = 
DomainObjectXxxLifecycleEventJpa.PersistedEvent.class,    // <.>
+        updatingLifecycleEvent = 
DomainObjectXxxLifecycleEventJpa.UpdatingEvent.class,      // <.>
+        updatedLifecycleEvent = 
DomainObjectXxxLifecycleEventJpa.UpdatedEvent.class,        // <.>
+        removingLifecycleEvent = 
DomainObjectXxxLifecycleEventJpa.RemovingEvent.class,      // <.>
+        loadedLifecycleEvent = 
DomainObjectXxxLifecycleEventJpa.LoadedEvent.class           // <.>
+)
+public abstract class DomainObjectXxxLifecycleEvent                            
             // <.>
+//end::class[]
         implements
         HasAsciiDocDescription,
-        ValueHolder<String> {
+        ValueHolder<String>
+//tag::class[]
+{
+    public interface LifecycleEvent {                                          
             // <.>
+        DomainObjectXxxLifecycleEvent getSource();
+    }
+
+    public static class CreatedEvent
+            extends ObjectCreatedEvent<DomainObjectXxxLifecycleEvent>          
             // <1>
+            implements LifecycleEvent { }                                      
             // <9>
+    public static class PersistingEvent
+            extends ObjectPersistingEvent<DomainObjectXxxLifecycleEvent>       
             // <2>
+            implements LifecycleEvent { }                                      
             // <9>
+    public static class PersistedEvent
+            extends ObjectPersistedEvent<DomainObjectXxxLifecycleEvent>        
             // <3>
+            implements LifecycleEvent { }                                      
             // <9>
+    public static class UpdatingEvent
+            extends ObjectUpdatingEvent<DomainObjectXxxLifecycleEvent>         
             // <4>
+            implements LifecycleEvent { }                                      
             // <9>
+    public static class UpdatedEvent
+            extends ObjectUpdatedEvent<DomainObjectXxxLifecycleEvent>          
             // <5>
+            implements LifecycleEvent { }                                      
             // <9>
+    public static class RemovingEvent
+            extends ObjectRemovingEvent<DomainObjectXxxLifecycleEvent>         
             // <6>
+            implements LifecycleEvent { }                                      
             // <9>
+    public static class LoadedEvent
+            extends ObjectLoadedEvent<DomainObjectXxxLifecycleEvent>           
             // <7>
+            implements LifecycleEvent { }                                      
             // <9>
+
+    // ...
+//end::class[]
 
     @ObjectSupport
     public String title() {
@@ -42,4 +88,6 @@ public abstract class DomainObjectXxxLifecycleEvent
     public abstract String getName();
     public abstract void setName(String value);
 
+//tag::class[]
 }
+//end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage-description.adoc
new file mode 100644
index 0000000000..2490edf19c
--- /dev/null
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage-description.adoc
@@ -0,0 +1,99 @@
+:Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or ag [...]
+
+
+The framework emits 7 different lifecycle event for domain entities as they 
progress through their persistence lifecycle.
+
+By default the framework will emit a default event type.
+However, using 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html[@DomainObject]
 the exact subtype can be overridden:
+
+* 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#createdlifecycleevent[@DomainObject#createdLifecycleEvent]
 - when an entity is instantiated in memory (but not yet persisted).
+Must be a subclass of 
https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/events/lifecycle/ObjectCreatedEvent[ObjectCreatedEvent].
+
+* 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#persistinglifecycleevent[@DomainObject#persistingLifecycleEvent]
 - when a newly instantiated entity is about to be INSERTed for the first time 
to the database.
+Must be a subclass of 
https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/events/lifecycle/ObjectPersistingEvent[ObjectPersistingEvent].
+
+* 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#persistinglifecycleevent[@DomainObject#persistingLifecycleEvent]
 - when a newly instantiated entity has just been INSERTed to the database for 
the first time.
+Must be a subclass of 
https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/events/lifecycle/ObjectPersistedEvent[ObjectPersistedEvent].
+
+* 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#loadedlifecycleevent[@DomainObject#loadedLifecycleEvent]
 - when a entity is retrieved from the database into memory.
+Must be a subclass of 
https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/events/lifecycle/ObjectLoadedEvent[ObjectLoadedEvent].
+
+* 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#updatinglifecycleevent[@DomainObject#updatingLifecycleEvent]
 - when an already-persisted entity is about to be UPDATEd in the database.
+Must be a subclass of 
https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/events/lifecycle/ObjectUpdatingEvent[ObjectUpdatingEvent].
+
+* 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#updatedlifecycleevent[@DomainObject#
+updatedLifecycleEvent] - when an already-persisted entity has just been 
UPDATEd in the database.
+Must be a subclass of 
https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/events/lifecycle/ObjectUpdatedEvent[ObjectUpdatedEvent].
+
+* 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObject.html#removinlifecycleevent[@DomainObject#
+removingLifecycleEvent] - when an already-persisted entity is about to be 
DELETEd from the database.
+Must be a subclass of 
https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/events/lifecycle/ObjectRemovingEvent[ObjectRemovingEvent].
+
+=== How this demo works
+
+The page provides actions to allow a single entity to be created, updated and 
deleted.
+It also shows a list of events that are captured by a subscriber, for each of 
the corresponding lifecycle events.
+
+In terms of code:
+
+* the entity class defines a set of domain event classes:
++
+[source,java]
+.DomainObjectXxxLifecycleEvent.java
+----
+include::DomainObjectXxxLifecycleEvent.java[tags=class]
+----
+<.> specifies a custom event type for the "created" callback
+<.> specifies a custom event type for the "persisting" callback
+<.> specifies a custom event type for the "persisted" callback
+<.> specifies a custom event type for the "updating" callback
+<.> specifies a custom event type for the "updated" callback
+<.> specifies a custom event type for the "removing" callback
+<.> specifies a custom event type for the "loaded" callback
+<.> This class is `abstract` only because the demo includes JPA and JDO 
specific subclasses
+<.> interface that all event classes implemented.
+Such an interface isn't mandatory, but it allows the subscriber (below) to 
subscribe to all events with a single callback.
+
+* the subscriber:
++
+[source,java]
+.DomainObjectXxxLifecycleEventSubscriber.java
+----
+include::DomainObjectXxxLifecycleEventSubscriber.java[tags=class]
+----
+<.> for simplicity, listens to the common interface defined by all of the 
custom event types
+<.> appends to an in-memory list
+
+* contributed `events` collection that simply surfaces the list of events 
received by the subscriber
++
+[source,java]
+.DomainObjectXxxLifecycleEventPage_events.java
+----
+include::DomainObjectXxxLifecycleEventPage_events.java[tags=class]
+----
+
+* the actions to create, update and delete:
+
+** create:
++
+[source,java]
+.DomainObjectXxxLifecycleEventPage_createEntity.java
+----
+include::DomainObjectXxxLifecycleEventPage_createEntity.java[tags=class]
+----
+
+** update:
++
+[source,java]
+.DomainObjectXxxLifecycleEventPage_updateEntity.java
+----
+include::DomainObjectXxxLifecycleEventPage_updateEntity.java[tags=class]
+----
+
+** delete:
++
+[source,java]
+.DomainObjectXxxLifecycleEventPage_deleteEntity.java
+----
+include::DomainObjectXxxLifecycleEventPage_deleteEntity.java[tags=class]
+----
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage.java
similarity index 65%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage.java
index c1d2d71ee6..15cd15b379 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage.java
@@ -19,29 +19,36 @@
 package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
 
 import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
 
 import javax.inject.Named;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
-import org.apache.causeway.applib.annotation.DomainObject;
-import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.*;
+import org.apache.causeway.applib.jaxb.PersistentEntityAdapter;
 
 //tag::class[]
-@XmlRootElement(name = "root")
+@XmlRootElement(name = "demo.DomainObjectXxxLifecycleEventPage")
 @XmlType
 @XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.DomainObjectXxxLifecyleEventPage")
+@Named("demo.DomainObjectXxxLifecycleEventPage")
 @DomainObject(
         nature = Nature.VIEW_MODEL)
-public class DomainObjectXxxLifecyleEventPage implements 
HasAsciiDocDescription {
+public class DomainObjectXxxLifecycleEventPage implements 
HasAsciiDocDescription {
 
     @ObjectSupport public String title() {
         return "DomainObject#xxxLifecyleEvent";
     }
 
+    @XmlJavaTypeAdapter(PersistentEntityAdapter.class)
+    @Property
+    @Getter @Setter
+    private DomainObjectXxxLifecycleEvent entity;
+
 }
 //end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage.layout.xml
similarity index 83%
rename from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
rename to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage.layout.xml
index 2ca31ba597..e65db7f26a 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.layout.xml
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage.layout.xml
@@ -18,7 +18,6 @@
        <bs3:row>
                <bs3:col span="10" unreferencedActions="true">
                        <cpt:domainObject />
-                       <cpt:action id="toggleEvents"/>
                </bs3:col>
                <bs3:col span="2">
                        <cpt:fieldSet name="" id="sources" />
@@ -27,9 +26,24 @@
 
        <bs3:row>
                <bs3:col span="6">
+                       <cpt:fieldSet name="Entity" id="entity">
+                               <cpt:property id="entity">
+                                       <cpt:action id="createEntity">
+                                               <cpt:named>Create</cpt:named>
+                                       </cpt:action>
+                                       <cpt:action id="updateEntity">
+                                               <cpt:named>Update</cpt:named>
+                                       </cpt:action>
+                                       <cpt:action id="deleteEntity">
+                                               <cpt:named>Delete</cpt:named>
+                                       </cpt:action>
+                               </cpt:property>
+                       </cpt:fieldSet>
                        <cpt:fieldSet name="Other" id="other" 
unreferencedProperties="true"/>
-                       <cpt:collection id="objects">
-                               <cpt:action id="updateName"/>
+                       <cpt:collection id="events" paged="20">
+                               <cpt:action id="clearEvents">
+                                       <cpt:named>Clear</cpt:named>
+                               </cpt:action>
                        </cpt:collection>
                </bs3:col>
                <bs3:col span="6">
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_clearEvents.java
similarity index 54%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_clearEvents.java
index 6b846797ec..78b46c4a18 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_clearEvents.java
@@ -18,28 +18,30 @@
  */
 package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
 
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom._infra.values.ValueHolder;
+import demoapp.dom._infra.values.ValueHolderRepository;
+import demoapp.dom.types.Samples;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
 
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import javax.inject.Inject;
 
-@SuppressWarnings("CdiManagedBeanInconsistencyInspection")
-public abstract class DomainObjectXxxLifecycleEvent
-        implements
-        HasAsciiDocDescription,
-        ValueHolder<String> {
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.annotation.SemanticsOf;
 
-    @ObjectSupport
-    public String title() {
-        return getName();
-    }
 
-    @Override
-    public String value() {
-        return getName();
-    }
+//tag::class[]
+@Action(semantics = SemanticsOf.IDEMPOTENT)
+@RequiredArgsConstructor
+public class DomainObjectXxxLifecycleEventPage_clearEvents {
 
-    public abstract String getName();
-    public abstract void setName(String value);
+    private final DomainObjectXxxLifecycleEventPage page;
+
+    @MemberSupport public DomainObjectXxxLifecycleEventPage act() {
+        subscriber.events.clear();
+        return page;
+    }
 
+    @Inject DomainObjectXxxLifecycleEventSubscriber subscriber;
 }
+//end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_createEntity.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_createEntity.java
new file mode 100644
index 0000000000..3014369c97
--- /dev/null
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_createEntity.java
@@ -0,0 +1,60 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
+
+import demoapp.dom._infra.values.ValueHolderRepository;
+import demoapp.dom.domain.objects.DomainObject.aliased.DomainObjectAliased;
+import 
demoapp.dom.domain.objects.DomainObject.xxxDomainEvent.DomainObjectXxxDomainEventPage;
+import demoapp.dom.types.Samples;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import javax.inject.Inject;
+
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.annotation.SemanticsOf;
+import org.apache.causeway.applib.util.ReasonBuffer;
+import org.apache.causeway.applib.util.ReasonBuffer2;
+import org.apache.causeway.applib.util.Reasons;
+
+
+//tag::class[]
+@Action(semantics = SemanticsOf.NON_IDEMPOTENT)
+@RequiredArgsConstructor
+public class DomainObjectXxxLifecycleEventPage_createEntity {
+
+    private final DomainObjectXxxLifecycleEventPage page;
+
+    @MemberSupport public DomainObjectXxxLifecycleEventPage act(final String 
text) {
+        val entity = objectRepository.create(text);
+        page.setEntity(entity);
+        return page;
+    }
+    @MemberSupport public String default0Act() {
+        return samples.single();
+    }
+    @MemberSupport public String disableAct() {
+        return page.getEntity() != null ? "Entity already created" : null;
+    }
+
+    @Inject ValueHolderRepository<String, ? extends 
DomainObjectXxxLifecycleEvent> objectRepository;
+    @Inject Samples<String> samples;
+}
+//end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_deleteEntity.java
similarity index 50%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_deleteEntity.java
index c1d2d71ee6..8b1da81200 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_deleteEntity.java
@@ -18,30 +18,32 @@
  */
 package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
 
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolderRepository;
+import demoapp.dom.types.Samples;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
 
-import javax.inject.Named;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
+import javax.inject.Inject;
+
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.annotation.SemanticsOf;
 
-import org.apache.causeway.applib.annotation.DomainObject;
-import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
 
 //tag::class[]
-@XmlRootElement(name = "root")
-@XmlType
-@XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.DomainObjectXxxLifecyleEventPage")
-@DomainObject(
-        nature = Nature.VIEW_MODEL)
-public class DomainObjectXxxLifecyleEventPage implements 
HasAsciiDocDescription {
+@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
+@RequiredArgsConstructor
+public class DomainObjectXxxLifecycleEventPage_deleteEntity {
 
-    @ObjectSupport public String title() {
-        return "DomainObject#xxxLifecyleEvent";
+    private final DomainObjectXxxLifecycleEventPage page;
+    @MemberSupport public DomainObjectXxxLifecycleEventPage act() {
+        objectRepository.remove(page.getEntity());
+        return page;
+    }
+    @MemberSupport public String disableAct() {
+        return page.getEntity() == null ? "Entity not yet created" : null;
     }
 
+    @Inject ValueHolderRepository<String, ? extends 
DomainObjectXxxLifecycleEvent> objectRepository;
 }
 //end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_events.java
similarity index 60%
copy from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
copy to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_events.java
index 6b846797ec..54af9cb71d 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEvent.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_events.java
@@ -18,28 +18,27 @@
  */
 package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
 
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom._infra.values.ValueHolder;
+import lombok.RequiredArgsConstructor;
 
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import java.util.List;
 
-@SuppressWarnings("CdiManagedBeanInconsistencyInspection")
-public abstract class DomainObjectXxxLifecycleEvent
-        implements
-        HasAsciiDocDescription,
-        ValueHolder<String> {
+import javax.inject.Inject;
 
-    @ObjectSupport
-    public String title() {
-        return getName();
-    }
+import org.apache.causeway.applib.annotation.Collection;
+import org.apache.causeway.applib.annotation.MemberSupport;
 
-    @Override
-    public String value() {
-        return getName();
-    }
 
-    public abstract String getName();
-    public abstract void setName(String value);
+//tag::class[]
+@Collection
+@RequiredArgsConstructor
+public class DomainObjectXxxLifecycleEventPage_events {
+
+    private final DomainObjectXxxLifecycleEventPage page;
+
+    @MemberSupport public List<DomainObjectLifecycleEventVm> coll() {
+        return subscriber.events;
+    }
 
+    @Inject DomainObjectXxxLifecycleEventSubscriber subscriber;
 }
+//end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_updateEntity.java
similarity index 50%
rename from 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
rename to 
examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_updateEntity.java
index c1d2d71ee6..7947f89340 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventPage_updateEntity.java
@@ -18,30 +18,34 @@
  */
 package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
 
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import demoapp.dom._infra.values.ValueHolderRepository;
+import demoapp.dom.types.Samples;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
 
-import javax.inject.Named;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
+import javax.inject.Inject;
+
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.annotation.SemanticsOf;
 
-import org.apache.causeway.applib.annotation.DomainObject;
-import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
 
 //tag::class[]
-@XmlRootElement(name = "root")
-@XmlType
-@XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.DomainObjectXxxLifecyleEventPage")
-@DomainObject(
-        nature = Nature.VIEW_MODEL)
-public class DomainObjectXxxLifecyleEventPage implements 
HasAsciiDocDescription {
+@Action(semantics = SemanticsOf.IDEMPOTENT)
+@RequiredArgsConstructor
+public class DomainObjectXxxLifecycleEventPage_updateEntity {
 
-    @ObjectSupport public String title() {
-        return "DomainObject#xxxLifecyleEvent";
-    }
+    private final DomainObjectXxxLifecycleEventPage page;
 
+    @MemberSupport public DomainObjectXxxLifecycleEventPage act(final String 
text) {
+        page.getEntity().setName(text);
+        return page;
+    }
+    @MemberSupport public String default0Act() {
+        return page.getEntity().getName();
+    }
+    @MemberSupport public String disableAct() {
+        return page.getEntity() == null ? "Entity not yet created" : null;
+    }
 }
 //end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventSubscriber.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventSubscriber.java
new file mode 100644
index 0000000000..ec2d41f4c0
--- /dev/null
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecycleEventSubscriber.java
@@ -0,0 +1,55 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package demoapp.dom.domain.objects.DomainObject.xxxLifecycleEvent;
+
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.causeway.applib.services.bookmark.Bookmark;
+import org.apache.causeway.applib.services.bookmark.BookmarkService;
+import org.apache.causeway.applib.services.registry.ServiceRegistry;
+import org.springframework.context.event.EventListener;
+import org.springframework.stereotype.Service;
+
+// tag::class[]
+@Service
+@RequiredArgsConstructor(onConstructor_ = {@Inject})
+class DomainObjectXxxLifecycleEventSubscriber {
+
+    final BookmarkService bookmarkService;
+
+    @EventListener(DomainObjectXxxLifecycleEvent.LifecycleEvent.class)  // <.>
+    public void on(DomainObjectXxxLifecycleEvent.LifecycleEvent ev) {   // <1>
+        val vm = new DomainObjectLifecycleEventVm(
+                ev.getClass().getSimpleName(),
+                
bookmarkService.bookmarkFor(ev.getSource()).map(Bookmark::toString).orElse(null)
+        );
+        events.add(0, vm);                                              // <.>
+    }
+
+    List<DomainObjectLifecycleEventVm> events = new LinkedList<>();
+
+}
+// end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage-description.adoc
deleted file mode 100644
index de341e26e9..0000000000
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/DomainObjectXxxLifecyleEventPage-description.adoc
+++ /dev/null
@@ -1,47 +0,0 @@
-:Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or ag [...]
-
-
-== createdLifecycleEvent
-
-Indicates that the loading of the domain object should be posted to the 
org.apache.causeway.applib.services.eventbus.EventBusService event bus using a 
custom (subclass of) ObjectCreatedEvent .
-
-This subclass must provide a no-arg constructor; the fields are set 
reflectively.
-
-== persistingLifecycleEvent
-
-Indicates that the loading of the domain object should be posted to the 
org.apache.causeway.applib.services.eventbus.EventBusService event bus using a 
custom (subclass of) ObjectPersistingEvent .
-
-This subclass must provide a no-arg constructor; the fields are set 
reflectively.
-
-== persistedLifecycleEvent
-
-Indicates that the loading of the domain object should be posted to the 
org.apache.causeway.applib.services.eventbus.EventBusService event bus using a 
custom (subclass of) ObjectPersistedEvent .
-
-This subclass must provide a no-arg constructor; the fields are set 
reflectively.
-
-== loadedLifecycleEvent
-
-Indicates that the loading of the domain object should be posted to the 
org.apache.causeway.applib.services.eventbus.EventBusService event bus using a 
custom (subclass of) ObjectLoadedEvent .
-
-This subclass must provide a no-arg constructor; the fields are set 
reflectively.
-
-== updatingLifecycleEvent
-
-Indicates that the loading of the domain object should be posted to the 
org.apache.causeway.applib.services.eventbus.EventBusService event bus using a 
custom (subclass of) ObjectUpdatingEvent .
-
-This subclass must provide a no-arg constructor; the fields are set 
reflectively.
-
-== updatedLifecycleEvent
-
-Indicates that the loading of the domain object should be posted to the 
org.apache.causeway.applib.services.eventbus.EventBusService event bus using a 
custom (subclass of) ObjectUpdatedEvent .
-
-This subclass must provide a no-arg constructor; the fields are set 
reflectively.
-
-== removingLifecycleEvent
-
-Indicates that the loading of the domain object should be posted to the 
org.apache.causeway.applib.services.eventbus.EventBusService event bus using a 
custom (subclass of) ObjectRemovingEvent .
-
-This subclass must provide a no-arg constructor; the fields are set 
reflectively.
-
-
-
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa-description.adoc
index 4b4548b0b1..068fdbba79 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa-description.adoc
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa-description.adoc
@@ -1,11 +1,11 @@
 :Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or ag [...]
 
-This domain class ...
+This domain class inherits from the superclass that is annotated with the 
various lifecycle events:
 
 [source,java,indent=0]
 .DomainObjectXxxLifecycleEvent.java
 ----
 include::../DomainObjectXxxLifecycleEvent.java[tags=class]
 ----
-<.> ...
+<.> ..cr
 
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa.java
index 0822d283d9..7d09405658 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObject/xxxLifecycleEvent/jpa/DomainObjectXxxLifecycleEventJpa.java
@@ -25,9 +25,12 @@ import lombok.Setter;
 
 import javax.inject.Named;
 import javax.persistence.*;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 import org.apache.causeway.applib.annotation.DomainObject;
 import org.apache.causeway.applib.annotation.Nature;
+import org.apache.causeway.applib.events.lifecycle.*;
+import org.apache.causeway.applib.jaxb.PersistentEntityAdapter;
 import 
org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener;
 import org.springframework.context.annotation.Profile;
 
@@ -45,6 +48,7 @@ import org.springframework.context.annotation.Profile;
 @DomainObject(nature = Nature.ENTITY)
 public class DomainObjectXxxLifecycleEventJpa
                 extends DomainObjectXxxLifecycleEvent {
+
     // ...
 //end::class[]
 

Reply via email to