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 2022/04/22 12:58:01 UTC

[isis-app-demo] 01/01: fixes for master

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

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

commit e06c7b8c77418c620ba376f4563fc9aff4a008eb
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Fri Apr 22 13:57:51 2022 +0100

    fixes for master
---
 .../java/petclinic/modules/pets/dom/petowner/PetOwners.java |  6 ++++--
 pom.xml                                                     |  4 ++--
 .../services/homepage/HomePageViewModel_bookVisit.java      | 13 ++++++++++---
 .../petclinic/webapp/custom/restapi/CustomController.java   |  3 ++-
 .../main/java/petclinic/webapp/quartz/job/SampleJob.java    |  3 ++-
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwners.java b/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwners.java
index 9745cd7..af0e721 100644
--- a/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwners.java
+++ b/module-pets/src/main/java/petclinic/modules/pets/dom/petowner/PetOwners.java
@@ -82,13 +82,15 @@ public class PetOwners {
     @Programmatic
     public void ping() {
         jpaSupportService.getEntityManager(PetOwner.class)
-            .ifSuccess(entityManager -> {
+            .mapSuccess(entityManager -> {
                 final TypedQuery<PetOwner> q = entityManager.createQuery(
                         "SELECT p FROM PetOwner p ORDER BY p.lastName",
                         PetOwner.class)
                     .setMaxResults(1);
                 q.getResultList();
-            });
+                return q;
+            })
+            .ifFailureFail();
     }
 
 
diff --git a/pom.xml b/pom.xml
index e0bc8e4..21aa86c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.apache.isis.app</groupId>
         <artifactId>isis-app-starter-parent</artifactId>
-        <version>2.0.0-M6</version>
+        <version>2.0.0-SNAPSHOT</version>
         <relativePath/>
     </parent>
 
@@ -19,7 +19,7 @@
     <packaging>pom</packaging>
 
     <properties>
-        <isis.version>2.0.0-M6</isis.version>
+        <isis.version>2.0.0-SNAPSHOT</isis.version>
         <java.version>11</java.version>
         <maven-cucumber-reporting.version>5.3.0</maven-cucumber-reporting.version>
         <archunit.version>0.14.1</archunit.version>
diff --git a/webapp/src/main/java/petclinic/webapp/application/services/homepage/HomePageViewModel_bookVisit.java b/webapp/src/main/java/petclinic/webapp/application/services/homepage/HomePageViewModel_bookVisit.java
index bdc1e21..0322f04 100644
--- a/webapp/src/main/java/petclinic/webapp/application/services/homepage/HomePageViewModel_bookVisit.java
+++ b/webapp/src/main/java/petclinic/webapp/application/services/homepage/HomePageViewModel_bookVisit.java
@@ -7,6 +7,8 @@ import java.util.List;
 import javax.inject.Inject;
 
 import org.apache.isis.applib.annotation.Action;
+import org.apache.isis.applib.annotation.Domain;
+import org.apache.isis.applib.annotation.Programmatic;
 import org.apache.isis.applib.services.factory.FactoryService;
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
 
@@ -40,9 +42,14 @@ public class HomePageViewModel_bookVisit {
         if(pet == null) return null;
         return factoryService.mixin(Pet_bookVisit.class, pet).default0Act();
     }
-    public String validate2Act(PetOwner petOwner, Pet pet, LocalDateTime visitAt){
-         return factoryService.mixin(Pet_bookVisit.class, pet).validate0Act(visitAt);
-    }
+
+    // TODO: regression #2 - adding @Domain.Exclude didn't work, same error thrown.
+//    @Domain.Exclude // TODO - regression #1:
+//                    //  [ERROR] Failures:
+//                    //  [ERROR]   ValidateDomainModel_IntegTest.validate:18 petclinic.webapp.application.services.homepage.HomePageViewModel_bookVisit#validate2Act(petclinic.modules.pets.dom.petowner.PetOwner, petclinic.modules.pets.dom.pet.Pet, java.time.LocalDateTime): is public, but orphaned (was not picked up by the framework); reporting orphans, because the class is setup for member introspection, without enforcing annotations
+//    public String validate2Act(PetOwner petOwner, Pet pet, LocalDateTime visitAt){
+//         return factoryService.mixin(Pet_bookVisit.class, pet).validate0Act(visitAt);
+//    }
 
     @Inject PetRepository petRepository;
     @Inject PetOwnerRepository petOwnerRepository;
diff --git a/webapp/src/main/java/petclinic/webapp/custom/restapi/CustomController.java b/webapp/src/main/java/petclinic/webapp/custom/restapi/CustomController.java
index 6d8a095..7d9f633 100644
--- a/webapp/src/main/java/petclinic/webapp/custom/restapi/CustomController.java
+++ b/webapp/src/main/java/petclinic/webapp/custom/restapi/CustomController.java
@@ -41,7 +41,8 @@ class CustomController {
         return interactionService.call(
                 InteractionContext.ofUserWithSystemDefaults(UserMemento.ofName(username)),
                 () -> transactionalProcessor.callWithinCurrentTransactionElseCreateNew(callable))
-                .optionalElseFail(); // re-throws exception that has occurred, if any
+                .ifFailureFail() // re-throws exception that has occurred, if any
+                .getValue();
     }
 
 }
diff --git a/webapp/src/main/java/petclinic/webapp/quartz/job/SampleJob.java b/webapp/src/main/java/petclinic/webapp/quartz/job/SampleJob.java
index 051d71b..7308935 100644
--- a/webapp/src/main/java/petclinic/webapp/quartz/job/SampleJob.java
+++ b/webapp/src/main/java/petclinic/webapp/quartz/job/SampleJob.java
@@ -50,6 +50,7 @@ public class SampleJob implements Job {
         return interactionService.call(
                 InteractionContext.ofUserWithSystemDefaults(UserMemento.ofName(username)),
                 () -> transactionalProcessor.callWithinCurrentTransactionElseCreateNew(callable))
-                .optionalElseFail(); // re-throws exception that has occurred, if any
+                .ifFailureFail() // re-throws exception that has occurred, if any
+                .getValue();
     }
 }