public core.entities.Topic toTopic() { core.entities.Topic topic = new core.entities.Topic(); topic.setTopicId(getTopicId()); topic.setDescription(getDescription()); topic.setCategory(getCategory()); topic.setChoices(new ArrayList<Choice>(getChoices())); topic.setDateTime(DateTime.parse(getDateTime())); topic.setUserId(getUserId()); return topic; }
public static Topic fromTopic(core.entities.Topic topic) { Topic topicModel = new Topic(); topicModel.setTopicId(topic.getTopicId()); topicModel.setDescription(topic.getDescription()); topicModel.setCategory(topic.getCategory()); topicModel.setChoices(new ArrayList<Choice>(topic.getChoices())); topicModel.setDateTime(topic.getDateTime().toString()); topicModel.setUserId(topic.getUserId()); return topicModel; }