@Override public String getValue(TopicDto item) { return item.getName(); } },
@Override public String render(TopicDto object) { return object != null ? object.getName() : ""; }
@Override public TopicDto saveTopic(TopicDto topicDto) { validateSqlObject(topicDto, "Can't save topic. Invalid topic object"); if (StringUtils.isBlank(topicDto.getId())) { LOG.debug("Save new topic."); topicDto.setCreatedTime(System.currentTimeMillis()); Topic topic = topicDao.findTopicByAppIdAndName(topicDto.getApplicationId(), topicDto.getName()); if (topic != null) { throw new IllegalArgumentException("Topic with the same name already present!"); } } return getDto(topicDao.save(new Topic(topicDto))); }
endpointId, topic.getId(), topic.getName());
/** * Instantiates new topic. */ public Topic(TopicDto dto) { if (dto != null) { this.id = getLongId(dto); this.name = dto.getName(); this.description = dto.getDescription(); this.createdUsername = dto.getCreatedUsername(); this.createdTime = dto.getCreatedTime(); this.sequenceNumber = dto.getSecNum(); this.type = dto.getType(); Long appId = getLongId(dto.getApplicationId()); this.application = appId != null ? new Application(appId) : null; } }
Topic topic = new Topic(); topic.setId(topicDto.getId()); topic.setName(topicDto.getName()); switch (topicDto.getType()) { case MANDATORY:
@Override protected void onEntityRetrieved() { detailsView.getName().setValue(entity.getName()); detailsView.getMandatory().setValue(entity.getType() == TopicTypeDto.MANDATORY); detailsView.getDescription().setValue(entity.getDescription()); detailsView.getCreatedUsername().setValue(entity.getCreatedUsername()); detailsView.getCreatedDateTime() .setValue(Utils.millisecondsToDateTimeString(entity.getCreatedTime())); }