Change in ovirt-engine[master]: core: refactored overgrown method

From Moti Asayag <masayag@redhat.com>:
Moti Asayag has submitted this change and it was merged. Change subject: core: refactored overgrown method ...................................................................... core: refactored overgrown method as command itself is named: Activate[or]Deactivate … ~ this is overgrown. Method executeVmCommand is repeatedly asking over and over, what it actually should do, plug or unplug. So it's quite clear, that this method should be split, which is very easy to do. work process: 1. implement new method with switch. 2. duplicate original method, one for plug, one for unplug. 3. since swith already made decision, we might re-set variables isNicToBePlugged and isNicToBeUnplugged to constants, true/false. 4. fix all static analysis problems. Example "if (null != null) {}" can be removed. both method should be much easier to grasp, since both methods now fit PC screen, lost of conditions simply disappeared, and we are solving one usecase at time. Unplug method became very short and easy. Change-Id: Ifbce80c40105e1ac41529752eac099125a9ca1bc Signed-off-by: Martin Mucha <mmucha@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/network/vm/ActivateDeactivateVmNicCommand.java 1 file changed, 42 insertions(+), 29 deletions(-) Approvals: Marcin Mirecki: Looks good to me, but someone else must approve Martin Mucha: Verified Jenkins CI: Passed CI tests Moti Asayag: Looks good to me, approved -- To view, visit https://gerrit.ovirt.org/67313 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifbce80c40105e1ac41529752eac099125a9ca1bc Gerrit-PatchSet: 9 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Mucha <mmucha@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Marcin Mirecki <mmirecki@redhat.com> Gerrit-Reviewer: Martin Mucha <mmucha@redhat.com> Gerrit-Reviewer: Moti Asayag <masayag@redhat.com> Gerrit-Reviewer: gerrit-hooks <automation@ovirt.org>
participants (1)
-
Code Review