Example usage for com.liferay.portal.kernel.util SubscriptionSender setLocalizedPortletTitleMap

List of usage examples for com.liferay.portal.kernel.util SubscriptionSender setLocalizedPortletTitleMap

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util SubscriptionSender setLocalizedPortletTitleMap.

Prototype

public void setLocalizedPortletTitleMap(Map<Locale, String> localizedPortletTitleMap) 

Source Link

Usage

From source file:com.liferay.asset.publisher.web.internal.messaging.AssetEntriesCheckerUtil.java

License:Open Source License

private static SubscriptionSender _getSubscriptionSender(PortletPreferences portletPreferences,
        List<AssetEntry> assetEntries) {

    if (assetEntries.isEmpty()) {
        return null;
    }// w  ww.  ja v  a2s  .c  o  m

    AssetEntry assetEntry = assetEntries.get(0);

    String fromName = _assetPublisherWebUtil.getEmailFromName(portletPreferences, assetEntry.getCompanyId());
    String fromAddress = _assetPublisherWebUtil.getEmailFromAddress(portletPreferences,
            assetEntry.getCompanyId());

    Map<Locale, String> localizedSubjectMap = _assetPublisherWebUtil
            .getEmailAssetEntryAddedSubjectMap(portletPreferences);
    Map<Locale, String> localizedBodyMap = _assetPublisherWebUtil
            .getEmailAssetEntryAddedBodyMap(portletPreferences);

    SubscriptionSender subscriptionSender = new SubscriptionSender();

    subscriptionSender.setCompanyId(assetEntry.getCompanyId());
    subscriptionSender.setContextAttributes("[$ASSET_ENTRIES$]",
            ListUtil.toString(assetEntries, _titleAccessor, StringPool.COMMA_AND_SPACE));
    subscriptionSender.setFrom(fromAddress, fromName);
    subscriptionSender.setHtmlFormat(true);
    subscriptionSender.setLocalizedBodyMap(localizedBodyMap);
    subscriptionSender
            .setLocalizedPortletTitleMap(PortletConfigurationUtil.getPortletTitleMap(portletPreferences));
    subscriptionSender.setLocalizedSubjectMap(localizedSubjectMap);
    subscriptionSender.setMailId("asset_entry", assetEntry.getEntryId());
    subscriptionSender.setPortletId(AssetPublisherPortletKeys.ASSET_PUBLISHER);
    subscriptionSender.setReplyToAddress(fromAddress);

    return subscriptionSender;
}