Search in sources :

Example 1 with DLFileShortcut

use of com.liferay.portlet.documentlibrary.model.DLFileShortcut in project liferay-ide by liferay.

the class WebServerServlet method getFileEntry.

protected FileEntry getFileEntry(String[] pathArray) throws Exception {
    if (pathArray.length == 1) {
        long dlFileShortcutId = GetterUtil.getLong(pathArray[0]);
        DLFileShortcut dlFileShortcut = DLAppServiceUtil.getFileShortcut(dlFileShortcutId);
        return DLAppServiceUtil.getFileEntry(dlFileShortcut.getToFileEntryId());
    } else if (pathArray.length == 2) {
        long groupId = GetterUtil.getLong(pathArray[0]);
        return DLAppServiceUtil.getFileEntryByUuidAndGroupId(pathArray[1], groupId);
    } else {
        long groupId = GetterUtil.getLong(pathArray[0]);
        long folderId = GetterUtil.getLong(pathArray[1]);
        String fileName = pathArray[2];
        if (fileName.contains(StringPool.QUESTION)) {
            fileName = fileName.substring(0, fileName.indexOf(StringPool.QUESTION));
        }
        return DLAppServiceUtil.getFileEntry(groupId, folderId, fileName);
    }
}
Also used : DLFileShortcut(com.liferay.portlet.documentlibrary.model.DLFileShortcut)

Example 2 with DLFileShortcut

use of com.liferay.portlet.documentlibrary.model.DLFileShortcut in project liferay-ide by liferay.

the class WebServerServlet method _checkFileEntry.

private static void _checkFileEntry(String[] pathArray) throws Exception {
    if (pathArray.length == 1) {
        long dlFileShortcutId = GetterUtil.getLong(pathArray[0]);
        DLFileShortcut dlFileShortcut = DLAppLocalServiceUtil.getFileShortcut(dlFileShortcutId);
        DLAppLocalServiceUtil.getFileEntry(dlFileShortcut.getToFileEntryId());
    } else if (pathArray.length == 2) {
    // Unable to check with UUID because of multiple repositories
    } else {
        long groupId = GetterUtil.getLong(pathArray[0]);
        long folderId = GetterUtil.getLong(pathArray[1]);
        String fileName = pathArray[2];
        try {
            DLAppLocalServiceUtil.getFileEntry(groupId, folderId, fileName);
        } catch (RepositoryException re) {
        }
    }
}
Also used : DLFileShortcut(com.liferay.portlet.documentlibrary.model.DLFileShortcut) RepositoryException(com.liferay.portal.kernel.repository.RepositoryException)

Aggregations

DLFileShortcut (com.liferay.portlet.documentlibrary.model.DLFileShortcut)2 RepositoryException (com.liferay.portal.kernel.repository.RepositoryException)1