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.persistence.MBThreadFinderImpl.java
License:Open Source License
public int countByG_U_A_S(long groupId, long userId, boolean anonymous, int status) throws SystemException { Session session = null;/* w w w.j a va2 s. c o m*/ try { session = openSession(); String sql = CustomSQLUtil.get(COUNT_BY_G_U_A_S); if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBMessage.status = ?)"); } SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(anonymous); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } Iterator<Long> itr = q.iterate(); if (itr.hasNext()) { Long count = itr.next(); if (count != null) { return count.intValue(); } } return 0; } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
public List<MBThread> findByG_U_S(long groupId, long userId, int status, int start, int end) throws SystemException { Session session = null;//from w ww.java 2 s.c o m try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_G_U_S); if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBMessage.status = ?)"); } SQLQuery q = session.createSQLQuery(sql); q.addEntity("MBThread", MBThreadImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
public List<MBThread> findByG_U_A_S(long groupId, long userId, boolean anonymous, int status, int start, int end) throws SystemException { Session session = null;//from www .j ava 2s . c o m try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_G_U_A_S); if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBMessage.status = ?)"); } SQLQuery q = session.createSQLQuery(sql); q.addEntity("MBThread", MBThreadImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(anonymous); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
public List<MBThread> findByS_G_U_S(long groupId, long userId, int status, int start, int end) throws SystemException { Session session = null;/*from ww w .ja va 2 s . co m*/ try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_S_G_U_S); if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBThread.status = ?)"); } SQLQuery q = session.createSQLQuery(sql); q.addEntity("MBThread", MBThreadImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(PortalUtil.getClassNameId(MBThread.class.getName())); qPos.add(groupId); qPos.add(userId); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
protected int doCountByG_C_S(long groupId, long categoryId, int status, boolean inlineSQLHelper) throws SystemException { if (!inlineSQLHelper || !InlineSQLHelperUtil.isEnabled(groupId)) { if (status != WorkflowConstants.STATUS_ANY) { return MBThreadUtil.countByG_C_S(groupId, categoryId, status); } else {/*from www.j a v a 2 s . co m*/ return MBThreadUtil.countByG_C(groupId, categoryId); } } Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(COUNT_BY_G_C); if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBThread.status = ?)"); } sql = InlineSQLHelperUtil.replacePermissionCheck(sql, MBMessage.class.getName(), "MBThread.rootMessageId", groupId); SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(categoryId); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } Iterator<Long> itr = q.iterate(); if (itr.hasNext()) { Long count = itr.next(); if (count != null) { return count.intValue(); } } return 0; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
protected int doCountByS_G_U_S(long groupId, long userId, int status) throws SystemException { Session session = null;//from w w w .j a v a 2s. c om try { session = openSession(); String sql = CustomSQLUtil.get(COUNT_BY_S_G_U_S); if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBThread.status = ?)"); } SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(PortalUtil.getClassNameId(MBThread.class.getName())); qPos.add(groupId); qPos.add(userId); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } Iterator<Long> itr = q.iterate(); if (itr.hasNext()) { Long count = itr.next(); if (count != null) { return count.intValue(); } } return 0; } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
protected int doCountByS_G_U_C_S(long groupId, long userId, long[] categoryIds, int status, boolean inlineSQLHelper) throws SystemException { Session session = null;/*from w ww . j a v a 2 s . c om*/ try { session = openSession(); String sql = CustomSQLUtil.get(COUNT_BY_S_G_U_C_S); if ((categoryIds == null) || (categoryIds.length == 0)) { sql = StringUtil.replace(sql, "(MBThread.categoryId = ?) AND", StringPool.BLANK); } else { sql = StringUtil.replace(sql, "MBThread.categoryId = ?", "MBThread.categoryId = " + StringUtil.merge(categoryIds, " OR MBThread.categoryId = ")); } if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBThread.status = ?)"); } if (inlineSQLHelper) { sql = InlineSQLHelperUtil.replacePermissionCheck(sql, MBMessage.class.getName(), "MBThread.rootMessageId", groupId); } SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(PortalUtil.getClassNameId(MBThread.class.getName())); qPos.add(groupId); qPos.add(userId); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } Iterator<Long> itr = q.iterate(); if (itr.hasNext()) { Long count = itr.next(); if (count != null) { return count.intValue(); } } return 0; } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
protected List<MBThread> doFindByG_C_S(long groupId, long categoryId, int status, int start, int end, boolean inlineSQLHelper) throws SystemException { if (!inlineSQLHelper || !InlineSQLHelperUtil.isEnabled(groupId)) { if (status != WorkflowConstants.STATUS_ANY) { return MBThreadUtil.findByG_C_S(groupId, categoryId, status, start, end); } else {//from ww w.ja v a 2s . c om return MBThreadUtil.findByG_C(groupId, categoryId, start, end); } } Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_G_C); if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBThread.status = ?)"); } sql = InlineSQLHelperUtil.replacePermissionCheck(sql, MBMessage.class.getName(), "MBThread.rootMessageId", groupId); SQLQuery q = session.createSQLQuery(sql); q.addEntity("MBThread", MBThreadImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(categoryId); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.service.persistence.MBThreadFinderImpl.java
License:Open Source License
protected List<MBThread> doFindByS_G_U_C_S(long groupId, long userId, long[] categoryIds, int status, int start, int end, boolean inlineSQLHelper) throws SystemException { Session session = null;//w w w . j ava2 s . c o m try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_S_G_U_C_S); if ((categoryIds == null) || (categoryIds.length == 0)) { sql = StringUtil.replace(sql, "(MBThread.categoryId = ?) AND", StringPool.BLANK); } else { sql = StringUtil.replace(sql, "MBThread.categoryId = ?", "MBThread.categoryId = " + StringUtil.merge(categoryIds, " OR MBThread.categoryId = ")); } if (status != WorkflowConstants.STATUS_ANY) { sql = CustomSQLUtil.appendCriteria(sql, "AND (MBThread.status = ?)"); } if (inlineSQLHelper) { sql = InlineSQLHelperUtil.replacePermissionCheck(sql, MBMessage.class.getName(), "MBThread.rootMessageId", groupId); } SQLQuery q = session.createSQLQuery(sql); q.addEntity("MBThread", MBThreadImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(PortalUtil.getClassNameId(MBThread.class.getName())); qPos.add(groupId); qPos.add(userId); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.messageboards.util.MBIndexer.java
License:Open Source License
@Override public void postProcessContextQuery(BooleanQuery contextQuery, SearchContext searchContext) throws Exception { int status = GetterUtil.getInteger(searchContext.getAttribute(Field.STATUS), WorkflowConstants.STATUS_ANY); if (status != WorkflowConstants.STATUS_ANY) { contextQuery.addRequiredTerm(Field.STATUS, status); }/* ww w . j a v a 2s. co m*/ boolean discussion = GetterUtil.getBoolean(searchContext.getAttribute("discussion"), false); contextQuery.addRequiredTerm("discussion", discussion); long threadId = GetterUtil.getLong((String) searchContext.getAttribute("threadId")); if (threadId > 0) { contextQuery.addRequiredTerm("threadId", threadId); } long[] categoryIds = searchContext.getCategoryIds(); if ((categoryIds != null) && (categoryIds.length > 0)) { if (categoryIds[0] == MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID) { return; } BooleanQuery categoriesQuery = BooleanQueryFactoryUtil.create(searchContext); for (long categoryId : categoryIds) { try { MBCategoryServiceUtil.getCategory(categoryId); } catch (Exception e) { continue; } categoriesQuery.addTerm(Field.CATEGORY_ID, categoryId); } contextQuery.add(categoriesQuery, BooleanClauseOccur.MUST); } }