use of easytests.personal.dto.IssueStandardTopicPriorityDto 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