Source:
private void fetchRelatedEntities(GlusterVolumeEntity volume) { if (volume != null) { volume.setOptions(dbFacade.getGlusterOptionDao().getOptionsOfVolume(volume.getId())); volume.setAccessProtocols(new HashSet<AccessProtocol>(getAccessProtocolsOfVolume(volume.getId()))); volume.setTransportTypes(new HashSet<TransportType>(getTransportTypesOfVolume(volume.getId()))); GlusterVolumeAdvancedDetails advancedDetails = fetchAdvancedDatails(volume.getId()); if (advancedDetails != null) { volume.setAdvancedDetails(advancedDetails); } GlusterAsyncTask asyncTask = getAsyncTaskOfVolume(volume.getId()); if (asyncTask != null) { volume.setAsyncTask(asyncTask); } List<GlusterBrickEntity> bricks = dbFacade.getGlusterBrickDao().getBricksOfVolume(volume.getId()); if (volume.getAsyncTask() != null && volume.getAsyncTask().getTaskId() != null) { for (GlusterBrickEntity brick : bricks) { if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volume.getAsyncTask().getTaskId())) { brick.setAsyncTask(volume.getAsyncTask()); } } } volume.setBricks(bricks); GlusterVolumeSnapshotConfig config = dbFacade.getGlusterVolumeSnapshotConfigDao() .getConfigByVolumeIdAndName(volume.getClusterId(), volume.getId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT); if (config == null || config.getParamValue() == null || config.getParamValue().equals("")) { config = dbFacade.getGlusterVolumeSnapshotConfigDao() .getConfigByClusterIdAndName(volume.getClusterId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT); } volume.setSnapMaxLimit(config != null ? Integer.valueOf(config.getParamValue()) : 0); } }

Target:
private void fetchRelatedEntities(GlusterVolumeEntity volume) { if (volume != null) { volume.setOptions(dbFacade.getGlusterOptionDao().getOptionsOfVolume(volume.getId())); volume.setAccessProtocols(new HashSet<AccessProtocol>(getAccessProtocolsOfVolume(volume.getId()))); volume.setTransportTypes(new HashSet<TransportType>(getTransportTypesOfVolume(volume.getId()))); GlusterVolumeAdvancedDetails advancedDetails = fetchAdvancedDatails(volume.getId()); if (advancedDetails != null) { volume.setAdvancedDetails(advancedDetails); } GlusterAsyncTask asyncTask = getAsyncTaskOfVolume(volume.getId()); if (asyncTask != null) { volume.setAsyncTask(asyncTask); } List<GlusterBrickEntity> bricks = dbFacade.getGlusterBrickDao().getBricksOfVolume(volume.getId()); if (volume.getAsyncTask() != null && volume.getAsyncTask().getTaskId() != null) { for (GlusterBrickEntity brick : bricks) { if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volume.getAsyncTask().getTaskId())) { brick.setAsyncTask(volume.getAsyncTask()); } } } volume.setBricks(bricks); GlusterVolumeSnapshotConfig config = dbFacade.getGlusterVolumeSnapshotConfigDao() .getConfigByVolumeIdAndName(volume.getClusterId(), volume.getId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT); if (config == null || StringUtils.isEmpty(config.getParamValue())) { config = dbFacade.getGlusterVolumeSnapshotConfigDao() .getConfigByClusterIdAndName(volume.getClusterId(), GlusterConstants.VOLUME_SNAPSHOT_MAX_HARD_LIMIT); } volume.setSnapMaxLimit(config != null ? Integer.valueOf(config.getParamValue()) : 0); } }