Change in ovirt-engine[master]: engine: Remove instanceof from GetDomainListQuery

amureini at redhat.com amureini at redhat.com
Mon Sep 16 15:20:23 UTC 2013


Allon Mureinik has submitted this change and it was merged.

Change subject: engine: Remove instanceof from GetDomainListQuery
......................................................................


engine: Remove instanceof from GetDomainListQuery

Runtime type checking is no way of passing parameters - if the internal
domain should not be filtered, we can just pass false.

This patch changes GetDomainListQuery to exclusively use the
GetDomainListParameters class instead of allowing
VdcQueryParameterBase to infer not filtering the internal domain.

In addition, this patch introduces a test for GetDomainListQuery to
ensure that no functionality was compromised.

Advantages of this approach:
1. Explicit is better than implicit - the code is more readable, and
   its more obvious what the caller is doing.
2. Better performance - runtime type checking is expensive, where as
   function calls are cheap.

Change-Id: I2e59b5053792e6a68030b8dcef604d9e5acdce80
Signed-off-by: Allon Mureinik <amureini at redhat.com>
---
M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetDomainListQuery.java
A backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/GetDomainListQueryTest.java
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendDomainsResource.java
M backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendUsersResourceBase.java
M backend/manager/modules/restapi/jaxrs/src/test/java/org/ovirt/engine/api/restapi/resource/BackendUsersResourceTest.java
5 files changed, 63 insertions(+), 14 deletions(-)

Approvals:
  Allon Mureinik: Verified; Looks good to me, approved



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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2e59b5053792e6a68030b8dcef604d9e5acdce80
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Michael Pasternak <mpastern at redhat.com>
Gerrit-Reviewer: Ori Liel <oliel at redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzaslavs at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server



More information about the Engine-commits mailing list