cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [34/51] [abbrv] git commit: updated refs/heads/4.9-bountycastle-daan to d8c42a9
Date Wed, 18 May 2016 11:46:59 GMT
DAO: Rewrite change for method findByIdIncludingRemoved(ID id)

Also change the sibling method findById(final ID id)


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

Branch: refs/heads/4.9-bountycastle-daan
Commit: 39aa0e4f35259f1b4962f0469c82930a3fdac579
Parents: 696440a
Author: Marc-Aurèle Brothier <m@brothier.org>
Authored: Mon May 9 11:39:04 2016 +0200
Committer: Marc-Aurèle Brothier <m@brothier.org>
Committed: Fri May 13 11:01:39 2016 +0200

----------------------------------------------------------------------
 .../src/com/cloud/utils/db/GenericDaoBase.java  | 22 +++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/39aa0e4f/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
----------------------------------------------------------------------
diff --git a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
index 2de161b..f1b8d0d 100644
--- a/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
+++ b/framework/db/src/com/cloud/utils/db/GenericDaoBase.java
@@ -942,12 +942,18 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
     @DB()
     @SuppressWarnings("unchecked")
     public T findById(final ID id) {
+        T result = null;
         if (_cache != null) {
             final Element element = _cache.get(id);
-            return element == null ? lockRow(id, null) : (T)element.getObjectValue();
+            if (element == null) {
+                result = lockRow(id, null);
+            } else {
+                result = (T)element.getObjectValue();
+            }
         } else {
-            return lockRow(id, null);
+            result = lockRow(id, null);
         }
+        return result;
     }
 
     @Override
@@ -968,13 +974,19 @@ public abstract class GenericDaoBase<T, ID extends Serializable>
extends Compone
 
     @Override
     @DB()
-    public T findByIdIncludingRemoved(ID id) {
+    public T findByIdIncludingRemoved(final ID id) {
+        T result = null;
         if (_cache != null) {
             final Element element = _cache.get(id);
-            return element == null ? findById(id, true, null) : (T)element.getObjectValue();
+            if (element == null) {
+                result = findById(id, true, null);
+            } else {
+                result = (T)element.getObjectValue();
+            }
         } else {
-            return findById(id, true, null);
+            result = findById(id, true, null);
         }
+        return result;
     }
 
     @Override


Mime
View raw message