Example usage for com.liferay.portal.kernel.security.permission ActionKeys EXPIRE

List of usage examples for com.liferay.portal.kernel.security.permission ActionKeys EXPIRE

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.security.permission ActionKeys EXPIRE.

Prototype

String EXPIRE

To view the source code for com.liferay.portal.kernel.security.permission ActionKeys EXPIRE.

Click Source Link

Usage

From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java

License:Open Source License

/**
 * Expires the web content article matching the group, article ID, and
 * version.//from ww  w.j ava  2s . c  o m
 *
 * @param  groupId the primary key of the web content article's group
 * @param  articleId the primary key of the web content article
 * @param  version the web content article's version
 * @param  articleURL the web content article's accessible URL
 * @param  serviceContext the service context to be applied. Can set the
 *         modification date, status date, portlet preferences, and can set
 *         whether to add the default command update for the web content
 *         article. With respect to social activities, by setting the
 *         service context's command to {@link
 *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
 *         is considered a web content update activity; otherwise it is
 *         considered a web content add activity.
 * @return the web content article
 */
@Override
public JournalArticle expireArticle(long groupId, String articleId, double version, String articleURL,
        ServiceContext serviceContext) throws PortalException {

    JournalArticlePermission.check(getPermissionChecker(), groupId, articleId, version, ActionKeys.EXPIRE);

    return journalArticleLocalService.expireArticle(getUserId(), groupId, articleId, version, articleURL,
            serviceContext);
}

From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java

License:Open Source License

/**
 * Expires the web content article matching the group and article ID,
 * expiring all of its versions if the/*from   w  w  w .  j  ava2 s .co m*/
 * <code>journal.article.expire.all.versions</code> portal property is
 * <code>true</code>, otherwise expiring only its latest approved version.
 *
 * @param groupId the primary key of the web content article's group
 * @param articleId the primary key of the web content article
 * @param articleURL the web content article's accessible URL
 * @param serviceContext the service context to be applied. Can set the
 *        modification date, status date, portlet preferences, and can set
 *        whether to add the default command update for the web content
 *        article. With respect to social activities, by setting the service
 *        context's command to {@link
 *        com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
 *        is considered a web content update activity; otherwise it is
 *        considered a web content add activity.
 */
@Override
public void expireArticle(long groupId, String articleId, String articleURL, ServiceContext serviceContext)
        throws PortalException {

    JournalArticlePermission.check(getPermissionChecker(), groupId, articleId, ActionKeys.EXPIRE);

    journalArticleLocalService.expireArticle(getUserId(), groupId, articleId, articleURL, serviceContext);
}

From source file:com.liferay.journal.web.internal.search.EntriesChecker.java

License:Open Source License

@Override
public String getRowCheckBox(HttpServletRequest request, boolean checked, boolean disabled, String primaryKey) {

    if (!_journalDisplayContext.isShowEditActions()) {
        return StringPool.BLANK;
    }/*from   w  ww  .  java2  s  . co m*/

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    JournalFolder folder = null;

    String articleId = GetterUtil.getString(primaryKey);

    JournalArticle article = JournalArticleLocalServiceUtil.fetchArticle(themeDisplay.getScopeGroupId(),
            articleId);

    if (article == null) {
        long folderId = GetterUtil.getLong(primaryKey);

        folder = JournalFolderLocalServiceUtil.fetchFolder(folderId);
    }

    String name = null;
    boolean showInput = false;

    if (article != null) {
        name = JournalArticle.class.getSimpleName();

        try {
            if (JournalArticlePermission.contains(_permissionChecker, article, ActionKeys.DELETE)
                    || JournalArticlePermission.contains(_permissionChecker, article, ActionKeys.EXPIRE)
                    || JournalArticlePermission.contains(_permissionChecker, article, ActionKeys.UPDATE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    } else if (folder != null) {
        name = JournalFolder.class.getSimpleName();

        try {
            if (JournalFolderPermission.contains(_permissionChecker, folder, ActionKeys.DELETE)) {

                showInput = true;
            }
        } catch (Exception e) {
        }
    }

    if (!showInput) {
        return StringPool.BLANK;
    }

    StringBundler sb = new StringBundler(9);

    sb.append("['");
    sb.append(_liferayPortletResponse.getNamespace());
    sb.append(RowChecker.ROW_IDS);
    sb.append(JournalFolder.class.getSimpleName());
    sb.append("', '");
    sb.append(_liferayPortletResponse.getNamespace());
    sb.append(RowChecker.ROW_IDS);
    sb.append(JournalArticle.class.getSimpleName());
    sb.append("']");

    String checkBoxRowIds = sb.toString();

    return getRowCheckBox(request, checked, disabled,
            _liferayPortletResponse.getNamespace() + RowChecker.ROW_IDS + name + StringPool.BLANK, primaryKey,
            checkBoxRowIds, "'#" + getAllRowIds() + "'", StringPool.BLANK);
}