Example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED

List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED.

Prototype

int STATUS_APPROVED

To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED.

Click Source Link

Usage

From source file:com.liferay.blogs.service.test.BlogsEntryStatusTransitionTest.java

License:Open Source License

@Test
public void testTrashToDraft() throws Exception {
    BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(),
            WorkflowConstants.STATUS_IN_TRASH, getServiceContext(entry), new HashMap<String, Serializable>());

    BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(),
            WorkflowConstants.STATUS_DRAFT, getServiceContext(entry), new HashMap<String, Serializable>());

    Assert.assertFalse(isAssetEntryVisible(entry.getEntryId()));
    Assert.assertEquals(0, searchBlogsEntriesCount(group.getGroupId()));

    BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(),
            WorkflowConstants.STATUS_APPROVED, getServiceContext(entry), new HashMap<String, Serializable>());

    BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(),
            WorkflowConstants.STATUS_DRAFT, getServiceContext(entry), new HashMap<String, Serializable>());

    BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(),
            WorkflowConstants.STATUS_IN_TRASH, getServiceContext(entry), new HashMap<String, Serializable>());

    BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(),
            WorkflowConstants.STATUS_DRAFT, getServiceContext(entry), new HashMap<String, Serializable>());

    Assert.assertFalse(isAssetEntryVisible(entry.getEntryId()));
    Assert.assertEquals(0, searchBlogsEntriesCount(group.getGroupId()));
}

From source file:com.liferay.blogs.test.util.BlogsTestUtil.java

License:Open Source License

protected static BlogsEntry updateStatus(BlogsEntry entry, ServiceContext serviceContext) throws Exception {

    Map<String, Serializable> workflowContext = new HashMap<>();

    workflowContext.put(WorkflowConstants.CONTEXT_URL, "http://localhost");
    workflowContext.put(WorkflowConstants.CONTEXT_USER_PORTRAIT_URL, "http://localhost");
    workflowContext.put(WorkflowConstants.CONTEXT_USER_URL, "http://localhost");

    return BlogsEntryLocalServiceUtil.updateStatus(entry.getUserId(), entry.getEntryId(),
            WorkflowConstants.STATUS_APPROVED, serviceContext, workflowContext);
}

From source file:com.liferay.blogs.verify.VerifyBlogsTrackbacks.java

License:Open Source License

protected void verifyMBDiscussions() {
    try (LoggingTimer loggingTimer = new LoggingTimer()) {
        List<MBDiscussion> mbDiscussions = _mbMessageLocalService.getDiscussions(BlogsEntry.class.getName());

        for (MBDiscussion mbDiscussion : mbDiscussions) {
            try {
                BlogsEntry entry = _blogsEntryLocalService.getEntry(mbDiscussion.getClassPK());

                List<MBMessage> mbMessages = _mbMessageLocalService
                        .getThreadMessages(mbDiscussion.getThreadId(), WorkflowConstants.STATUS_APPROVED);

                for (MBMessage mbMessage : mbMessages) {
                    _verifyPost(entry, mbMessage);
                }/*from   w  ww .ja v  a 2  s.co  m*/
            } catch (Exception e) {
                _log.error(e, e);
            }
        }
    }
}

From source file:com.liferay.blogs.web.internal.portlet.action.RSSAction.java

License:Open Source License

@Override
protected byte[] getRSS(HttpServletRequest request) throws Exception {
    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Layout layout = themeDisplay.getLayout();

    long plid = ParamUtil.getLong(request, "p_l_id");

    if (plid == LayoutConstants.DEFAULT_PLID) {
        plid = themeDisplay.getPlid();//from   w  w  w  .j  a va 2s . c  o  m
    }

    long companyId = ParamUtil.getLong(request, "companyId");
    long groupId = ParamUtil.getLong(request, "groupId");
    long organizationId = ParamUtil.getLong(request, "organizationId");
    int status = WorkflowConstants.STATUS_APPROVED;
    int max = ParamUtil.getInteger(request, "max", SearchContainer.DEFAULT_DELTA);
    String type = ParamUtil.getString(request, "type", RSSUtil.FORMAT_DEFAULT);
    double version = ParamUtil.getDouble(request, "version", RSSUtil.VERSION_DEFAULT);
    String displayStyle = ParamUtil.getString(request, "displayStyle", RSSUtil.DISPLAY_STYLE_DEFAULT);

    String feedURL = themeDisplay.getPortalURL() + themeDisplay.getPathMain() + "/blogs/find_entry?";

    String entryURL = feedURL;

    String rss = StringPool.BLANK;

    if (companyId > 0) {
        feedURL = StringPool.BLANK;

        rss = _blogsEntryService.getCompanyEntriesRSS(companyId, new Date(), status, max, type, version,
                displayStyle, feedURL, entryURL, themeDisplay);
    } else if (groupId > 0) {
        feedURL += "p_l_id=" + plid;

        entryURL = feedURL;

        rss = _blogsEntryService.getGroupEntriesRSS(groupId, new Date(), status, max, type, version,
                displayStyle, feedURL, entryURL, themeDisplay);
    } else if (organizationId > 0) {
        feedURL = StringPool.BLANK;

        rss = _blogsEntryService.getOrganizationEntriesRSS(organizationId, new Date(), status, max, type,
                version, displayStyle, feedURL, entryURL, themeDisplay);
    } else if (layout != null) {
        groupId = themeDisplay.getScopeGroupId();

        feedURL = themeDisplay.getPathMain() + "/blogs/rss";

        entryURL = feedURL;

        rss = _blogsEntryService.getGroupEntriesRSS(groupId, new Date(), status, max, type, version,
                displayStyle, feedURL, entryURL, themeDisplay);
    }

    return rss.getBytes(StringPool.UTF8);
}

From source file:com.liferay.bookmarks.search.BookmarksEntryIndexer.java

License:Open Source License

protected void reindexEntries(long companyId, final long groupId, final long folderId) throws PortalException {

    final IndexableActionableDynamicQuery indexableActionableDynamicQuery = _bookmarksEntryLocalService
            .getIndexableActionableDynamicQuery();

    indexableActionableDynamicQuery.setAddCriteriaMethod(new ActionableDynamicQuery.AddCriteriaMethod() {

        @Override/*from   ww w  . j a  va  2 s.c o m*/
        public void addCriteria(DynamicQuery dynamicQuery) {
            Property folderIdProperty = PropertyFactoryUtil.forName("folderId");

            dynamicQuery.add(folderIdProperty.eq(folderId));

            Property statusProperty = PropertyFactoryUtil.forName("status");

            Integer[] statuses = { WorkflowConstants.STATUS_APPROVED, WorkflowConstants.STATUS_IN_TRASH };

            dynamicQuery.add(statusProperty.in(statuses));
        }

    });
    indexableActionableDynamicQuery.setCompanyId(companyId);
    indexableActionableDynamicQuery.setGroupId(groupId);
    indexableActionableDynamicQuery
            .setPerformActionMethod(new ActionableDynamicQuery.PerformActionMethod<BookmarksEntry>() {

                @Override
                public void performAction(BookmarksEntry entry) {
                    try {
                        Document document = getDocument(entry);

                        indexableActionableDynamicQuery.addDocuments(document);
                    } catch (PortalException pe) {
                        if (_log.isWarnEnabled()) {
                            _log.warn("Unable to index bookmarks entry " + entry.getEntryId(), pe);
                        }
                    }
                }

            });
    indexableActionableDynamicQuery.setSearchEngineId(getSearchEngineId());

    indexableActionableDynamicQuery.performActions();
}

From source file:com.liferay.bookmarks.search.test.BookmarksEntrySearchTest.java

License:Open Source License

@Override
protected long searchGroupEntriesCount(long groupId, long creatorUserId) throws Exception {

    Hits hits = BookmarksEntryServiceUtil.search(groupId, creatorUserId, WorkflowConstants.STATUS_APPROVED,
            QueryUtil.ALL_POS, QueryUtil.ALL_POS);

    return hits.getLength();
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> getEntries(long groupId, long folderId, int start, int end) {

    return getEntries(groupId, folderId, WorkflowConstants.STATUS_APPROVED, start, end);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> getEntries(long groupId, long folderId, int start, int end,
        OrderByComparator<BookmarksEntry> orderByComparator) {

    return getEntries(groupId, folderId, WorkflowConstants.STATUS_APPROVED, start, end, orderByComparator);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public int getEntriesCount(long groupId, long folderId) {
    return getEntriesCount(groupId, folderId, WorkflowConstants.STATUS_APPROVED);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Override
public int getFoldersEntriesCount(long groupId, List<Long> folderIds) {
    return bookmarksEntryPersistence.countByG_F_S(groupId,
            ArrayUtil.toArray(folderIds.toArray(new Long[folderIds.size()])),
            WorkflowConstants.STATUS_APPROVED);
}