Source:
protected boolean canDoAction() { String connectionId = getConnection().getid(); List<StorageDomain> domains = new ArrayList<>(); if(StringUtils.isEmpty(connectionId) ) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_EMPTY); } StorageServerConnections connection = getStorageServerConnectionDao().get(connectionId); StorageType storageType = connection.getstorage_type(); if(storageType.isFileDomain()) { domains = getStorageDomainsByConnId(connectionId); if(domains.size() > 0) { String domainNames = createDomainNamesListFromStorageDomains(domains); return prepareFailureMessageForDomains(domainNames); } } else if(storageType.equals(StorageType.ISCSI)) { List<String> domainNames = new ArrayList<>(); List<String> diskNames = new ArrayList<>(); List<LUNs> luns = getLunDao().getAllForStorageServerConnection(connectionId); if(luns.size() > 0) { String volumeGroupId = null; for(LUNs lun : luns) { volumeGroupId = lun.getvolume_group_id(); if(StringUtils.isNotEmpty(volumeGroupId)) { String domainName = lun.getStorageDomainName(); domainNames.add(domainName); } else { String lunDiskName = lun.getDiskAlias(); diskNames.add(lunDiskName); } } String domainNamesForMessage = null; if(domainNames.size() > 0 ) { domainNamesForMessage = prepareEntityNamesForMessage(domainNames); if(diskNames.size() < 1) { return prepareFailureMessageForDomains(domainNamesForMessage) ; } else { String diskNamesForMessage = prepareEntityNamesForMessage(diskNames); return prepareFailureMessageForDomainsAndDisks(domainNamesForMessage,diskNamesForMessage); } } else if(diskNames.size() > 0 ) { String diskNamesForMessage = prepareEntityNamesForMessage(diskNames); return prepareFailureMessageForDisks(diskNamesForMessage); } } } return true; }

Target:
protected boolean canDoAction() { String connectionId = getConnection().getid(); List<StorageDomain> domains = new ArrayList<>(); if (StringUtils.isEmpty(connectionId) ) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ID_EMPTY); } StorageServerConnections connection = getStorageServerConnectionDao().get(connectionId); StorageType storageType = connection.getstorage_type(); if (storageType.isFileDomain()) { domains = getStorageDomainsByConnId(connectionId); if(domains.size() > 0) { String domainNames = createDomainNamesListFromStorageDomains(domains); return prepareFailureMessageForDomains(domainNames); } } else if (storageType.equals(StorageType.ISCSI)) { List<String> domainNames = new ArrayList<>(); List<String> diskNames = new ArrayList<>(); List<LUNs> luns = getLunDao().getAllForStorageServerConnection(connectionId); if (!luns.isEmpty()) { String volumeGroupId = null; for(LUNs lun : luns) { volumeGroupId = lun.getvolume_group_id(); if (StringUtils.isNotEmpty(volumeGroupId)) { String domainName = lun.getStorageDomainName(); domainNames.add(domainName); } else { String lunDiskName = lun.getDiskAlias(); diskNames.add(lunDiskName); } } String domainNamesForMessage = null; if (!domainNames.isEmpty() ) { domainNamesForMessage = prepareEntityNamesForMessage(domainNames); if (diskNames.isEmpty()) { return prepareFailureMessageForDomains(domainNamesForMessage) ; } else { String diskNamesForMessage = prepareEntityNamesForMessage(diskNames); return prepareFailureMessageForDomainsAndDisks(domainNamesForMessage,diskNamesForMessage); } } else if (!diskNames.isEmpty()) { String diskNamesForMessage = prepareEntityNamesForMessage(diskNames); return prepareFailureMessageForDisks(diskNamesForMessage); } } } return true; }