I just work on a jive plugin with should modify blogPost. And for me it looks like there is something wrong or weird in the internal Api.

 

In the interface com.jivesoftware.community.BlogPost if found this:

 

/** 
 * Saves the state of this BlogPost to the database 
 * 
 * @param fireModifiedEvent true if a modified event should get fired after the blog is saved. 
 * @throws UnauthorizedException If the user is not allowed to modify this blogpost 
 * @throws IllegalArgumentException if the subject has already been used on this blog on the given publish date 
 */  
void save(boolean fireModifiedEvent) throws UnauthorizedException;  

 

 

In the implementation of com.jivesoftware.community.impl.DbBlogPost the method signature looks like this:

 

@Transactional(readOnly = false, propagation = Propagation.REQUIRED)  
public void save(boolean runInterceptors) {  

 That doesn't match. And when i look further in the method I found this:

// In the case of a moderated post we don't want to send a modified event  
// before sending out a created event.  
// That only happens when the status is changed from PUBLISHED to AWAITING_MODERATION. Fixed    
if (!(existingPost.getStatus() == Status.PUBLISHED && this.getStatus() == Status.AWAITING_MODERATION )) {  

boolean shouldFeed = this.getStatus().isVisible();  

    Map<String, Object> paramMap = new HashMap<String, Object>();  
    paramMap.put(BlogPostEvent.KEY_EXISTING_POST_STATUS, existingPost.getStatus()); 

    BlogPostEvent event; 

if (existingPost.getStatus() != Status.PUBLISHED && shouldFeed) {  
        event = new BlogPostEvent(BlogPostEvent.Type.CREATED, this, paramMap);  
    } else {  
        event = new BlogPostEvent(BlogPostEvent.Type.MODIFIED, this, paramMap);  
    } 

    event.setShouldFeedActivity(shouldFeed); 

    JiveApplication.getEffectiveContext().getEventDispatcher().fire(event); 
} 

So it looks like a blogPost event is fired when

 

!(existingPost.getStatus() == Status.PUBLISHED && this.getStatus() == Status.AWAITING_MODERATION )

 

So for me. It looks like the save(boolean fireModifiedEvent) does fire modified events when the parameter is set to false. Does anybody know how i can save a BlogPost without firing a modifed event. Only with the BlogPostBean?

 

Thanks

Jens