use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class SongAssetRenderer method getThumbnailPath.
@Override
public String getThumbnailPath(PortletRequest portletRequest) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
String thumbnailSrc = _song.getImageURL(themeDisplay);
if (Validator.isNotNull(thumbnailSrc)) {
return thumbnailSrc;
}
return themeDisplay.getPortalURL() + "/jukebox-portlet/icons/songs.png";
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class BaseKBPortlet method updateKBComment.
public void updateKBComment(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (!themeDisplay.isSignedIn()) {
return;
}
String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
long kbCommentId = ParamUtil.getLong(actionRequest, "kbCommentId");
long classNameId = ParamUtil.getLong(actionRequest, "classNameId");
long classPK = ParamUtil.getLong(actionRequest, "classPK");
String content = ParamUtil.getString(actionRequest, "content");
int status = ParamUtil.getInteger(actionRequest, "status", KBCommentConstants.STATUS_ANY);
ServiceContext serviceContext = ServiceContextFactory.getInstance(KBComment.class.getName(), actionRequest);
if (cmd.equals(Constants.ADD)) {
KBCommentLocalServiceUtil.addKBComment(themeDisplay.getUserId(), classNameId, classPK, content, serviceContext);
} else if (cmd.equals(Constants.UPDATE)) {
if (status == KBCommentConstants.STATUS_ANY) {
KBComment kbComment = KBCommentServiceUtil.getKBComment(kbCommentId);
status = kbComment.getStatus();
}
KBCommentServiceUtil.updateKBComment(kbCommentId, classNameId, classPK, content, status, serviceContext);
}
SessionMessages.add(actionRequest, "suggestionSaved");
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class BaseKBPortlet method subscribeKBArticle.
public void subscribeKBArticle(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long resourcePrimKey = ParamUtil.getLong(actionRequest, "resourcePrimKey");
KBArticleServiceUtil.subscribeKBArticle(themeDisplay.getScopeGroupId(), resourcePrimKey);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class BaseKBPortlet method deleteKBComment.
public void deleteKBComment(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (!themeDisplay.isSignedIn()) {
return;
}
long kbCommentId = ParamUtil.getLong(actionRequest, "kbCommentId");
KBCommentServiceUtil.deleteKBComment(kbCommentId);
SessionMessages.add(actionRequest, "suggestionDeleted");
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class BaseKBPortlet method addTempAttachment.
public void addTempAttachment(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(actionRequest);
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long resourcePrimKey = ParamUtil.getLong(actionRequest, "resourcePrimKey");
String sourceFileName = uploadPortletRequest.getFileName("file");
InputStream inputStream = null;
try {
inputStream = uploadPortletRequest.getFileAsStream("file");
String mimeType = uploadPortletRequest.getContentType("file");
KBArticleServiceUtil.addTempAttachment(themeDisplay.getScopeGroupId(), resourcePrimKey, sourceFileName, KnowledgeBaseConstants.TEMP_FOLDER_NAME, inputStream, mimeType);
} finally {
StreamUtil.cleanUp(inputStream);
}
}
Aggregations