Alona Kaplan has posted comments on this change.

Change subject: webadmin: removed caching from EnumTranslator.
......................................................................


Patch Set 3:

(2 comments)

I think you can change Translator to be an interface in this patch. But as you 
wish, I don't really care if it will be in a separate patch.

http://gerrit.ovirt.org/#/c/26048/3/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserEventNotifierListModel.java
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/users/UserEventNotifierListModel.java:

Line 121:         for (EventNotificationEntity eventType : eventTypes)
Line 122:         {
Line 123:             SelectionTreeNodeModel stnm = new 
SelectionTreeNodeModel();
Line 124:             stnm.setTitle(eventType.toString());
Line 125:             stnm.setDescription(translator.containsKey(eventType) ? 
translator.get(eventType)
The new get implementation does the same, you can just do- 
stnm.setDescription(translator.get(eventType))
Line 126:                     : eventType.toString());
Line 127:             list.add(stnm);
Line 128: 
Line 129:             for (AuditLogType logtype : 
availableEvents.get(eventType))


http://gerrit.ovirt.org/#/c/26048/3/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/EnumTranslator.java
File 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/EnumTranslator.java:

You should override containsKey.
containsKey implementaition in EnumTranslator is wrong.
It returns true even if the resource is missing.
I suggest splitting get into 2 methods-
1. private translateWithoutErrorHandling- the original get without catching  
MissingResourceException
2. public translate- a method that calls translateWithoutErrorHandling and 
catches  MissingResourceException.

conatainsKey should call the private translateWithoutErrorHandling and return 
false in case of MissingResourceException.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I3df424d8e7a35ed249b2760da79deba7db31b785
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Mucha <mmu...@redhat.com>
Gerrit-Reviewer: Alona Kaplan <alkap...@redhat.com>
Gerrit-Reviewer: Lior Vernia <lver...@redhat.com>
Gerrit-Reviewer: Martin Mucha <mmu...@redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to