Martin Mucha has uploaded a new change for review.

Change subject: core: MultipleActionsRunner refactor: extracted canRunActions 
method from execute()
......................................................................

core: MultipleActionsRunner refactor: extracted canRunActions method from 
execute()

method execute() is overgrown and disallowing modifications in
subclasses. There are Commands written in a way disallowing separating
method calls of 'canDoAction'and 'execute'. Calling all 'canDoAction'
methods prior to calling first 'execute' yields bad results,
therefore, canDoAction have to be called prior to respective execute
method.

Change-Id: Id0c8b741d5a8ddce3caf5177d77285132bb1053b
Signed-off-by: Martin Mucha <mmu...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java
1 file changed, 11 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/90/35190/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java
index 5d950db..551f359 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MultipleActionsRunner.java
@@ -73,15 +73,7 @@
                 }
             }
 
-            boolean canRunActions = canRunActions(returnValues);
-
-            if (canRunActions) {
-                if (isWaitForResult) {
-                    invokeSyncCommands();
-                } else {
-                    invokeCommands();
-                }
-            }
+            invokeCommands(returnValues);
         } catch (RuntimeException e) {
             log.error("Failed to execute multiple actions of type '{}': {}", 
actionType, e.getMessage());
             log.error("Exception", e);
@@ -89,6 +81,16 @@
         return returnValues;
     }
 
+    protected void invokeCommands(ArrayList<VdcReturnValueBase> returnValues) {
+        if (canRunActions(returnValues)) {
+            if (isWaitForResult) {
+                invokeSyncCommands();
+            } else {
+                invokeCommands();
+            }
+        }
+    }
+
     protected boolean canRunActions(ArrayList<VdcReturnValueBase> 
returnValues) {
         if (getCommands().size() == 1) {
             
CorrelationIdTracker.setCorrelationId(getCommands().get(0).getCorrelationId());


-- 
To view, visit http://gerrit.ovirt.org/35190
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0c8b741d5a8ddce3caf5177d77285132bb1053b
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Mucha <mmu...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to