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

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

Introduction

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

Prototype

public List<SearchEntry> getEntries();

Source Link

Usage

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

License:Open Source License

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

        ResultRow row = searchContainerRowTag.getRow();

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

        ButtonSearchEntry buttonSearchEntry = new ButtonSearchEntry();

        buttonSearchEntry.setAlign(getAlign());
        buttonSearchEntry.setColspan(getColspan());
        buttonSearchEntry.setCssClass(getCssClass());
        buttonSearchEntry.setHref((String) getHref());
        buttonSearchEntry.setName(getName());
        buttonSearchEntry.setValign(getValign());

        row.addSearchEntry(index, buttonSearchEntry);

        return EVAL_PAGE;
    } finally {
        index = -1;

        if (!ServerDetector.isResin()) {
            align = SearchEntry.DEFAULT_ALIGN;
            colspan = SearchEntry.DEFAULT_COLSPAN;
            cssClass = SearchEntry.DEFAULT_CSS_CLASS;
            _href = null;
            name = StringPool.BLANK;
            valign = SearchEntry.DEFAULT_VALIGN;
        }
    }
}

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

License:Open Source License

@Override
public int doEndTag() {
    try {//  w ww. j  a  va 2 s  .  c om
        SearchContainerRowTag<R> searchContainerRowTag = (SearchContainerRowTag<R>) findAncestorWithClass(this,
                SearchContainerRowTag.class);

        ResultRow row = searchContainerRowTag.getRow();

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

        JSPSearchEntry jspSearchEntry = new JSPSearchEntry();

        jspSearchEntry.setAlign(getAlign());
        jspSearchEntry.setColspan(getColspan());
        jspSearchEntry.setCssClass(getCssClass());
        jspSearchEntry.setPath(getPath());
        jspSearchEntry.setRequest((HttpServletRequest) pageContext.getRequest());
        jspSearchEntry.setResponse((HttpServletResponse) pageContext.getResponse());
        jspSearchEntry.setServletContext(pageContext.getServletContext());
        jspSearchEntry.setValign(getValign());

        row.addSearchEntry(index, jspSearchEntry);

        return EVAL_PAGE;
    } finally {
        index = -1;

        if (!ServerDetector.isResin()) {
            align = SearchEntry.DEFAULT_ALIGN;
            colspan = SearchEntry.DEFAULT_COLSPAN;
            cssClass = SearchEntry.DEFAULT_CSS_CLASS;
            name = StringPool.BLANK;
            _path = null;
            valign = SearchEntry.DEFAULT_VALIGN;
        }
    }
}

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

License:Open Source License

@Override
public int doEndTag() {
    try {//  ww  w .j  a  va  2  s .  co 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 w  w w.  j  a  v  a 2 s .  c o m
        @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;
        }
    }
}