use of easytests.core.models.IdentityInterface 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++;
}
}
use of easytests.core.models.IdentityInterface in project easy-tests by malinink.
the class IssueStandardDtoValidator method validateTopicPriorityDtoIdBelongsToIssueStandard.
private void validateTopicPriorityDtoIdBelongsToIssueStandard(Errors errors, IssueStandardDto issueStandardDto) {
final List<IssueStandardTopicPriorityModelInterface> tpModels = this.topicPrioritiesService.findByIssueStandard(new IssueStandardModelEmpty(issueStandardDto.getId()));
final List<Integer> tpModelIds = new ArrayList<>(tpModels.size());
tpModelIds.addAll(tpModels.stream().map(IdentityInterface::getId).collect(Collectors.toList()));
int index = 0;
for (IssueStandardTopicPriorityDto tpDto : issueStandardDto.getTopicPriorities()) {
if (tpDto.getId() != null && !tpModelIds.contains(tpDto.getId())) {
reject(errors, tpField(index, "id"), "Foreign topicPriority id for IssueStandard entity");
}
index++;
}
}
Aggregations