Foren

Cant get access to com.liferay.portal.util.WebKeys library.

Pavel Ivanov, geändert vor 11 Jahren.

Cant get access to com.liferay.portal.util.WebKeys library.

New Member Beiträge: 17 Beitrittsdatum: 22.08.12 Neueste Beiträge
I m trying to use
Folder folder = (com.liferay.portal.kernel.repository.model.Folder)request.getAttribute(WebKeys.DOCUMENT_LIBRARY_FOLDER);

And i have an error :
"WebKeys.DOCMENT_LIBRARY_FOLDER cannot be resolved to a type". As i see, my problem is that i cant get access to library:
"The import com.liferay.portal.util.WebKeys cannot be
resolved", and in com.liferay.portal.kernel.util.WebKeys there is no DOCUMENT_LIBRARY_FOLDER method.
How i can avoid that error?

By the way, whats another way to get Documents & Media folder id?

P.S. Sorry for bad english.
Pavel Ivanov, geändert vor 11 Jahren.

RE: Cant get access to com.liferay.portal.util.WebKeys library.

New Member Beiträge: 17 Beitrittsdatum: 22.08.12 Neueste Beiträge
More information about error:
"Only a type can be imported. com.liferay.portal.util.WebKeys resolves to a package"
thumbnail
Prakash Khanchandani, geändert vor 11 Jahren.

RE: Cant get access to com.liferay.portal.util.WebKeys library. (Antwort)

Expert Beiträge: 329 Beitrittsdatum: 10.02.11 Neueste Beiträge
You can't use a class which is in portal-impl.jar, in your custom plugin portlet and WebKeys is a class in portal-impl.jar.

Either paste the string value of WebKeys.DOCUMENT_LIBRARY_FOLDER directly, by the way if you are using a custom portlet this code will not give you a folder.

You can use "DLFolderConstants" class to get default folder id or else use DLFolderLocalServiceUtil or DLAppLocalServiceUtil classes' methods to get folders.
Pavel Ivanov, geändert vor 11 Jahren.

RE: Cant get access to com.liferay.portal.util.WebKeys library.

New Member Beiträge: 17 Beitrittsdatum: 22.08.12 Neueste Beiträge
Thank you, i ll try "DLFolderConstants" class.
Pavel Ivanov, geändert vor 11 Jahren.

RE: Cant get access to com.liferay.portal.util.WebKeys library.

New Member Beiträge: 17 Beitrittsdatum: 22.08.12 Neueste Beiträge
Now i have some dumb question - how i can get list of files in folder if i know folderID now?
I was trying to find something usefull in DLFileEntry or DLFileEntryModel, but i found nothing. (but may be i m blind)
thumbnail
Vilmos Papp, geändert vor 11 Jahren.

RE: Cant get access to com.liferay.portal.util.WebKeys library.

Liferay Master Beiträge: 529 Beitrittsdatum: 21.10.10 Neueste Beiträge
Hi,

You should check DLFileEntryServiceUtil or DLFileEntryLocalServiceUtil for the function what meets your requirements.

Regards
Vilmos
Pavel Ivanov, geändert vor 11 Jahren.

RE: Cant get access to com.liferay.portal.util.WebKeys library.

New Member Beiträge: 17 Beitrittsdatum: 22.08.12 Neueste Beiträge
thank you, i got all i need with
List<DLFileEntry> DLFileEntries = DLFileEntryServiceUtil.getFileEntries(MyGroupId, MyFolderId, -1, -1, null);
thumbnail
Enrique Valdes Lacasa, geändert vor 8 Jahren.

RE: Cant get access to com.liferay.portal.util.WebKeys library.

Junior Member Beiträge: 92 Beitrittsdatum: 29.07.14 Neueste Beiträge
You could try importing com.liferay.portal.kernel.util.WebKeys instead...