Example usage for com.liferay.portal.kernel.util Constants EXPIRE

List of usage examples for com.liferay.portal.kernel.util Constants EXPIRE

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util Constants EXPIRE.

Prototype

String EXPIRE

To view the source code for com.liferay.portal.kernel.util Constants EXPIRE.

Click Source Link

Usage

From source file:com.liferay.portlet.journal.action.EditArticleAction.java

License:Open Source License

public void processAction(ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
        ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    JournalArticle article = null;//from   w w w. j av  a  2s . co m

    try {
        if (cmd.equals(Constants.ADD) || cmd.equals(Constants.UPDATE)) {
            article = updateArticle(actionRequest);
        } else if (cmd.equals(Constants.APPROVE)) {
            approveArticle(actionRequest);
        } else if (cmd.equals(Constants.DELETE)) {
            deleteArticles(actionRequest);
        } else if (cmd.equals(Constants.EXPIRE)) {
            expireArticles(actionRequest);
        } else if (cmd.equals("removeArticlesLocale")) {
            removeArticlesLocale(actionRequest);
        }

        if (Validator.isNotNull(cmd)) {
            String redirect = ParamUtil.getString(actionRequest, "redirect");

            if (article != null) {
                boolean saveAndContinue = ParamUtil.getBoolean(actionRequest, "saveAndContinue");

                if (saveAndContinue) {
                    redirect = getSaveAndContinueRedirect(portletConfig, actionRequest, article, redirect);
                }
            }

            sendRedirect(actionRequest, actionResponse, redirect);
        }
    } catch (Exception e) {
        if (e instanceof NoSuchArticleException || e instanceof NoSuchStructureException
                || e instanceof NoSuchTemplateException || e instanceof PrincipalException) {

            SessionErrors.add(actionRequest, e.getClass().getName());

            setForward(actionRequest, "portlet.journal.error");
        } else if (e instanceof ArticleContentException || e instanceof ArticleDisplayDateException
                || e instanceof ArticleExpirationDateException || e instanceof ArticleIdException
                || e instanceof ArticleSmallImageNameException || e instanceof ArticleSmallImageSizeException
                || e instanceof ArticleTitleException || e instanceof ArticleTypeException
                || e instanceof DuplicateArticleIdException) {

            SessionErrors.add(actionRequest, e.getClass().getName());
        } else if (e instanceof TagsEntryException) {
            SessionErrors.add(actionRequest, e.getClass().getName(), e);
        } else {
            throw e;
        }
    }
}