Source:
<code>protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } <START> <END> if (retVal && !VmTemplateHandler.verifyVmTemplateStatusForUse(getVmTemplateId(), false)) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); retVal = false; } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }</code><technical_language>template is located DB, help</technical_language>

Target:
protected boolean canDoAction() { boolean retVal = true; if (getVmTemplate() == null) { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } if (retVal && !VmTemplateHandler.isTemplateStatusIsNotLocked(getVmTemplateId())) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); retVal = false; } if (retVal) { DiskImageList images = templatesFromExport.get(LinqUtils.firstOrNull(templatesFromExport.keySet(), new Predicate<VmTemplate>() { @Override public boolean eval(VmTemplate t) { return t.getId().equals(getParameters().getVmTemplateId()); } })); if (images != null) { getParameters().setImages(Arrays.asList(images.getDiskImages())); } else { retVal = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); } } if (retVal) { StorageDomainValidator validator = new StorageDomainValidator(getStorageDomain()); retVal = validator.isDomainExistAndActive(getReturnValue().getCanDoActionMessages()); } if (retVal && getStorageDomain().getstorage_domain_type() != StorageDomainType.ImportExport) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); retVal = false; } if (retVal) { VmTemplate tmpl = DbFacade.getInstance().getVmTemplateDAO().get(getVmTemplateId()); if (tmpl != null) { retVal = (tmpl.getstatus() != VmTemplateStatus.Locked); if (!retVal) { getReturnValue().getCanDoActionMessages() .add(VdcBllMessages.VM_TEMPLATE_IMAGE_IS_LOCKED.toString()); } } } return retVal; }