use of com.liferay.portal.theme.ThemeDisplay in project sw360portal by sw360.
the class CustomFieldHelper method getLiferayUser.
private static com.liferay.portal.model.User getLiferayUser(PortletRequest request, User user) throws PortalException, SystemException {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long companyId = themeDisplay.getCompanyId();
return UserLocalServiceUtil.getUserByEmailAddress(companyId, user.email);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class BaseKBPortlet method deleteTempAttachment.
public void deleteTempAttachment(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
long resourcePrimKey = ParamUtil.getLong(actionRequest, "resourcePrimKey");
String fileName = ParamUtil.getString(actionRequest, "fileName");
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
try {
KBArticleServiceUtil.deleteTempAttachment(themeDisplay.getScopeGroupId(), resourcePrimKey, fileName, KnowledgeBaseConstants.TEMP_FOLDER_NAME);
jsonObject.put("deleted", Boolean.TRUE);
} catch (Exception e) {
String errorMessage = themeDisplay.translate("an-unexpected-error-occurred-while-deleting-the-file");
jsonObject.put("deleted", Boolean.FALSE);
jsonObject.put("errorMessage", errorMessage);
}
writeJSON(actionRequest, actionResponse, jsonObject);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class BaseKBPortlet method serveKBArticleRSS.
public void serveKBArticleRSS(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
if (!PortalUtil.isRSSFeedsEnabled()) {
PortalUtil.sendRSSFeedsDisabledError(resourceRequest, resourceResponse);
return;
}
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
long resourcePrimKey = ParamUtil.getLong(resourceRequest, "resourcePrimKey");
int rssDelta = ParamUtil.getInteger(resourceRequest, "rssDelta");
String rssDisplayStyle = ParamUtil.getString(resourceRequest, "rssDisplayStyle");
String rssFormat = ParamUtil.getString(resourceRequest, "rssFormat");
String rss = KBArticleServiceUtil.getKBArticleRSS(resourcePrimKey, WorkflowConstants.STATUS_APPROVED, rssDelta, rssDisplayStyle, rssFormat, themeDisplay);
PortletResponseUtil.sendFile(resourceRequest, resourceResponse, null, rss.getBytes(StringPool.UTF8), ContentTypes.TEXT_XML_UTF8);
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class BaseKBPortlet method buildEditURL.
protected String buildEditURL(ActionRequest actionRequest, ActionResponse actionResponse, KBArticle kbArticle) throws PortalException, SystemException {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletDisplay portletDisplay = themeDisplay.getPortletDisplay();
String editURL = PortalUtil.getLayoutFullURL(themeDisplay);
editURL = HttpUtil.setParameter(editURL, "p_p_id", portletDisplay.getId());
editURL = HttpUtil.setParameter(editURL, actionResponse.getNamespace() + "mvcPath", templatePath + "edit_article.jsp");
editURL = HttpUtil.setParameter(editURL, actionResponse.getNamespace() + "redirect", getRedirect(actionRequest, actionResponse));
editURL = HttpUtil.setParameter(editURL, actionResponse.getNamespace() + "resourcePrimKey", kbArticle.getResourcePrimKey());
editURL = HttpUtil.setParameter(editURL, actionResponse.getNamespace() + "status", WorkflowConstants.STATUS_ANY);
return editURL;
}
use of com.liferay.portal.theme.ThemeDisplay in project liferay-ide by liferay.
the class LiferayPortlet method translate.
protected String translate(PortletRequest portletRequest, String key) {
PortletConfig portletConfig = (PortletConfig) portletRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
return LanguageUtil.get(portletConfig, themeDisplay.getLocale(), key);
}
Aggregations