Source:
protected void executeQueryCommand() { String volumeName = getParameters().getVolumeName(); GlusterVolumeEntity nfsReplicateVolume; if (!getParameters().isDetailRequired() && StringUtils.isEmpty(volumeName)) { VDSReturnValue nfsReturnValue = 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 (nfsReturnValue != null && replicateVolume != null) { VDSReturnValue shdStatusReturnValue = executeCommand(replicateVolume.getName()); GlusterVolumeAdvancedDetails volumeAdvancedDetailsForNfs = (GlusterVolumeAdvancedDetails) nfsReturnValue.getReturnValue(); GlusterVolumeAdvancedDetails volumeAdvancedDetailsForShd = (GlusterVolumeAdvancedDetails) shdStatusReturnValue.getReturnValue(); volumeAdvancedDetailsForNfs.getServiceInfo().addAll(volumeAdvancedDetailsForShd.getServiceInfo()); getQueryReturnValue().setReturnValue(volumeAdvancedDetailsForNfs); } else if (nfsReturnValue == null && replicateVolume != null) { VDSReturnValue shdReturnValue = executeCommand(replicateVolume.getName()); getQueryReturnValue().setReturnValue(shdReturnValue.getReturnValue()); } else if (nfsReturnValue != null && replicateVolume == null) { getQueryReturnValue().setReturnValue(nfsReturnValue.getReturnValue()); } } else { VDSReturnValue returnValue = executeCommand(nfsReplicateVolume.getName()); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); } } else { VDSReturnValue returnValue = executeCommand(volumeName); getQueryReturnValue().setReturnValue(returnValue.getReturnValue()); } }

Target:
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()); }