Daniel Erez has posted comments on this change.

Change subject: webadmin: prevent several imported VMs with same name
......................................................................


Patch Set 2: (4 inline comments)

....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/TemplateBackupModel.java
Line 148:         }
Line 149:         return true;
Line 150:     }
Line 151: 
Line 152:     @Override
Is the Override needed just because of VM_TEMPLATE_NAME_MAX_LIMIT constant? If 
so, wouldn't it be simpler and shorter to extract and override only this?
Line 153:     protected IValidation[] getClonedAppendedNameValidators(Object 
object) {
Line 154:         return new IValidation[] {
Line 155:                 new NotEmptyValidation(),
Line 156:                 new 
LengthValidation(UnitVmModel.VM_TEMPLATE_NAME_MAX_LIMIT),


Line 159:                     protected String composeMessage() {
Line 160:                         return ConstantsManager.getInstance()
Line 161:                                 .getMessages()
Line 162:                                 
.newNameWithSuffixCannotContainBlankOrSpecialChars(UnitVmModel.VM_TEMPLATE_NAME_MAX_LIMIT);
Line 163:                     };
Isn't UniqueNameValidator required for template as well?
Line 164:                 }
Line 165:         };
Line 166:     }
Line 167: 


Line 164:                 }
Line 165:         };
Line 166:     }
Line 167: 
Line 168:     @Override
same here
Line 169:     protected IValidation[] getClonedNameValidators(Object object) {
Line 170:         return new IValidation[] {
Line 171:                 new NotEmptyValidation(),
Line 172:                 new 
LengthValidation(UnitVmModel.VM_TEMPLATE_NAME_MAX_LIMIT),


....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/storage/VmBackupModel.java
Line 299:         }
Line 300:         return true;
Line 301:     }
Line 302: 
Line 303:     protected IValidation[] getClonedNameValidators(Object object) {
getClonedNameValidators() and getClonedAppendedNameValidators() seems similar - 
try extracting the identical code.
Line 304:         VM vm = ((ImportVmData) object).getVm();
Line 305:         final int length = 
AsyncDataProvider.IsWindowsOsType(vm.getOs()) ? 
UnitVmModel.WINDOWS_VM_NAME_MAX_LIMIT
Line 306:                 : UnitVmModel.NON_WINDOWS_VM_NAME_MAX_LIMIT;
Line 307:         return new IValidation[] {


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I69eae7350ae840a06b440003c436f7adc0b032cd
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <[email protected]>
Gerrit-Reviewer: Arik Hadas <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Gilad Chaplik <[email protected]>
Gerrit-Reviewer: Tomas Jelinek <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to