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