Example usage for com.liferay.portal.kernel.util StringPool PIPE

List of usage examples for com.liferay.portal.kernel.util StringPool PIPE

Introduction

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

Prototype

String PIPE

To view the source code for com.liferay.portal.kernel.util StringPool PIPE.

Click Source Link

Usage

From source file:com.liferay.iframe.web.internal.display.context.IFrameDisplayContext.java

License:Open Source License

public String getHiddenVariables() {
    if (_hiddenVariables != null) {
        return _hiddenVariables;
    }/*from   w w  w  .ja  v a2 s .c om*/

    _hiddenVariables = StringUtil.merge(_iFramePortletInstanceConfiguration.hiddenVariables(), StringPool.PIPE);

    return _hiddenVariables;
}

From source file:com.liferay.message.boards.web.internal.portlet.action.MBAdminConfigurationAction.java

License:Open Source License

protected void updateThreadPriorities(ActionRequest actionRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    for (Locale locale : LanguageUtil.getAvailableLocales(themeDisplay.getSiteGroupId())) {

        String languageId = LocaleUtil.toLanguageId(locale);

        List<String> priorities = new ArrayList<>();

        for (int j = 0; j < 10; j++) {
            String name = ParamUtil.getString(actionRequest, "priorityName" + j + "_" + languageId);
            String image = ParamUtil.getString(actionRequest, "priorityImage" + j + "_" + languageId);
            double value = ParamUtil.getDouble(actionRequest, "priorityValue" + j + "_" + languageId);

            if (Validator.isNotNull(name) || Validator.isNotNull(image) || (value != 0.0)) {

                priorities.add(name + StringPool.PIPE + image + StringPool.PIPE + value);
            }// ww w.  j av a  2s .c  o  m
        }

        String preferenceName = LocalizationUtil.getLocalizedName("priorities", languageId);

        setPreference(actionRequest, preferenceName, priorities.toArray(new String[priorities.size()]));
    }
}

From source file:com.liferay.tools.sourceformatter.JSPSourceProcessor.java

License:Open Source License

protected String getTaglibRegex(String quoteType) {
    StringBuilder sb = new StringBuilder();

    sb.append("<(");

    for (int i = 0; i < _TAG_LIBRARIES.length; i++) {
        sb.append(_TAG_LIBRARIES[i]);/*from w  w  w .  jav a 2s  .c  o  m*/
        sb.append(StringPool.PIPE);
    }

    sb.deleteCharAt(sb.length() - 1);
    sb.append("):([^>]|%>)*");
    sb.append(quoteType);
    sb.append("<%=.*");
    sb.append(quoteType);
    sb.append(".*%>");
    sb.append(quoteType);
    sb.append("([^>]|%>)*>");

    return sb.toString();
}

From source file:com.liferay.wiki.navigation.web.internal.util.MenuItem.java

License:Open Source License

private static List<MenuItem> _fromWikiPage(WikiPage wikiPage, PortletURL portletURL) {

    List<MenuItem> menuItems = new LinkedList<>();

    Matcher matcher = _pattern.matcher(wikiPage.getContent());

    MenuItem menuItem = null;/*  w  w w .j av  a 2  s  . c  o m*/

    while (matcher.find()) {
        String title = matcher.group(3);

        if (title != null) {
            menuItem = new MenuItem();

            menuItem.setLabel(title);

            menuItems.add(menuItem);
        }

        if (menuItem == null) {
            menuItem = new MenuItem();

            menuItem.setLabel(StringPool.BLANK);

            menuItems.add(menuItem);
        }

        String s = matcher.group(6);

        if (s != null) {
            MenuItem childMenuItem = new MenuItem();

            int index = s.indexOf(StringPool.PIPE);

            String label = null;
            String url = null;

            if (index != -1) {
                label = s.substring(index + 1);
                url = s.substring(0, index);

                if (!url.startsWith(Http.HTTP)) {
                    long nodeId = wikiPage.getNodeId();

                    portletURL.setParameter("title", url);
                    portletURL.setParameter("nodeId", String.valueOf(nodeId));

                    url = portletURL.toString();
                } else {
                    childMenuItem.setExternalURL(true);
                }
            } else {
                label = s;
                url = s;

                if (!url.startsWith(Http.HTTP)) {
                    long nodeId = wikiPage.getNodeId();

                    portletURL.setParameter("title", url);
                    portletURL.setParameter("nodeId", String.valueOf(nodeId));

                    url = portletURL.toString();
                }
            }

            childMenuItem.setLabel(label);
            childMenuItem.setURL(url);

            menuItem.addChild(childMenuItem);
        }
    }

    return menuItems;
}

From source file:com.liferay.wikinavigation.util.MenuItem.java

License:Open Source License

private static List<MenuItem> _fromWikiPage(WikiPage wikiPage, PortletURL portletURL) {

    List<MenuItem> menuItems = new LinkedList<MenuItem>();

    Matcher matcher = _pattern.matcher(wikiPage.getContent());

    MenuItem menuItem = null;/* w  w  w .  jav  a 2 s .c o m*/

    while (matcher.find()) {
        String title = matcher.group(3);

        if (title != null) {
            menuItem = new MenuItem();

            menuItem.setLabel(title);

            menuItems.add(menuItem);
        }

        if (menuItem == null) {
            menuItem = new MenuItem();

            menuItem.setLabel(StringPool.BLANK);

            menuItems.add(menuItem);
        }

        String s = matcher.group(6);

        if (s != null) {
            MenuItem childMenuItem = new MenuItem();

            int index = s.indexOf(StringPool.PIPE);

            String label = null;
            String url = null;

            if (index != -1) {
                label = s.substring(index + 1);
                url = s.substring(0, index);

                if (!url.startsWith(Http.HTTP)) {
                    long nodeId = wikiPage.getNodeId();

                    portletURL.setParameter("title", url);
                    portletURL.setParameter("nodeId", String.valueOf(nodeId));

                    url = portletURL.toString();
                } else {
                    childMenuItem.setExternalURL(true);
                }
            } else {
                label = s;
                url = s;

                if (!url.startsWith(Http.HTTP)) {
                    long nodeId = wikiPage.getNodeId();

                    portletURL.setParameter("title", url);
                    portletURL.setParameter("nodeId", String.valueOf(nodeId));

                    url = portletURL.toString();
                }
            }

            childMenuItem.setLabel(label);
            childMenuItem.setURL(url);

            menuItem.addChild(childMenuItem);
        }
    }

    return menuItems;
}

From source file:org.un.ldcportal.jargon.service.impl.LDCJargonLocalServiceImpl.java

License:Open Source License

public String tooltipJargon(String s, Map<String, String> jargonMap, String start1, String start2, String end) {

    if (Validator.isNull(s) || Validator.isNull(jargonMap)) {
        return s;
    }/*from   www .j  av  a2  s .c om*/

    if (jargonMap.isEmpty()) {
        return StringPool.BLANK;
    }

    StringBundler sb = new StringBundler(2 * jargonMap.size() - 1);

    int i = 0;

    for (Map.Entry<String, String> jargon : jargonMap.entrySet()) {
        // Pattern checking that the word is not part of an link tag
        String patternString = "(?!<.*?)\\b(" + Pattern.quote(jargon.getKey()) + ")\\b(?![^<>]*?(</a>|>))";
        sb.append(patternString);

        if ((i + 1) < jargonMap.size()) {
            sb.append(StringPool.PIPE);
        }

        i++;
    }

    int flags = Pattern.CANON_EQ | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE;

    Pattern pattern = Pattern.compile(sb.toString(), flags);

    Matcher matcher = pattern.matcher(s);

    StringBuffer result = new StringBuffer(s);

    int addedLength = 0;

    while (matcher.find()) {
        String replaceString = start1 + matcher.group() + start2 + jargonMap.get(matcher.group().toLowerCase())
                + end;

        //         System.out.print("Start index: " + matcher.start());
        //         System.out.print(" End index: " + matcher.end() + " ");
        //         System.out.println(matcher.group());

        result.replace(addedLength + matcher.start(), addedLength + matcher.end(), replaceString);

        addedLength += replaceString.length() - matcher.end() + matcher.start();

        s = result.toString();
    }

    return result.toString();
}