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

ahuber pushed a commit to branch dev/2.0.0-M2
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 4d17b700811bd28a61df1bde26d99617792188a8
Author: Dan Haywood <d...@haywood-associates.co.uk>
AuthorDate: Tue Sep 19 23:02:07 2017 +0100

    ISIS-1728: uses typesafe queries for helloworld
---
 .../runtime/systemusinginstallers/IsisComponentProvider.java     | 1 -
 .../src/main/java/domainapp/dom/impl/HelloWorldObject.java       | 4 +++-
 .../src/main/java/domainapp/dom/impl/HelloWorldObjects.java      | 9 +++++----
 .../java/domainapp/modules/simple/dom/impl/SimpleObjects.java    | 7 +++----
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git 
a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
 
b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
index 471b547..b637fe4 100644
--- 
a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
+++ 
b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProvider.java
@@ -29,7 +29,6 @@ import java.util.stream.Stream;
 
 import javax.annotation.Nullable;
 import javax.jdo.annotations.PersistenceCapable;
-import javax.ws.rs.HEAD;
 
 import com.google.common.base.Function;
 import com.google.common.base.Joiner;
diff --git 
a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
 
b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
index 54a1a35..502b756 100644
--- 
a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
+++ 
b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObject.java
@@ -43,7 +43,6 @@ import org.apache.isis.applib.services.title.TitleService;
 @javax.jdo.annotations.PersistenceCapable(identityType = 
IdentityType.DATASTORE, schema = "helloworld" )
 @javax.jdo.annotations.DatastoreIdentity(strategy = 
IdGeneratorStrategy.IDENTITY, column = "id")
 @javax.jdo.annotations.Version(strategy= VersionStrategy.DATE_TIME, column 
="version")
-@javax.jdo.annotations.Unique(name="HelloWorldObject_name_UNQ", members = 
{"name"})
 @DomainObject(auditing = Auditing.ENABLED)
 @DomainObjectLayout()  // causes UI events to be triggered
 public class HelloWorldObject implements Comparable<HelloWorldObject> {
@@ -52,6 +51,8 @@ public class HelloWorldObject implements 
Comparable<HelloWorldObject> {
         this.name = name;
     }
 
+
+    @javax.jdo.annotations.Unique
     @javax.jdo.annotations.Column(allowsNull = "false", length = 40)
     @Property(editing = Editing.DISABLED)
     @Title(prepend = "Object: ")
@@ -59,6 +60,7 @@ public class HelloWorldObject implements 
Comparable<HelloWorldObject> {
     public String getName() { return name; }
     public void setName(final String name) { this.name = name; }
 
+
     @javax.jdo.annotations.Column(allowsNull = "true", length = 4000)
     @Property(editing = Editing.ENABLED)
     private String notes;
diff --git 
a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObjects.java
 
b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObjects.java
index 92bd565..2c776f5 100644
--- 
a/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObjects.java
+++ 
b/example/application/helloworld/src/main/java/domainapp/dom/impl/HelloWorldObjects.java
@@ -20,7 +20,7 @@ package domainapp.dom.impl;
 
 import java.util.List;
 
-import org.datanucleus.query.typesafe.TypesafeQuery;
+import javax.jdo.JDOQLTypedQuery;
 
 import org.apache.isis.applib.annotation.Action;
 import org.apache.isis.applib.annotation.DomainService;
@@ -31,9 +31,9 @@ import org.apache.isis.applib.annotation.ParameterLayout;
 import org.apache.isis.applib.annotation.RestrictTo;
 import org.apache.isis.applib.annotation.SemanticsOf;
 import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
-import org.apache.isis.applib.services.registry.ServiceRegistry;
 import org.apache.isis.applib.services.repository.RepositoryService;
 
+
 @DomainService(
         nature = NatureOfService.VIEW_MENU_ONLY,
         objectType = "helloworld.HelloWorldObjects"
@@ -52,7 +52,7 @@ public class HelloWorldObjects {
     @Action(semantics = SemanticsOf.SAFE)
     @MemberOrder(sequence = "2")
     public List<HelloWorldObject> findByName(final String name) {
-        TypesafeQuery<HelloWorldObject> q = 
isisJdoSupport.newTypesafeQuery(HelloWorldObject.class);
+        JDOQLTypedQuery<HelloWorldObject> q = 
isisJdoSupport.newTypesafeQuery(HelloWorldObject.class);
         final QHelloWorldObject cand = QHelloWorldObject.candidate();
         q = q.filter(
                 cand.name.indexOf(q.stringParameter("name")).ne(-1)
@@ -64,7 +64,8 @@ public class HelloWorldObjects {
     @Action(semantics = SemanticsOf.SAFE, restrictTo = RestrictTo.PROTOTYPING)
     @MemberOrder(sequence = "3")
     public List<HelloWorldObject> listAll() {
-        return repositoryService.allInstances(HelloWorldObject.class);
+        return isisJdoSupport.newTypesafeQuery(HelloWorldObject.class)
+                .executeList();
     }
 
     @javax.inject.Inject
diff --git 
a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjects.java
 
b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjects.java
index 335f9d0..d77fe47 100644
--- 
a/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjects.java
+++ 
b/example/application/simpleapp/module-simple/src/main/java/domainapp/modules/simple/dom/impl/SimpleObjects.java
@@ -20,7 +20,7 @@ package domainapp.modules.simple.dom.impl;
 
 import java.util.List;
 
-import org.datanucleus.query.typesafe.TypesafeQuery;
+import javax.jdo.JDOQLTypedQuery;
 
 import org.apache.isis.applib.annotation.Action;
 import org.apache.isis.applib.annotation.ActionLayout;
@@ -35,7 +35,6 @@ import org.apache.isis.applib.annotation.SemanticsOf;
 import org.apache.isis.applib.services.eventbus.ActionDomainEvent;
 import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
 import org.apache.isis.applib.services.repository.RepositoryService;
-import org.apache.isis.applib.services.xactn.TransactionService;
 
 @DomainService(
         nature = NatureOfService.VIEW_MENU_ONLY,
@@ -63,7 +62,7 @@ public class SimpleObjects {
             @ParameterLayout(named="Name")
             final String name
     ) {
-        TypesafeQuery<SimpleObject> q = 
isisJdoSupport.newTypesafeQuery(SimpleObject.class);
+        JDOQLTypedQuery<SimpleObject> q = 
isisJdoSupport.newTypesafeQuery(SimpleObject.class);
         final QSimpleObject cand = QSimpleObject.candidate();
         q = q.filter(
                 cand.name.indexOf(q.stringParameter("name")).ne(-1)
@@ -74,7 +73,7 @@ public class SimpleObjects {
 
     @Programmatic
     public SimpleObject findByNameExact(final String name) {
-        TypesafeQuery<SimpleObject> q = 
isisJdoSupport.newTypesafeQuery(SimpleObject.class);
+        JDOQLTypedQuery<SimpleObject> q = 
isisJdoSupport.newTypesafeQuery(SimpleObject.class);
         final QSimpleObject cand = QSimpleObject.candidate();
         q = q.filter(
                 cand.name.eq(q.stringParameter("name"))

-- 
To stop receiving notification emails like this one, please contact
ahu...@apache.org.

Reply via email to