/** * Creates a poll for the topic or updates an existing one. * On update all poll items with the same name remain unchanged, * except probably their position in list. Users, previously voted * for the deleted items can NOT vote again. * * @param poll poll data from UI form * @param persistentTopic topic from a database */ private void createPoll(Poll poll, Topic persistentTopic) { if (poll != null && poll.isHasPoll()) { if (persistentTopic.getPoll() == null) { persistentTopic.setPoll(poll); poll.setTopic(persistentTopic); pollService.createPoll(poll); } } }