Source:
private void formatIssue(Issue.Builder issueBuilder, IssueDto dto, SearchResponseData data) { issueBuilder.setKey(dto.getKey()); setNullable(dto.getType(), issueBuilder::setType, Common.RuleType::valueOf); ComponentDto component = data.getComponentByUuid(dto.getComponentUuid()); issueBuilder.setOrganization(data.getOrganizationKey(component.getOrganizationUuid())); issueBuilder.setComponent(component.getKey()); setNullable(component.getBranch(), issueBuilder::setBranch); ComponentDto project = data.getComponentByUuid(dto.getProjectUuid()); if (project != null) { issueBuilder.setProject(project.getKey()); ComponentDto subProject = data.getComponentByUuid(dto.getModuleUuid()); if (subProject != null && !subProject.getDbKey().equals(project.getDbKey())) { issueBuilder.setSubProject(subProject.getKey()); } } issueBuilder.setRule(dto.getRuleKey().toString()); issueBuilder.setSeverity(Common.Severity.valueOf(dto.getSeverity())); setNullable(emptyToNull(dto.getAssignee()), issueBuilder::setAssignee); setNullable(emptyToNull(dto.getResolution()), issueBuilder::setResolution); issueBuilder.setStatus(dto.getStatus()); issueBuilder.setMessage(nullToEmpty(dto.getMessage())); issueBuilder.addAllTags(dto.getTags()); Long effort = dto.getEffort(); if (effort != null) { String effortValue = durations.encode(Duration.create(effort)); issueBuilder.setDebt(effortValue); issueBuilder.setEffort(effortValue); } setNullable(dto.getLine(), issueBuilder::setLine); setNullable(dto.getChecksum(), issueBuilder::setHash); completeIssueLocations(dto, issueBuilder); issueBuilder.setAuthor(nullToEmpty(dto.getAuthorLogin())); setNullable(dto.getIssueCreationDate(), issueBuilder::setCreationDate, DateUtils::formatDateTime); setNullable(dto.getIssueUpdateDate(), issueBuilder::setUpdateDate, DateUtils::formatDateTime); setNullable(dto.getIssueCloseDate(), issueBuilder::setCloseDate, DateUtils::formatDateTime); }

Target:
private void formatIssue(Issue.Builder issueBuilder, IssueDto dto, SearchResponseData data) { issueBuilder.setKey(dto.getKey()); setNullable(dto.getType(), issueBuilder::setType, Common.RuleType::valueOf); ComponentDto component = data.getComponentByUuid(dto.getComponentUuid()); issueBuilder.setOrganization(data.getOrganizationKey(component.getOrganizationUuid())); issueBuilder.setComponent(component.getKey()); setNullable(component.getBranch(), issueBuilder::setBranch); ComponentDto project = data.getComponentByUuid(dto.getProjectUuid()); if (project != null) { issueBuilder.setProject(project.getKey()); ComponentDto subProject = data.getComponentByUuid(dto.getModuleUuid()); if (subProject != null && !subProject.getDbKey().equals(project.getDbKey())) { issueBuilder.setSubProject(subProject.getKey()); } } issueBuilder.setRule(dto.getRuleKey().toString()); issueBuilder.setSeverity(Common.Severity.valueOf(dto.getSeverity())); setNullable(emptyToNull(dto.getAssignee()), issueBuilder::setAssignee); setNullable(emptyToNull(dto.getResolution()), issueBuilder::setResolution); issueBuilder.setStatus(dto.getStatus()); issueBuilder.setMessage(nullToEmpty(dto.getMessage())); issueBuilder.addAllTags(dto.getTags()); Long effort = dto.getEffort(); if (effort != null) { String effortValue = durations.encode(Duration.create(effort)); issueBuilder.setDebt(effortValue); issueBuilder.setEffort(effortValue); } setNullable(dto.getLine(), issueBuilder::setLine); setNullable(emptyToNull(dto.getChecksum()), issueBuilder::setHash); completeIssueLocations(dto, issueBuilder); issueBuilder.setAuthor(nullToEmpty(dto.getAuthorLogin())); setNullable(dto.getIssueCreationDate(), issueBuilder::setCreationDate, DateUtils::formatDateTime); setNullable(dto.getIssueUpdateDate(), issueBuilder::setUpdateDate, DateUtils::formatDateTime); setNullable(dto.getIssueCloseDate(), issueBuilder::setCloseDate, DateUtils::formatDateTime); }