List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_IN_TRASH
int STATUS_IN_TRASH
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_IN_TRASH.
Click Source Link
From source file:com.liferay.blogs.service.impl.BlogsEntryServiceImpl.java
License:Open Source License
@Override public int getGroupEntriesCount(long groupId, int status) { if (status == WorkflowConstants.STATUS_ANY) { return blogsEntryPersistence.filterCountByG_NotS(groupId, WorkflowConstants.STATUS_IN_TRASH); } else {//from ww w . ja v a 2s . c o m return blogsEntryPersistence.filterCountByG_S(groupId, status); } }
From source file:com.liferay.blogs.service.impl.BlogsEntryServiceImpl.java
License:Open Source License
@Override public List<BlogsEntry> getGroupsEntries(long companyId, long groupId, Date displayDate, int status, int max) throws PortalException { List<BlogsEntry> entries = new ArrayList<>(); boolean listNotExhausted = true; QueryDefinition<BlogsEntry> queryDefinition = new QueryDefinition<>(status, false, 0, 0, new EntryDisplayDateComparator()); if (status == WorkflowConstants.STATUS_ANY) { queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true); }/*from w w w .ja v a 2s . c o m*/ while ((entries.size() < max) && listNotExhausted) { queryDefinition.setEnd(queryDefinition.getStart() + max); List<BlogsEntry> entryList = blogsEntryLocalService.getGroupsEntries(companyId, groupId, displayDate, queryDefinition); queryDefinition.setStart(queryDefinition.getStart() + max); listNotExhausted = (entryList.size() == max); for (BlogsEntry entry : entryList) { if (entries.size() >= max) { break; } if (BlogsEntryPermission.contains(getPermissionChecker(), entry, ActionKeys.VIEW)) { entries.add(entry); } } } return entries; }
From source file:com.liferay.blogs.service.impl.BlogsEntryServiceImpl.java
License:Open Source License
@Override public List<BlogsEntry> getGroupUserEntries(long groupId, long userId, int status, int start, int end, OrderByComparator<BlogsEntry> obc) { if (status == WorkflowConstants.STATUS_ANY) { return blogsEntryPersistence.filterFindByG_U_NotS(groupId, userId, WorkflowConstants.STATUS_IN_TRASH, start, end, obc);/*from w ww.j a va2s.co m*/ } else { return blogsEntryPersistence.filterFindByG_U_S(groupId, userId, status, start, end, obc); } }
From source file:com.liferay.blogs.service.impl.BlogsEntryServiceImpl.java
License:Open Source License
@Override public int getGroupUserEntriesCount(long groupId, long userId, int status) { if (status == WorkflowConstants.STATUS_ANY) { return blogsEntryPersistence.filterCountByG_U_NotS(groupId, userId, WorkflowConstants.STATUS_IN_TRASH); } else {// ww w . ja v a 2 s . c om return blogsEntryPersistence.filterCountByG_U_S(groupId, userId, status); } }
From source file:com.liferay.blogs.service.impl.BlogsEntryServiceImpl.java
License:Open Source License
@Override public List<BlogsEntry> getOrganizationEntries(long organizationId, Date displayDate, int status, int max) throws PortalException { List<BlogsEntry> entries = new ArrayList<>(); boolean listNotExhausted = true; QueryDefinition<BlogsEntry> queryDefinition = new QueryDefinition<>(status, false, 0, 0, new EntryDisplayDateComparator()); if (status == WorkflowConstants.STATUS_ANY) { queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true); }/*from www . j av a2s.co m*/ while ((entries.size() < max) && listNotExhausted) { queryDefinition.setEnd(queryDefinition.getStart() + max); List<BlogsEntry> entryList = blogsEntryFinder.findByOrganizationId(organizationId, displayDate, queryDefinition); queryDefinition.setStart(queryDefinition.getStart() + max); listNotExhausted = (entryList.size() == max); for (BlogsEntry entry : entryList) { if (entries.size() >= max) { break; } if (BlogsEntryPermission.contains(getPermissionChecker(), entry, ActionKeys.VIEW)) { entries.add(entry); } } } return entries; }
From source file:com.liferay.blogs.service.test.BlogsEntryLocalServiceTest.java
License:Open Source License
@Test public void testGetGroupsEntries() throws Exception { List<BlogsEntry> groupsEntries = BlogsEntryLocalServiceUtil.getGroupsEntries(_user.getCompanyId(), _group.getGroupId(), new Date(), _statusInTrashQueryDefinition); int initialCount = groupsEntries.size(); addEntry(false);/*from w w w .j a v a 2 s . com*/ addEntry(true); List<BlogsEntry> groupsEntriesInTrash = BlogsEntryLocalServiceUtil.getGroupsEntries(_user.getCompanyId(), _group.getGroupId(), new Date(), _statusInTrashQueryDefinition); Assert.assertEquals(initialCount + 1, groupsEntriesInTrash.size()); for (BlogsEntry groupsEntry : groupsEntriesInTrash) { Assert.assertEquals("Entry " + groupsEntry.getEntryId() + " is not in trash", WorkflowConstants.STATUS_IN_TRASH, groupsEntry.getStatus()); Assert.assertEquals("Entry belongs to company " + groupsEntry.getCompanyId() + " but should belong to company " + _user.getCompanyId(), _user.getCompanyId(), groupsEntry.getCompanyId()); } }
From source file:com.liferay.blogs.service.test.BlogsEntryLocalServiceTest.java
License:Open Source License
protected void assertBlogsEntriesStatus(List<BlogsEntry> entries, boolean statusInTrash) { for (BlogsEntry entry : entries) { if (statusInTrash) { Assert.assertEquals("The entry " + entry.getEntryId() + " should be in trash", WorkflowConstants.STATUS_IN_TRASH, entry.getStatus()); } else {/*from w ww . jav a2 s. c om*/ Assert.assertNotEquals("The entry " + entry.getEntryId() + " should not be in trash", WorkflowConstants.STATUS_IN_TRASH, entry.getStatus()); } } }
From source file:com.liferay.blogs.service.test.BlogsEntryStatusTransitionTest.java
License:Open Source License
@Test public void testApprovedToTrash() throws Exception { BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(), WorkflowConstants.STATUS_APPROVED, getServiceContext(entry), new HashMap<String, Serializable>()); BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(), WorkflowConstants.STATUS_IN_TRASH, getServiceContext(entry), new HashMap<String, Serializable>()); Assert.assertFalse(isAssetEntryVisible(entry.getEntryId())); Assert.assertEquals(0, searchBlogsEntriesCount(group.getGroupId())); }
From source file:com.liferay.blogs.service.test.BlogsEntryStatusTransitionTest.java
License:Open Source License
@Test public void testDraftToTrash() throws Exception { BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(), WorkflowConstants.STATUS_IN_TRASH, getServiceContext(entry), new HashMap<String, Serializable>()); Assert.assertFalse(isAssetEntryVisible(entry.getEntryId())); Assert.assertEquals(0, searchBlogsEntriesCount(group.getGroupId())); }
From source file:com.liferay.blogs.service.test.BlogsEntryStatusTransitionTest.java
License:Open Source License
@Test public void testTrashToApproved() throws Exception { BlogsEntryLocalServiceUtil.updateStatus(TestPropsValues.getUserId(), entry.getEntryId(), WorkflowConstants.STATUS_APPROVED, 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_APPROVED, getServiceContext(entry), new HashMap<String, Serializable>()); Assert.assertTrue(isAssetEntryVisible(entry.getEntryId())); Assert.assertEquals(1, searchBlogsEntriesCount(group.getGroupId())); checkSocialActivity(BlogsActivityKeys.ADD_ENTRY, 1); }