use of easytests.personal.dto.IssueStandardQuestionTypeOptionDto in project easy-tests by malinink.
the class IssueStandardDtoValidator method validateQuestionTypeOptionDtoIdBelongsToIssueStandard.
private void validateQuestionTypeOptionDtoIdBelongsToIssueStandard(Errors errors, IssueStandardDto issueStandardDto) {
final List<IssueStandardQuestionTypeOptionModelInterface> qtoModels = this.questionTypeOptionsService.findByIssueStandard(new IssueStandardModelEmpty(issueStandardDto.getId()));
final List<Integer> qtoModelIds = new ArrayList<>(qtoModels.size());
qtoModelIds.addAll(qtoModels.stream().map(IdentityInterface::getId).collect(Collectors.toList()));
int index = 0;
for (IssueStandardQuestionTypeOptionDto qtoDto : issueStandardDto.getQuestionTypeOptions()) {
if (qtoDto.getId() != null && !qtoModelIds.contains(qtoDto.getId())) {
reject(errors, qtoField(index, "id"), "Foreign questionTypeOption id for IssueStandard entity");
}
index++;
}
}
Aggregations