001
014
015 package com.liferay.util.bridges.jsf.common;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.GetterUtil;
020 import com.liferay.portal.model.User;
021 import com.liferay.portal.service.UserLocalServiceUtil;
022
023 import javax.faces.context.FacesContext;
024
025
033 public class ThemeDisplayManagedBean {
034
035 public User getUser() {
036 FacesContext facesContext = FacesContext.getCurrentInstance();
037
038 String remoteUser = facesContext.getExternalContext().getRemoteUser();
039
040 try {
041 long userId = GetterUtil.getLong(remoteUser);
042
043 return UserLocalServiceUtil.getUserById(userId);
044 }
045 catch (Exception e) {
046 _log.error(e, e);
047 }
048
049 return null;
050 }
051
052 private static Log _log = LogFactoryUtil.getLog(
053 ThemeDisplayManagedBean.class);
054
055 }