private List<PickerAssignee> convertToPickerAssignees(TurboIssue issue, List<TurboUser> users) { return users .stream() .map( user -> { PickerAssignee convertedAssignee = new PickerAssignee(user); if (isExistingAssignee(issue, convertedAssignee)) { convertedAssignee.setExisting(true); } return convertedAssignee; }) .sorted() .collect(Collectors.toList()); }
private void setConfirmResultConverter() { setResultConverter( (dialogButton) -> { List<PickerAssignee> finalUsers = state.getCurrentUsersList(); Optional<PickerAssignee> selectedAssignee = PickerAssignee.getSelectedAssignee(finalUsers); return new AssigneePickerDialogResponse( dialogButton, selectedAssignee.map(PickerAssignee::getLoginName)); }); }
private boolean isExistingAssignee(TurboIssue issue, PickerAssignee assignee) { if (!issue.getAssignee().isPresent()) return false; return issue.getAssignee().get().equals(assignee.getLoginName()); }
private void fillTextFieldWithExistingAssignee() { PickerAssignee.getExistingAssignee(originalUsers) .map(PickerAssignee::getLoginName) .ifPresent(this::fillTextFieldWithUsername); }
private void updateExistingAssignee(List<PickerAssignee> users, FlowPane assignedUserPane) { Optional<PickerAssignee> existingAssignee = PickerAssignee.getExistingAssignee(users); Node existingAssigneeNode = createExistingAssigneeNode(existingAssignee); assignedUserPane.getChildren().add(existingAssigneeNode); }