Example usage for com.liferay.portal.kernel.dao.search ResultRow isRestricted

List of usage examples for com.liferay.portal.kernel.dao.search ResultRow isRestricted

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.search ResultRow isRestricted.

Prototype

public boolean isRestricted();

Source Link

Usage

From source file:com.liferay.taglib.ui.SearchContainerColumnTextTag.java

License:Open Source License

@Override
public int doEndTag() {
    try {/*from  w w w .  ja  v  a 2s  .c o  m*/
        SearchContainerRowTag<R> searchContainerRowTag = (SearchContainerRowTag<R>) findAncestorWithClass(this,
                SearchContainerRowTag.class);

        ResultRow row = searchContainerRowTag.getRow();

        if (Validator.isNotNull(_property)) {
            _value = String.valueOf(BeanPropertiesUtil.getObject(row.getObject(), _property));
        } else if (Validator.isNotNull(_buffer)) {
            _value = _sb.toString();
        } else if (_value == null) {
            BodyContent bodyContent = getBodyContent();

            if (bodyContent != null) {
                _value = bodyContent.getString();
            } else {
                Object object = BeanPropertiesUtil.getObject(row.getObject(), getName());

                _value = String.valueOf(object);
            }
        }

        if (_translate) {
            _value = LanguageUtil.get(pageContext, _value);
        }

        if (index <= -1) {
            index = row.getEntries().size();
        }

        if (row.isRestricted()) {
            _href = null;
        }

        TextSearchEntry textSearchEntry = new TextSearchEntry();

        textSearchEntry.setAlign(getAlign());
        textSearchEntry.setColspan(getColspan());
        textSearchEntry.setCssClass(getCssClass());
        textSearchEntry.setHref((String) getHref());
        textSearchEntry.setName(getValue());
        textSearchEntry.setTarget(getTarget());
        textSearchEntry.setTitle(getTitle());
        textSearchEntry.setValign(getValign());

        row.addSearchEntry(index, textSearchEntry);

        return EVAL_PAGE;
    } finally {
        index = -1;
        _value = null;

        if (!ServerDetector.isResin()) {
            align = SearchEntry.DEFAULT_ALIGN;
            _buffer = null;
            colspan = SearchEntry.DEFAULT_COLSPAN;
            cssClass = SearchEntry.DEFAULT_CSS_CLASS;
            _href = null;
            name = null;
            _orderable = false;
            _orderableProperty = null;
            _property = null;
            _sb = null;
            _target = null;
            _title = null;
            _translate = false;
            valign = SearchEntry.DEFAULT_VALIGN;
        }
    }
}

From source file:eu.citadel.liferay.tag.SearchContainerColumnListTag.java

License:Open Source License

@Override
public int doEndTag() {
    try {//from  www.  j a  v a2 s .c  om
        @SuppressWarnings("unchecked")
        SearchContainerRowTag<R> searchContainerRowTag = (SearchContainerRowTag<R>) findAncestorWithClass(this,
                SearchContainerRowTag.class);

        ResultRow resultRow = searchContainerRowTag.getRow();

        if (index <= -1) {
            List<SearchEntry> searchEntries = resultRow.getEntries();
            index = searchEntries.size();
        }

        if (resultRow.isRestricted()) {
            _href = null;
        }

        for (int i = 0; i < _list.size(); i++) {
            String key = String.valueOf(i);
            Object tmp = _list.get(i);
            if (tmp == null)
                tmp = "";
            String val = tmp.toString();

            if (_translate) {
                val = LanguageUtil.get(pageContext, val);
            }
            if (getLengthLimit() > 0) {
                val = StringUtils.abbreviate(val, getLengthLimit());
            }
            TextSearchEntry textSearchEntry = new TextSearchEntry();

            textSearchEntry.setAlign(getAlign());
            textSearchEntry.setColspan(getColspan());
            textSearchEntry.setCssClass(getCssClass());
            textSearchEntry.setHref((String) getHref());
            textSearchEntry.setName(val);
            textSearchEntry.setTarget(getTarget());
            textSearchEntry.setTitle(key);
            textSearchEntry.setValign(getValign());

            resultRow.addSearchEntry(index + i, textSearchEntry);
        }

        return EVAL_PAGE;
    } finally {
        index = -1;

        if (!ServerDetector.isResin()) {
            align = SearchEntry.DEFAULT_ALIGN;
            _buffer = null;
            colspan = SearchEntry.DEFAULT_COLSPAN;
            cssClass = SearchEntry.DEFAULT_CSS_CLASS;
            _href = null;
            name = null;
            _property = null;
            _sb = null;
            _target = null;
            _title = null;
            _translate = false;
            valign = SearchEntry.DEFAULT_VALIGN;
        }
    }
}