Oved Ourfali has submitted this change and it was merged.

Change subject: core: added Entities utility class to build map of entities by 
name
......................................................................


core: added Entities utility class to build map of entities by name

Lots of places in the code, specially networking logics
takes 2 lists and do iterate and compare, most of times "name" is
the key for comparison. For cleaner and mostly more efficient code
we can easily extract a map of name->entity and working with 
map.containsKey(name)

very trivial networking example - check vds networks exists in cluster networks:

ugly solution:
 for (i in vds networks)
  for (n in cluster networks)
   if n.name = i.name
    gotIt = true

uglier:
  LinqUtils...

cleaner:
netsByName = Entities.entitiesByName(clusterNetworks)
for (i in vds networks)
    if (netByName.containsKey(i.name)
      gotIt = tru

Change-Id: I752671576c04904f517101a5fbf412c86477dead
---
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Entities.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NetworkInterface.java
2 files changed, 57 insertions(+), 1 deletion(-)

Approvals:
  Oved Ourfali: Verified; Looks good to me, approved


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

Gerrit-MessageType: merged
Gerrit-Change-Id: I752671576c04904f517101a5fbf412c86477dead
Gerrit-PatchSet: 20
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Roy Golan <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Laszlo Hornyak <[email protected]>
Gerrit-Reviewer: Oved Ourfali <[email protected]>
Gerrit-Reviewer: Roy Golan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to