Source:
<code>public Response restore(Action action) { action.setAsync(false); TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(parentId, guid); if (action.isSetRestoreMemory()) { tryBackParams.setRestoreMemory(action.isRestoreMemory()); } if (action.isSetDisks()) { List<DiskImage> disks = collection.mapDisks(action.getDisks()); List<DiskImage> disksFromDB = null; if (disks != null) { String noImageId = disks.stream() .filter(disk -> disk.getImageId().equals(Guid.Empty)) .map(disk -> disk.getId().toString()) .collect(Collectors.joining(",")); if (!noImageId.isEmpty()) { badRequest("Missing image ids for disks: " + noImageId); } disksFromDB = disks.stream() .map(disk -> getEntity(org.ovirt.engine.core.common.businessentities.storage.DiskImage.class, QueryType.GetDiskImageByDiskAndImageIds, new GetDiskImageByDiskAndImageIdsParameters(disk.getId(), disk.getImageId()), <START> "disk id=" + disk.getId() + " ,image_id=" + disk.getImageId())) <END> .collect(Collectors.toList()); } tryBackParams.setDisks(disksFromDB); } tryBackParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response = doAction(ActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action, PollingType.JOB); if (response.getStatus()==Response.Status.OK.getStatusCode()) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, SnapshotActionEnum.COMMIT); restoreParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response2 = doAction(ActionType.RestoreAllSnapshots, restoreParams, action); if (response2.getStatus()!=Response.Status.OK.getStatusCode()) { return response2; } } return response; }</code><technical_language>add query's name, add some context. Also, consider String.format instead of string concatination, code a tad cleaner</technical_language>

Target:
public Response restore(Action action) { action.setAsync(false); TryBackToAllSnapshotsOfVmParameters tryBackParams = new TryBackToAllSnapshotsOfVmParameters(parentId, guid); if (action.isSetRestoreMemory()) { tryBackParams.setRestoreMemory(action.isRestoreMemory()); } if (action.isSetDisks()) { List<DiskImage> disks = collection.mapDisks(action.getDisks()); List<DiskImage> disksFromDB = null; if (disks != null) { String noImageId = disks.stream() .filter(disk -> disk.getImageId().equals(Guid.Empty)) .map(disk -> disk.getId().toString()) .collect(Collectors.joining(",")); if (!noImageId.isEmpty()) { badRequest("Missing image ids for disks: " + noImageId); } disksFromDB = disks.stream() .map(disk -> getEntity(org.ovirt.engine.core.common.businessentities.storage.DiskImage.class, QueryType.GetDiskImageByDiskAndImageIds, new GetDiskImageByDiskAndImageIdsParameters(disk.getId(), disk.getImageId()), String.format("GetDiskImageByDiskAndImageIds: disk id=%s, image_id=%s", disk.getId(), disk.getImageId()))) .collect(Collectors.toList()); } tryBackParams.setDisks(disksFromDB); } tryBackParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response = doAction(ActionType.TryBackToAllSnapshotsOfVm, tryBackParams, action, PollingType.JOB); if (response.getStatus()==Response.Status.OK.getStatusCode()) { RestoreAllSnapshotsParameters restoreParams = new RestoreAllSnapshotsParameters(parentId, SnapshotActionEnum.COMMIT); restoreParams.setCorrelationId(RESTORE_SNAPSHOT_CORRELATION_ID); Response response2 = doAction(ActionType.RestoreAllSnapshots, restoreParams, action); if (response2.getStatus()!=Response.Status.OK.getStatusCode()) { return response2; } } return response; }