use of org.jbei.ice.lib.dto.message.MessageInfo in project ice by JBEI.
the class Messages method get.
public Results<MessageInfo> get(int start, int limit) {
Account account = accountDAO.getByEmail(this.userId);
List<Group> groups = DAOFactory.getGroupDAO().retrieveMemberGroups(account);
List<Message> messages = new ArrayList<>(dao.retrieveMessages(account, groups, start, limit));
Results<MessageInfo> results = new Results<>();
for (Message message : messages) {
Account from = accountDAO.getByEmail(message.getFromEmail());
if (from == null)
continue;
MessageInfo info = new MessageInfo();
info.setId(message.getId());
info.setFrom(message.getFromEmail());
info.setTitle(message.getTitle());
info.setRead(message.isRead());
info.setSent(message.getDateSent().getTime());
results.getData().add(info);
}
int totalSize = dao.retrieveMessageCount(account, groups);
results.setResultCount(totalSize);
return results;
}
use of org.jbei.ice.lib.dto.message.MessageInfo in project ice by JBEI.
the class Message method toDataTransferObject.
@Override
public MessageInfo toDataTransferObject() {
MessageInfo info = new MessageInfo();
info.setId(getId());
info.setFrom(getFromEmail());
info.setMessage(getMessage());
info.setTitle(getTitle());
info.setRead(isRead());
info.setSent(this.dateSent.getTime());
return info;
}
Aggregations