
Omer Frenkel has submitted this change and it was merged. Change subject: engine: Refactoring of VmTemplateHandler editable fields ...................................................................... engine: Refactoring of VmTemplateHandler editable fields Introducing annotations EditableOnVm and EditableOnTemplate as a replacement for hard-coded list of field names in VmTemplateHandler, which was error-prone and difficult to maintain. New annotation behavior: @EditableField: describes that this VmBase field will be editable for both VMs and VmTemplates. @EditableOnVm: describes that this VmBase field will be editable for VMs. @EditableOnTemplate: describes that this VmBase field will be editable for VmTemplates. On the derived entities (VmStatic, VmTemplate) you can continue using plain @EditableField; these annotations were just added for disambiguation of those VmBase fields that are editable only for template of for specific VM status and template. Implementation: VmHandler includes into permitted fields those annotated with EditableField, EditableOnVm and EditableOnVmStatusField (see note). VmTemplateHandler includes into permitted fields those annotated with EditableField and EditableOnTemplate. note: EditableOnVmStatus behavior remains unchanged, so if you have for example field which is editable only when the VM status is down and for template use the following: @EditableOnVmStatusField @EditableOnTemplate private String timeZone; Change-Id: I2bd933e14310cf8f58280448a580ed761169f777 Signed-off-by: Martin Betak <mbetak@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmTemplateHandler.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/EditableOnTemplate.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/EditableOnVm.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmTemplate.java 6 files changed, 56 insertions(+), 10 deletions(-) Approvals: Omer Frenkel: Verified; Looks good to me, approved -- To view, visit http://gerrit.ovirt.org/19410 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2bd933e14310cf8f58280448a580ed761169f777 Gerrit-PatchSet: 7 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Martin Betak <mbetak@redhat.com> Gerrit-Reviewer: Frank Kobzik <fkobzik@redhat.com> Gerrit-Reviewer: Martin Betak <mbetak@redhat.com> Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofrenkel@redhat.com> Gerrit-Reviewer: Roy Golan <rgolan@redhat.com> Gerrit-Reviewer: Tomas Jelinek <tjelinek@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server