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

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

Introduction

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

Prototype

public FileShortcut getFileShortcut(long fileShortcutId) throws PortalException;

Source Link

Usage

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

License:Open Source License

@Override
public void moveTrashEntry(long userId, long classPK, long containerModelId, ServiceContext serviceContext)
        throws PortalException {

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    TrashCapability trashCapability = documentRepository.getCapability(TrashCapability.class);

    Folder newFolder = null;//from w ww .  ja  v  a  2 s  .co m

    if (containerModelId != DLFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
        newFolder = documentRepository.getFolder(containerModelId);
    }

    FileShortcut fileShortcut = documentRepository.getFileShortcut(classPK);

    trashCapability.moveFileShortcutFromTrash(userId, fileShortcut, newFolder, serviceContext);
}

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

License:Open Source License

@Override
public void restoreTrashEntry(long userId, long classPK) throws PortalException {

    DocumentRepository documentRepository = getDocumentRepository(classPK);

    TrashCapability trashCapability = documentRepository.getCapability(TrashCapability.class);

    FileShortcut fileShortcut = documentRepository.getFileShortcut(classPK);

    trashCapability.restoreFileShortcutFromTrash(userId, fileShortcut);
}