Created
May 10, 2022 22:04
-
-
Save pedroblandim/acb7d7ecdfc8d7961e243a3b6a7109d6 to your computer and use it in GitHub Desktop.
Liferay get DL File preview URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.liferay.document.library.kernel.service.DLAppLocalServiceUtil; | |
import com.liferay.portal.kernel.repository.model.FileEntry; | |
import com.liferay.document.library.util.DLURLHelperUtil; | |
import com.liferay.portal.kernel.theme.ThemeDisplay; | |
import com.liferay.portal.kernel.exception.PortalException; | |
public static String getDLEntryFileURL(long fileEntryId, ThemeDisplay themeDisplay) | |
throws PortalException { | |
FileEntry file = DLAppLocalServiceUtil.getFileEntry(fileEntryId); | |
return DLURLHelperUtil.getPreviewURL( | |
file, file.getFileVersion(), themeDisplay, null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment