/** * Set string representation of poll options. Parse this string and fill * poll items list. * * @param pollItemsValue poll options in string representation */ public void setPollItemsValue(String pollItemsValue) { if (StringUtils.isNotBlank(pollItemsValue)) { this.pollItemsValue = pollItemsValue; this.setPollItems(parseItems(pollItemsValue)); } }
public static Poll createDefaultVoting() { Topic topic = getDefaultTopic(); Poll poll = new Poll("New voting"); List<PollItem> pollItems = new ArrayList<>(); pollItems.add(new PollItem("item1")); pollItems.add(new PollItem("item2")); pollItems.add(new PollItem("item3")); poll.setPollItems(pollItems); topic.setPoll(poll); poll.setTopic(topic); persist(topic); return poll; }