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 2016/04/26 20:24:36 UTC

[1/6] isis git commit: ISIS-1392: Extend RepositoryService with persistAndFlush(...) and removeAndFlush(...) methods

Repository: isis
Updated Branches:
  refs/heads/master e5d8d9178 -> 9455c078e


ISIS-1392: Extend RepositoryService with persistAndFlush(...) and removeAndFlush(...) methods


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f6e3835c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f6e3835c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f6e3835c

Branch: refs/heads/master
Commit: f6e3835c035ebeb8d007d6a6134f64086d93a375
Parents: 474cb71
Author: Oscar Bou <os...@apache.org>
Authored: Sun Apr 24 23:29:52 2016 +0200
Committer: Oscar Bou <os...@apache.org>
Committed: Sun Apr 24 23:29:52 2016 +0200

----------------------------------------------------------------------
 .../services/repository/RepositoryService.java     | 17 +++++++++++++++--
 .../repository/RepositoryServiceDefault.java       | 14 ++++++++++++++
 2 files changed, 29 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/f6e3835c/core/applib/src/main/java/org/apache/isis/applib/services/repository/RepositoryService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/repository/RepositoryService.java b/core/applib/src/main/java/org/apache/isis/applib/services/repository/RepositoryService.java
index 60f2adc..49cbe08 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/repository/RepositoryService.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/repository/RepositoryService.java
@@ -70,10 +70,17 @@ public interface RepositoryService {
      *
      * @see org.apache.isis.applib.DomainObjectContainer#newTransientInstance(Class)
      * @see #isPersistent(Object)
-     * @see #persist(Object)
      */
     @Programmatic
     void persist(Object domainObject);
+    
+    /**
+     * Persist the specified object (or do nothing if already persistent) and flushes changes to the database.
+     *
+     * @see #persist(Object)
+     */
+    @Programmatic
+    void persistAndFlush(Object domainObject);
 
     /**
      * Deletes the domain object but only if is persistent.
@@ -83,7 +90,13 @@ public interface RepositoryService {
     @Programmatic
     void remove(Object domainObject);
 
-
+    /**
+     * Deletes the domain object but only if is persistent, and flushes changes to the database.
+     *
+     * @param domainObject
+     */
+    @Programmatic
+    void removeAndFlush(Object domainObject);
 
     /**
      * Returns all the instances of the specified type (including subtypes).

http://git-wip-us.apache.org/repos/asf/isis/blob/f6e3835c/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/repository/RepositoryServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/repository/RepositoryServiceDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/repository/RepositoryServiceDefault.java
index 73c62fa..5d9ed76 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/repository/RepositoryServiceDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/repository/RepositoryServiceDefault.java
@@ -100,6 +100,13 @@ public class RepositoryServiceDefault
         }
         persistenceSessionService.makePersistent(adapter);
     }
+    
+    @Programmatic
+    @Override
+    public void persistAndFlush(final Object object) {
+	persist(object);
+	transactionService.flushTransaction();
+    }
 
     @Override
     @Programmatic
@@ -121,6 +128,13 @@ public class RepositoryServiceDefault
 
         persistenceSessionService.remove(adapter);
     }
+    
+    @Override
+    @Programmatic
+    public void removeAndFlush(final Object domainObject) {
+        remove(domainObject);
+	transactionService.flushTransaction();
+    }
 
 
     // //////////////////////////////////////


[2/6] isis git commit: ISIS-1392: updating documentation detailing the use case for managed relationships

Posted by da...@apache.org.
ISIS-1392: updating documentation detailing the use case for managed relationships


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5722c0bc
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5722c0bc
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5722c0bc

Branch: refs/heads/master
Commit: 5722c0bc44401efde2da80301604df5a9ea0c9f1
Parents: f6e3835
Author: Oscar Bou <os...@apache.org>
Authored: Sun Apr 24 23:48:10 2016 +0200
Committer: Oscar Bou <os...@apache.org>
Committed: Sun Apr 24 23:48:10 2016 +0200

----------------------------------------------------------------------
 .../guides/_rgsvc_api_RepositoryService.adoc    | 120 ++++++++++++++++---
 1 file changed, 106 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5722c0bc/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
index 51a6326..9f33e5d 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
@@ -30,18 +30,20 @@ public interface RepositoryService {
 
     boolean isPersistent(Object domainObject);                                              // <2>
     void persist(Object domainObject);                                                      // <3>
-    void remove(Object persistentDomainObject);                                             // <4>
+    void persistAndFlush(Object domainObject);                                              // <4>
+    void remove(Object persistentDomainObject);                                             // <5>
+    void removeAndFlush(Object persistentDomainObject);                                     // <6>
 
-    <T> List<T> allInstances(Class<T> ofType, long... range);                               // <5>
+    <T> List<T> allInstances(Class<T> ofType, long... range);                               // <7>
 
-    <T> List<T> allMatches(Query<T> query);                                                 // <6>
-    <T> List<T> allMatches(Class<T> ofType, Predicate<? super T> predicate, long... range); // <7>
+    <T> List<T> allMatches(Query<T> query);                                                 // <8>
+    <T> List<T> allMatches(Class<T> ofType, Predicate<? super T> predicate, long... range); // <9>
 
-    <T> T uniqueMatch(Query<T> query);                                                      // <8>
-    <T> T uniqueMatch(final Class<T> ofType, final Predicate<T> predicate);                 // <9>
+    <T> T uniqueMatch(Query<T> query);                                                      // <10>
+    <T> T uniqueMatch(final Class<T> ofType, final Predicate<T> predicate);                 // <11>
 
-    <T> T firstMatch(Query<T> query);                                                       // <10>
-    <T> T firstMatch(final Class<T> ofType, final Predicate<T> predicate);                  // <11>
+    <T> T firstMatch(Query<T> query);                                                       // <12>
+    <T> T firstMatch(final Class<T> ofType, final Predicate<T> predicate);                  // <13>
 
 }
 ----
@@ -50,14 +52,16 @@ xref:rgsvc.adoc#_rgsvc_api_FactoryService[`FactoryService`]'s `instantiate(...)`
 ``RepositoryService``'s API too because instantiating and persisting objects are often done together.
 <2> test whether a particular domain object is persistent or not
 <3> persist (ie save) an object to the persistent object store (or do nothing if it is already persistent).
-<4> remove (ie delete) an object from the persistent object store (or do nothing if it has already been deleted).
-<5> return all persisted instances of specified type.  Mostly for prototyping, though can be useful to obtain all instances of domain entities if the number is known to be small.  The optional varargs parameters are for paging control; more on this below.
-<6> all persistence instances matching the specified `Query`.  Query itself is an Isis abstraction on top of JDO/DataNucleus' Query API.  *This is the primary API used for querying*
-<7> As the previous, but with client-side filtering using a `Predicate`.  Only really intended for prototyping.
-<8> Returns the first instance that matches the supplied query.  If no instance is found then `null `will be returned, while if there is more that one instances a run-time exception will be thrown.  Generally this method is preferred for looking up an object by its (primary or alternate) key.
+<4> persistAndFlush (ie save and flush) same as "persist()", but also flushes changes to database and updates managed properties and collections (i.e., 1-1, 1-n, m-n relationships automatically maintained by the Persistence Mechanism - such as DataNucleus -).
+<5> remove (ie delete) an object from the persistent object store (or do nothing if it has already been deleted).
+<6> remove (ie delete and flush) same as "remove()", but also flushes changes to database and updates managed properties and collections (i.e., 1-1, 1-n, m-n relationships automatically maintained by the Persistence Mechanism - such as DataNucleus -). 
+<7> return all persisted instances of specified type.  Mostly for prototyping, though can be useful to obtain all instances of domain entities if the number is known to be small.  The optional varargs parameters are for paging control; more on this below.
+<8> all persistence instances matching the specified `Query`.  Query itself is an Isis abstraction on top of JDO/DataNucleus' Query API.  *This is the primary API used for querying*
 <9> As the previous, but with client-side filtering using a `Predicate`.  Only really intended for prototyping.
-<10> Returns the first instance that matches the supplied query.  If no instance is found then `null `will be returned.  No exception is thrown if more than one matches, so this is less strict that `uniqueMatch(...)`.
+<10> Returns the first instance that matches the supplied query.  If no instance is found then `null `will be returned, while if there is more that one instances a run-time exception will be thrown.  Generally this method is preferred for looking up an object by its (primary or alternate) key.
 <11> As the previous, but with client-side filtering using a `Predicate`.  Only really intended for prototyping.
+<12> Returns the first instance that matches the supplied query.  If no instance is found then `null `will be returned.  No exception is thrown if more than one matches, so this is less strict that `uniqueMatch(...)`.
+<13> As the previous, but with client-side filtering using a `Predicate`.  Only really intended for prototyping.
 
 
 The `uniqueMatch(...)` methods are the recommended way of querying for (precisely) one instance.  The `firstMatch(...)` methods are for less strict querying.
@@ -68,6 +72,94 @@ The `uniqueMatch(...)` methods are the recommended way of querying for (precisel
 This section briefly discusses how application code can use these APIs.
 
 
+=== "persistAndFlush(..)", "removeAndFlush(...)"
+
+In some cases, such as when using Managed Properties and Collections for implementing 1-1, 1-n, or m-n relationships, the user needs to invoke "flush()" to send the changes to the persistence mechanism (such as JDO/DataNucleus).
+Then is when the persistence mechanism updates the managed properties and collections.
+ 
+
+[source,java]
+----
+public abstract class Warehouse extends SalesVIPEntity<Marketplace> {
+
+    // {{ ExcludedProducts (Collection)
+    @Persistent(mappedBy = "marketplace", dependentElement = "true")
+    private SortedSet<MarketplaceExcludedProduct> excludedProducts = new TreeSet<MarketplaceExcludedProduct>();
+
+    @MemberOrder(sequence = "1")
+    public SortedSet<MarketplaceExcludedProduct> getExcludedProducts() {
+	return this.excludedProducts;
+    }
+
+    public void setExcludedProducts(
+	    final SortedSet<MarketplaceExcludedProduct> excludedProducts) {
+	this.excludedProducts = excludedProducts;
+    }
+
+    // }}
+
+    // {{ addExcludedProduct (action)
+    @Action(semantics = SemanticsOf.IDEMPOTENT)
+    @MemberOrder(sequence = "1")
+    public MarketplaceExcludedProduct addExcludedProduct(final Product product) {
+	MarketplaceExcludedProduct marketplaceExcludedProduct = this
+		.findExcludedProduct(product);
+	if (marketplaceExcludedProduct == null) {
+	    marketplaceExcludedProduct = this.factoryService
+		    .instantiate(MarketplaceExcludedProduct.class);
+	}
+
+	this.wrap(marketplaceExcludedProduct).setMarketplace(this);
+	this.wrap(marketplaceExcludedProduct).setProduct(product);
+
+	this.repositoryService.persistAndFlush(marketplaceExcludedProduct);  // <— Needed for updating the managed properties and collections.
+
+	return marketplaceExcludedProduct;
+    }
+
+    // }}
+
+    // {{ deleteFromExcludedProducts (action)
+    @Action(semantics = SemanticsOf.IDEMPOTENT)
+    @MemberOrder(sequence = "1")
+    public void deleteFromExcludedProducts(final Product product) {
+	final MarketplaceExcludedProduct marketplaceExcludedProduct = this
+		.findExcludedProduct(product);
+	if (marketplaceExcludedProduct != null) {
+	    this.repositoryService.remove(marketplaceExcludedProduct);
+	    this.flushTransaction();
+	}
+    }
+
+    // }}
+----
+
+On the “addExcludedProduct()” action, if the user don’t flush, this test would fail, as the managed collection would not containing the given product:
+
+[source,java]
+----
+    @Test
+  	public void addExcludedProduct() {
+
+  	    // given
+  	    final AmazonMarketplace amazonMarketplace = this.wrapSkipRules(
+  		    this.marketplaceRepository).findOrCreateAmazonMarketplace(
+  			    AmazonMarketplaceLocation.FRANCE);
+  	    
+	    final Product product = this.wrap(this.productRepository)
+		    .createProduct(UUID.randomUUID().toString(),
+			    UUID.randomUUID().toString());
+  	    
+  	    // when
+  	    this.wrap(amazonMarketplace).addExcludedProduct(product);
+
+  	    // then
+  	    Assertions.assertThat(this.wrapSkipRules(amazonMarketplace).findAllProductsExcluded()).contains(product); // <-- this would fail.
+
+  	}
+  	
+----
+
 === Query
 
 [source,java]


[5/6] isis git commit: Merge branch 'ISIS-1392_pr-43'

Posted by da...@apache.org.
Merge branch 'ISIS-1392_pr-43'


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/bcca867a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/bcca867a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/bcca867a

Branch: refs/heads/master
Commit: bcca867a2ee755fa1e61eabb927ab3d0d41ab48b
Parents: e5d8d91 78b70ad
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Apr 26 19:01:21 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Apr 26 19:01:21 2016 +0100

----------------------------------------------------------------------
 .../guides/_rgsvc_api_RepositoryService.adoc    | 118 ++++++++++++++++---
 .../services/repository/RepositoryService.java  |  17 ++-
 .../repository/RepositoryServiceDefault.java    |  14 +++
 3 files changed, 129 insertions(+), 20 deletions(-)
----------------------------------------------------------------------



[4/6] isis git commit: ISIS-1392: minor edits to updated docs

Posted by da...@apache.org.
ISIS-1392: minor edits to updated docs


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/78b70ade
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/78b70ade
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/78b70ade

Branch: refs/heads/master
Commit: 78b70ade82bf5e398783343a1a710e7dba6bb1cf
Parents: 219e63a
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Apr 26 19:01:04 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Apr 26 19:01:04 2016 +0100

----------------------------------------------------------------------
 .../guides/_rgsvc_api_RepositoryService.adoc    | 152 +++++++++----------
 1 file changed, 71 insertions(+), 81 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/78b70ade/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
index 9f33e5d..5aafe76 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_RepositoryService.adoc
@@ -25,12 +25,12 @@ The API of `RepositoryService` is:
 [source,java]
 ----
 public interface RepositoryService {
-
     <T> T instantiate(final Class<T> ofType);                                               // <1>
 
     boolean isPersistent(Object domainObject);                                              // <2>
     void persist(Object domainObject);                                                      // <3>
     void persistAndFlush(Object domainObject);                                              // <4>
+
     void remove(Object persistentDomainObject);                                             // <5>
     void removeAndFlush(Object persistentDomainObject);                                     // <6>
 
@@ -44,7 +44,6 @@ public interface RepositoryService {
 
     <T> T firstMatch(Query<T> query);                                                       // <12>
     <T> T firstMatch(final Class<T> ofType, final Predicate<T> predicate);                  // <13>
-
 }
 ----
 <1> create a new non-persisted domain entity.  This is identical to
@@ -52,9 +51,9 @@ xref:rgsvc.adoc#_rgsvc_api_FactoryService[`FactoryService`]'s `instantiate(...)`
 ``RepositoryService``'s API too because instantiating and persisting objects are often done together.
 <2> test whether a particular domain object is persistent or not
 <3> persist (ie save) an object to the persistent object store (or do nothing if it is already persistent).
-<4> persistAndFlush (ie save and flush) same as "persist()", but also flushes changes to database and updates managed properties and collections (i.e., 1-1, 1-n, m-n relationships automatically maintained by the Persistence Mechanism - such as DataNucleus -).
+<4> (`1.13.0-SNAPSHOT`) persist (ie save) and flush; same as `persist()`, but also flushes changes to database and updates managed properties and collections (i.e., 1-1, 1-n, m-n relationships automatically maintained by the DataNucleus persistence mechanism).
 <5> remove (ie delete) an object from the persistent object store (or do nothing if it has already been deleted).
-<6> remove (ie delete and flush) same as "remove()", but also flushes changes to database and updates managed properties and collections (i.e., 1-1, 1-n, m-n relationships automatically maintained by the Persistence Mechanism - such as DataNucleus -). 
+<6> (`1.13.0-SNAPSHOT`) remove (delete) and flush;  same as `remove()`, but also flushes changes to database and updates managed properties and collections (i.e., 1-1, 1-n, m-n relationships automatically maintained by the DataNucleus persistence mechanism).
 <7> return all persisted instances of specified type.  Mostly for prototyping, though can be useful to obtain all instances of domain entities if the number is known to be small.  The optional varargs parameters are for paging control; more on this below.
 <8> all persistence instances matching the specified `Query`.  Query itself is an Isis abstraction on top of JDO/DataNucleus' Query API.  *This is the primary API used for querying*
 <9> As the previous, but with client-side filtering using a `Predicate`.  Only really intended for prototyping.
@@ -69,113 +68,104 @@ The `uniqueMatch(...)` methods are the recommended way of querying for (precisel
 
 == Usage
 
-This section briefly discusses how application code can use these APIs.
+This section briefly discusses how application code can use (some of) these APIs.
 
 
-=== "persistAndFlush(..)", "removeAndFlush(...)"
-
-In some cases, such as when using Managed Properties and Collections for implementing 1-1, 1-n, or m-n relationships, the user needs to invoke "flush()" to send the changes to the persistence mechanism (such as JDO/DataNucleus).
-Then is when the persistence mechanism updates the managed properties and collections.
- 
+=== Persist
 
 [source,java]
 ----
-public abstract class Warehouse extends SalesVIPEntity<Marketplace> {
+Customer cust = repositoryService.instantiate(Customer.class);
+cust.setFirstName("Freddie");
+cust.setLastName("Mercury");
+repositoryService.persist(cust);
+----
 
-    // {{ ExcludedProducts (Collection)
-    @Persistent(mappedBy = "marketplace", dependentElement = "true")
-    private SortedSet<MarketplaceExcludedProduct> excludedProducts = new TreeSet<MarketplaceExcludedProduct>();
+You should be aware that by default Apache Isis queues up calls to `#persist()` and `#remove()`.  These are then executed either when the request completes (and the transaction commits), or if the queue is flushed.  This can be done either implicitly by the framework, or as the result of a direct call to `#flush()`.
 
-    @MemberOrder(sequence = "1")
-    public SortedSet<MarketplaceExcludedProduct> getExcludedProducts() {
-	return this.excludedProducts;
-    }
+By default the framework itself will cause `#flush()` to be called whenever a query is executed by way of `#allMatches(Query)`, as documented xref:rgsvc.adoc#_rgsvc_api_DomainObjectContainer_generic-repository-api[above].  However, this behaviour can be disabled using the  xref:rgcfg.adoc#_rgcfg_configuring-core[configuration property] `isis.services.container.disableAutoFlush`.
 
-    public void setExcludedProducts(
-	    final SortedSet<MarketplaceExcludedProduct> excludedProducts) {
-	this.excludedProducts = excludedProducts;
-    }
 
-    // }}
 
-    // {{ addExcludedProduct (action)
+=== `persistAndFlush(...)`, `removeAndFlush(...)`
+
+In some cases, such as when using managed properties and collections for implementing 1-1, 1-n, or m-n relationships,
+the developer needs to invoke `flush()` to send the changes to the DataNucleus persistence mechanism.  These
+managed properties and collections and then updated.
+
+The `persistAndFlush(...)` and `removeAndFlush(...)` methods (introduced in `1.13.0-SNAPSHOT`) save the developer from
+having to call the `flush(...)` method.
+
+For example, the following code requires a flush to occur, so uses these methods:
+
+[source,java]
+----
+public abstract class Warehouse extends SalesVIPEntity<Marketplace> {
+
+    @Persistent(mappedBy = "marketplace", dependentElement = "true")
+    @Getter @Setter                                                             // <1>
+    private SortedSet<MarketplaceExcludedProduct> excludedProducts =
+                            new TreeSet<MarketplaceExcludedProduct>();
+
     @Action(semantics = SemanticsOf.IDEMPOTENT)
-    @MemberOrder(sequence = "1")
     public MarketplaceExcludedProduct addExcludedProduct(final Product product) {
-	MarketplaceExcludedProduct marketplaceExcludedProduct = this
-		.findExcludedProduct(product);
-	if (marketplaceExcludedProduct == null) {
-	    marketplaceExcludedProduct = this.factoryService
-		    .instantiate(MarketplaceExcludedProduct.class);
-	}
-
-	this.wrap(marketplaceExcludedProduct).setMarketplace(this);
-	this.wrap(marketplaceExcludedProduct).setProduct(product);
+        MarketplaceExcludedProduct marketplaceExcludedProduct = this.findExcludedProduct(product);
+        if (marketplaceExcludedProduct == null) {
+            marketplaceExcludedProduct =
+                this.factoryService.instantiate(MarketplaceExcludedProduct.class);
+        }
 
-	this.repositoryService.persistAndFlush(marketplaceExcludedProduct);  // <— Needed for updating the managed properties and collections.
+        this.wrap(marketplaceExcludedProduct).setMarketplace(this);
+        this.wrap(marketplaceExcludedProduct).setProduct(product);
 
-	return marketplaceExcludedProduct;
+        this.repositoryService.persistAndFlush(marketplaceExcludedProduct);     // <2>
+        return marketplaceExcludedProduct;
     }
 
-    // }}
-
-    // {{ deleteFromExcludedProducts (action)
     @Action(semantics = SemanticsOf.IDEMPOTENT)
-    @MemberOrder(sequence = "1")
     public void deleteFromExcludedProducts(final Product product) {
-	final MarketplaceExcludedProduct marketplaceExcludedProduct = this
-		.findExcludedProduct(product);
-	if (marketplaceExcludedProduct != null) {
-	    this.repositoryService.remove(marketplaceExcludedProduct);
-	    this.flushTransaction();
-	}
+        final MarketplaceExcludedProduct marketplaceExcludedProduct = findExcludedProduct(product);
+        if (marketplaceExcludedProduct != null) {
+            this.repositoryService.removeAndFlush(marketplaceExcludedProduct);
+        }
     }
-
-    // }}
+    ...                                                                         // <3>
+}
 ----
+<1> using lombok for brevity
+<2> Needed for updating the managed properties and collections.
+<3> injected services and other methods ommited
 
-On the “addExcludedProduct()” action, if the user don’t flush, this test would fail, as the managed collection would not containing the given product:
+On the “addExcludedProduct()” action, if the user didn’t flush, the following test would fail because the managed
+collection would not containing the given product:
 
 [source,java]
 ----
-    @Test
-  	public void addExcludedProduct() {
-
-  	    // given
-  	    final AmazonMarketplace amazonMarketplace = this.wrapSkipRules(
-  		    this.marketplaceRepository).findOrCreateAmazonMarketplace(
-  			    AmazonMarketplaceLocation.FRANCE);
-  	    
-	    final Product product = this.wrap(this.productRepository)
-		    .createProduct(UUID.randomUUID().toString(),
-			    UUID.randomUUID().toString());
-  	    
-  	    // when
-  	    this.wrap(amazonMarketplace).addExcludedProduct(product);
-
-  	    // then
-  	    Assertions.assertThat(this.wrapSkipRules(amazonMarketplace).findAllProductsExcluded()).contains(product); // <-- this would fail.
-
-  	}
-  	
-----
+@Test
+public void addExcludedProduct() {
 
-=== Query
+    // given
+    final AmazonMarketplace amazonMarketplace = this.wrapSkipRules(
+        this.marketplaceRepository).findOrCreateAmazonMarketplace(
+            AmazonMarketplaceLocation.FRANCE);
 
-[source,java]
-----
-Customer cust = repositoryService.instantiate(Customer.class);
-cust.setFirstName("Freddie");
-cust.setLastName("Mercury");
-repositoryService.persist(cust);
-----
+    final Product product = this.wrap(this.productRepository)
+        .createProduct(UUID.randomUUID().toString(), UUID.randomUUID().toString());
 
-You should be aware that by default Apache Isis queues up calls to `#persist()` and `#remove()`.  These are then executed either when the request completes (and the transaction commits), or if the queue is flushed.  This can be done either implicitly by the framework, or as the result of a direct call to `#flush()`.
+    // when
+    this.wrap(amazonMarketplace).addExcludedProduct(product);
+
+    // then
+    Assertions.assertThat(
+            this.wrapSkipRules(amazonMarketplace).findAllProductsExcluded()
+        ).contains(product);                                                    // <1>
+}
+----
+<1> this would fail.
 
-By default the framework itself will cause `#flush()` to be called whenever a query is executed by way of `#allMatches(Query)`, as documented xref:rgsvc.adoc#_rgsvc_api_DomainObjectContainer_generic-repository-api[above].  However, this behaviour can be disabled using the  xref:rgcfg.adoc#_rgcfg_configuring-core[configuration property] `isis.services.container.disableAutoFlush`.
 
 
-=== Query
+=== Query and `xxxMatches(...)`
 
 There are various implementations of the `Query` API, but these either duplicate functionality of the other overloads of `allMatches(...)` or they are not supported by the JDO/DataNucleus object store.   The only significant implementation of `Query` to be aware of is `QueryDefault`, which identifies a named query and a set of parameter/argument tuples.
 


[3/6] isis git commit: Merge branch 'ISIS-1392' of https://github.com/oscarbou/isis into ISIS-1392_pr-43

Posted by da...@apache.org.
Merge branch 'ISIS-1392' of https://github.com/oscarbou/isis into ISIS-1392_pr-43


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/219e63ad
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/219e63ad
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/219e63ad

Branch: refs/heads/master
Commit: 219e63addc70ab675e71baaf92a15c64883a3eb2
Parents: e5d8d91 5722c0b
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Apr 26 18:40:08 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Apr 26 18:40:08 2016 +0100

----------------------------------------------------------------------
 .../guides/_rgsvc_api_RepositoryService.adoc    | 120 ++++++++++++++++---
 .../services/repository/RepositoryService.java  |  17 ++-
 .../repository/RepositoryServiceDefault.java    |  14 +++
 3 files changed, 135 insertions(+), 16 deletions(-)
----------------------------------------------------------------------



[6/6] isis git commit: ISIS-1355: fixing the 'fork me on github' link; tiny fix to mvn validate goal docs

Posted by da...@apache.org.
ISIS-1355: fixing the 'fork me on github' link; tiny fix to mvn validate goal docs


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/9455c078
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/9455c078
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/9455c078

Branch: refs/heads/master
Commit: 9455c078e81978150a1309635baabbff0038c907
Parents: bcca867
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Tue Apr 26 19:24:10 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Tue Apr 26 19:24:10 2016 +0100

----------------------------------------------------------------------
 adocs/documentation/src/main/asciidoc/guides/_rgmvn_validate.adoc | 2 +-
 adocs/documentation/src/main/asciidoc/index.html                  | 2 +-
 adocs/template/document.html.erb                                  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/9455c078/adocs/documentation/src/main/asciidoc/guides/_rgmvn_validate.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rgmvn_validate.adoc b/adocs/documentation/src/main/asciidoc/guides/_rgmvn_validate.adoc
index 3a21d2c..56a92f6 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rgmvn_validate.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rgmvn_validate.adoc
@@ -32,7 +32,7 @@ different configuration; see the final section for differences.
 
 == `dom` submodule
 
-Update the `pom.xml` (we recommend in your project's `dom` module, and with a xref:rgmvn.adoc#_rgmvn_intro_app-manifest[minimal AppManifest]:
+Update the `pom.xml` (we recommend in your project's `dom` module, and with a xref:rgmvn.adoc#_rgmvn_intro_app-manifest[minimal AppManifest]):
 
 [source,xml]
 ----

http://git-wip-us.apache.org/repos/asf/isis/blob/9455c078/adocs/documentation/src/main/asciidoc/index.html
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/index.html b/adocs/documentation/src/main/asciidoc/index.html
index 309f90d..3b018a5 100644
--- a/adocs/documentation/src/main/asciidoc/index.html
+++ b/adocs/documentation/src/main/asciidoc/index.html
@@ -351,7 +351,7 @@
 
 <div class="github-fork-ribbon-wrapper right" style="position: fixed;">
     <div class="github-fork-ribbon">
-        <a href="https://github.com/apache/isis/fork">Fork me on GitHub</a>
+        <a href="https://github.com/apache/isis#fork-destination-box">Fork me on GitHub</a>
     </div>
 </div>
 

http://git-wip-us.apache.org/repos/asf/isis/blob/9455c078/adocs/template/document.html.erb
----------------------------------------------------------------------
diff --git a/adocs/template/document.html.erb b/adocs/template/document.html.erb
index 34924f7..cbd19ac 100644
--- a/adocs/template/document.html.erb
+++ b/adocs/template/document.html.erb
@@ -359,7 +359,7 @@
 
 <<div class="github-fork-ribbon-wrapper right" style="position: fixed;">
     <div class="github-fork-ribbon">
-        <a href="https://github.com/apache/isis/fork">Fork me on GitHub</a>
+        <a href="https://github.com/apache/isis#fork-destination-box">Fork me on GitHub</a>
     </div>
 </div>