Allon Mureinik has uploaded a new change for review.

Change subject: core: Standardize RemoveSnapshot.canDoAction
......................................................................

core: Standardize RemoveSnapshot.canDoAction

Set the action and the type parameters in the
setActionMessageParameters(), which is supported in CommandBase's
framework.

The old workaround was removed, resulting in a cleaner canDoAction()
method.

Change-Id: I93f391984827fa5deb816d8856a982bf03b77df1
Signed-off-by: Allon Mureinik <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
1 file changed, 4 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/22/11322/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
index 2bcf736..3c62495 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveSnapshotCommand.java
@@ -166,32 +166,26 @@
                 !validateSnapshotExists() ||
                 !validate(new VmValidator(getVm()).vmDown()) ||
                 !validateImagesAndVMStates()) {
-            handleCanDoActionFailure();
             return false;
         }
 
         if (hasImages()) {
             // check that we are not deleting the template
             if (!validateImageNotInTemplate()) {
-                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE);
-                handleCanDoActionFailure();
-                return false;
+                return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_IMAGE_TEMPLATE);
             }
 
             // check that we are not deleting the vm working snapshot
             if (!validateImageNotActive()) {
-                
addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE);
-                handleCanDoActionFailure();
-                return false;
+                return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE);
             }
         }
 
-        getReturnValue().setCanDoAction(true);
         return true;
     }
 
-    private void handleCanDoActionFailure() {
-        getReturnValue().setCanDoAction(false);
+    @Override
+    protected void setActionMessageParameters() {
         addCanDoActionMessage(VdcBllMessages.VAR__TYPE__SNAPSHOT);
         addCanDoActionMessage(VdcBllMessages.VAR__ACTION__REMOVE);
     }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I93f391984827fa5deb816d8856a982bf03b77df1
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to