Example usage for com.liferay.portal.webdav LockException LockException

List of usage examples for com.liferay.portal.webdav LockException LockException

Introduction

In this page you can find the example usage for com.liferay.portal.webdav LockException LockException.

Prototype

public LockException() 

Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.webdav.DLWebDAVStorageImpl.java

License:Open Source License

protected boolean deleteResource(long groupId, long parentFolderId, String name, String lockUuid)
        throws Exception {

    try {/*from  ww w  .jav a2  s .  c o  m*/
        Folder folder = DLAppServiceUtil.getFolder(groupId, parentFolderId, name);

        DLAppServiceUtil.deleteFolder(folder.getFolderId());

        return true;
    } catch (NoSuchFolderException nsfe) {
        try {
            FileEntry fileEntry = DLAppServiceUtil.getFileEntry(groupId, parentFolderId, name);

            if (!hasLock(fileEntry, lockUuid) && (fileEntry.getLock() != null)) {

                throw new LockException();
            }

            DLAppServiceUtil.deleteFileEntryByTitle(groupId, parentFolderId, name);

            return true;
        } catch (NoSuchFileEntryException nsfee) {
        }
    }

    return false;
}