Roy Golan has uploaded a new change for review.

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 eficient 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
A 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/Nameble.java
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/NetworkInterface.java
3 files changed, 43 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/2473/1
--
To view, visit http://gerrit.ovirt.org/2473
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to