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

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

commit 74c16b8826c011f1488e1cd9ec70848d9f144921
Author: Dan Haywood <[email protected]>
AuthorDate: Fri May 24 07:11:05 2024 +0100

    CAUSEWAY-2873: 02-05, 03-04
---
 .gitignore                                         |   3 +
 .../petclinic/pages/020-the-petclinic-domain.adoc  |  52 ++++++++-
 .../petclinic/pages/030-petowner-entity.adoc       | 116 +++++++++++++++++++--
 .../modules/petclinic/pages/100-todo.adoc          |   4 +
 4 files changed, 162 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index 69fc1a2cdd..5a54c9a8f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+# Linux
+nohup.out
+
 # IDEA
 .idea
 *.iml
diff --git 
a/antora/components/tutorials/modules/petclinic/pages/020-the-petclinic-domain.adoc
 
b/antora/components/tutorials/modules/petclinic/pages/020-the-petclinic-domain.adoc
index 72d06a82ee..f7b58db22f 100644
--- 
a/antora/components/tutorials/modules/petclinic/pages/020-the-petclinic-domain.adoc
+++ 
b/antora/components/tutorials/modules/petclinic/pages/020-the-petclinic-domain.adoc
@@ -337,6 +337,9 @@ The 
xref:testing:fixtures:about.adoc#personas-and-builders[persona] pattern lets
 
 In this exercise we'll modify the `PetOwners_persona` (copied from 
`SimpleObjects_persona` earlier) to create more realistic data.
 
+We'll also update the existing top-level `DomainAppDemo` fixture script, so 
that it will recreate our new ``PetOwner``s.
+This will allow us to quickly create a whole set of `PetOwner` objects from 
the "Prototyping" menu.
+
 
 === Solution
 
@@ -349,7 +352,50 @@ mvn -pl spring-boot:run
 
 === Tasks
 
-* locate the `PetOwners_persona` class
-* refactor the enum constants and values to create 10 realistic pet owner names
-* (optional) we'll use the associated `.pdf` to store a "veterinary clinic 
service agreement" for each pet owner.
+* locate the `PetOwners_persona` class, and refactor the enum constants and 
values to create 10 realistic pet owner names
++
+[source,java]
+.PetOwners_persona.java
+----
+@RequiredArgsConstructor
+public enum PetOwner_persona
+implements Persona<PetOwner, PetOwner_persona.Builder> {
+
+    JAMAL("Jamal Washington", "jamal.pdf", "J"),
+    CAMILA("Camila González", "camila.pdf", null),
+    ARJUN("Arjun Patel", "arjun.pdf", null),
+    NIA("Nia Robinson", "nia.pdf", null),
+    OLIVIA("Olivia Hartman", "olivia.pdf", null),
+    LEILA("Leila Hassan", "leila.pdf", null),
+    MATT("Matthew Miller", "matt.pdf", "Matt"),
+    BENJAMIN("Benjamin Thatcher", "benjamin.pdf", "Ben"),
+    JESSICA("Jessica Raynor", "jessica.pdf", "Jess"),
+    DANIEL("Daniel Keating", "daniel.pdf", "Dan");
+
+    ...
+}
+----
+
+* create new `.pdf` files each pet owner, to store a "veterinary clinic 
service agreement" for each.
++
+The solution already provides these `.pdf` files, so you might want to borrow 
them.
+
+* locate the `DomainAppDemo` class and update:
++
+[source,java]
+.DomainAppDemo.java
+----
+@Override
+protected void execute(final ExecutionContext ec) {
+    ec.executeChildren(this, moduleWithFixturesService.getTeardownFixture());
+    ec.executeChild(this, new PetOwner_persona.PersistAll());   // <.>
+}
+----
+<.> change to set up ``PetOwner``s (rather than ``SimpleObject``s, as before)
+
+
+Test that you can quickly create a whole set of `PetOwner` objects
+from the "Prototyping" menu:
 
+* "Prototyping > Run Fixture Script" and select "Domain App Demo", or
+* "Prototyping > Recreate Objects and Return First".
diff --git 
a/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc 
b/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc
index a7b0d399fb..d51996df78 100644
--- 
a/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc
+++ 
b/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc
@@ -151,7 +151,6 @@ Comparing `PetOwner` as it is currently defined with our 
domain model, there are
 
 * we still need to add in a `telephoneNumber` property, and an `emailAddress` 
property
 
-
 We'll make these changes in this exercise.
 
 === Solution
@@ -181,22 +180,119 @@ petOwner.setLastVisit(lastVisit);
 <.> The 
xref:refguide:testing:index/fakedata/applib/services/FakeDataService.adoc[FakeDataService]
 provides an easy way to create fake data for testing and prototyping
 <.> It's good practice to use 
xref:refguide:applib:index/services/clock/ClockService.adoc[ClockService], so 
it can be easily mocked in tests
 
-Add the `telephoneNumber` property:
+Now add the two new properties:
 
-* ...
-* ...
+* Add the `telephoneNumber` property:
++
+[source,java]
+.PetOwner.java
+----
+@Column(length = 40, nullable = true, name = "telephoneNumber")
+@Getter @Setter
+@Property(editing = Editing.ENABLED)
+@PropertyLayout(fieldSetId = "contact", sequence = "1.1")   // <.>
+private String telephoneNumber;
+----
+<.> This places the property in a new "contact" fieldset group; we'll define 
that below
 
-Add the `emailAddress` property:
+* and add the `emailAddress` property:
++
+[source,java]
+.PetOwner.java
+----
+@Column(length = 40, nullable = true, name = "emailAddress")
+@Getter @Setter
+@Property(editing = Editing.ENABLED)
+@PropertyLayout(fieldSetId = "contact", sequence = "1.2")
+private String emailAddress;
+----
 
-* ...
-* ...
+And now let's define the referenced "contact" fieldset.
 
+* Locate the associated `.layout.xml` file for `PetOwner`.
+Before the "Details" fieldset, add:
++
+[source,xml]
+.PetOwner.layout.xml
+----
+<bs3:col span="12">
+    <cpt:fieldSet name="Contact" id="contact"/>
+</bs3:col>
+----
+
+TIP: if you make changes to this file then your IDE may be able detect the 
changes automatically.
+For example, with IntelliJ you can use "Reload Changed Classes" menu item.
+
+You can learn more about layout files 
xref:userguide::ui-layout-and-hints.adoc[here].
+
+[#exercise-3-4-list-new-properties-of-PetOwner]
+== Ex 3.4: List-new-properties-of-PetOwner
+
+Several of the actions in the "Pet Owners" menu return lists of ``PetOwner``s; 
the "list" action returns all of them.
+
+When we do this we see only the `name` property of the `PetOwner`.
+Let's update the app to see some other properties we added in the previous 
exercise.
+
+=== Solution
 
-TODO: ideas for future steps:
-- introduce a meta-annotation
-- introduce a custom type for these
+[source,bash]
+----
+git checkout tags/03-04-list-new-properties-of-PetOwner
+mvn clean install
+mvn -pl spring-boot:run
+----
 
+=== Tasks
 
+* Locate the `PetOwner.columnOrder.txt` and make these changes:
++
+[source,text]
+.PetOwner.columnOrder.txt
+----
+name
+telephoneNumber
+emailAddress
+lastVisit
+----
+
+Confirm that "Pet Owners > List" now shows the additional properties as 
columns.
+
+TIP: if you make changes to this file then your IDE may be able detect the 
changes automatically.
+For example, with IntelliJ you can use "Reload Changed Classes" menu item.
+
+You can learn more about layout files 
xref:userguide::ui-layout-and-hints.adoc[here].
+
+
+
+[#exercise-3-5-run-default-fixture-at-startup]
+== Ex 3.5: Run default fixture at startup
+
+Prototyping involves a lot of iteration, meaning make a change, re-run the 
app, in the app re-create some example objects, inspect the result.
+
+One way to create objects is from the Prototyping menu; you might already have 
been doing this.
+
+xxx
+
+=== Solution
+
+[source,bash]
+----
+git checkout tags/03-04-list-new-properties-of-PetOwner
+mvn clean install
+mvn -pl spring-boot:run
+----
+
+=== Tasks
+
+----
+----
+
+----
+----
+
+----
+----
+*UP TO HERE*
 
 [#exercise-3-4-modify-the-menu-action-to-create-petowners]
 == Ex 3.4: Modify the menu action to create PetOwners
diff --git a/antora/components/tutorials/modules/petclinic/pages/100-todo.adoc 
b/antora/components/tutorials/modules/petclinic/pages/100-todo.adoc
new file mode 100644
index 0000000000..a669ffc86b
--- /dev/null
+++ b/antora/components/tutorials/modules/petclinic/pages/100-todo.adoc
@@ -0,0 +1,4 @@
+
+TODO: ideas for future steps:
+- introduce a meta-annotation
+- introduce a custom type for these

Reply via email to