Forums de discussion

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

Pavel Ivanov, modifié il y a 11 années.

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

New Member Publications: 17 Date d'inscription: 22/08/12 Publications récentes
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, modifié il y a 11 années.

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

New Member Publications: 17 Date d'inscription: 22/08/12 Publications récentes
More information about error:
"Only a type can be imported. com.liferay.portal.util.WebKeys resolves to a package"
thumbnail
Prakash Khanchandani, modifié il y a 11 années.

RE: Cant get access to com.liferay.portal.util.WebKeys library. (Réponse)

Expert Publications: 329 Date d'inscription: 10/02/11 Publications récentes
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, modifié il y a 11 années.

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

New Member Publications: 17 Date d'inscription: 22/08/12 Publications récentes
Thank you, i ll try "DLFolderConstants" class.
Pavel Ivanov, modifié il y a 11 années.

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

New Member Publications: 17 Date d'inscription: 22/08/12 Publications récentes
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, modifié il y a 11 années.

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

Liferay Master Publications: 529 Date d'inscription: 21/10/10 Publications récentes
Hi,

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

Regards
Vilmos
Pavel Ivanov, modifié il y a 11 années.

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

New Member Publications: 17 Date d'inscription: 22/08/12 Publications récentes
thank you, i got all i need with
List<DLFileEntry> DLFileEntries = DLFileEntryServiceUtil.getFileEntries(MyGroupId, MyFolderId, -1, -1, null);
thumbnail
Enrique Valdes Lacasa, modifié il y a 8 années.

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

Junior Member Publications: 92 Date d'inscription: 29/07/14 Publications récentes
You could try importing com.liferay.portal.kernel.util.WebKeys instead...