Roy Golan has posted comments on this change. Change subject: engine: Watchdog model validation ......................................................................
Patch Set 2: (2 comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmWatchdogValidator.java Line 34: * otherwise it's OK. Line 35: */ Line 36: public ValidationResult isModelCompatibleWithOs() { Line 37: Line 38: List<String> watchDogModels = getOsRepository().getWatchDogModels(osId, version); I'm thinking of the flexibility of the osRepo API here. is it better to have more suitable types in the API - in that case return List<WachdogTypes> instead of List<String> class OsRepository { ... List<WatchdogType> getWatchDogModels(int osId, Version version); } while this is coupling the repository to the code enums, its making the client code better. thoughts? Line 39: List<VmWatchdogType> vmWatchdogTypes = new ArrayList<VmWatchdogType>(); Line 40: Line 41: for (String watchDogModel : watchDogModels) { Line 42: vmWatchdogTypes.add(VmWatchdogType.getByName(watchDogModel)); Line 38: List<String> watchDogModels = getOsRepository().getWatchDogModels(osId, version); Line 39: List<VmWatchdogType> vmWatchdogTypes = new ArrayList<VmWatchdogType>(); Line 40: Line 41: for (String watchDogModel : watchDogModels) { Line 42: vmWatchdogTypes.add(VmWatchdogType.getByName(watchDogModel)); its simpler to loose the directly check it here if (vmWatchdog.getModel().equals(VmWatchdogType.getByName(watchDogModel)) { return Valid } return FAILED... and the vmWatchdogTypes is redundant Line 43: } Line 44: Line 45: return (!vmWatchdogTypes.contains(vmWatchdog.getModel())) Line 46: ? new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_ILLEGAL_WATCHDOG_MODEL_IS_NOT_SUPPORTED_BY_OS) -- To view, visit http://gerrit.ovirt.org/18448 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7a470fd389f0fcd5d077c56a2f69ee2f79fce065 Gerrit-PatchSet: 2 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gustavo Frederico Temple Pedrosa <gustavo.pedr...@eldorado.org.br> Gerrit-Reviewer: Doron Fediuck <dfedi...@redhat.com> Gerrit-Reviewer: Itamar Heim <ih...@redhat.com> Gerrit-Reviewer: Laszlo Hornyak <lhorn...@redhat.com> Gerrit-Reviewer: Leonardo Bianconi <leonardo.bianc...@eldorado.org.br> Gerrit-Reviewer: Lior Vernia <lver...@redhat.com> Gerrit-Reviewer: Martin Betak <mbe...@redhat.com> Gerrit-Reviewer: Michal Skrivanek <michal.skriva...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Tomas Jelinek <tjeli...@redhat.com> Gerrit-Reviewer: Vitor de Lima <vitor.l...@eldorado.org.br> 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