Weblogger roller = WebloggerFactory.getWeblogger();
WeblogManager weblogMgr = roller.getWeblogManager();
Timestamp current = new Timestamp(System.currentTimeMillis());
WeblogEntry entry = new WeblogEntry();
entry.setTitle(title);
entry.setText(content);
entry.setLocale(website.getLocale());
entry.setPubTime(current);
entry.setUpdateTime(current);
User user = roller.getUserManager().getUserByUserName(userid);
entry.setCreator(user);
entry.setWebsite(website);
entry.setCategory(website.getBloggerCategory());
entry.setCommentDays(new Integer(website.getDefaultCommentDays()));
if (Boolean.valueOf(publish).booleanValue()) {
entry.setStatus(WeblogEntry.PUBLISHED);
} else {
entry.setStatus(WeblogEntry.DRAFT);
}
// save the entry
weblogMgr.saveWeblogEntry(entry);
roller.flush();
// notify cache
flushPageCache(entry.getWebsite());
return entry.getId();
} catch (Exception e) {
String msg = "ERROR in BlooggerAPIHander.newPost";
mLogger.error(msg,e);
throw new XmlRpcException(UNKNOWN_EXCEPTION, msg);
}