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.dynamic.data.lists.form.web.internal.display.context.DDLFormViewRecordsDisplayContext.java
License:Open Source License
protected void updateSearchContainerResults() { List<DDLRecord> results = null; int total = 0; DisplayTerms displayTerms = _recordSearchContainer.getDisplayTerms(); int status = WorkflowConstants.STATUS_ANY; if (Validator.isNull(displayTerms.getKeywords())) { results = _ddlRecordLocalService.getRecords(_ddlRecordSet.getRecordSetId(), status, _recordSearchContainer.getStart(), _recordSearchContainer.getEnd(), _recordSearchContainer.getOrderByComparator()); total = _ddlRecordLocalService.getRecordsCount(_ddlRecordSet.getRecordSetId(), status); } else {/*from ww w.ja v a 2s . com*/ SearchContext searchContext = SearchContextFactory .getInstance(PortalUtil.getHttpServletRequest(_renderRequest)); searchContext.setAttribute(Field.STATUS, status); searchContext.setAttribute("recordSetId", _ddlRecordSet.getRecordSetId()); searchContext.setAttribute("recordSetScope", _ddlRecordSet.getScope()); searchContext.setEnd(_recordSearchContainer.getEnd()); searchContext.setKeywords(displayTerms.getKeywords()); searchContext.setStart(_recordSearchContainer.getStart()); BaseModelSearchResult<DDLRecord> baseModelSearchResult = _ddlRecordLocalService .searchDDLRecords(searchContext); results = baseModelSearchResult.getBaseModels(); total = baseModelSearchResult.getLength(); } _recordSearchContainer.setResults(results); _recordSearchContainer.setTotal(total); }
From source file:com.liferay.dynamic.data.lists.internal.exportimport.data.handler.DDLRecordStagedModelDataHandler.java
License:Open Source License
@Override protected void validateExport(PortletDataContext portletDataContext, DDLRecord record) throws PortletDataException { int status = WorkflowConstants.STATUS_ANY; try {// w w w. j a va2 s . co m status = record.getStatus(); } catch (Exception e) { throw new PortletDataException(e); } if (!portletDataContext.isInitialPublication() && !ArrayUtil.contains(getExportableStatuses(), status)) { PortletDataException pde = new PortletDataException(PortletDataException.STATUS_UNAVAILABLE); pde.setStagedModel(record); throw pde; } }
From source file:com.liferay.dynamic.data.lists.internal.search.DDLRecordIndexer.java
License:Open Source License
@Override public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext) throws Exception { int status = GetterUtil.getInteger(searchContext.getAttribute(Field.STATUS), WorkflowConstants.STATUS_APPROVED); if (status != WorkflowConstants.STATUS_ANY) { contextBooleanFilter.addRequiredTerm(Field.STATUS, status); }// w ww. j a v a 2 s .c o m long recordSetId = GetterUtil.getLong(searchContext.getAttribute("recordSetId")); if (recordSetId > 0) { contextBooleanFilter.addRequiredTerm("recordSetId", recordSetId); } long recordSetScope = GetterUtil.getLong(searchContext.getAttribute("recordSetScope"), DDLRecordSetConstants.SCOPE_DYNAMIC_DATA_LISTS); contextBooleanFilter.addRequiredTerm("recordSetScope", recordSetScope); addSearchClassTypeIds(contextBooleanFilter, searchContext); String ddmStructureFieldName = (String) searchContext.getAttribute("ddmStructureFieldName"); Serializable ddmStructureFieldValue = searchContext.getAttribute("ddmStructureFieldValue"); if (Validator.isNotNull(ddmStructureFieldName) && Validator.isNotNull(ddmStructureFieldValue)) { QueryFilter queryFilter = ddmIndexer.createFieldValueQueryFilter(ddmStructureFieldName, ddmStructureFieldValue, searchContext.getLocale()); contextBooleanFilter.add(queryFilter, BooleanClauseOccur.MUST); } }
From source file:com.liferay.dynamic.data.lists.search.test.DDLRecordSearchTest.java
License:Open Source License
protected static SearchContext getSearchContext(Group group, User user, DDLRecordSet recordSet) throws Exception { SearchContext searchContext = SearchContextTestUtil.getSearchContext(group.getGroupId()); searchContext.setAttribute("recordSetId", recordSet.getRecordSetId()); searchContext.setAttribute("status", WorkflowConstants.STATUS_ANY); searchContext.setUserId(user.getUserId()); return searchContext; }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordFinderImpl.java
License:Open Source License
@Override public int countByR_S(long recordSetId, int status) { Session session = null;/*from w ww . j ava2 s . c o m*/ try { session = openSession(); String sql = CustomSQLUtil.get(getClass(), COUNT_BY_R_S); if (status == WorkflowConstants.STATUS_ANY) { sql = StringUtil.replace(sql, "(DDLRecordVersion.status = ?) AND", StringPool.BLANK); } SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, Type.LONG); QueryPos qPos = QueryPos.getInstance(q); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } qPos.add(recordSetId); 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.dynamic.data.lists.service.persistence.impl.DDLRecordFinderImpl.java
License:Open Source License
@Override public int countByC_S_S(long companyId, int status, int scope) { Session session = null;/* w w w . java2 s. c om*/ try { session = openSession(); String sql = CustomSQLUtil.get(getClass(), COUNT_BY_C_S_S); if (status == WorkflowConstants.STATUS_ANY) { sql = StringUtil.replace(sql, "(DDLRecordVersion.status = ?) AND", StringPool.BLANK); } SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, Type.LONG); QueryPos qPos = QueryPos.getInstance(q); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } qPos.add(scope); qPos.add(companyId); 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.dynamic.data.lists.service.persistence.impl.DDLRecordFinderImpl.java
License:Open Source License
@Override public List<DDLRecord> findByR_S(long recordSetId, int status, int start, int end, OrderByComparator<DDLRecord> orderByComparator) { Session session = null;//from w ww . j a v a 2s . co m try { session = openSession(); String sql = CustomSQLUtil.get(getClass(), FIND_BY_R_S); if (status == WorkflowConstants.STATUS_ANY) { sql = StringUtil.replace(sql, "(DDLRecordVersion.status = ?) AND", StringPool.BLANK); } sql = CustomSQLUtil.replaceOrderBy(sql, orderByComparator); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addEntity("DDLRecord", DDLRecordImpl.class); QueryPos qPos = QueryPos.getInstance(q); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } qPos.add(recordSetId); return (List<DDLRecord>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordFinderImpl.java
License:Open Source License
@Override public List<DDLRecord> findByC_S_S(long companyId, int status, int scope, int start, int end, OrderByComparator<DDLRecord> orderByComparator) { Session session = null;// w w w . j av a2 s . c o m try { session = openSession(); String sql = CustomSQLUtil.get(getClass(), FIND_BY_C_S_S); if (status == WorkflowConstants.STATUS_ANY) { sql = StringUtil.replace(sql, "(DDLRecordVersion.status = ?) AND", StringPool.BLANK); } sql = CustomSQLUtil.replaceOrderBy(sql, orderByComparator); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addEntity("DDLRecord", DDLRecordImpl.class); QueryPos qPos = QueryPos.getInstance(q); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } qPos.add(scope); qPos.add(companyId); return (List<DDLRecord>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordFinderImpl.java
License:Open Source License
@Override public Long[] findByC_S_S_MinAndMax(long companyId, int status, int scope) { Session session = null;/* w w w .j a v a2s . com*/ try { session = openSession(); String sql = CustomSQLUtil.get(getClass(), COUNT_BY_C_S_S); sql = StringUtil.replace(sql, "COUNT(DISTINCT DDLRecord.recordId) AS COUNT_VALUE", "MIN(DDLRecord.recordId) AS minRecordId, " + "MAX(DDLRecord.recordId) AS maxRecordId"); if (status == WorkflowConstants.STATUS_ANY) { sql = StringUtil.replace(sql, "(DDLRecordVersion.status = ?) AND", StringPool.BLANK); } SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar("minRecordId", Type.LONG); q.addScalar("maxRecordId", Type.LONG); QueryPos qPos = QueryPos.getInstance(q); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } qPos.add(scope); qPos.add(companyId); Object[] array = (Object[]) q.iterateNext(); if (array == null) { return null; } return ArrayUtil.toLongArray(array); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordFinderImpl.java
License:Open Source License
@Override public List<DDLRecord> findByC_S_S_MinAndMax(long companyId, int status, int scope, long minRecordId, long maxRecordId) { Session session = null;//from ww w . j a v a 2s . co m try { session = openSession(); String sql = CustomSQLUtil.get(getClass(), FIND_BY_C_S_S); if (status == WorkflowConstants.STATUS_ANY) { sql = StringUtil.replace(sql, "(DDLRecordVersion.status = ?) AND", StringPool.BLANK); } sql = CustomSQLUtil.removeOrderBy(sql); sql += " AND (DDLRecord.recordId >= ?) AND (DDLRecord.recordId < ?)"; SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addEntity("DDLRecord", DDLRecordImpl.class); QueryPos qPos = QueryPos.getInstance(q); if (status != WorkflowConstants.STATUS_ANY) { qPos.add(status); } qPos.add(scope); qPos.add(companyId); qPos.add(minRecordId); qPos.add(maxRecordId); return q.list(); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }