Example usage for com.liferay.portal.kernel.dao.orm QueryDefinition QueryDefinition

List of usage examples for com.liferay.portal.kernel.dao.orm QueryDefinition QueryDefinition

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm QueryDefinition QueryDefinition.

Prototype

public QueryDefinition(int status, long ownerUserId, boolean includeOwner) 

Source Link

Usage

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

License:Open Source License

/**
 * Returns the number of web content articles matching the group, user, the
 * root folder or any of its subfolders.
 *
 * @param  groupId the primary key of the web content article's group
 * @param  userId the primary key of the user (optionally <code>0</code>)
 * @param  rootFolderId the primary key of the root folder to begin the
 *         search/*from w w  w .j a v a 2  s  . c  o m*/
 * @param  status the web content article's workflow status. For more
 *         information see {@link WorkflowConstants} for constants starting
 *         with the "STATUS_" prefix.
 * @return the range of matching web content articles ordered by the
 *         comparator
 */
@Override
public int getGroupArticlesCount(long groupId, long userId, long rootFolderId, int status, boolean includeOwner)
        throws PortalException {

    List<Long> folderIds = new ArrayList<>();

    if (rootFolderId != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        folderIds = journalFolderService.getFolderIds(groupId, rootFolderId);
    }

    QueryDefinition<JournalArticle> queryDefinition = new QueryDefinition<>(status, userId, includeOwner);

    return journalArticleFinder.filterCountByG_F_C(groupId, folderIds,
            JournalArticleConstants.CLASSNAME_ID_DEFAULT, queryDefinition);
}

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

License:Open Source License

@Override
public int getFoldersAndArticlesCount(long groupId, long folderId, int status) {

    QueryDefinition<?> queryDefinition = new QueryDefinition<>(status, 0, false);

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

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

License:Open Source License

@Override
public int getFoldersAndArticlesCount(long groupId, long userId, long folderId, int status) {

    QueryDefinition<Object> queryDefinition = new QueryDefinition<>(status, userId, true);

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

From source file:com.liferay.wiki.service.impl.WikiPageServiceImpl.java

License:Open Source License

@Override
public List<WikiPage> getPages(long groupId, long nodeId, boolean head, long userId, boolean includeOwner,
        int status, int start, int end, OrderByComparator<WikiPage> obc) throws PortalException {

    WikiNodePermissionChecker.check(getPermissionChecker(), nodeId, ActionKeys.VIEW);

    QueryDefinition<WikiPage> queryDefinition = new QueryDefinition<>(status, userId, includeOwner);

    queryDefinition.setEnd(end);/*from   w w w  . j a va 2s  .c  o m*/
    queryDefinition.setOrderByComparator(obc);
    queryDefinition.setStart(start);

    return wikiPageFinder.filterFindByG_N_H_S(groupId, nodeId, head, queryDefinition);
}

From source file:com.liferay.wiki.service.impl.WikiPageServiceImpl.java

License:Open Source License

@Override
public int getPagesCount(long groupId, long nodeId, boolean head, long userId, boolean includeOwner, int status)
        throws PortalException {

    WikiNodePermissionChecker.check(getPermissionChecker(), nodeId, ActionKeys.VIEW);

    QueryDefinition<WikiPage> queryDefinition = new QueryDefinition<>(status, userId, includeOwner);

    return wikiPageFinder.filterCountByG_N_H_S(groupId, nodeId, head, queryDefinition);
}