Example usage for com.liferay.portal.kernel.messaging DestinationNames MAIL_SYNCHRONIZER

List of usage examples for com.liferay.portal.kernel.messaging DestinationNames MAIL_SYNCHRONIZER

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.messaging DestinationNames MAIL_SYNCHRONIZER.

Prototype

String MAIL_SYNCHRONIZER

To view the source code for com.liferay.portal.kernel.messaging DestinationNames MAIL_SYNCHRONIZER.

Click Source Link

Usage

From source file:com.liferay.mail.util.MailManager.java

License:Open Source License

public void markAsRead(long accountId, long folderId, long messageId) throws PortalException {

    com.liferay.portal.kernel.messaging.Message message = new com.liferay.portal.kernel.messaging.Message();

    message.put("command", "flag");

    message.put("userId", _user.getUserId());
    message.put("accountId", accountId);
    message.put("password", _passwordRetriever.getPassword(accountId));
    message.put("folderId", folderId);
    message.put("messageId", messageId);
    message.put("flag", MailConstants.FLAG_SEEN);
    message.put("flagValue", true);

    MessageBusUtil.sendMessage(DestinationNames.MAIL_SYNCHRONIZER, message);
}

From source file:com.liferay.mail.util.MailManager.java

License:Open Source License

protected void synchronize(long accountId, long folderId, long messageId, int pageNumber, int messagesPerPage)
        throws PortalException {

    String password = _passwordRetriever.getPassword(accountId);

    if (Validator.isNull(password)) {
        return;/*from w  ww . ja va 2s.  c om*/
    }

    com.liferay.portal.kernel.messaging.Message message = new com.liferay.portal.kernel.messaging.Message();

    message.put("command", "synchronize");

    message.put("userId", _user.getUserId());
    message.put("accountId", accountId);
    message.put("password", password);
    message.put("folderId", folderId);
    message.put("messageId", messageId);
    message.put("pageNumber", pageNumber);
    message.put("messagesPerPage", messagesPerPage);

    MessageBusUtil.sendMessage(DestinationNames.MAIL_SYNCHRONIZER, message);
}