Example usage for com.liferay.portal.kernel.language LanguageUtil format

List of usage examples for com.liferay.portal.kernel.language LanguageUtil format

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.language LanguageUtil format.

Prototype

public static String format(ResourceBundle resourceBundle, String pattern, Object[] arguments) 

Source Link

Usage

From source file:com.liferay.util.bridges.jsf.common.FacesMessageUtil.java

License:Open Source License

private static void _addMessage(String clientId, FacesContext facesContext, Severity severity, String key,
        Object[] arguments) {/*from   ww  w  .  ja va  2s.c  o  m*/

    Locale locale = JSFPortletUtil.getLocale(facesContext);

    String message = LanguageUtil.format(locale, key, arguments);

    FacesMessage facesMessage = new FacesMessage(severity, message, null);

    facesContext.addMessage(clientId, facesMessage);
}

From source file:com.liferay.wiki.service.impl.WikiPageLocalServiceImpl.java

License:Open Source License

protected WikiPage doRenamePage(long userId, long nodeId, String title, String newTitle,
        ServiceContext serviceContext) throws PortalException {

    // Version pages

    List<WikiPage> versionPages = wikiPagePersistence.findByN_T(nodeId, title, QueryUtil.ALL_POS,
            QueryUtil.ALL_POS, new PageVersionComparator());

    WikiPage page = fetchLatestPage(nodeId, newTitle, WorkflowConstants.STATUS_ANY, false);

    if (page == null) {
        page = getLatestPage(nodeId, title, WorkflowConstants.STATUS_ANY, false);
    }// w w w  .  ja va2 s . c  o  m

    for (WikiPage versionPage : versionPages) {
        versionPage.setRedirectTitle(page.getRedirectTitle());
        versionPage.setTitle(newTitle);

        wikiPagePersistence.update(versionPage);
    }

    // Page resource

    long resourcePrimKey = page.getResourcePrimKey();

    WikiPageResource pageResource = wikiPageResourcePersistence.findByPrimaryKey(resourcePrimKey);

    pageResource.setTitle(newTitle);

    wikiPageResourcePersistence.update(pageResource);

    // Create stub page at the old location

    double version = WikiPageConstants.VERSION_DEFAULT;
    String summary = LanguageUtil.format(serviceContext.getLocale(), "renamed-as-x", newTitle);
    String format = page.getFormat();
    boolean head = true;
    String parentTitle = page.getParentTitle();
    String redirectTitle = page.getTitle();
    String content = StringPool.DOUBLE_OPEN_BRACKET + redirectTitle + StringPool.DOUBLE_CLOSE_BRACKET;

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);

    populateServiceContext(serviceContext, page);

    boolean workflowEnabled = WorkflowThreadLocal.isEnabled();

    WorkflowThreadLocal.setEnabled(false);

    serviceContext.setCommand(Constants.ADD);

    addPage(userId, nodeId, title, version, content, summary, false, format, head, parentTitle, redirectTitle,
            serviceContext);

    WorkflowThreadLocal.setEnabled(workflowEnabled);

    // Child pages

    List<WikiPage> childPages = wikiPagePersistence.findByN_P(nodeId, title);

    for (WikiPage childPage : childPages) {
        childPage.setParentTitle(newTitle);

        wikiPagePersistence.update(childPage);
    }

    // Redirect pages

    List<WikiPage> redirectorPages = getRedirectorPages(nodeId, title);

    for (WikiPage redirectorPage : redirectorPages) {
        redirectorPage.setRedirectTitle(newTitle);

        wikiPagePersistence.update(redirectorPage);
    }

    // Asset

    updateAsset(userId, page, serviceContext.getAssetCategoryIds(), serviceContext.getAssetTagNames(),
            serviceContext.getAssetLinkEntryIds(), serviceContext.getAssetPriority());

    return page;
}

From source file:com.tls.basiclti.BasicLTIUtil.java

License:Apache License

/**
 * Create the HTML to render a POST form and then automatically submit it.
 * Make sure to call {@link #cleanupProperties(Properties)} before signing.
 * /*from   w  ww.j  ava2  s  .  c o  m*/
 * @param cleanProperties
 *          Assumes you have called {@link #cleanupProperties(Properties)}
 *          beforehand.
 * @param endpoint
 *          The LTI launch url.
 * @param debug
 *          Useful for viewing the HTML before posting to end point.
 * @return the HTML ready for IFRAME src = inclusion.
 */
public static String postLaunchHTML(final Map<String, String> cleanProperties, String endpoint, boolean debug,
        Locale locale, boolean iframe) {
    if (cleanProperties == null || cleanProperties.isEmpty()) {
        throw new IllegalArgumentException("cleanProperties == null || cleanProperties.isEmpty()");
    }
    if (endpoint == null) {
        throw new IllegalArgumentException("endpoint == null");
    }
    Map<String, String> newMap = null;
    if (debug) {
        // sort the properties for readability
        newMap = new TreeMap<String, String>(cleanProperties);
    } else {
        newMap = cleanProperties;
    }
    StringBuilder text = new StringBuilder();
    // paint form
    text.append("<div id=\"ltiLaunchFormSubmitArea\">\n");
    text.append("<form action=\"");
    text.append(endpoint);
    text.append("\" name=\"ltiLaunchForm\" id=\"ltiLaunchForm\" method=\"post\" ");

    if (iframe)
        text.append("target=\"output_frame\"");

    text.append(" encType=\"application/x-www-form-urlencoded\" accept-charset=\"utf-8\">\n");
    for (Entry<String, String> entry : newMap.entrySet()) {
        String key = entry.getKey();
        String value = entry.getValue();
        if (value == null)
            continue;
        // This will escape the contents pretty much - at least
        // we will be safe and not generate dangerous HTML
        key = htmlspecialchars(key);
        value = htmlspecialchars(value);
        if (!key.equals(BASICLTI_SUBMIT)) {
            //text.append("<input type=\"submit\" name=\"");
            text.append("<input type=\"hidden\" name=\"");
            text.append(key);
            text.append("\" value=\"");
            text.append(value);
            text.append("\"/>\n");
        } /*else {
          }
          text.append(key);
          text.append("\" value=\"");
          text.append(value);
          text.append("\"/>\n");*/
    }
    text.append("</form>\n");
    text.append("</div>\n");
    // paint debug output
    if (debug) {
        text.append("<pre>\n");
        text.append("<b>BasicLTI Endpoint</b>\n");
        text.append(endpoint);
        text.append("\n\n");
        text.append("<b>BasicLTI Parameters:</b>\n");
        for (Entry<String, String> entry : newMap.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            if (value == null)
                continue;
            text.append(key);
            text.append("=");
            text.append(value);
            text.append("\n");
        }
        text.append("</pre>\n");
    } else {
        // paint auto submit script
        text.append("<div class='ltimessage'>");
        if (iframe) {
            text.append(" <a href='#content' onclick='javascript:goto();' >");
            text.append(LanguageUtil.format(locale, "learningactivity.lti.goiframe", null));
        } else {
            text.append(LanguageUtil.format(locale, "learningactivity.lti.outplataform", null));
            text.append(" <a href='#' onclick='javascript:goto();' >");
            text.append(LanguageUtil.format(locale, "learningactivity.lti.go", null));
        }
        text.append("</a>");
        text.append(
                "<script language=\"javascript\">function goto(){" + "nei = document.createElement('input');"
                        + "nei.setAttribute('type', 'hidden');" + "nei.setAttribute('name', '" + BASICLTI_SUBMIT
                        + "');" + " nei.setAttribute('value', '" + newMap.get(BASICLTI_SUBMIT) + "');"
                        + "document.getElementById(\"ltiLaunchForm\").appendChild(nei);"
                        + "document.ltiLaunchForm.submit();");
        if (iframe) {
            text.append("f = document.getElementById(\"output_frame\");" + "f.style.display = \"block\";");
        }
        text.append("}</script>");
        text.append("</div>");
        /*text
           .append(" <script language=\"javascript\"> \n"
          + "    document.getElementById(\"ltiLaunchFormSubmitArea\").style.display = \"none\";\n"
          + "    nei = document.createElement('input');\n"
          + "    nei.setAttribute('type', 'hidden');\n"
          + "    nei.setAttribute('name', '"
          + BASICLTI_SUBMIT
          + "');\n"
          + "    nei.setAttribute('value', '"
          + newMap.get(BASICLTI_SUBMIT)
          + "');\n"
          + "    document.getElementById(\"ltiLaunchForm\").appendChild(nei);\n"
          + "    document.ltiLaunchForm.submit(); \n" + " </script> \n");*/
    }

    String htmltext = text.toString();
    return htmltext;
}

From source file:org.apache.jsp.meetups.view_jsp.java

License:Open Source License

public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;//from  ww w .j a v a2s  . c o m
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
        response.setContentType("text/html");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

        out.write("\r\n");
        out.write("\r\n");

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //  portlet:defineObjects
        com.liferay.taglib.portlet.DefineObjectsTag _jspx_th_portlet_005fdefineObjects_005f0 = (com.liferay.taglib.portlet.DefineObjectsTag) _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.portlet.DefineObjectsTag.class);
        _jspx_th_portlet_005fdefineObjects_005f0.setPageContext(_jspx_page_context);
        _jspx_th_portlet_005fdefineObjects_005f0.setParent(null);
        int _jspx_eval_portlet_005fdefineObjects_005f0 = _jspx_th_portlet_005fdefineObjects_005f0.doStartTag();
        if (_jspx_th_portlet_005fdefineObjects_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_portlet_005fdefineObjects_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                .reuse(_jspx_th_portlet_005fdefineObjects_005f0);
        javax.portlet.ActionRequest actionRequest = null;
        javax.portlet.ActionResponse actionResponse = null;
        javax.portlet.EventRequest eventRequest = null;
        javax.portlet.EventResponse eventResponse = null;
        javax.portlet.PortletConfig portletConfig = null;
        java.lang.String portletName = null;
        javax.portlet.PortletPreferences portletPreferences = null;
        java.util.Map portletPreferencesValues = null;
        javax.portlet.PortletSession portletSession = null;
        java.util.Map portletSessionScope = null;
        javax.portlet.RenderRequest renderRequest = null;
        javax.portlet.RenderResponse renderResponse = null;
        javax.portlet.ResourceRequest resourceRequest = null;
        javax.portlet.ResourceResponse resourceResponse = null;
        actionRequest = (javax.portlet.ActionRequest) _jspx_page_context.findAttribute("actionRequest");
        actionResponse = (javax.portlet.ActionResponse) _jspx_page_context.findAttribute("actionResponse");
        eventRequest = (javax.portlet.EventRequest) _jspx_page_context.findAttribute("eventRequest");
        eventResponse = (javax.portlet.EventResponse) _jspx_page_context.findAttribute("eventResponse");
        portletConfig = (javax.portlet.PortletConfig) _jspx_page_context.findAttribute("portletConfig");
        portletName = (java.lang.String) _jspx_page_context.findAttribute("portletName");
        portletPreferences = (javax.portlet.PortletPreferences) _jspx_page_context
                .findAttribute("portletPreferences");
        portletPreferencesValues = (java.util.Map) _jspx_page_context.findAttribute("portletPreferencesValues");
        portletSession = (javax.portlet.PortletSession) _jspx_page_context.findAttribute("portletSession");
        portletSessionScope = (java.util.Map) _jspx_page_context.findAttribute("portletSessionScope");
        renderRequest = (javax.portlet.RenderRequest) _jspx_page_context.findAttribute("renderRequest");
        renderResponse = (javax.portlet.RenderResponse) _jspx_page_context.findAttribute("renderResponse");
        resourceRequest = (javax.portlet.ResourceRequest) _jspx_page_context.findAttribute("resourceRequest");
        resourceResponse = (javax.portlet.ResourceResponse) _jspx_page_context
                .findAttribute("resourceResponse");
        out.write("\r\n");
        out.write("\r\n");
        //  liferay-theme:defineObjects
        com.liferay.taglib.theme.DefineObjectsTag _jspx_th_liferay_002dtheme_005fdefineObjects_005f0 = (com.liferay.taglib.theme.DefineObjectsTag) _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.theme.DefineObjectsTag.class);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setPageContext(_jspx_page_context);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setParent(null);
        int _jspx_eval_liferay_002dtheme_005fdefineObjects_005f0 = _jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doStartTag();
        if (_jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
        com.liferay.portal.theme.ThemeDisplay themeDisplay = null;
        com.liferay.portal.model.Company company = null;
        com.liferay.portal.model.Account account = null;
        com.liferay.portal.model.User user = null;
        com.liferay.portal.model.User realUser = null;
        com.liferay.portal.model.Contact contact = null;
        com.liferay.portal.model.Layout layout = null;
        java.util.List layouts = null;
        java.lang.Long plid = null;
        com.liferay.portal.model.LayoutTypePortlet layoutTypePortlet = null;
        java.lang.Long scopeGroupId = null;
        com.liferay.portal.security.permission.PermissionChecker permissionChecker = null;
        java.util.Locale locale = null;
        java.util.TimeZone timeZone = null;
        com.liferay.portal.model.Theme theme = null;
        com.liferay.portal.model.ColorScheme colorScheme = null;
        com.liferay.portal.theme.PortletDisplay portletDisplay = null;
        java.lang.Long portletGroupId = null;
        themeDisplay = (com.liferay.portal.theme.ThemeDisplay) _jspx_page_context.findAttribute("themeDisplay");
        company = (com.liferay.portal.model.Company) _jspx_page_context.findAttribute("company");
        account = (com.liferay.portal.model.Account) _jspx_page_context.findAttribute("account");
        user = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("user");
        realUser = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("realUser");
        contact = (com.liferay.portal.model.Contact) _jspx_page_context.findAttribute("contact");
        layout = (com.liferay.portal.model.Layout) _jspx_page_context.findAttribute("layout");
        layouts = (java.util.List) _jspx_page_context.findAttribute("layouts");
        plid = (java.lang.Long) _jspx_page_context.findAttribute("plid");
        layoutTypePortlet = (com.liferay.portal.model.LayoutTypePortlet) _jspx_page_context
                .findAttribute("layoutTypePortlet");
        scopeGroupId = (java.lang.Long) _jspx_page_context.findAttribute("scopeGroupId");
        permissionChecker = (com.liferay.portal.security.permission.PermissionChecker) _jspx_page_context
                .findAttribute("permissionChecker");
        locale = (java.util.Locale) _jspx_page_context.findAttribute("locale");
        timeZone = (java.util.TimeZone) _jspx_page_context.findAttribute("timeZone");
        theme = (com.liferay.portal.model.Theme) _jspx_page_context.findAttribute("theme");
        colorScheme = (com.liferay.portal.model.ColorScheme) _jspx_page_context.findAttribute("colorScheme");
        portletDisplay = (com.liferay.portal.theme.PortletDisplay) _jspx_page_context
                .findAttribute("portletDisplay");
        portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId");
        out.write("\r\n");
        out.write("\r\n");

        WindowState windowState = renderRequest.getWindowState();

        String currentURL = PortalUtil.getCurrentURL(request);

        Group group = GroupLocalServiceUtil.getGroup(scopeGroupId);

        Organization organization = null;
        User user2 = null;

        if (group.isOrganization()) {
            organization = OrganizationLocalServiceUtil.getOrganization(group.getClassPK());
        } else if (group.isUser()) {
            user2 = UserLocalServiceUtil.getUserById(group.getClassPK());
        }

        Format dateFormatDate = FastDateFormatFactoryUtil.getDate(locale, timeZone);
        Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(locale, timeZone);

        NumberFormat numberFormat = NumberFormat.getNumberInstance(locale);
        NumberFormat percentFormat = NumberFormat.getPercentInstance(locale);

        out.write("\r\n");
        out.write("\r\n");

        String tabs1 = ParamUtil.getString(request, "tabs1", "all-meetups");

        List<MeetupsEntry> meetupsEntries = null;

        if (tabs1.equals("all-meetups")) {
            meetupsEntries = MeetupsEntryLocalServiceUtil
                    .getMeetupsEntriesByCompany(themeDisplay.getCompanyId());
        } else if (tabs1.equals("my-meetups")) {
            meetupsEntries = MeetupsEntryLocalServiceUtil
                    .getMeetupsEntriesByUser(PortalUtil.getUserId(request));
        }

        out.write("\r\n");
        out.write("\r\n");
        //  c:if
        org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest
                .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
        _jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context);
        _jspx_th_c_005fif_005f0.setParent(null);
        // /meetups/view.jsp(32,0) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
        _jspx_th_c_005fif_005f0.setTest(permissionChecker.isCompanyAdmin(company.getCompanyId()));
        int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag();
        if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
            do {
                out.write("\r\n");
                out.write("\r\n");
                out.write("\t");

                PortletURL portletURL = renderResponse.createRenderURL();

                out.write("\r\n");
                out.write("\r\n");
                out.write("\t");
                //  liferay-ui:tabs
                com.liferay.taglib.ui.TabsTag _jspx_th_liferay_002dui_005ftabs_005f0 = (com.liferay.taglib.ui.TabsTag) _005fjspx_005ftagPool_005fliferay_002dui_005ftabs_0026_005furl_005fparam_005fnames_005fnobody
                        .get(com.liferay.taglib.ui.TabsTag.class);
                _jspx_th_liferay_002dui_005ftabs_005f0.setPageContext(_jspx_page_context);
                _jspx_th_liferay_002dui_005ftabs_005f0
                        .setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f0);
                // /meetups/view.jsp(38,1) name = names type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                _jspx_th_liferay_002dui_005ftabs_005f0.setNames("all-meetups,my-meetups");
                // /meetups/view.jsp(38,1) name = param type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                _jspx_th_liferay_002dui_005ftabs_005f0.setParam("tabs1");
                // /meetups/view.jsp(38,1) name = url type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                _jspx_th_liferay_002dui_005ftabs_005f0.setUrl(portletURL.toString());
                int _jspx_eval_liferay_002dui_005ftabs_005f0 = _jspx_th_liferay_002dui_005ftabs_005f0
                        .doStartTag();
                if (_jspx_th_liferay_002dui_005ftabs_005f0
                        .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                    _005fjspx_005ftagPool_005fliferay_002dui_005ftabs_0026_005furl_005fparam_005fnames_005fnobody
                            .reuse(_jspx_th_liferay_002dui_005ftabs_005f0);
                    return;
                }
                _005fjspx_005ftagPool_005fliferay_002dui_005ftabs_0026_005furl_005fparam_005fnames_005fnobody
                        .reuse(_jspx_th_liferay_002dui_005ftabs_005f0);
                out.write("\r\n");
                out.write("\r\n");
                out.write("\t");

                PortletURL addMeetupsEntryURL = renderResponse.createRenderURL();

                addMeetupsEntryURL.setWindowState(WindowState.MAXIMIZED);

                addMeetupsEntryURL.setParameter("jspPage", "/meetups/edit_entry.jsp");
                addMeetupsEntryURL.setParameter("redirect", currentURL);

                out.write("\r\n");
                out.write("\r\n");
                out.write("\t<input type=\"button\" value='");
                if (_jspx_meth_liferay_002dui_005fmessage_005f0(_jspx_th_c_005fif_005f0, _jspx_page_context))
                    return;
                out.write("' onClick='location.href = \"");
                out.print(addMeetupsEntryURL.toString());
                out.write("\"' />\r\n");
                out.write("\r\n");
                out.write("\t<br /><br />\r\n");
                int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody();
                if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                    break;
            } while (true);
        }
        if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
        out.write("\r\n");
        out.write("\r\n");
        out.write("<table class=\"lfr-table\" width=\"100%\">\r\n");
        out.write("\r\n");

        for (int i = 0; i < meetupsEntries.size(); i++) {
            MeetupsEntry meetupsEntry = meetupsEntries.get(i);

            int yesTotal = MeetupsRegistrationLocalServiceUtil.getMeetupsRegistrationsCount(
                    meetupsEntry.getMeetupsEntryId(), MeetupsConstants.STATUS_YES);

            out.write("\r\n");
            out.write("\r\n");
            out.write("\t<tr>\r\n");
            out.write("\t\t<td align=\"center\" valign=\"top\">\r\n");
            out.write("\r\n");
            out.write("\t\t\t");

            PortletURL viewMeetupsEntryURL = renderResponse.createRenderURL();

            viewMeetupsEntryURL.setWindowState(WindowState.MAXIMIZED);

            viewMeetupsEntryURL.setParameter("jspPage", "/meetups/view_entry.jsp");
            viewMeetupsEntryURL.setParameter("meetupsEntryId",
                    String.valueOf(meetupsEntry.getMeetupsEntryId()));

            String thumbnailURL = null;

            if (meetupsEntry.getThumbnailId() == 0) {
                thumbnailURL = request.getContextPath() + "/meetups/images/calendar.png";
            } else {
                thumbnailURL = themeDisplay.getPathImage() + "/meetups?img_id=" + meetupsEntry.getThumbnailId()
                        + "&t=" + ImageServletTokenUtil.getToken(meetupsEntry.getThumbnailId());
            }

            out.write("\r\n");
            out.write("\r\n");
            out.write("\t\t\t<a href=\"");
            out.print(viewMeetupsEntryURL);
            out.write("\"><img alt=\"");
            if (_jspx_meth_liferay_002dui_005fmessage_005f1(_jspx_page_context))
                return;
            out.write("\" src=\"");
            out.print(thumbnailURL);
            out.write("\" /></a>\r\n");
            out.write("\t\t</td>\r\n");
            out.write("\t\t<td valign=\"top\" width=\"99%\">\r\n");
            out.write("\t\t\t<div>\r\n");
            out.write("\t\t\t\t");
            out.print(meetupsEntry.getTitle());
            out.write("\r\n");
            out.write("\t\t\t</div>\r\n");
            out.write("\r\n");
            out.write("\t\t\t<br />\r\n");
            out.write("\r\n");
            out.write("\t\t\t<div>\r\n");
            out.write("\t\t\t\t");
            out.print(meetupsEntry.getDescription());
            out.write("\r\n");
            out.write("\t\t\t</div>\r\n");
            out.write("\r\n");
            out.write("\t\t\t<br />\r\n");
            out.write("\r\n");
            out.write("\t\t\t");
            //  c:if
            org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f1 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest
                    .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
            _jspx_th_c_005fif_005f1.setPageContext(_jspx_page_context);
            _jspx_th_c_005fif_005f1.setParent(null);
            // /meetups/view.jsp(103,3) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
            _jspx_th_c_005fif_005f1.setTest(yesTotal > 1);
            int _jspx_eval_c_005fif_005f1 = _jspx_th_c_005fif_005f1.doStartTag();
            if (_jspx_eval_c_005fif_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                do {
                    out.write("\r\n");
                    out.write("\t\t\t\t<div>\r\n");
                    out.write("\t\t\t\t\t");
                    out.print(LanguageUtil.format(pageContext, "x-people-are-planning-to-attend-this-meetup",
                            String.valueOf(yesTotal)));
                    out.write("\r\n");
                    out.write("\t\t\t\t</div>\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t<br />\r\n");
                    out.write("\t\t\t");
                    int evalDoAfterBody = _jspx_th_c_005fif_005f1.doAfterBody();
                    if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                        break;
                } while (true);
            }
            if (_jspx_th_c_005fif_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1);
                return;
            }
            _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1);
            out.write("\r\n");
            out.write("\r\n");
            out.write("\t\t\t");
            //  liferay-ui:icon-list
            com.liferay.taglib.ui.IconListTag _jspx_th_liferay_002dui_005ficon_002dlist_005f0 = (com.liferay.taglib.ui.IconListTag) _005fjspx_005ftagPool_005fliferay_002dui_005ficon_002dlist
                    .get(com.liferay.taglib.ui.IconListTag.class);
            _jspx_th_liferay_002dui_005ficon_002dlist_005f0.setPageContext(_jspx_page_context);
            _jspx_th_liferay_002dui_005ficon_002dlist_005f0.setParent(null);
            int _jspx_eval_liferay_002dui_005ficon_002dlist_005f0 = _jspx_th_liferay_002dui_005ficon_002dlist_005f0
                    .doStartTag();
            if (_jspx_eval_liferay_002dui_005ficon_002dlist_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                if (_jspx_eval_liferay_002dui_005ficon_002dlist_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
                    out = _jspx_page_context.pushBody();
                    _jspx_th_liferay_002dui_005ficon_002dlist_005f0
                            .setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
                    _jspx_th_liferay_002dui_005ficon_002dlist_005f0.doInitBody();
                }
                do {
                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");
                    //  c:if
                    org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f2 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest
                            .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
                    _jspx_th_c_005fif_005f2.setPageContext(_jspx_page_context);
                    _jspx_th_c_005fif_005f2.setParent(
                            (javax.servlet.jsp.tagext.Tag) _jspx_th_liferay_002dui_005ficon_002dlist_005f0);
                    // /meetups/view.jsp(113,4) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                    _jspx_th_c_005fif_005f2.setTest(permissionChecker.isCompanyAdmin(company.getCompanyId()));
                    int _jspx_eval_c_005fif_005f2 = _jspx_th_c_005fif_005f2.doStartTag();
                    if (_jspx_eval_c_005fif_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                        do {
                            out.write("\r\n");
                            out.write("\r\n");
                            out.write("\t\t\t\t\t");

                            PortletURL editMeetupsEntryURL = renderResponse.createRenderURL();

                            editMeetupsEntryURL.setWindowState(WindowState.MAXIMIZED);

                            editMeetupsEntryURL.setParameter("jspPage", "/meetups/edit_entry.jsp");
                            editMeetupsEntryURL.setParameter("redirect", currentURL);
                            editMeetupsEntryURL.setParameter("meetupsEntryId",
                                    String.valueOf(meetupsEntry.getMeetupsEntryId()));

                            out.write("\r\n");
                            out.write("\r\n");
                            out.write("\t\t\t\t\t");
                            //  liferay-ui:icon
                            com.liferay.taglib.ui.IconTag _jspx_th_liferay_002dui_005ficon_005f0 = (com.liferay.taglib.ui.IconTag) _005fjspx_005ftagPool_005fliferay_002dui_005ficon_0026_005furl_005fmethod_005fimage_005fnobody
                                    .get(com.liferay.taglib.ui.IconTag.class);
                            _jspx_th_liferay_002dui_005ficon_005f0.setPageContext(_jspx_page_context);
                            _jspx_th_liferay_002dui_005ficon_005f0
                                    .setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f2);
                            // /meetups/view.jsp(125,5) name = image type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                            _jspx_th_liferay_002dui_005ficon_005f0.setImage("edit");
                            // /meetups/view.jsp(125,5) name = url type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                            _jspx_th_liferay_002dui_005ficon_005f0.setUrl(editMeetupsEntryURL.toString());
                            // /meetups/view.jsp(125,5) name = method type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                            _jspx_th_liferay_002dui_005ficon_005f0.setMethod("get");
                            int _jspx_eval_liferay_002dui_005ficon_005f0 = _jspx_th_liferay_002dui_005ficon_005f0
                                    .doStartTag();
                            if (_jspx_th_liferay_002dui_005ficon_005f0
                                    .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                                _005fjspx_005ftagPool_005fliferay_002dui_005ficon_0026_005furl_005fmethod_005fimage_005fnobody
                                        .reuse(_jspx_th_liferay_002dui_005ficon_005f0);
                                return;
                            }
                            _005fjspx_005ftagPool_005fliferay_002dui_005ficon_0026_005furl_005fmethod_005fimage_005fnobody
                                    .reuse(_jspx_th_liferay_002dui_005ficon_005f0);
                            out.write("\r\n");
                            out.write("\t\t\t\t");
                            int evalDoAfterBody = _jspx_th_c_005fif_005f2.doAfterBody();
                            if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                                break;
                        } while (true);
                    }
                    if (_jspx_th_c_005fif_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                        _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f2);
                        return;
                    }
                    _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f2);
                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");
                    //  liferay-ui:icon
                    com.liferay.taglib.ui.IconTag _jspx_th_liferay_002dui_005ficon_005f1 = (com.liferay.taglib.ui.IconTag) _005fjspx_005ftagPool_005fliferay_002dui_005ficon_0026_005furl_005fmethod_005fmessage_005fimage_005fnobody
                            .get(com.liferay.taglib.ui.IconTag.class);
                    _jspx_th_liferay_002dui_005ficon_005f1.setPageContext(_jspx_page_context);
                    _jspx_th_liferay_002dui_005ficon_005f1.setParent(
                            (javax.servlet.jsp.tagext.Tag) _jspx_th_liferay_002dui_005ficon_002dlist_005f0);
                    // /meetups/view.jsp(132,4) name = image type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                    _jspx_th_liferay_002dui_005ficon_005f1.setImage("join");
                    // /meetups/view.jsp(132,4) name = message type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                    _jspx_th_liferay_002dui_005ficon_005f1.setMessage("register");
                    // /meetups/view.jsp(132,4) name = url type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                    _jspx_th_liferay_002dui_005ficon_005f1.setUrl(viewMeetupsEntryURL.toString());
                    // /meetups/view.jsp(132,4) name = method type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                    _jspx_th_liferay_002dui_005ficon_005f1.setMethod("get");
                    int _jspx_eval_liferay_002dui_005ficon_005f1 = _jspx_th_liferay_002dui_005ficon_005f1
                            .doStartTag();
                    if (_jspx_th_liferay_002dui_005ficon_005f1
                            .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                        _005fjspx_005ftagPool_005fliferay_002dui_005ficon_0026_005furl_005fmethod_005fmessage_005fimage_005fnobody
                                .reuse(_jspx_th_liferay_002dui_005ficon_005f1);
                        return;
                    }
                    _005fjspx_005ftagPool_005fliferay_002dui_005ficon_0026_005furl_005fmethod_005fmessage_005fimage_005fnobody
                            .reuse(_jspx_th_liferay_002dui_005ficon_005f1);
                    out.write("\r\n");
                    out.write("\r\n");
                    out.write("\t\t\t\t");
                    //  c:if
                    org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f3 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest
                            .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
                    _jspx_th_c_005fif_005f3.setPageContext(_jspx_page_context);
                    _jspx_th_c_005fif_005f3.setParent(
                            (javax.servlet.jsp.tagext.Tag) _jspx_th_liferay_002dui_005ficon_002dlist_005f0);
                    // /meetups/view.jsp(139,4) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                    _jspx_th_c_005fif_005f3.setTest(permissionChecker.isCompanyAdmin(company.getCompanyId()));
                    int _jspx_eval_c_005fif_005f3 = _jspx_th_c_005fif_005f3.doStartTag();
                    if (_jspx_eval_c_005fif_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                        do {
                            out.write("\r\n");
                            out.write("\r\n");
                            out.write("\t\t\t\t\t");

                            PortletURL deleteMeetupsEntryURL = renderResponse.createActionURL();

                            deleteMeetupsEntryURL.setWindowState(WindowState.MAXIMIZED);

                            deleteMeetupsEntryURL.setParameter(ActionRequest.ACTION_NAME, "deleteMeetupsEntry");
                            deleteMeetupsEntryURL.setParameter("redirect", currentURL);
                            deleteMeetupsEntryURL.setParameter("meetupsEntryId",
                                    String.valueOf(meetupsEntry.getMeetupsEntryId()));

                            out.write("\r\n");
                            out.write("\r\n");
                            out.write("\t\t\t\t\t");
                            //  liferay-ui:icon-delete
                            com.liferay.taglib.ui.IconDeleteTag _jspx_th_liferay_002dui_005ficon_002ddelete_005f0 = (com.liferay.taglib.ui.IconDeleteTag) _005fjspx_005ftagPool_005fliferay_002dui_005ficon_002ddelete_0026_005furl_005fnobody
                                    .get(com.liferay.taglib.ui.IconDeleteTag.class);
                            _jspx_th_liferay_002dui_005ficon_002ddelete_005f0
                                    .setPageContext(_jspx_page_context);
                            _jspx_th_liferay_002dui_005ficon_002ddelete_005f0
                                    .setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f3);
                            // /meetups/view.jsp(151,5) name = url type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                            _jspx_th_liferay_002dui_005ficon_002ddelete_005f0
                                    .setUrl(deleteMeetupsEntryURL.toString());
                            int _jspx_eval_liferay_002dui_005ficon_002ddelete_005f0 = _jspx_th_liferay_002dui_005ficon_002ddelete_005f0
                                    .doStartTag();
                            if (_jspx_th_liferay_002dui_005ficon_002ddelete_005f0
                                    .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                                _005fjspx_005ftagPool_005fliferay_002dui_005ficon_002ddelete_0026_005furl_005fnobody
                                        .reuse(_jspx_th_liferay_002dui_005ficon_002ddelete_005f0);
                                return;
                            }
                            _005fjspx_005ftagPool_005fliferay_002dui_005ficon_002ddelete_0026_005furl_005fnobody
                                    .reuse(_jspx_th_liferay_002dui_005ficon_002ddelete_005f0);
                            out.write("\r\n");
                            out.write("\t\t\t\t");
                            int evalDoAfterBody = _jspx_th_c_005fif_005f3.doAfterBody();
                            if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                                break;
                        } while (true);
                    }
                    if (_jspx_th_c_005fif_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                        _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f3);
                        return;
                    }
                    _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f3);
                    out.write("\r\n");
                    out.write("\t\t\t");
                    int evalDoAfterBody = _jspx_th_liferay_002dui_005ficon_002dlist_005f0.doAfterBody();
                    if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                        break;
                } while (true);
                if (_jspx_eval_liferay_002dui_005ficon_002dlist_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
                    out = _jspx_page_context.popBody();
                }
            }
            if (_jspx_th_liferay_002dui_005ficon_002dlist_005f0
                    .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                _005fjspx_005ftagPool_005fliferay_002dui_005ficon_002dlist
                        .reuse(_jspx_th_liferay_002dui_005ficon_002dlist_005f0);
                return;
            }
            _005fjspx_005ftagPool_005fliferay_002dui_005ficon_002dlist
                    .reuse(_jspx_th_liferay_002dui_005ficon_002dlist_005f0);
            out.write("\r\n");
            out.write("\t\t</td>\r\n");
            out.write("\t</tr>\r\n");
            out.write("\r\n");
            out.write("\t");
            //  c:if
            org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f4 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest
                    .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
            _jspx_th_c_005fif_005f4.setPageContext(_jspx_page_context);
            _jspx_th_c_005fif_005f4.setParent(null);
            // /meetups/view.jsp(159,1) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
            _jspx_th_c_005fif_005f4.setTest((i + 1) < meetupsEntries.size());
            int _jspx_eval_c_005fif_005f4 = _jspx_th_c_005fif_005f4.doStartTag();
            if (_jspx_eval_c_005fif_005f4 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                do {
                    out.write("\r\n");
                    out.write("\t\t<tr>\r\n");
                    out.write("\t\t\t<td colspan=\"2\">\r\n");
                    out.write("\t\t\t\t<div class=\"separator\"><!-- --></div>\r\n");
                    out.write("\t\t\t</td>\r\n");
                    out.write("\t\t</tr>\r\n");
                    out.write("\t");
                    int evalDoAfterBody = _jspx_th_c_005fif_005f4.doAfterBody();
                    if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                        break;
                } while (true);
            }
            if (_jspx_th_c_005fif_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f4);
                return;
            }
            _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f4);
            out.write("\r\n");
            out.write("\r\n");

        }

        out.write("\r\n");
        out.write("\r\n");
        out.write("</table>");
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                try {
                    out.clearBuffer();
                } catch (java.io.IOException e) {
                }
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        _jspxFactory.releasePageContext(_jspx_page_context);
    }
}

From source file:org.lsug.quota.web.internal.notification.QuotaServerNotificationHandler.java

License:Open Source License

@Override
protected String getBody(UserNotificationEvent userNotificationEvent, ServiceContext serviceContext)
        throws Exception {

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload());

    long classPK = jsonObject.getLong("classPK");

    long userId = jsonObject.getLong("userId");
    String webId = CompanyLocalServiceUtil.getCompany(classPK).getWebId();

    ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", serviceContext.getLocale(),
            getClass());/*from   w w w  .j a  v a2 s .  com*/

    String title = LanguageUtil.format(resourceBundle, "quota-from-instance-x-above-the-alert",
            HtmlUtil.escape(webId));

    return StringUtil.replace(getBodyTemplate(), new String[] { "[$TITLE$]" }, new String[] { title });
}

From source file:org.lsug.quota.web.internal.notification.QuotaSiteNotificationHandler.java

License:Open Source License

@Override
protected String getBody(UserNotificationEvent userNotificationEvent, ServiceContext serviceContext)
        throws Exception {

    JSONObject jsonObject = JSONFactoryUtil.createJSONObject(userNotificationEvent.getPayload());

    long classPK = jsonObject.getLong("classPK");

    long userId = jsonObject.getLong("userId");
    String type = jsonObject.getString("type");

    Group group = GroupLocalServiceUtil.getGroup(classPK);
    String groupDescriptiveName = group.getDescriptiveName(serviceContext.getLocale());

    String title = null;/* ww w  .jav a  2s  . com*/

    ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", serviceContext.getLocale(),
            getClass());

    if (group.isUser()) {
        title = LanguageUtil.format(resourceBundle, "quota-from-user-x-above-the-alert",
                HtmlUtil.escape(groupDescriptiveName));
    } else {
        title = LanguageUtil.format(resourceBundle, "quota-from-site-x-above-the-alert",
                HtmlUtil.escape(groupDescriptiveName));

    }

    return StringUtil.replace(getBodyTemplate(), new String[] { "[$TITLE$]" },
            new String[] { HtmlUtil.escape(title) });
}