Moti Asayag has posted comments on this change.

Change subject: core: Use set instead of List to prevent duplicate key 
violiation
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.ovirt.org/#/c/40709/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/tasks/CommandExecutor.java:

Line 179: 
Line 180:     private Collection<CommandAssociatedEntity> 
buildCommandAssociatedEntities(Guid cmdId, SubjectEntity... subjectEntities) {
Line 181:         if (subjectEntities.length == 0) {
Line 182:             return Collections.emptyList();
Line 183:         }
what i had in mind is:

  Set<SubjectEntity> entities = new HashSet<>(Arrays.asList(subjectEntities));
  List<CommandAssociatedEntity> results = new ArrayList<>(entities.size());
  for (SubjectEntity subjectEntity : entities) {
Line 184:         Set<CommandAssociatedEntity> results = new 
HashSet<>(subjectEntities.length);
Line 185:         for (SubjectEntity subjectEntity : subjectEntities) {
Line 186:             results.add(new CommandAssociatedEntity(cmdId, 
subjectEntity.getEntityType(), subjectEntity.getEntityId()));
Line 187: 


-- 
To view, visit https://gerrit.ovirt.org/40709
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I55a2933da86aec6202fd806bf1a5701811ed1207
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Moti Asayag <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to