use of javax.portlet.PortletException in project liferay-ide by liferay.
the class SectionPortlet method render.
@Override
public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
try {
int status = getStatus(renderRequest);
renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_STATUS, status);
KBArticle kbArticle = getKBArticle(renderRequest, status);
renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_KB_ARTICLE, kbArticle);
} catch (Exception e) {
if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {
SessionErrors.add(renderRequest, e.getClass());
} else {
throw new PortletException(e);
}
}
super.render(renderRequest, renderResponse);
}
use of javax.portlet.PortletException in project liferay-ide by liferay.
the class ArticlePortlet method render.
@Override
public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
try {
int status = getStatus(renderRequest);
renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_STATUS, status);
KBArticle kbArticle = null;
long resourcePrimKey = getResourcePrimKey(renderRequest);
if (resourcePrimKey > 0) {
kbArticle = KBArticleServiceUtil.getLatestKBArticle(resourcePrimKey, status);
}
renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_KB_ARTICLE, kbArticle);
} catch (Exception e) {
if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {
SessionErrors.add(renderRequest, e.getClass());
SessionMessages.add(renderRequest, PortalUtil.getPortletId(renderRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
} else {
throw new PortletException(e);
}
}
super.render(renderRequest, renderResponse);
}
use of javax.portlet.PortletException in project liferay-ide by liferay.
the class DisplayPortlet method render.
@Override
public void render(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
try {
KBArticle kbArticle = getKBArticle(renderRequest);
int status = getStatus(renderRequest, kbArticle);
renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_STATUS, status);
if ((kbArticle != null) && (kbArticle.getStatus() != status)) {
kbArticle = KBArticleLocalServiceUtil.fetchLatestKBArticle(kbArticle.getResourcePrimKey(), status);
}
renderRequest.setAttribute(WebKeys.KNOWLEDGE_BASE_KB_ARTICLE, kbArticle);
} catch (Exception e) {
if (e instanceof NoSuchArticleException || e instanceof PrincipalException) {
SessionErrors.add(renderRequest, e.getClass());
SessionMessages.add(renderRequest, PortalUtil.getPortletId(renderRequest) + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE);
} else {
throw new PortletException(e);
}
}
super.render(renderRequest, renderResponse);
}
use of javax.portlet.PortletException in project liferay-blade-samples by liferay.
the class JSPPortlet method processAction.
@Override
public void processAction(ActionRequest actionRequest, ActionResponse actionResponse) throws IOException, PortletException {
try {
String cmd = ParamUtil.getString(actionRequest, Constants.CMD);
if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {
updateFoo(actionRequest);
} else if (cmd.equals(Constants.DELETE)) {
deleteFoo(actionRequest);
}
if (Validator.isNotNull(cmd)) {
if (SessionErrors.isEmpty(actionRequest)) {
SessionMessages.add(actionRequest, "requestProcessed");
}
String redirect = ParamUtil.getString(actionRequest, "redirect");
actionResponse.sendRedirect(redirect);
}
} catch (Exception e) {
throw new PortletException(e);
}
}
use of javax.portlet.PortletException in project sw360portal by sw360.
the class FossologyAwarePortlet method serveGetSendableReleases.
protected void serveGetSendableReleases(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {
String projectId = request.getParameter(PROJECT_ID);
User user = UserCacheHolder.getUserFromRequest(request);
try {
putReleasesAndProjectIntoRequest(request, projectId, user);
include("/html/projects/ajax/sendableTable.jsp", request, response, PortletRequest.RESOURCE_PHASE);
} catch (TException e) {
log.error("Problem with project client", e);
throw new PortletException(e);
}
}
Aggregations