Example usage for com.liferay.portal.kernel.bean BeanPropertiesUtil getStringSilent

List of usage examples for com.liferay.portal.kernel.bean BeanPropertiesUtil getStringSilent

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.bean BeanPropertiesUtil getStringSilent.

Prototype

public static String getStringSilent(Object bean, String param, String defaultValue) 

Source Link

Usage

From source file:com.liferay.taglib.aui.SelectTag.java

License:Open Source License

@Override
protected void setAttributes(HttpServletRequest request) {
    super.setAttributes(request);

    Object bean = getBean();/*from  www .j av  a 2s  .co m*/

    if (bean == null) {
        bean = pageContext.getAttribute("aui:model-context:bean");
    }

    String name = getName();

    int pos = name.indexOf(StringPool.DOUBLE_DASH);

    if (pos != -1) {
        name = name.substring(pos + 2, name.length() - 2);
    }

    String id = getId();

    if (Validator.isNull(id)) {
        id = name;
    }

    String label = getLabel();

    if (label == null) {
        label = TextFormatter.format(name, TextFormatter.K);
    }

    String listType = getListType();
    String listTypeFieldName = getListTypeFieldName();

    if (Validator.isNotNull(listType) && Validator.isNull(listTypeFieldName)) {

        listTypeFieldName = "typeId";
    }

    String value = StringPool.BLANK;

    if (Validator.isNull(listType)) {
        if (bean != null) {
            value = BeanPropertiesUtil.getStringSilent(bean, name, value);
        }

        if (!getIgnoreRequestValue()) {
            value = ParamUtil.getString(request, name, value);
        }
    }

    setNamespacedAttribute(request, "bean", bean);
    setNamespacedAttribute(request, "id", id);
    setNamespacedAttribute(request, "label", label);
    setNamespacedAttribute(request, "listTypeFieldName", listTypeFieldName);
    setNamespacedAttribute(request, "value", value);
}