001
014
015 package com.liferay.portal.util;
016
017 import com.liferay.portal.kernel.exception.SystemException;
018 import com.liferay.portal.kernel.util.PropsKeys;
019 import com.liferay.portal.kernel.util.StringPool;
020 import com.liferay.portal.kernel.util.ThemeFactory;
021 import com.liferay.portal.kernel.util.ThemeFactoryUtil;
022 import com.liferay.portal.model.Theme;
023 import com.liferay.portal.model.impl.ThemeImpl;
024
025
028 public class ThemeFactoryImpl implements ThemeFactory {
029
030 @Override
031 public Theme getDefaultRegularTheme(long companyId) throws SystemException {
032 return new ThemeImpl(
033 ThemeFactoryUtil.getDefaultRegularThemeId(companyId),
034 StringPool.BLANK);
035 }
036
037 @Override
038 public String getDefaultRegularThemeId(long companyId)
039 throws SystemException {
040
041 String defaultRegularThemeId = PrefsPropsUtil.getString(
042 companyId, PropsKeys.DEFAULT_REGULAR_THEME_ID);
043
044 return PortalUtil.getJsSafePortletId(defaultRegularThemeId);
045 }
046
047 @Override
048 public Theme getDefaultWapTheme(long companyId) throws SystemException {
049 return new ThemeImpl(
050 ThemeFactoryUtil.getDefaultWapThemeId(companyId), StringPool.BLANK);
051 }
052
053 @Override
054 public String getDefaultWapThemeId(long companyId) throws SystemException {
055 String defaultWapThemeId = PrefsPropsUtil.getString(
056 companyId, PropsKeys.DEFAULT_WAP_THEME_ID);
057
058 return PortalUtil.getJsSafePortletId(defaultWapThemeId);
059 }
060
061 @Override
062 public Theme getTheme() {
063 return new ThemeImpl();
064 }
065
066 @Override
067 public Theme getTheme(String themeId) {
068 return new ThemeImpl(themeId);
069 }
070
071 @Override
072 public Theme getTheme(String themeId, String name) {
073 return new ThemeImpl(themeId, name);
074 }
075
076 }