Example usage for com.liferay.portal.kernel.repository DocumentRepository getFileEntriesAndFileShortcuts

List of usage examples for com.liferay.portal.kernel.repository DocumentRepository getFileEntriesAndFileShortcuts

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.repository DocumentRepository getFileEntriesAndFileShortcuts.

Prototype

public List<RepositoryEntry> getFileEntriesAndFileShortcuts(long folderId, int status, int start, int end)
            throws PortalException;

Source Link

Usage

From source file:com.liferay.document.library.internal.trash.DLBaseTrashHandler.java

License:Open Source License

@Override
public List<TrashRenderer> getTrashContainedModelTrashRenderers(long classPK, int start, int end)
        throws PortalException {

    List<TrashRenderer> trashRenderers = new ArrayList<>();

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    List<RepositoryEntry> repositoryEntries = documentRepository.getFileEntriesAndFileShortcuts(classPK,
            WorkflowConstants.STATUS_IN_TRASH, start, end);

    for (RepositoryEntry repositoryEntry : repositoryEntries) {
        String curClassName = StringPool.BLANK;
        long curClassPK = 0;

        if (repositoryEntry instanceof FileShortcut) {
            FileShortcut fileShortcut = (FileShortcut) repositoryEntry;

            curClassName = DLFileShortcutConstants.getClassName();
            curClassPK = fileShortcut.getPrimaryKey();
        } else if (repositoryEntry instanceof FileEntry) {
            FileEntry fileEntry = (FileEntry) repositoryEntry;

            curClassName = DLFileEntry.class.getName();
            curClassPK = fileEntry.getPrimaryKey();
        } else {//  w  ww .ja  v  a2 s .c o m
            continue;
        }

        TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(curClassName);

        TrashRenderer trashRenderer = trashHandler.getTrashRenderer(curClassPK);

        trashRenderers.add(trashRenderer);
    }

    return trashRenderers;
}