List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY
int STATUS_ANY
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY.
Click Source Link
From source file:com.liferay.portlet.messageboards.service.impl.MBMessageServiceImpl.java
License:Open Source License
public int getThreadMessagesCount(long groupId, long categoryId, long threadId, int status) throws SystemException { if (status == WorkflowConstants.STATUS_ANY) { return mbMessagePersistence.filterCountByG_C_T(groupId, categoryId, threadId); } else {/*from w w w .j ava2s. c o m*/ return mbMessagePersistence.filterCountByG_C_T_S(groupId, categoryId, threadId, status); } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public int getCategoryThreadsCount(long groupId, long categoryId, int status) throws SystemException { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.countByG_C(groupId, categoryId); } else {/*from w w w .j a va2s . c om*/ return mbThreadPersistence.countByG_C_S(groupId, categoryId, status); } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public List<MBThread> getGroupThreads(long groupId, int status, int start, int end) throws SystemException { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.findByG_NotC(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID, start, end);//from w w w .j av a2 s. co m } else { return mbThreadPersistence.findByG_NotC_S(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID, status, start, end); } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public List<MBThread> getGroupThreads(long groupId, long userId, int status, boolean subscribed, boolean includeAnonymous, int start, int end) throws PortalException, SystemException { if (userId <= 0) { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.findByG_NotC(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID, start, end);/* w w w . jav a 2 s . c om*/ } else { return mbThreadPersistence.findByG_NotC_S(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID, status, start, end); } } else { if (subscribed) { return mbThreadFinder.findByS_G_U_C_S(groupId, userId, null, status, start, end); } else { List<Long> threadIds = null; if (includeAnonymous) { threadIds = mbMessageFinder.findByG_U_C_S(groupId, userId, null, status, start, end); } else { threadIds = mbMessageFinder.findByG_U_C_A_S(groupId, userId, null, false, status, start, end); } List<MBThread> threads = new ArrayList<MBThread>(threadIds.size()); for (long threadId : threadIds) { MBThread thread = mbThreadPersistence.findByPrimaryKey(threadId); threads.add(thread); } return threads; } } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public int getGroupThreadsCount(long groupId, int status) throws SystemException { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.countByG_NotC(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID); } else {//from w ww .j a v a 2 s. com return mbThreadPersistence.countByG_NotC_S(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID, status); } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public int getGroupThreadsCount(long groupId, long userId, int status, boolean subscribed, boolean includeAnonymous) throws SystemException { if (userId <= 0) { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.countByG_NotC(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID); } else {/* w w w . ja v a 2s . c o m*/ return mbThreadPersistence.countByG_NotC_S(groupId, MBCategoryConstants.DISCUSSION_CATEGORY_ID, status); } } else { if (subscribed) { return mbThreadFinder.countByS_G_U_C_S(groupId, userId, null, status); } else { if (includeAnonymous) { return mbMessageFinder.countByG_U_C_S(groupId, userId, null, status); } else { return mbMessageFinder.countByG_U_C_A_S(groupId, userId, null, false, status); } } } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public List<MBThread> getThreads(long groupId, long categoryId, int status, int start, int end) throws SystemException { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.findByG_C(groupId, categoryId, start, end); } else {/* www. jav a 2 s. c o m*/ return mbThreadPersistence.findByG_C_S(groupId, categoryId, status, start, end); } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public int getThreadsCount(long groupId, long categoryId, int status) throws SystemException { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.countByG_C(groupId, categoryId); } else {//from www . ja v a 2s . com return mbThreadPersistence.countByG_C_S(groupId, categoryId, status); } }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadLocalServiceImpl.java
License:Open Source License
public MBThread splitThread(long messageId, String subject, ServiceContext serviceContext) throws PortalException, SystemException { MBMessage message = mbMessagePersistence.findByPrimaryKey(messageId); if (message.isRoot()) { throw new SplitThreadException(); }//from ww w . j a v a 2 s.com MBCategory category = message.getCategory(); MBThread oldThread = message.getThread(); MBMessage rootMessage = mbMessagePersistence.findByPrimaryKey(oldThread.getRootMessageId()); String oldAttachmentsDir = message.getAttachmentsDir(); // Message flags mbMessageLocalService.updateAnswer(message, false, true); // Create new thread MBThread thread = addThread(message.getCategoryId(), message); // Update messages if (Validator.isNotNull(subject)) { MBMessageDisplay messageDisplay = mbMessageService.getMessageDisplay(messageId, WorkflowConstants.STATUS_ANY, MBThreadConstants.THREAD_VIEW_TREE, false); MBTreeWalker treeWalker = messageDisplay.getTreeWalker(); List<MBMessage> messages = treeWalker.getMessages(); int[] range = treeWalker.getChildrenRange(message); for (int i = range[0]; i < range[1]; i++) { MBMessage curMessage = messages.get(i); String oldSubject = message.getSubject(); String curSubject = curMessage.getSubject(); if (oldSubject.startsWith("RE: ")) { curSubject = StringUtil.replace(curSubject, rootMessage.getSubject(), subject); } else { curSubject = StringUtil.replace(curSubject, oldSubject, subject); } curMessage.setSubject(curSubject); mbMessagePersistence.update(curMessage, false); } message.setSubject(subject); } message.setThreadId(thread.getThreadId()); message.setRootMessageId(thread.getRootMessageId()); message.setParentMessageId(0); message.setAttachmentsDir(null); mbMessagePersistence.update(message, false); // Attachments moveAttachmentsFromOldThread(message, oldAttachmentsDir); // Indexer if (!message.isDiscussion()) { Indexer indexer = IndexerRegistryUtil.getIndexer(MBMessage.class); indexer.reindex(message); } // Update children int messagesMoved = 1; messagesMoved += moveChildrenMessages(message, category, oldThread.getThreadId()); // Update new thread thread.setMessageCount(messagesMoved); mbThreadPersistence.update(thread, false); // Update old thread oldThread.setMessageCount(oldThread.getMessageCount() - messagesMoved); mbThreadPersistence.update(oldThread, false); // Category if ((message.getCategoryId() != MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) && (message.getCategoryId() != MBCategoryConstants.DISCUSSION_CATEGORY_ID)) { category.setThreadCount(category.getThreadCount() + 1); mbCategoryPersistence.update(category, false); } return thread; }
From source file:com.liferay.portlet.messageboards.service.impl.MBThreadServiceImpl.java
License:Open Source License
public List<MBThread> getGroupThreads(long groupId, long userId, int status, boolean subscribed, boolean includeAnonymous, int start, int end) throws PortalException, SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return doGetGroupThreads(groupId, userId, status, subscribed, includeAnonymous, start, end); }/* www. jav a 2 s . c o m*/ long[] categoryIds = mbCategoryService.getCategoryIds(groupId, MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID); if (categoryIds.length == 0) { return Collections.emptyList(); } if (userId <= 0) { if (status == WorkflowConstants.STATUS_ANY) { return mbThreadPersistence.findByG_C(groupId, categoryIds, start, end); } else { return mbThreadPersistence.findByG_C_S(groupId, categoryIds, status, start, end); } } else { if (subscribed) { return mbThreadFinder.filterFindByS_G_U_C_S(groupId, userId, categoryIds, status, start, end); } else { List<Long> threadIds = null; if (includeAnonymous) { threadIds = mbMessageFinder.filterFindByG_U_C_S(groupId, userId, categoryIds, status, start, end); } else { threadIds = mbMessageFinder.filterFindByG_U_C_A_S(groupId, userId, categoryIds, false, status, start, end); } List<MBThread> threads = new ArrayList<MBThread>(threadIds.size()); for (long threadId : threadIds) { MBThread thread = mbThreadPersistence.findByPrimaryKey(threadId); threads.add(thread); } return threads; } } }