Search in sources :

Example 6 with PortletException

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);
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) PortletException(javax.portlet.PortletException) PrincipalException(com.liferay.portal.security.auth.PrincipalException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) NoSuchSubscriptionException(com.liferay.portal.NoSuchSubscriptionException) PrincipalException(com.liferay.portal.security.auth.PrincipalException) PortalException(com.liferay.portal.kernel.exception.PortalException) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) IOException(java.io.IOException) NoSuchCommentException(com.liferay.knowledgebase.NoSuchCommentException) PortletException(javax.portlet.PortletException)

Example 7 with PortletException

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);
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) PortletException(javax.portlet.PortletException) PrincipalException(com.liferay.portal.security.auth.PrincipalException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) NoSuchSubscriptionException(com.liferay.portal.NoSuchSubscriptionException) PrincipalException(com.liferay.portal.security.auth.PrincipalException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) IOException(java.io.IOException) NoSuchCommentException(com.liferay.knowledgebase.NoSuchCommentException) PortletException(javax.portlet.PortletException)

Example 8 with PortletException

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);
}
Also used : KBArticle(com.liferay.knowledgebase.model.KBArticle) PortletException(javax.portlet.PortletException) PrincipalException(com.liferay.portal.security.auth.PrincipalException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) NoSuchSubscriptionException(com.liferay.portal.NoSuchSubscriptionException) PrincipalException(com.liferay.portal.security.auth.PrincipalException) PortalException(com.liferay.portal.kernel.exception.PortalException) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) IOException(java.io.IOException) NoSuchCommentException(com.liferay.knowledgebase.NoSuchCommentException) PortletException(javax.portlet.PortletException)

Example 9 with PortletException

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);
    }
}
Also used : PortletException(javax.portlet.PortletException) IOException(java.io.IOException) PortalException(com.liferay.portal.kernel.exception.PortalException) PortletException(javax.portlet.PortletException)

Example 10 with PortletException

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);
    }
}
Also used : TException(org.apache.thrift.TException) User(org.eclipse.sw360.datahandler.thrift.users.User) PortletException(javax.portlet.PortletException)

Aggregations

PortletException (javax.portlet.PortletException)21 IOException (java.io.IOException)17 NoSuchArticleException (com.liferay.knowledgebase.NoSuchArticleException)5 NoSuchCommentException (com.liferay.knowledgebase.NoSuchCommentException)5 KBArticle (com.liferay.knowledgebase.model.KBArticle)5 NoSuchSubscriptionException (com.liferay.portal.NoSuchSubscriptionException)5 PortalException (com.liferay.portal.kernel.exception.PortalException)5 PrincipalException (com.liferay.portal.security.auth.PrincipalException)5 PortletContainerException (org.apache.pluto.container.PortletContainerException)5 PortletDispatchException (org.apereo.portal.portlet.PortletDispatchException)5 IPortletWindow (org.apereo.portal.portlet.om.IPortletWindow)5 SystemException (com.liferay.portal.kernel.exception.SystemException)3 TException (org.apache.thrift.TException)3 PortletHttpServletResponseWrapper (org.apereo.portal.utils.web.PortletHttpServletResponseWrapper)3 User (org.eclipse.sw360.datahandler.thrift.users.User)3 CacheControl (javax.portlet.CacheControl)2 PortletSession (javax.portlet.PortletSession)2 SessionUser (org.alfresco.repo.SessionUser)2 AuthenticationException (org.alfresco.repo.security.authentication.AuthenticationException)2 AuthenticationService (org.alfresco.service.cmr.security.AuthenticationService)2