You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2021/10/03 21:28:58 UTC

[isis-app-demo] 05/05: defaults name for removePet if there is only one.

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

danhaywood pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/isis-app-demo.git

commit 01b46a7e110cd654d5d28bb17e8489000baf5ec4
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Oct 3 22:27:49 2021 +0100

    defaults name for removePet if there is only one.
---
 .../java/petclinic/modules/pets/dom/petowner/PetOwner_removePet.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner_removePet.java b/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner_removePet.java
index 97aa8d4..bba2eac 100644
--- a/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner_removePet.java
+++ b/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwner_removePet.java
@@ -41,6 +41,10 @@ public class PetOwner_removePet {
                 .map(Pet::getName)
                 .collect(Collectors.toList());
     }
+    public String default0Act() {
+        List<String> names = choices0Act();
+        return names.size() == 1 ? names.get(0) : null;
+    }
 
     @Inject PetRepository petRepository;
     @Inject RepositoryService repositoryService;