You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2024/05/26 19:42:27 UTC

(causeway-app-petclinic) branch v2 updated (f7b0617 -> 9790f11)

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

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


 discard f7b0617  updates PetOwner's layout, indicating where to render the 'visits' coll.
 discard 4c97fb0  adds 'visits' mixin collection, to view visits of pets of a pet owner.
 discard 51e2239  adds PetOwner_bookVisit mixin action,  to allow visits to be booked
     new 746e853  adds PetOwner_bookVisit mixin action,  to allow visits to be booked
     new 2484c75  adds 'visits' mixin collection, to view visits of pets of a pet owner.
     new 9790f11  updates PetOwner's layout, indicating where to render the 'visits' coll.

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f7b0617)
            \
             N -- N -- N   refs/heads/v2 (9790f11)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../modules/visit/contributions/PetOwner_bookVisit.java     | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)


(causeway-app-petclinic) 02/03: adds 'visits' mixin collection, to view visits of pets of a pet owner.

Posted by da...@apache.org.
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 2484c756ba957e6ffca37e11d6ffce7969c2900b
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun May 26 20:24:37 2024 +0100

    adds 'visits' mixin collection, to view visits of pets of a pet owner.
---
 .../visit/contributions/PetOwner_visits.java       | 35 ++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/module-visit/src/main/java/domainapp/modules/visit/contributions/PetOwner_visits.java b/module-visit/src/main/java/domainapp/modules/visit/contributions/PetOwner_visits.java
new file mode 100644
index 0000000..452b954
--- /dev/null
+++ b/module-visit/src/main/java/domainapp/modules/visit/contributions/PetOwner_visits.java
@@ -0,0 +1,35 @@
+package domainapp.modules.visit.contributions;
+
+import domainapp.modules.petowner.dom.pet.Pet;
+import domainapp.modules.petowner.dom.petowner.PetOwner;
+import domainapp.modules.visit.dom.visit.Visit;
+import domainapp.modules.visit.dom.visit.VisitRepository;
+
+import lombok.RequiredArgsConstructor;
+
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import javax.inject.Inject;
+
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.Collection;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.services.repository.RepositoryService;
+
+@Collection
+@RequiredArgsConstructor
+public class PetOwner_visits {
+
+    private final PetOwner petOwner;
+
+    @MemberSupport
+    public List<Visit> coll() {
+        return visitRepository.findByPetOwner(petOwner);
+    }
+
+    @Inject VisitRepository visitRepository;
+
+}


(causeway-app-petclinic) 03/03: updates PetOwner's layout, indicating where to render the 'visits' coll.

Posted by da...@apache.org.
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 9790f11a35319dd0e564273f6a628a34b718ede8
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun May 26 20:25:08 2024 +0100

    updates PetOwner's layout, indicating where to render the 'visits' coll.
---
 .../java/domainapp/modules/petowner/dom/petowner/PetOwner.layout.xml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.layout.xml b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.layout.xml
index b9a0929..d295583 100644
--- a/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.layout.xml
+++ b/module-petowner/src/main/java/domainapp/modules/petowner/dom/petowner/PetOwner.layout.xml
@@ -70,6 +70,11 @@
                             <cpt:collection id="pets"/>
                         </bs3:col>
                     </bs3:row>
+                    <bs3:row>
+                        <bs3:col span="12">
+                            <cpt:collection id="visits"/>
+                        </bs3:col>
+                    </bs3:row>
                     <cpt:fieldSet name="Content" id="content">
                         <cpt:property id="attachment">
                             <cpt:action id="updateAttachment" position="PANEL"/>


(causeway-app-petclinic) 01/03: adds PetOwner_bookVisit mixin action, to allow visits to be booked

Posted by da...@apache.org.
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 746e85395ef5f7468646d889e42a0680fe3d875a
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun May 26 20:41:29 2024 +0100

    adds PetOwner_bookVisit mixin action,  to allow visits to be booked
    
    
    
    rearranges method order is all
---
 .../visit/contributions/PetOwner_bookVisit.java    | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/module-visit/src/main/java/domainapp/modules/visit/contributions/PetOwner_bookVisit.java b/module-visit/src/main/java/domainapp/modules/visit/contributions/PetOwner_bookVisit.java
new file mode 100644
index 0000000..9b086de
--- /dev/null
+++ b/module-visit/src/main/java/domainapp/modules/visit/contributions/PetOwner_bookVisit.java
@@ -0,0 +1,62 @@
+package domainapp.modules.visit.contributions;
+
+import java.time.LocalDateTime;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.ActionLayout;
+import org.apache.causeway.applib.annotation.MemberSupport;
+import org.apache.causeway.applib.services.clock.ClockService;
+import org.apache.causeway.applib.services.repository.RepositoryService;
+
+import lombok.RequiredArgsConstructor;
+
+import domainapp.modules.petowner.dom.pet.Pet;
+import domainapp.modules.petowner.dom.petowner.PetOwner;
+import domainapp.modules.visit.dom.visit.Visit;
+
+@Action
+@ActionLayout(associateWith = "visits")
+@RequiredArgsConstructor
+public class PetOwner_bookVisit {
+
+    private final PetOwner petOwner;
+
+    @MemberSupport
+    public PetOwner act(Pet pet, LocalDateTime visitAt) {
+        Visit visit = new Visit(pet, visitAt);
+        repositoryService.persistAndFlush(visit);
+        return petOwner;
+    }
+    @MemberSupport
+    public Set<Pet> choices0Act() {
+        return petOwner.getPets();
+    }
+    @MemberSupport
+    public Pet default0Act() {
+        Set<Pet> pets = petOwner.getPets();
+        return pets.size() == 1 ? pets.iterator().next() : null;
+    }
+    @MemberSupport
+    public LocalDateTime default1Act() {
+        return officeHoursTomorrow();
+    }
+    @MemberSupport
+    public String validate1Act(LocalDateTime visitAt) {
+        if (visitAt.isBefore(officeHoursTomorrow())) {
+            return "Must book in the future";
+        }
+        return null;
+    }
+
+    private LocalDateTime officeHoursTomorrow() {
+        return clockService.getClock().nowAsLocalDate().atStartOfDay().plusDays(1).plusHours(9);
+    }
+
+
+    @Inject ClockService clockService;
+    @Inject RepositoryService repositoryService;
+
+}