Fórum

Document Library Util Methods in Liferay 6.1

Sreekanth Pola, modificado 11 Anos atrás.

Document Library Util Methods in Liferay 6.1

New Member Postagens: 21 Data de Entrada: 05/09/12 Postagens Recentes
I was previously using the Liferay 6.0.6. In that we were adding files to the document library using the Document Library service util methods. They were working fine. When we migrated to Liferay 6.1, these methods completely changed. I am unable to add files and file shortcuts to the Document library in liferay 6.1

I am using the following methods of Document Library

DLFileEntryServiceUtil.addFileEntry();
DLFileShortcutServiceUtil.addFileShortcut();

The method signatures from 6.0.6 to 6.1 are completely changed. Can anyone assist me in this regard.

Thanks in advance!
thumbnail
Victor Zorin, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

Liferay Legend Postagens: 1228 Data de Entrada: 14/04/08 Postagens Recentes
Have a look at DLRepositoryLocalServiceUtil, e.g. :

V6.1: DLFileEntry entry = DLRepositoryLocalServiceUtil.getFileEntry(summary.getFileEntryId());
V.6.0: DLFileEntry entry = DLFileEntryLocalServiceUtil.getFileEntry(summary.getFileEntryId());

Yes, it is a big inconvenience, so for all our portlets we had to separate out our classes that have version-dependent code into separate libraries, and insert them into portlet.war depending on target Liferay environment.
Sreekanth Pola, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

New Member Postagens: 21 Data de Entrada: 05/09/12 Postagens Recentes
Victor Zorin:
Have a look at DLRepositoryLocalServiceUtil, e.g. :

V6.1.: DLFileEntry entry = DLRepositoryLocalServiceUtil.getFileEntry(summary.getFileEntryId());
V.6.0: DLFileEntry entry = DLFileEntryLocalServiceUtil.getFileEntry(summary.getFileEntryId());

Yes, it is a big inconvenience, so for all our portlets we had to separate out own classes with version-dependent code into separate libraries with own jar build, and insert them into portlet.war depending on target Liferay environment.


Where the class file DLRepositoryLocalServiceUtil is exactly located? can you briefly explain about each param in the methods mentioned. Some of those params are new in liferay 6.1

DLFileEntryServiceUtil.addFileEntry();
DLFileShortcutServiceUtil.addFileShortcut();
thumbnail
Victor Zorin, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

Liferay Legend Postagens: 1228 Data de Entrada: 14/04/08 Postagens Recentes
They are sitting in the same jar as others (com/liferay/portlet/documentlibrary/service/), so they should be visible to you in your development environment such as Eclipse.
Or have look at the source code or online docs, e.g. DLFileEntryLocalServiceUtil.
Sreekanth Pola, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

New Member Postagens: 21 Data de Entrada: 05/09/12 Postagens Recentes
I could not find DLRepositoryLocalServiceUtil in the poratl-service.jar. By the way how to get the fileEntryTypeId for a file that is being uploaded to the document library. I am confused with the param fieldsMap in the addFileEntry() method.
thumbnail
Victor Zorin, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

Liferay Legend Postagens: 1228 Data de Entrada: 14/04/08 Postagens Recentes
Yes, I can see it is not there, let me dig into it...
Edited: It looks like the interface has been shifted again to somewhere else. Amazing, looks like we will have to do another patching for GA2.
Will send further details tomorrow.
thumbnail
Mika Koivisto, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1 (Resposta)

Liferay Legend Postagens: 1519 Data de Entrada: 07/08/06 Postagens Recentes
If you want to use Document Library api use DLAppServiceUtil. If you use DLFileEntry you are using internal api and many features like thumbnail generation, metadata extraction etc won't work. Also that API might change at any time.
Sreekanth Pola, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

New Member Postagens: 21 Data de Entrada: 05/09/12 Postagens Recentes
What can be the repositoryId in the below method? Its throwing an exception when I give the ID of my folder in the Document Library.

DLAppServiceUtil.addFileEntry(repositoryId, folderId, sourceFileName, mimeType, title, description, changeLog, file, serviceContext)
thumbnail
Mika Koivisto, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

Liferay Legend Postagens: 1519 Data de Entrada: 07/08/06 Postagens Recentes
RepositoryId is the scopeGroupId for Liferay Repository.
Sreekanth Pola, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

New Member Postagens: 21 Data de Entrada: 05/09/12 Postagens Recentes
Thank you.. It worked for me...emoticon
tom mahy, modificado 11 Anos atrás.

RE: Document Library Util Methods in Liferay 6.1

Junior Member Postagens: 38 Data de Entrada: 02/05/12 Postagens Recentes
Ive tried this and i get an error:
Caused by: com.liferay.portal.NoSuchGroupException: No Group exists with the key {companyId=0, classNameId=10008, classPK=0}

SearchContext searchContext = new SearchContext();
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
Group group = GroupLocalServiceUtil.getGroup(themeDisplay.getScopeGroupId());
Hits hits = DLAppServiceUtil.search(group.getGroupId(), searchContext);



What am i doing wrong ?