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/08/25 11:07:09 UTC

[3/4] isis git commit: ISIS-1476: updating docs

ISIS-1476: updating docs


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

Branch: refs/heads/master
Commit: 201637501b8c2532a443b66d68544c5363069907
Parents: 882a2ed
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Aug 25 12:04:22 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Aug 25 12:04:22 2016 +0100

----------------------------------------------------------------------
 .../guides/_rgsvc_api_TransactionService.adoc   | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/20163750/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TransactionService.adoc
----------------------------------------------------------------------
diff --git a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TransactionService.adoc b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TransactionService.adoc
index 3c0d7b4..960cd79 100644
--- a/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TransactionService.adoc
+++ b/adocs/documentation/src/main/asciidoc/guides/_rgsvc_api_TransactionService.adoc
@@ -47,6 +47,7 @@ public interface Transaction {
     UUID getTransactionId();            // <1>
     int getSequence();                  // <2>
     void flush();                       // <3>
+    void clearAbortCause();             // <4>
 }
 ----
 <1> is a unique identifier for the interaction/request, as defined by the
@@ -54,7 +55,29 @@ xref:rgcms.adoc#_rgcms_classes_mixins_HasTransactionId[`HasTransactionId`] mixin
 <2> there can actually be multiple transactions within such a request/interaction; the sequence is a (0-based) is used
 to distinguish such.
 <3> as per `TransactionService#flushTransaction()` described above.
+<4> If the cause has been rendered higher up in the stack, then clear the cause so that it won't be picked up and
+rendered elsewhere.
 
+[TIP]
+====
+One place where `clearAboutCause()` may be useful is for application-level handling of SQL integrity exceptions, eg as
+described in link:https://issues.apache.org/jira/browse/ISIS-1476[ISIS-1476]:
+
+[source,java]
+----
+try {
+    // do something...
+} catch (final JDODataStoreException e) {
+    if (Iterables.filter(Throwables.getCausalChain(e),
+        SQLIntegrityConstraintViolationException.class) != null) {
+        // ignore
+        this.transactionService.currentTransaction().clearAbortCause();
+    } else {
+        throw e;
+    }
+}
+----
+====
 
 
 == Implementation