Example usage for com.liferay.portal.layoutconfiguration.util.xml PortletLogic OPEN_TAG

List of usage examples for com.liferay.portal.layoutconfiguration.util.xml PortletLogic OPEN_TAG

Introduction

In this page you can find the example usage for com.liferay.portal.layoutconfiguration.util.xml PortletLogic OPEN_TAG.

Prototype

String OPEN_TAG

To view the source code for com.liferay.portal.layoutconfiguration.util.xml PortletLogic OPEN_TAG.

Click Source Link

Usage

From source file:com.liferay.journal.content.web.internal.JournalContentPortletLayoutListener.java

License:Open Source License

protected Set<String> getRuntimePortletIds(String content) throws Exception {

    Set<String> portletIds = new LinkedHashSet<>();

    for (int index = 0;;) {
        index = content.indexOf(PortletLogic.OPEN_TAG, index);

        if (index == -1) {
            break;
        }//from www .j  a v  a  2 s  .c  o m

        int close1 = content.indexOf(PortletLogic.CLOSE_1_TAG, index);
        int close2 = content.indexOf(PortletLogic.CLOSE_2_TAG, index);

        int closeIndex = -1;

        if ((close2 == -1) || ((close1 != -1) && (close1 < close2))) {
            closeIndex = close1 + PortletLogic.CLOSE_1_TAG.length();
        } else {
            closeIndex = close2 + PortletLogic.CLOSE_2_TAG.length();
        }

        if (closeIndex == -1) {
            break;
        }

        portletIds.add(getRuntimePortletId(content.substring(index, closeIndex)));

        index = closeIndex;
    }

    return portletIds;
}