Omer Frenkel has uploaded a new change for review. Change subject: core: create VmWatchdog from VmDevice ......................................................................
core: create VmWatchdog from VmDevice Change-Id: I30d2c7871bfd98e6bb653f4150ffa72122fed1fa Signed-off-by: Omer Frenkel <ofren...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetWatchdogQuery.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWatchdog.java 2 files changed, 11 insertions(+), 9 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/56/26756/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetWatchdogQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetWatchdogQuery.java index 10e1ee8..946c6ae 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetWatchdogQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetWatchdogQuery.java @@ -6,8 +6,6 @@ import org.ovirt.engine.core.common.businessentities.VmDevice; import org.ovirt.engine.core.common.businessentities.VmDeviceGeneralType; import org.ovirt.engine.core.common.businessentities.VmWatchdog; -import org.ovirt.engine.core.common.businessentities.VmWatchdogAction; -import org.ovirt.engine.core.common.businessentities.VmWatchdogType; import org.ovirt.engine.core.common.queries.IdQueryParameters; import org.ovirt.engine.core.dao.VmDeviceDAO; @@ -22,13 +20,7 @@ final List<VmDevice> vmDevices = getVmDeviceDAO().getVmDeviceByVmIdAndType(getParameters().getId(), VmDeviceGeneralType.WATCHDOG); if (vmDevices != null && !vmDevices.isEmpty()) { - VmDevice device = vmDevices.get(0); - VmWatchdog watchdog = new VmWatchdog(); - watchdog.setAction(VmWatchdogAction.getByName((String) device.getSpecParams().get("action"))); - watchdog.setModel(VmWatchdogType.getByName((String) device.getSpecParams().get("model"))); - watchdog.setVmId(getParameters().getId()); - watchdog.setId(device.getDeviceId()); - setReturnValue(Collections.singletonList(watchdog)); + setReturnValue(Collections.singletonList(new VmWatchdog(vmDevices.get(0)))); } else { setReturnValue(Collections.emptyList()); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWatchdog.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWatchdog.java index 4c5528e..b1864a1 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWatchdog.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmWatchdog.java @@ -18,6 +18,16 @@ VmWatchdogAction action; VmWatchdogType model; + public VmWatchdog() { + } + + public VmWatchdog(VmDevice device) { + setId(device.getDeviceId()); + setVmId(device.getVmId()); + setAction(VmWatchdogAction.getByName((String) device.getSpecParams().get("action"))); + setModel(VmWatchdogType.getByName((String) device.getSpecParams().get("model"))); + } + public Guid getVmId() { return vmId; } -- To view, visit http://gerrit.ovirt.org/26756 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I30d2c7871bfd98e6bb653f4150ffa72122fed1fa Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Omer Frenkel <ofren...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches