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/10/21 15:01:00 UTC

[06/44] 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/87966d8f
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/87966d8f
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/87966d8f

Branch: refs/heads/master
Commit: 87966d8f0a0efabe69e7fad414b380d514c3081f
Parents: b12d2ac
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:06:04 2016 +0100

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


http://git-wip-us.apache.org/repos/asf/isis/blob/87966d8f/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