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

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

Introduction

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

Prototype

public Folder getFolder(long folderId) 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;/*w  w w . j a  v a  2  s . c  o 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.DLFolderTrashHandler.java

License:Open Source License

@Override
public void deleteTrashEntry(long classPK) throws PortalException {
    DocumentRepository documentRepository = getDocumentRepository(classPK);

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

    Folder folder = documentRepository.getFolder(classPK);

    trashCapability.deleteFolder(folder);
}

From source file:com.liferay.document.library.internal.trash.DLFolderTrashHandler.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 folder = documentRepository.getFolder(classPK);

    Folder destinationFolder = null;/*from  w  ww . ja va 2 s .  c om*/

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

    trashCapability.moveFolderFromTrash(userId, folder, destinationFolder, serviceContext);
}

From source file:com.liferay.document.library.internal.trash.DLFolderTrashHandler.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);

    Folder folder = documentRepository.getFolder(classPK);

    trashCapability.restoreFolderFromTrash(userId, folder);
}