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

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

commit 6f945d8cf6b80931eb8c9f962d8dfd71ba443047
Author: Dan Haywood <[email protected]>
AuthorDate: Wed May 22 23:34:40 2024 +0100

    Extends PetOwner_persona to set up a 'knownAs' alias
    
    for some of the owners.
---
 .../modules/petowner/dom/petowner/PetOwner.java    |  6 ++++++
 .../modules/petowner/fixture/PetOwner_persona.java | 24 +++++++++++++---------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git 
a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java
 
b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java
index 7fb69a8..d7c341c 100644
--- 
a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java
+++ 
b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.java
@@ -124,6 +124,12 @@ public class PetOwner implements Comparable<PetOwner>, 
CalendarEventable {
     @PropertyLayout(fieldSetId = LayoutConstants.FieldSetId.IDENTITY, sequence 
= "1")
     private String name;
 
+    @Column(length = 40, nullable = true, name = "knownAs")
+    @Getter @Setter
+    @Property(editing = Editing.ENABLED)
+    @PropertyLayout(fieldSetId = LayoutConstants.FieldSetId.IDENTITY, sequence 
= "1.1")
+    private String knownAs;
+
     @Notes
     @Column(length = Notes.MAX_LEN, nullable = true)
     @Getter @Setter
diff --git 
a/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java
 
b/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java
index 6cc80ce..a698ff6 100644
--- 
a/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java
+++ 
b/module-petowner/src/main/java/domainapp/modules/petowner/fixture/PetOwner_persona.java
@@ -30,19 +30,20 @@ import domainapp.modules.petowner.dom.petowner.PetOwner;
 public enum PetOwner_persona
 implements Persona<PetOwner, PetOwner_persona.Builder> {
 
-    JAMAL("Jamal Washington", "jamal.pdf"),
-    CAMILA("Camila González", "camila.pdf"),
-    ARJUN("Arjun Patel", "arjun.pdf"),
-    NIA("Nia Robinson", "nia.pdf"),
-    OLIVIA("Olivia Hartman", "olivia.pdf"),
-    LEILA("Leila Hassan", "leila.pdf"),
-    MATT("Matt Miller", "matt.pdf"),
-    BENJAMIN("Benjamin Thatcher", "benjamin.pdf"),
-    JESSICA("Jessica Raynor", "jessica.pdf"),
-    DANIEL("Daniel Keating", "daniel.pdf");
+    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");
 
     private final String name;
     private final String contentFileName;
+    private final String knownAs;
 
     @Override
     public Builder builder() {
@@ -69,6 +70,9 @@ implements Persona<PetOwner, PetOwner_persona.Builder> {
                 val attachment = new Blob(persona.contentFileName, 
"application/pdf", bytes);
                 petOwner.updateAttachment(attachment);
             }
+            if (persona.knownAs != null) {
+                petOwner.setKnownAs(persona.knownAs);
+            }
 
             
petOwner.setLastCheckedIn(clockService.getClock().nowAsLocalDate().plusDays(fakeDataService.ints().between(-10,
 +10)));
 

Reply via email to