Source:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); GlusterVolumeEntity nfsReplicateVolume; if (!getParameters().isDetailRequired() && StringUtils.isEmpty(volumeName)) { VDSReturnValue nfsReturnValue = null; VDSReturnValue replicateReturnValue = null; GlusterVolumeEntity nfsVolume; GlusterVolumeEntity replicateVolume; nfsReplicateVolume = getNfsReplicateVolume(getParameters().getClusterId()); if (nfsReplicateVolume == null) { nfsVolume = getNfsVolume(getParameters().getClusterId()); replicateVolume = getReplicateVolume(getParameters().getClusterId()); if (nfsVolume == null && replicateVolume == null) { log.error("To get service details, no Nfs or Replicated volumes found in the cluster."); getQueryReturnValue().setReturnValue(new GlusterVolumeAdvancedDetails()); return; } if (nfsVolume != null) { nfsReturnValue = executeCommand(nfsVolume.getName()); } if (replicateVolume != null) { replicateReturnValue = executeCommand(replicateVolume.getName()); } if (nfsReturnValue != null && replicateReturnValue != null) { GlusterVolumeAdvancedDetails volumeAdvancedDetailsForNfs = (GlusterVolumeAdvancedDetails) nfsReturnValue.getReturnValue(); GlusterVolumeAdvancedDetails volumeAdvancedDetailsForShd = (GlusterVolumeAdvancedDetails) replicateReturnValue.getReturnValue(); volumeAdvancedDetailsForNfs.getServiceInfo().addAll(volumeAdvancedDetailsForShd.getServiceInfo()); getQueryReturnValue().setReturnValue(volumeAdvancedDetailsForNfs); } else if (nfsReturnValue == null && replicateReturnValue != null) { getQueryReturnValue().setReturnValue(replicateReturnValue.getReturnValue()); } else if (nfsReturnValue != null && replicateVolume == null) { getQueryReturnValue().setReturnValue(nfsReturnValue.getReturnValue()); } } else { volumeName = nfsReplicateVolume.getName(); } } VDSReturnValue returnValue = executeCommand(volumeName); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); }

Target:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); if (getParameters().isDetailRequired() || StringUtils.isNotEmpty(volumeName)) { executeAndSetReturnValue(volumeName); } VDSReturnValue nfsReturnValue = null; VDSReturnValue replicateReturnValue = null; GlusterVolumeEntity nfsReplicateVolume = getNfsReplicateVolume(getParameters().getClusterId()); if (nfsReplicateVolume != null) { executeAndSetReturnValue(nfsReplicateVolume.getName()); } GlusterVolumeEntity nfsVolume = getNfsVolume(getParameters().getClusterId()); GlusterVolumeEntity replicateVolume = getReplicateVolume(getParameters().getClusterId()); if (nfsVolume == null && replicateVolume == null) { log.error("To get service details, no Nfs or Replicated volumes found in the cluster."); getQueryReturnValue().setReturnValue(new GlusterVolumeAdvancedDetails()); return; } if (nfsVolume != null) { nfsReturnValue = executeCommand(nfsVolume.getName()); } if (replicateVolume != null) { replicateReturnValue = executeCommand(replicateVolume.getName()); } if (nfsReturnValue != null && replicateReturnValue != null) { GlusterVolumeAdvancedDetails volumeAdvancedDetailsForNfs = (GlusterVolumeAdvancedDetails) nfsReturnValue.getReturnValue(); GlusterVolumeAdvancedDetails volumeAdvancedDetailsForShd = (GlusterVolumeAdvancedDetails) replicateReturnValue.getReturnValue(); volumeAdvancedDetailsForNfs.getServiceInfo().addAll(volumeAdvancedDetailsForShd.getServiceInfo()); getQueryReturnValue().setReturnValue(volumeAdvancedDetailsForNfs); } else if (nfsReturnValue == null && replicateReturnValue != null) { getQueryReturnValue().setReturnValue(replicateReturnValue.getReturnValue()); } else if (nfsReturnValue != null && replicateVolume == null) { getQueryReturnValue().setReturnValue(nfsReturnValue.getReturnValue()); } }