tb.setApproved(currentThread.isApproved());
tb.setNotApprovedMessages(currentThread.getMessageCount(false));
tb.setReplies(currentThread.getMessageCount() - 1);
tb.setTopic(currentThread.getName());
Message rootMessage = currentThread.getRootMessage();
MessageBean mb = new MessageBean();
mb.setAnonymous(rootMessage.isAnonymous());
UserBean ub = new UserBean();
if(!rootMessage.isAnonymous()){
User rootMessageUser = rootMessage.getUser();
ub.setId(rootMessageUser.getID());
ub.setUserName(rootMessageUser.getUsername());
ub.setName(rootMessageUser.getName());
ub.setEmail(rootMessageUser.getEmail());
}else{
//:NOTE: we suppose in front application : name & email message property for anonymous user
ub.setUserName(rootMessage.getProperty("name"));
ub.setEmail(rootMessage.getProperty("email"));
}
mb.setAuthor(ub);
tb.setRootMessage(mb);
tbs.add(tb);