Example usage for com.liferay.portal.kernel.model User getFullName

List of usage examples for com.liferay.portal.kernel.model User getFullName

Introduction

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

Prototype

@com.liferay.portal.kernel.bean.AutoEscape
public String getFullName(boolean usePrefix, boolean useSuffix);

Source Link

Document

Returns the user's full name.

Usage

From source file:tj.obwaja.informacija.service.impl.ObwajaInformacijaLocalServiceImpl.java

License:Open Source License

public ObwajaInformacija getObInfoByIzvewenieId(long IzvewenijaID, long userId) {

    ObwajaInformacija obwaja_informacija = new ObwajaInformacijaImpl();
    String phone = "";
    String email = "";
    String fullname = "";
    try {//from   ww w.  ja v  a  2s.  co m
        obwaja_informacija = obwajaInformacijaPersistence.findByIzvewenieID(IzvewenijaID);
    } catch (NoSuchObwajaInformacijaException e) {
        List<Phone> phones = Collections.emptyList();

        try {
            User user = UserLocalServiceUtil.getUser(userId);
            phones = user.getPhones();

            if (!phones.isEmpty())
                phone = phones.get(0).getNumber();

            email = user.getEmailAddress();
            fullname = user.getFullName(false, true);

            obwaja_informacija.setJe_pochta(email);
            obwaja_informacija.setKontaktnyj_telefon(phone);
            obwaja_informacija.setKontaktnoe_lico(fullname);
        } catch (PortalException e1) {

        }

    }

    return obwaja_informacija;
}