Source:
<code>protected boolean canDoAction() { if (!super.canDoAction() || !initializeVds() || !checkStorageDomainNameLengthValid()) { return false; } if (isStorageWithSameNameExists()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ISO && !getStorageDomain().getStorageType().isFileDomain()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS, <START> String.format("$domainType %1$s", "ISO"), <END> String.format("$storageTypes %1$s", "file")); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ImportExport && (getStorageDomain().getStorageType() == StorageType.LOCALFS || getStorageDomain().getStorageType().isBlockDomain())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS, String.format("$domainType %1$s", "Export"), String.format("$storageTypes %1$s", "shared file")); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } if (!Guid.isNullOrEmpty(getParameters().getStoragePoolId()) && getTargetStoragePool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } ensureStorageFormatInitialized(); if (!isStorageFormatSupportedByStoragePool() || !isStorageFormatCompatibleWithDomain()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); getReturnValue().getCanDoActionMessages().add( String.format("$storageFormat %1$s", getStorageDomain().getStorageFormat())); return false; } return canAddDomain(); }</code><technical_language>constants (for example in StorageConstants) re-used usages more easily</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction() || !initializeVds() || !checkStorageDomainNameLengthValid()) { return false; } if (isStorageWithSameNameExists()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ISO && !getStorageDomain().getStorageType().isFileDomain()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS, String.format("$domainType %1$s", StorageConstants.ISO), String.format("$storageTypes %1$s", StorageConstants.FILE)); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.ImportExport && (getStorageDomain().getStorageType() == StorageType.LOCALFS || getStorageDomain().getStorageType().isBlockDomain())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DOMAIN_TYPE_CAN_BE_CREATED_ONLY_ON_SPECIFIC_STORAGE_DOMAINS, String.format("$domainType %1$s", StorageConstants.EXPORT), String.format("$storageTypes %1$s", StorageConstants.SHARED + " " + StorageConstants.FILE)); } if (getStorageDomain().getStorageDomainType() == StorageDomainType.Master) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_TYPE_ILLEGAL); } if (!Guid.isNullOrEmpty(getParameters().getStoragePoolId()) && getTargetStoragePool() == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_EXIST); } ensureStorageFormatInitialized(); if (!isStorageFormatSupportedByStoragePool() || !isStorageFormatCompatibleWithDomain()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_FORMAT_ILLEGAL_HOST); getReturnValue().getCanDoActionMessages().add( String.format("$storageFormat %1$s", getStorageDomain().getStorageFormat())); return false; } return canAddDomain(); }