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.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public List<KBArticle> getCompanyKBArticles(long companyId, int status, int start, int end,
        OrderByComparator<KBArticle> orderByComparator) {

    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.findByC_L(companyId, true, start, end, orderByComparator);
    } else if (status == WorkflowConstants.STATUS_APPROVED) {
        return kbArticlePersistence.findByC_M(companyId, true, start, end, orderByComparator);
    }/*from w w w.j av  a  2s  .  c  o  m*/

    return kbArticlePersistence.findByC_S(companyId, status, start, end, orderByComparator);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public int getCompanyKBArticlesCount(long companyId, int status) {
    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.countByC_L(companyId, true);
    } else if (status == WorkflowConstants.STATUS_APPROVED) {
        return kbArticlePersistence.countByC_M(companyId, true);
    }//  w  w  w.j a v  a  2  s  .com

    return kbArticlePersistence.countByC_S(companyId, status);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public List<KBArticle> getGroupKBArticles(long groupId, int status, int start, int end,
        OrderByComparator<KBArticle> orderByComparator) {

    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.findByG_L(groupId, true, start, end, orderByComparator);
    } else if (status == WorkflowConstants.STATUS_APPROVED) {
        return kbArticlePersistence.findByG_M(groupId, true, start, end, orderByComparator);
    }/*from  w w w.  ja  v  a2 s.c o m*/

    return kbArticlePersistence.findByG_S(groupId, status, start, end, orderByComparator);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public int getGroupKBArticlesCount(long groupId, int status) {
    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.countByG_L(groupId, true);
    } else if (status == WorkflowConstants.STATUS_APPROVED) {
        return kbArticlePersistence.countByG_M(groupId, true);
    }/*from   ww  w  .j a  va2  s.  c o  m*/

    return kbArticlePersistence.countByG_S(groupId, status);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public List<KBArticle> getKBArticles(long groupId, long parentResourcePrimKey, int status, int start, int end,
        OrderByComparator<KBArticle> orderByComparator) {

    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.findByG_P_L(groupId, parentResourcePrimKey, true, start, end,
                orderByComparator);//  ww  w .java  2  s.co  m
    } else if (status == WorkflowConstants.STATUS_APPROVED) {
        return kbArticlePersistence.findByG_P_M(groupId, parentResourcePrimKey, true, start, end,
                orderByComparator);
    }

    return kbArticlePersistence.findByG_P_S(groupId, parentResourcePrimKey, status, start, end,
            orderByComparator);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public List<KBArticle> getKBArticles(long[] resourcePrimKeys, int status,
        OrderByComparator<KBArticle> orderByComparator) {

    List<KBArticle> kbArticles = new ArrayList<KBArticle>();

    Long[][] params = new Long[][] { ArrayUtil.toArray(resourcePrimKeys) };

    while ((params = KnowledgeBaseUtil.getParams(params[0])) != null) {
        List<KBArticle> curKBArticles = null;

        if (status == WorkflowConstants.STATUS_ANY) {
            curKBArticles = kbArticlePersistence.findByR_L(ArrayUtil.toArray(params[1]), true);
        } else if (status == WorkflowConstants.STATUS_APPROVED) {
            curKBArticles = kbArticlePersistence.findByR_M(ArrayUtil.toArray(params[1]), true);
        } else {/*from w  w  w.j  av a2 s.c  o  m*/
            curKBArticles = kbArticlePersistence.findByR_S(ArrayUtil.toArray(params[1]), status);
        }

        kbArticles.addAll(curKBArticles);
    }

    if (orderByComparator != null) {
        kbArticles = ListUtil.sort(kbArticles, orderByComparator);
    } else {
        kbArticles = KnowledgeBaseUtil.sort(resourcePrimKeys, kbArticles);
    }

    return Collections.unmodifiableList(kbArticles);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public int getKBArticlesCount(long groupId, long parentResourcePrimKey, int status) {

    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.countByG_P_L(groupId, parentResourcePrimKey, true);
    } else if (status == WorkflowConstants.STATUS_APPROVED) {
        return kbArticlePersistence.countByG_P_M(groupId, parentResourcePrimKey, true);
    }/* ww w  . j  a v  a 2s. c  o  m*/

    return kbArticlePersistence.countByG_P_S(groupId, parentResourcePrimKey, status);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public List<KBArticle> getKBArticleVersions(long resourcePrimKey, int status, int start, int end,
        OrderByComparator<KBArticle> orderByComparator) {

    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.findByResourcePrimKey(resourcePrimKey, start, end, orderByComparator);
    }//w ww  .j  a va  2  s.  co  m

    return kbArticlePersistence.findByR_S(resourcePrimKey, status, start, end, orderByComparator);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public int getKBArticleVersionsCount(long resourcePrimKey, int status) {
    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.countByResourcePrimKey(resourcePrimKey);
    }/*  w w w  .  j a va 2  s. c o m*/

    return kbArticlePersistence.countByR_S(resourcePrimKey, status);
}

From source file:com.liferay.knowledgebase.service.impl.KBArticleLocalServiceImpl.java

License:Open Source License

@Override
public KBArticle getLatestKBArticle(long resourcePrimKey, int status) throws PortalException {

    if (status == WorkflowConstants.STATUS_ANY) {
        return kbArticlePersistence.findByResourcePrimKey_First(resourcePrimKey,
                new KBArticleVersionComparator());
    }/*from w ww  . java  2s.com*/

    return kbArticlePersistence.findByR_S_First(resourcePrimKey, status, new KBArticleVersionComparator());
}