Search in sources :

Example 1 with DiscussionUpdateEvent

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));
}
Also used : DiscussionUpdateEvent(com.github.chipolaris.bootforum.event.DiscussionUpdateEvent) Tag(com.github.chipolaris.bootforum.domain.Tag)

Example 2 with DiscussionUpdateEvent

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);
    }
}
Also used : DiscussionUpdateEvent(com.github.chipolaris.bootforum.event.DiscussionUpdateEvent) Discussion(com.github.chipolaris.bootforum.domain.Discussion)

Example 3 with DiscussionUpdateEvent

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"));
    }
}
Also used : DiscussionUpdateEvent(com.github.chipolaris.bootforum.event.DiscussionUpdateEvent) Discussion(com.github.chipolaris.bootforum.domain.Discussion)

Example 4 with DiscussionUpdateEvent

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);
    }
}
Also used : DiscussionUpdateEvent(com.github.chipolaris.bootforum.event.DiscussionUpdateEvent) Tag(com.github.chipolaris.bootforum.domain.Tag) Discussion(com.github.chipolaris.bootforum.domain.Discussion)

Aggregations

DiscussionUpdateEvent (com.github.chipolaris.bootforum.event.DiscussionUpdateEvent)4 Discussion (com.github.chipolaris.bootforum.domain.Discussion)3 Tag (com.github.chipolaris.bootforum.domain.Tag)2