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:57 UTC

[isis-app-demo] 04/05: diables removePet action if the owner has no pets.

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 477de6e11be8eebbd8d0f59514b47bbc79d5db4f
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Oct 3 22:26:49 2021 +0100

    diables removePet action if the owner has no pets.
---
 .../java/petclinic/modules/pets/dom/petowner/PetOwner_removePet.java   | 3 +++
 1 file changed, 3 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 045f14c..97aa8d4 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
@@ -32,6 +32,9 @@ public class PetOwner_removePet {
                 .ifPresent(pet -> repositoryService.remove(pet));
         return petOwner;
     }
+    public String disableAct() {
+        return petRepository.findByPetOwner(petOwner).isEmpty() ? "No pets" : null;
+    }
     public List<String> choices0Act() {
         return petRepository.findByPetOwner(petOwner)
                 .stream()