You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2019/01/09 09:51:36 UTC

[isis] 01/06: ISIS-2033: minor: renaming methods (prefixing 'is')

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

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

commit be336d8d6cc54aff8b18460e710080df08e1f27b
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Jan 9 05:31:31 2019 +0100

    ISIS-2033: minor: renaming methods (prefixing 'is')
    
    Task-Url: https://issues.apache.org/jira/browse/ISIS-2033
---
 .../org/apache/isis/core/runtime/headless/IsisSystem.java  |  2 +-
 .../core/runtime/system/session/IsisSessionFactory.java    | 14 ++++++++++----
 .../restfulobjects/server/resources/ResourceAbstract.java  |  2 +-
 .../webapp/IsisTransactionFilterForRestfulObjects.java     |  4 ++--
 .../wicket/viewer/integration/wicket/LocalizerForIsis.java |  2 +-
 .../viewer/integration/wicket/WebRequestCycleForIsis.java  |  6 +++---
 6 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/headless/IsisSystem.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/headless/IsisSystem.java
index 2367467..2db9a9c 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/headless/IsisSystem.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/headless/IsisSystem.java
@@ -190,7 +190,7 @@ public final class IsisSystem {
     }
 
     public void closeSession() throws Exception {
-        if(isisSessionFactory!=null && isisSessionFactory.inSession()) {
+        if(isisSessionFactory!=null && isisSessionFactory.isInSession()) {
             isisSessionFactory.closeSession();
         }
     }
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
index 07423d0..cadb54b 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/session/IsisSessionFactory.java
@@ -253,12 +253,18 @@ public class IsisSessionFactory {
         return currentSession.getPersistenceSession().getTransactionManager();
     }
 
-    public boolean inSession() {
+    /**
+     * @return whether the calling thread is within the context of an open IsisSession
+     */
+    public boolean isInSession() {
         return getCurrentSession() != null;
     }
 
-    public boolean inTransaction() {
-        if (inSession()) {
+    /**
+     * @return whether the calling thread is within the context of an open IsisTransaction
+     */
+    public boolean isInTransaction() {
+        if (isInSession()) {
             if (getCurrentSession().getCurrentTransaction() != null) {
                 if (!getCurrentSession().getCurrentTransaction().getState().isComplete()) {
                     return true;
@@ -311,7 +317,7 @@ public class IsisSessionFactory {
      */
     public <R> R doInSession(final Callable<R> callable, final AuthenticationSession authenticationSession) {
         final IsisSessionFactory sessionFactory = this;
-        boolean noSession = !sessionFactory.inSession();
+        boolean noSession = !sessionFactory.isInSession();
         try {
             if (noSession) {
                 sessionFactory.openSession(authenticationSession);
diff --git a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
index ddc4fcf..42ab3b0 100644
--- a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
+++ b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/resources/ResourceAbstract.java
@@ -109,7 +109,7 @@ public abstract class ResourceAbstract {
             final Where where,
             final RepresentationService.Intent intent,
             final String urlUnencodedQueryString) {
-        if (!getIsisSessionFactory().inSession()) {
+        if (!getIsisSessionFactory().isInSession()) {
             throw RestfulObjectsApplicationException.create(HttpStatusCode.UNAUTHORIZED);
         }
         if (getAuthenticationSession() == null) {
diff --git a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/webapp/IsisTransactionFilterForRestfulObjects.java b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/webapp/IsisTransactionFilterForRestfulObjects.java
index 8d9c099..8739102 100644
--- a/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/webapp/IsisTransactionFilterForRestfulObjects.java
+++ b/core/viewer-restfulobjects-server/src/main/java/org/apache/isis/viewer/restfulobjects/server/webapp/IsisTransactionFilterForRestfulObjects.java
@@ -42,7 +42,7 @@ public class IsisTransactionFilterForRestfulObjects implements Filter {
     public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
         // no-op if no session available.
         final IsisSessionFactory isisSessionFactory = isisSessionFactoryFrom(request);
-        if(!isisSessionFactory.inSession()) {
+        if(!isisSessionFactory.isInSession()) {
             chain.doFilter(request, response);
             return;
         }
@@ -52,7 +52,7 @@ public class IsisTransactionFilterForRestfulObjects implements Filter {
         try {
             chain.doFilter(request, response);
         } finally {
-            final boolean inTransaction = isisSessionFactory.inTransaction();
+            final boolean inTransaction = isisSessionFactory.isInTransaction();
             if(inTransaction) {
                 // user/logout will have invalidated the current transaction and also persistence session.
                 try {
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/LocalizerForIsis.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/LocalizerForIsis.java
index 94d288e..60b2e28 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/LocalizerForIsis.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/LocalizerForIsis.java
@@ -69,7 +69,7 @@ public class LocalizerForIsis extends Localizer {
     protected String translate(final String key, final Component component) {
         final Class<?> contextClass = determineContextClassElse(component, IsisWicketApplication.class);
         final String context = contextClass.getName();
-        if(getIsisSessionFactory().inSession()) {
+        if(getIsisSessionFactory().isInSession()) {
             return translate(key, context);
         } else {
             return getIsisSessionFactory().doInSession(new Callable<String>() {
diff --git a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java
index b65de5d..badbe7c 100644
--- a/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java
+++ b/core/viewer-wicket-impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java
@@ -135,7 +135,7 @@ public class WebRequestCycleForIsis implements IRequestCycleListener {
             ConcurrencyChecking.reset(ConcurrencyChecking.CHECK);
         }
 
-        if (getIsisSessionFactory().inSession()) {
+        if (getIsisSessionFactory().isInSession()) {
             try {
                 // will commit (or abort) the transaction;
                 // an abort will cause the exception to be thrown.
@@ -166,7 +166,7 @@ public class WebRequestCycleForIsis implements IRequestCycleListener {
      */
     @Override
     public synchronized void onEndRequest(RequestCycle cycle) {
-        if (getIsisSessionFactory().inSession()) {
+        if (getIsisSessionFactory().isInSession()) {
             try {
                 // belt and braces
                 getTransactionManager().endTransaction();
@@ -365,7 +365,7 @@ public class WebRequestCycleForIsis implements IRequestCycleListener {
     }
 
     protected boolean inIsisSession() {
-        return getIsisSessionFactory().inSession();
+        return getIsisSessionFactory().isInSession();
     }
 
     protected AuthenticationSession getAuthenticationSession() {