001
014
015 package com.liferay.portlet.asset.model;
016
017 import com.liferay.portal.kernel.exception.PortalException;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
020 import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
021 import com.liferay.portal.kernel.util.WebKeys;
022 import com.liferay.portal.security.permission.PermissionChecker;
023 import com.liferay.portal.theme.ThemeDisplay;
024 import com.liferay.portal.util.PortalUtil;
025 import com.liferay.portlet.asset.service.AssetEntryLocalServiceUtil;
026
027 import java.util.Locale;
028 import java.util.Map;
029
030 import javax.portlet.PortletRequest;
031 import javax.portlet.PortletURL;
032
033
039 public abstract class BaseAssetRendererFactory implements AssetRendererFactory {
040
041 public AssetEntry getAssetEntry(long assetEntryId)
042 throws PortalException, SystemException {
043
044 return AssetEntryLocalServiceUtil.getEntry(assetEntryId);
045 }
046
047 public AssetEntry getAssetEntry(String className, long classPK)
048 throws PortalException, SystemException {
049
050 return AssetEntryLocalServiceUtil.getEntry(className, classPK);
051 }
052
053 public AssetRenderer getAssetRenderer(long classPK)
054 throws PortalException, SystemException {
055
056 return getAssetRenderer(classPK, TYPE_LATEST_APPROVED);
057 }
058
059 @SuppressWarnings("unused")
060 public AssetRenderer getAssetRenderer(long groupId, String urlTitle)
061 throws PortalException, SystemException {
062
063 return null;
064 }
065
066 public long getClassNameId() {
067 return PortalUtil.getClassNameId(_className);
068 }
069
070 public Map<Long, String> getClassTypes(long[] groupId, Locale locale)
071 throws Exception {
072
073 return null;
074 }
075
076 public String getIconPath(PortletRequest portletRequest) {
077 ThemeDisplay themeDisplay = (ThemeDisplay)portletRequest.getAttribute(
078 WebKeys.THEME_DISPLAY);
079
080 return getIconPath(themeDisplay);
081 }
082
083 public String getPortletId() {
084 return _portletId;
085 }
086
087 @SuppressWarnings("unused")
088 public PortletURL getURLAdd(
089 LiferayPortletRequest liferayPortletRequest,
090 LiferayPortletResponse liferayPortletResponse)
091 throws PortalException, SystemException {
092
093 return null;
094 }
095
096 public boolean hasPermission(
097 PermissionChecker permissionChecker, long classPK, String actionId)
098 throws Exception {
099
100 return _PERMISSION;
101 }
102
103 public boolean isCategorizable() {
104 return true;
105 }
106
107 public boolean isLinkable() {
108 return _LINKABLE;
109 }
110
111 public boolean isSelectable() {
112 return _SELECTABLE;
113 }
114
115 public void setClassName(String className) {
116 _className = className;
117 }
118
119 public void setPortletId(String portletId) {
120 _portletId = portletId;
121 }
122
123 protected long getControlPanelPlid(ThemeDisplay themeDisplay)
124 throws PortalException, SystemException {
125
126 return PortalUtil.getControlPanelPlid(themeDisplay.getCompanyId());
127 }
128
129 protected String getIconPath(ThemeDisplay themeDisplay) {
130 return themeDisplay.getPathThemeImages() + "/common/page.png";
131 }
132
133 private static final boolean _LINKABLE = false;
134
135 private static final boolean _PERMISSION = true;
136
137 private static final boolean _SELECTABLE = true;
138
139 private String _className;
140 private String _portletId;
141
142 }