Martin Mucha has uploaded a new change for review.

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

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

method execute() is overgrown and disallowing
modifications in subclasses.

Change-Id: I99a501325f364aab789f04680e6c7c6999c38b7a
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, 20 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/91/35191/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 551f359..17dff8e 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
@@ -56,22 +56,7 @@
 
         ArrayList<VdcReturnValueBase> returnValues = new 
ArrayList<VdcReturnValueBase>();
         try {
-            VdcReturnValueBase returnValue;
-            for (VdcActionParametersBase parameter : getParameters()) {
-                parameter.setMultipleAction(true);
-                returnValue = 
ExecutionHandler.evaluateCorrelationId(parameter);
-                if (returnValue == null) {
-                    CommandBase<?> command = isInternal ?
-                            CommandsFactory.createCommand(actionType, 
parameter, commandContext.clone()
-                                    .withoutCompensationContext()) :
-                                    CommandsFactory.createCommand(actionType, 
parameter);
-
-                    command.setInternalExecution(isInternal);
-                    getCommands().add(command);
-                } else {
-                    returnValues.add(returnValue);
-                }
-            }
+            initCommandsAndReturnValues(returnValues);
 
             invokeCommands(returnValues);
         } catch (RuntimeException e) {
@@ -81,6 +66,25 @@
         return returnValues;
     }
 
+    protected void initCommandsAndReturnValues(ArrayList<VdcReturnValueBase> 
returnValues) {
+        VdcReturnValueBase returnValue;
+        for (VdcActionParametersBase parameter : getParameters()) {
+            parameter.setMultipleAction(true);
+            returnValue = ExecutionHandler.evaluateCorrelationId(parameter);
+            if (returnValue == null) {
+                CommandBase<?> command = isInternal ?
+                        CommandsFactory.createCommand(actionType, parameter, 
commandContext.clone()
+                                .withoutCompensationContext()) :
+                                CommandsFactory.createCommand(actionType, 
parameter);
+
+                command.setInternalExecution(isInternal);
+                getCommands().add(command);
+            } else {
+                returnValues.add(returnValue);
+            }
+        }
+    }
+
     protected void invokeCommands(ArrayList<VdcReturnValueBase> returnValues) {
         if (canRunActions(returnValues)) {
             if (isWaitForResult) {


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99a501325f364aab789f04680e6c7c6999c38b7a
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