Tomas Jelinek has submitted this change and it was merged.
Change subject: frontend: Utilize Builders in VmListModels
......................................................................
frontend: Utilize Builders in VmListModels
* Refactoring of duplicate and very error-prone mapping of VM/Template
fields in UserPortalListModel, TemplateListModel, PoolListModel,
VmListModel and VmSnapshotListModel.
* Utilizing the Builder infrastructure with minor additions
the mappings were extractend into encapsulated builder classes either
of type UnitVmModel -> VmBase or VmBase -> VmBase (depending on whether
we are mapping properties from UnitVmModel or an existing VM)
* These builders form a composition hierarchy at root of which sits the
CoreUnitToVmBuilder. When adding new VmBase fields one should strive to
add the appropriate mapping to only one place - that is to to most
general builder. In most cases this will precisely be the root
CoreUnitToVmBuilder. This builder is also used in PoolListModel,
so if it is not desirable to map this new field for pool VMs
yout need to add it to one some builder that is composed of
CoreUnitToVmBuilder. Most notable examples are:
- CommonUnitToVmBaseBuilder
- FullUnitToVmBaseBuilder
where Common contains mappings to be performed in onNewTemplate
methods and Full contains Common + all remainging mappings used
in onSave *ListModel methods.
* General principle is that there should be at most one reference to
a Vm setter in UiCommonWeb and the mapping from model to entity should be
encapsulated in an appropriate builder. (If there is more complex logic
to that mapping a separate simple builder derived from BaseSyncBuilder
encapsulating that logic would be appropriate).
Change-Id: I7cbd0f8c79ae13dd368a7542262397168c363f57
Signed-off-by: Martin Betak <mbetak(a)redhat.com>
---
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/BuilderExecutor.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/CompositeBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CommonUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/CoreUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/DedicatedVmForVdsUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/DedicatedVmForVdsVmBaseToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/FullUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/KernelParamsUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/KernelParamsVmBaseToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/MigrationOptionsUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/MigrationOptionsVmBaseToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/NameUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/QuotaUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/UsbPolicyUnitToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/UsbPolicyVmBaseToVmBaseBuilder.java
A
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/builders/vm/VmSpecificUnitToVmBuilder.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModel.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModel.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java
M
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModel.java
A
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/BaseVmListModelTest.java
A
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModelTest.java
A
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/templates/TemplateListModelTest.java
A
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/userportal/UserPortalListModelTest.java
A
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModelTest.java
A
frontend/webadmin/modules/uicommonweb/src/test/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmSnapshotListModelTest.java
27 files changed, 844 insertions(+), 415 deletions(-)
Approvals:
Tomas Jelinek: Looks good to me, approved
Martin Betak: Verified
--
To view, visit
http://gerrit.ovirt.org/23474
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7cbd0f8c79ae13dd368a7542262397168c363f57
Gerrit-PatchSet: 10
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <mbetak(a)redhat.com>
Gerrit-Reviewer: Martin Betak <mbetak(a)redhat.com>
Gerrit-Reviewer: Tomas Jelinek <tjelinek(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server