Arik Hadas has posted comments on this change.

Change subject: restapi,engine: fix usb mapping on update vm call
......................................................................


Patch Set 2: (2 inline comments)

....................................................
File 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/TemplateMapper.java
Line 30: 
Line 31:     @Mapping(from = Template.class, to = VmTemplate.class)
Line 32:     public static VmTemplate map(Template model, VmTemplate incoming) {
Line 33:         // USB policy will be updated outside of this method because 
there's
Line 34:         // a different mapping for it on create and update VM 
operations
but doesn't it mean that we'll have code duplication? we'll need the 
getUsbPolicyOnCreate to be called from VmMapper and TemplateMapper so we'll 
need to copy that method for the two mappers right?
Line 35:         VmTemplate entity = incoming != null ? incoming : new 
VmTemplate();
Line 36:         if (model.isSetName()) {
Line 37:             entity.setname(model.getName());
Line 38:         }


....................................................
File 
backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/VmMapper.java
Line 98:     }
Line 99:     @Mapping(from = VM.class, to = VmStatic.class)
Line 100:     public static VmStatic map(VM vm, VmStatic template) {
Line 101:         // USB policy will be updated outside of this method because 
there's
Line 102:         // a different mapping for it on create and update VM 
operations
but how can I detect in this case if that's an update or add operation - it 
seems that both operations use the Mapper from Vm => VmStatic
Line 103:         VmStatic staticVm = template != null ? template : new 
VmStatic();
Line 104:         if (vm.isSetName()) {
Line 105:             staticVm.setvm_name(vm.getName());
Line 106:         }


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If74bf6ede2fc0f932db8dfcd7951b6bcf90b7744
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Arik Hadas <aha...@redhat.com>
Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to