Example usage for com.liferay.portal.kernel.messaging Message getBoolean

List of usage examples for com.liferay.portal.kernel.messaging Message getBoolean

Introduction

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

Prototype

public boolean getBoolean(String key) 

Source Link

Usage

From source file:com.liferay.mail.messaging.MailSynchronizationMessageListener.java

License:Open Source License

protected void flagMessage(Message message) throws Exception {
    long userId = message.getLong("userId");
    long accountId = message.getLong("accountId");
    String password = message.getString("password");
    long folderId = message.getLong("folderId");
    long messageId = message.getLong("messageId");
    int flag = message.getInteger("flag");
    boolean flagValue = message.getBoolean("flagValue");

    if (_log.isDebugEnabled()) {
        _log.debug("Flagging message for messageId " + messageId);
    }/*from ww  w .j  av  a  2 s  .  com*/

    if (Validator.isNull(password)) {
        return;
    }

    Mailbox mailbox = MailboxFactoryUtil.getMailbox(userId, accountId, password);

    mailbox.updateFlags(folderId, new long[] { messageId }, flag, flagValue);
}

From source file:com.liferay.mobile.pushnotifications.messaging.NotificationMessageListener.java

License:Open Source License

public void receive(Message message) {
    List<Long> userIds = (List<Long>) message.get("userIds");
    String alert = message.getString("alert");
    String collapseKey = message.getString("collapseKey");
    String data = message.getString("data");
    int timeToLive = message.getInteger("timeToLive");
    boolean delayWhileIdle = message.getBoolean("delayWhileIdle");
    int badge = message.getInteger("badge");
    String sound = message.getString("sound");

    for (long userId : userIds) {
        try {/* www  . j  a  v  a 2s.c o  m*/
            AndroidNotificationSender.send(userId, collapseKey, data, timeToLive, delayWhileIdle);

            iOSNotificationSender.send(userId, alert, data, badge, sound);
        } catch (Exception e) {
            _log.error(e);
        }
    }
}

From source file:com.liferay.ruon.messaging.RUONMessageListener.java

License:Open Source License

protected void updatePresence(Message message) throws Exception {
    long userId = message.getLong("userId");
    String networkName = message.getString("networkName");
    boolean online = message.getBoolean("online");

    PresenceLocalServiceUtil.updatePresence(userId, networkName, online);
}

From source file:com.liferay.testtransaction.messaging.TestTransactionMessageListener.java

License:Open Source License

@Override
protected void doReceive(Message message) throws Exception {
    boolean rollback = message.getBoolean("rollback");
    String text = message.getString("text");

    if (rollback) {
        BarLocalServiceUtil.addBar_Rollback(text);
    } else {/*from   www .j a v  a 2 s.com*/
        BarLocalServiceUtil.addBar_Success(text);
    }
}

From source file:com.rivetlogic.event.notification.messagelistener.NotificationListener.java

License:Open Source License

private void doReceive(Message message) throws AddressException, PortalException, SystemException {

    String cmd = message.getString(NotificationConstants.CMD);
    String[] data = null;/*from w  w  w.  j ava2 s .  co  m*/
    MessageSenderImpl messageSender = new MessageSenderImpl();
    setCommonFields(message, messageSender);

    if (NotificationConstants.REGULAR_INVITATION.equalsIgnoreCase(cmd)) {

        data = processRegularInvitation(message, messageSender);

    } else if (NotificationConstants.MANUAL_EVENT_REGISTRATION.equalsIgnoreCase(cmd)) {

        data = processManualEvent(message, messageSender);

    } else if (NotificationConstants.EVENT_UPDATED.equalsIgnoreCase(cmd)) {

        processUpdatedEvent(message, messageSender);

    } else if (NotificationConstants.EVENT_CANCELLED.equalsIgnoreCase(cmd)) {

        processCancelledEvent(message, messageSender);

    } else if (NotificationConstants.SINGLE_EVENT_UPDATE.equalsIgnoreCase(cmd)) {

        data = processSingleUpdatedEvent(message, messageSender);

    } else if (NotificationConstants.SINGLE_CANCELLED_EVENT.equalsIgnoreCase(cmd)) {

        processSingleCancelledEvent(message, messageSender);

    } else if (NotificationConstants.REMINDER_MESSAGE.equalsIgnoreCase(cmd)) {

        processReminderMessage(message, messageSender);
    }

    if (data != null) {
        processTemplate(messageSender, data);

        if (_log.isDebugEnabled())
            _log.debug(messageSender.getBody());

        EmailNotificationUtil.sendEmailNotification(messageSender);

        if (!message.getBoolean(NotificationConstants.DONT_UPDATE_USER)) {
            updateParticipantStatus(message.getLong(NotificationConstants.PARTICIPANT_ID));
        }
    }
}