Example usage for com.liferay.portal.kernel.service RoleLocalServiceUtil getRoles

List of usage examples for com.liferay.portal.kernel.service RoleLocalServiceUtil getRoles

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.service RoleLocalServiceUtil getRoles.

Prototype

public static java.util.List<com.liferay.portal.kernel.model.Role> getRoles(long companyId, int[] types) 

Source Link

Document

Returns all the roles with the types.

Usage

From source file:com.liferay.tool.datamanipulator.displayfield.DisplayFields.java

License:Open Source License

public void addRoleMultiSelect(String name) throws SystemException {
    List<Role> roles = RoleLocalServiceUtil.getRoles(QueryUtil.ALL_POS, QueryUtil.ALL_POS);

    List<KeyValuePair> values = new ArrayList<KeyValuePair>(roles.size());

    for (Role role : roles) {
        if (role.getType() == RoleConstants.TYPE_REGULAR) {
            long roleId = role.getRoleId();
            String roleName = role.getName();

            if (Validator.isNull(roleId) || Validator.isNull(roleName)) {
                continue;
            }//  w  ww  . j a va 2  s.  c om

            values.add(new KeyValuePair(roleName, String.valueOf(roleId)));
        }
    }

    addMultiSelectList(name, values);
}