Foros de discusión

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

Pavel Ivanov, modificado hace 11 años.

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

New Member Mensajes: 17 Fecha de incorporación: 22/08/12 Mensajes recientes
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, modificado hace 11 años.

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

New Member Mensajes: 17 Fecha de incorporación: 22/08/12 Mensajes recientes
More information about error:
"Only a type can be imported. com.liferay.portal.util.WebKeys resolves to a package"
thumbnail
Prakash Khanchandani, modificado hace 11 años.

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

Expert Mensajes: 329 Fecha de incorporación: 10/02/11 Mensajes recientes
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, modificado hace 11 años.

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

New Member Mensajes: 17 Fecha de incorporación: 22/08/12 Mensajes recientes
Thank you, i ll try "DLFolderConstants" class.
Pavel Ivanov, modificado hace 11 años.

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

New Member Mensajes: 17 Fecha de incorporación: 22/08/12 Mensajes recientes
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, modificado hace 11 años.

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

Liferay Master Mensajes: 529 Fecha de incorporación: 21/10/10 Mensajes recientes
Hi,

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

Regards
Vilmos
Pavel Ivanov, modificado hace 11 años.

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

New Member Mensajes: 17 Fecha de incorporación: 22/08/12 Mensajes recientes
thank you, i got all i need with
List<DLFileEntry> DLFileEntries = DLFileEntryServiceUtil.getFileEntries(MyGroupId, MyFolderId, -1, -1, null);
thumbnail
Enrique Valdes Lacasa, modificado hace 8 años.

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

Junior Member Mensajes: 92 Fecha de incorporación: 29/07/14 Mensajes recientes
You could try importing com.liferay.portal.kernel.util.WebKeys instead...