/
AssetRenderer.java
206 lines (142 loc) · 5.26 KB
/
AssetRenderer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.asset.kernel.model;
import com.liferay.petra.string.StringPool;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
import com.liferay.portal.kernel.security.permission.PermissionChecker;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.LocaleUtil;
import java.util.Locale;
import javax.portlet.PortletRequest;
import javax.portlet.PortletURL;
import javax.portlet.WindowState;
import javax.servlet.http.HttpServletRequest;
import org.osgi.annotation.versioning.ProviderType;
/**
* @author Jorge Ferrer
* @author Juan Fernández
*/
@ProviderType
public interface AssetRenderer<T> extends Renderer {
public static final String TEMPLATE_ABSTRACT = "abstract";
public static final String TEMPLATE_FULL_CONTENT = "full_content";
public static final String TEMPLATE_PREVIEW = "preview";
public T getAssetObject();
public default T getAssetObject(long versionClassPK) {
return getAssetObject();
}
public AssetRendererFactory<T> getAssetRendererFactory();
public int getAssetRendererType();
public String[] getAvailableLanguageIds() throws Exception;
public DDMFormValuesReader getDDMFormValuesReader();
public default String getDefaultLanguageId() throws Exception {
String[] availableLanguageIds = getAvailableLanguageIds();
String siteDefaultLanguageId = LocaleUtil.toLanguageId(
LocaleUtil.getSiteDefault());
if (ArrayUtil.isNotEmpty(availableLanguageIds) &&
!ArrayUtil.contains(availableLanguageIds, siteDefaultLanguageId)) {
return availableLanguageIds[0];
}
return siteDefaultLanguageId;
}
public String getDiscussionPath();
public long getGroupId();
public String getNewName(String oldName, String token);
public String getSearchSummary(Locale locale);
public int getStatus();
public String getSummary();
public String[] getSupportedConversions();
public String getThumbnailPath(PortletRequest portletRequest)
throws Exception;
public String getURLDownload(ThemeDisplay themeDisplay);
public default PortletURL getURLEdit(HttpServletRequest httpServletRequest)
throws Exception {
return null;
}
public default PortletURL getURLEdit(
HttpServletRequest httpServletRequest, WindowState windowState,
PortletURL redirectURL)
throws Exception {
return null;
}
public default PortletURL getURLEdit(
HttpServletRequest httpServletRequest, WindowState windowState,
String redirect)
throws Exception {
return null;
}
public PortletURL getURLEdit(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse)
throws Exception;
public PortletURL getURLEdit(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
WindowState windowState, PortletURL redirectURL)
throws Exception;
public default PortletURL getURLEdit(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
WindowState windowState, String redirect)
throws Exception {
return null;
}
public PortletURL getURLExport(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse)
throws Exception;
public String getURLImagePreview(PortletRequest portletRequest)
throws Exception;
public String getUrlTitle();
public String getUrlTitle(Locale locale);
public String getURLView(
LiferayPortletResponse liferayPortletResponse,
WindowState windowState)
throws Exception;
public PortletURL getURLViewDiffs(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse)
throws Exception;
public String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect)
throws Exception;
public default String getURLViewUsages(
HttpServletRequest httpServletRequest)
throws Exception {
return StringPool.BLANK;
}
public long getUserId();
public String getUserName();
public String getUuid();
public String getViewInContextMessage();
public boolean hasEditPermission(PermissionChecker permissionChecker)
throws PortalException;
public boolean hasViewPermission(PermissionChecker permissionChecker)
throws PortalException;
public default boolean isCategorizable(long groupId) {
return true;
}
public boolean isCommentable();
public boolean isConvertible();
public boolean isDisplayable();
public boolean isLocalizable();
public boolean isPreviewInContext();
public boolean isPrintable();
public boolean isRatable();
}