use of org.mamute.model.NewsInformation in project mamute by caelum.
the class NewsController method newNews.
@Post
@CustomBrutauthRules({ LoggedRule.class, InputRule.class })
public void newNews(String title, MarkedText description) {
NewsInformation information = new NewsInformation(title, description, currentUser, "new news");
User author = currentUser.getCurrent();
News news = new News(information, author);
result.include("news", news);
newses.save(news);
result.redirectTo(this).showNews(news, news.getSluggedTitle());
}
use of org.mamute.model.NewsInformation in project mamute by caelum.
the class NewsBuilder method build.
public News build() {
if (loggedUser == null) {
loggedUser = new LoggedUser(author, null);
}
NewsInformation newsInformation = new NewsInformation(title, description, loggedUser, comment);
News news = new News(newsInformation, author);
setId(news, id);
return news;
}
use of org.mamute.model.NewsInformation in project mamute by caelum.
the class NewsController method saveEdit.
@Post
@CustomBrutauthRules(EditNewsRule.class)
public void saveEdit(@Load News news, String title, MarkedText description, String comment) {
Information newInformation = new NewsInformation(title, description, currentUser, comment);
news.enqueueChange(newInformation, UpdateStatus.NO_NEED_TO_APPROVE);
result.redirectTo(this).showNews(news, news.getSluggedTitle());
}
use of org.mamute.model.NewsInformation in project mamute by caelum.
the class NewsDAOTest method saveNews.
private News saveNews(User newsAuthor, boolean approved) {
NewsInformation newsInformation = newsInformation(newsAuthor);
News news = new News(newsInformation, newsAuthor);
if (approved)
news.approved();
session.save(newsInformation);
session.save(news);
return news;
}
Aggregations