Example usage for com.liferay.portal.util PropsValues POP_SERVER_SUBDOMAIN

List of usage examples for com.liferay.portal.util PropsValues POP_SERVER_SUBDOMAIN

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues POP_SERVER_SUBDOMAIN.

Prototype

String POP_SERVER_SUBDOMAIN

To view the source code for com.liferay.portal.util PropsValues POP_SERVER_SUBDOMAIN.

Click Source Link

Usage

From source file:com.liferay.message.boards.internal.pop.MessageListenerImpl.java

License:Open Source License

protected Company getCompany(String messageIdString) throws Exception {
    int pos = messageIdString.indexOf(CharPool.AT) + PropsValues.POP_SERVER_SUBDOMAIN.length() + 1;

    if (PropsValues.POP_SERVER_SUBDOMAIN.length() > 0) {
        pos++;/* w w  w. j  a  va  2s  . c o m*/
    }

    int endPos = messageIdString.indexOf(CharPool.GREATER_THAN, pos);

    if (endPos == -1) {
        endPos = messageIdString.length();
    }

    String mx = messageIdString.substring(pos, endPos);

    return _companyLocalService.getCompanyByMx(mx);
}

From source file:com.liferay.message.boards.internal.pop.MessageListenerImpl.java

License:Open Source License

protected String getMessageIdString(String recipient, Message message) throws Exception {

    if (PropsValues.POP_SERVER_SUBDOMAIN.length() > 0) {
        return recipient;
    } else {/*from   ww w .  j  a v a 2s. co m*/
        return MBUtil.getParentMessageIdString(message);
    }
}

From source file:com.liferay.portlet.messageboards.pop.MessageListenerImpl.java

License:Open Source License

protected Company getCompany(String messageId) throws Exception {
    int pos = messageId.indexOf(CharPool.AT) + PropsValues.POP_SERVER_SUBDOMAIN.length() + 1;

    if (PropsValues.POP_SERVER_SUBDOMAIN.length() > 0) {
        pos++;/*  ww  w .  j  av  a  2s . c o  m*/
    }

    String mx = messageId.substring(pos, messageId.length() - 1);

    return CompanyLocalServiceUtil.getCompanyByMx(mx);
}

From source file:com.liferay.portlet.messageboards.pop.MessageListenerImpl.java

License:Open Source License

protected String getMessageId(String recipient, Message message) throws Exception {

    if (PropsValues.POP_SERVER_SUBDOMAIN.length() > 0) {
        return recipient;
    } else {//from   www  . j  a  va2 s .co m
        return MBUtil.getParentMessageIdString(message);
    }
}

From source file:com.liferay.portlet.messageboards.pop.MessageListenerImpl.java

License:Open Source License

protected int getOffset() {
    if (PropsValues.POP_SERVER_SUBDOMAIN.length() == 0) {
        return 1;
    }

    return 0;
}

From source file:com.liferay.portlet.messageboards.util.MBUtil.java

License:Open Source License

public static String getMailingListAddress(long groupId, long categoryId, long messageId, String mx,
        String defaultMailingListAddress) {

    if (PropsValues.POP_SERVER_SUBDOMAIN.length() <= 0) {
        String mailingListAddress = defaultMailingListAddress;

        try {//from   w w w .  ja va 2  s.  com
            MBMailingList mailingList = MBMailingListLocalServiceUtil.getCategoryMailingList(groupId,
                    categoryId);

            if (mailingList.isActive()) {
                mailingListAddress = mailingList.getEmailAddress();
            }
        } catch (Exception e) {
        }

        return mailingListAddress;
    }

    StringBundler sb = new StringBundler(8);

    sb.append(MESSAGE_POP_PORTLET_PREFIX);
    sb.append(categoryId);
    sb.append(StringPool.PERIOD);
    sb.append(messageId);
    sb.append(StringPool.AT);
    sb.append(PropsValues.POP_SERVER_SUBDOMAIN);
    sb.append(StringPool.PERIOD);
    sb.append(mx);

    return sb.toString();
}

From source file:com.liferay.portlet.messageboards.util.MBUtil.java

License:Open Source License

public static boolean hasMailIdHeader(Message message) throws Exception {
    String[] messageIds = message.getHeader("Message-ID");

    if (messageIds == null) {
        return false;
    }/*from  w ww .ja v a 2s  .c  o  m*/

    for (String messageId : messageIds) {
        if (Validator.isNotNull(PropsValues.POP_SERVER_SUBDOMAIN)
                && messageId.contains(PropsValues.POP_SERVER_SUBDOMAIN)) {

            return true;
        }
    }

    return false;
}