use of com.github.chipolaris.bootforum.event.DiscussionUpdateEvent in project BootForum by chipolaris.
the class DataInitializer method createBulletinTag.
private void createBulletinTag(Discussion discussion) {
Tag tag = new Tag();
tag.setLabel("Bulletin");
// DodgerBlue
tag.setColor("1e90ff");
tag.setIcon("pi pi-book");
genericService.saveEntity(tag);
discussion.setTags(List.of(tag));
genericService.updateEntity(discussion);
applicationEventPublisher.publishEvent(new DiscussionUpdateEvent(this, discussion));
}
use of com.github.chipolaris.bootforum.event.DiscussionUpdateEvent in project BootForum by chipolaris.
the class ModerateDiscussion method updateDiscussion.
public void updateDiscussion() {
ServiceResponse<Discussion> response = genericService.updateEntity(this.discussion);
if (response.getAckCode() != AckCodeType.FAILURE) {
JSFUtils.addInfoStringMessage(null, "Discussion Updated");
applicationEventPublisher.publishEvent(new DiscussionUpdateEvent(this, this.discussion));
} else {
JSFUtils.addServiceErrorMessage(response);
}
}
use of com.github.chipolaris.bootforum.event.DiscussionUpdateEvent in project BootForum by chipolaris.
the class ViewDiscussion method saveDiscussionTitle.
public void saveDiscussionTitle() {
if (this.userSession.getUser() == null || !this.discussion.getCreateBy().equals(this.userSession.getUser().getUsername())) {
JSFUtils.addErrorStringMessage(null, JSFUtils.getMessageBundle().getString("unable.to.complete.request"));
return;
}
ServiceResponse<Discussion> serviceResponse = genericService.updateEntity(this.discussion);
if (serviceResponse.getAckCode() == AckCodeType.SUCCESS) {
JSFUtils.addInfoStringMessage(null, JSFUtils.getMessageBundle().getString("discussion.title.updated"));
applicationEventPublisher.publishEvent(new DiscussionUpdateEvent(this, this.discussion));
} else {
JSFUtils.addErrorStringMessage(null, JSFUtils.getMessageBundle().getString("unable.to.save.discussion.title"));
}
}
use of com.github.chipolaris.bootforum.event.DiscussionUpdateEvent in project BootForum by chipolaris.
the class ModerateDiscussion method updateDiscussionTag.
public void updateDiscussionTag() {
ServiceResponse<Discussion> response = genericService.updateEntity(this.discussion);
if (response.getAckCode() != AckCodeType.FAILURE) {
JSFUtils.addInfoStringMessage(null, "Discussion Tag Updated");
for (Tag tag : discussion.getTags()) {
cacheManager.getCache(CachingConfig.DISCCUSIONS_FOR_TAG).evict(tag.getId());
}
applicationEventPublisher.publishEvent(new DiscussionUpdateEvent(this, this.discussion));
} else {
JSFUtils.addServiceErrorMessage(response);
}
}
Aggregations