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

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

Introduction

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

Prototype

int STATUS_ANY

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

Click Source Link

Usage

From source file:com.liferay.journal.service.impl.JournalFolderLocalServiceImpl.java

License:Open Source License

@Override
public List<Object> getFoldersAndArticles(long groupId, long folderId) {
    QueryDefinition<?> queryDefinition = new QueryDefinition<>(WorkflowConstants.STATUS_ANY);

    return journalFolderFinder.findF_A_ByG_F(groupId, folderId, queryDefinition);
}

From source file:com.liferay.journal.service.impl.JournalFolderLocalServiceImpl.java

License:Open Source License

@Override
public List<Object> getFoldersAndArticles(long groupId, long folderId, int start, int end,
        OrderByComparator<?> obc) {

    return getFoldersAndArticles(groupId, folderId, WorkflowConstants.STATUS_ANY, start, end, obc);
}

From source file:com.liferay.journal.service.impl.JournalFolderLocalServiceImpl.java

License:Open Source License

@Override
public int getFoldersAndArticlesCount(long groupId, long folderId) {
    QueryDefinition<?> queryDefinition = new QueryDefinition<>(WorkflowConstants.STATUS_ANY);

    return journalFolderFinder.countF_A_ByG_F(groupId, folderId, queryDefinition);
}

From source file:com.liferay.journal.service.impl.JournalFolderLocalServiceImpl.java

License:Open Source License

@Override
public List<DDMStructure> searchDDMStructures(long companyId, long[] groupIds, long folderId,
        int restrictionType, String keywords, int start, int end, OrderByComparator<DDMStructure> obc)
        throws PortalException {

    if (restrictionType == JournalFolderConstants.RESTRICTION_TYPE_DDM_STRUCTURES_AND_WORKFLOW) {

        return ddmStructureLocalService.search(companyId, groupIds,
                classNameLocalService.getClassNameId(JournalFolder.class), folderId, keywords, start, end, obc);
    }// w  ww. ja va2 s .  c  o m

    folderId = getOverridedDDMStructuresFolderId(folderId);

    if (folderId != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        return ddmStructureLocalService.search(companyId, groupIds,
                classNameLocalService.getClassNameId(JournalFolder.class), folderId, keywords, start, end, obc);
    }

    return ddmStructureLocalService.search(companyId, groupIds,
            classNameLocalService.getClassNameId(JournalArticle.class), keywords, WorkflowConstants.STATUS_ANY,
            start, end, obc);
}

From source file:com.liferay.journal.service.impl.JournalFolderServiceImpl.java

License:Open Source License

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

From source file:com.liferay.journal.service.impl.JournalFolderServiceImpl.java

License:Open Source License

@Override
public int getFoldersCount(long groupId, long parentFolderId, int status) {
    if (status == WorkflowConstants.STATUS_ANY) {
        return journalFolderPersistence.filterCountByG_P_NotS(groupId, parentFolderId,
                WorkflowConstants.STATUS_IN_TRASH);
    } else {/*from w  ww .j a va2  s.c om*/
        return journalFolderPersistence.filterCountByG_P_S(groupId, parentFolderId, status);
    }
}

From source file:com.liferay.journal.service.persistence.impl.JournalArticleFinderImpl.java

License:Open Source License

protected JournalArticle getLatestArticle(long groupId, String articleId, int status) {

    List<JournalArticle> articles = null;

    if (status == WorkflowConstants.STATUS_ANY) {
        articles = JournalArticleUtil.findByG_A(groupId, articleId, 0, 1);
    } else {/*from  ww w.  j a  va  2  s  .  c  o  m*/
        articles = JournalArticleUtil.findByG_A_ST(groupId, articleId, status, 0, 1);
    }

    if (articles.isEmpty()) {
        return null;
    }

    return articles.get(0);
}

From source file:com.liferay.journal.service.persistence.impl.JournalArticleFinderImpl.java

License:Open Source License

protected String replaceStatusJoin(String sql, QueryDefinition<JournalArticle> queryDefinition) {

    if (queryDefinition.getStatus() == WorkflowConstants.STATUS_ANY) {
        return StringUtil.replace(sql, "[$STATUS_JOIN$] AND", StringPool.BLANK);
    }//from w w w  .j  a va2  s.  co m

    if (queryDefinition.isExcludeStatus()) {
        StringBundler sb = new StringBundler(5);

        sb.append("(JournalArticle.status != ");
        sb.append(queryDefinition.getStatus());
        sb.append(") AND (tempJournalArticle.status != ");
        sb.append(queryDefinition.getStatus());
        sb.append(")");

        sql = StringUtil.replace(sql, "[$STATUS_JOIN$]", sb.toString());
    } else {
        StringBundler sb = new StringBundler(5);

        sb.append("(JournalArticle.status = ");
        sb.append(queryDefinition.getStatus());
        sb.append(") AND (tempJournalArticle.status = ");
        sb.append(queryDefinition.getStatus());
        sb.append(")");

        sql = StringUtil.replace(sql, "[$STATUS_JOIN$]", sb.toString());
    }

    return sql;
}

From source file:com.liferay.journal.service.persistence.test.JournalArticleFinderTest.java

License:Open Source License

@Test
public void testDraftArticles() throws Exception {
    QueryDefinition<JournalArticle> queryDefinition = new QueryDefinition<>(WorkflowConstants.STATUS_ANY);

    testQueryByG_C(_group.getGroupId(), Collections.<Long>emptyList(),
            JournalArticleConstants.CLASSNAME_ID_DEFAULT, queryDefinition, 2);

    queryDefinition.setOwnerUserId(TestPropsValues.getUserId());

    JournalArticle article = JournalTestUtil.addArticleWithXMLContent(_group.getGroupId(),
            _folder.getFolderId(), JournalArticleConstants.CLASSNAME_ID_DEFAULT, "<title>Article 1</title>",
            _basicWebContentDDMStructure.getStructureKey(), _basicWebContentDDMTemplate.getTemplateKey());

    article.setUserId(_USER_ID);//from ww w.  jav  a 2s .c o  m
    article.setStatus(WorkflowConstants.STATUS_DRAFT);

    JournalArticleLocalServiceUtil.updateJournalArticle(article);

    _articles.add(article);

    queryDefinition.setIncludeOwner(true);
    queryDefinition.setOwnerUserId(_USER_ID);
    queryDefinition.setStatus(WorkflowConstants.STATUS_APPROVED);

    testQueryByG_C(_group.getGroupId(), Collections.<Long>emptyList(),
            JournalArticleConstants.CLASSNAME_ID_DEFAULT, queryDefinition, 3);

    queryDefinition.setIncludeOwner(false);

    testQueryByG_C(_group.getGroupId(), Collections.<Long>emptyList(),
            JournalArticleConstants.CLASSNAME_ID_DEFAULT, queryDefinition, 0);
}

From source file:com.liferay.journal.service.persistence.test.JournalArticleFinderTest.java

License:Open Source License

@Test
public void testFindByExpirationDate() throws Exception {

    // Status any

    QueryDefinition<JournalArticle> queryDefinition = new QueryDefinition<>();

    queryDefinition.setStatus(WorkflowConstants.STATUS_ANY);

    List<JournalArticle> articles = _journalArticleFinder
            .findByExpirationDate(JournalArticleConstants.CLASSNAME_ID_DEFAULT, new Date(), queryDefinition);

    Assert.assertEquals(articles.toString(), 1, articles.size());

    JournalArticle article = articles.get(0);

    Assert.assertEquals(_USER_ID, article.getUserId());

    // Status in trash

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH);

    articles = _journalArticleFinder.findByExpirationDate(JournalArticleConstants.CLASSNAME_ID_DEFAULT,
            new Date(), queryDefinition);

    Assert.assertEquals(articles.toString(), 1, articles.size());

    article = articles.get(0);/*from   ww  w.  ja  va  2  s  . co  m*/

    Assert.assertEquals(_USER_ID, article.getUserId());

    // Status not in trash

    queryDefinition.setStatus(WorkflowConstants.STATUS_IN_TRASH, true);

    articles = _journalArticleFinder.findByExpirationDate(JournalArticleConstants.CLASSNAME_ID_DEFAULT,
            new Date(), queryDefinition);

    Assert.assertEquals(articles.toString(), 0, articles.size());
}