Example usage for com.liferay.portal.kernel.model BaseModel getExpandoBridge

List of usage examples for com.liferay.portal.kernel.model BaseModel getExpandoBridge

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model BaseModel getExpandoBridge.

Prototype

@Override
public ExpandoBridge getExpandoBridge();

Source Link

Document

Returns the expando bridge for this model instance.

Usage

From source file:com.liferay.osb.scv.connector.internal.jsonws.SCVUserJSONWS.java

License:Open Source License

protected JSONObject addUser(JSONObject jsonObject, BaseModel baseModel, List<String> fields) {

    if ((fields == null) || fields.isEmpty()) {
        return null;
    }/*from www .  j  a v  a  2 s.c  om*/

    ExpandoBridge expandoBridge = baseModel.getExpandoBridge();

    for (String field : fields) {
        if (field.startsWith(_CUSTOM_FIELD)) {
            Serializable attribute = expandoBridge.getAttribute(field.replace(_CUSTOM_FIELD, StringPool.BLANK));

            jsonObject.put(field, String.valueOf(attribute));
        } else {
            String value = BeanPropertiesUtil.getString(baseModel, field);

            jsonObject.put(field, value);
        }
    }

    return jsonObject;
}