Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Sreekanth Pola
Document Library Util Methods in Liferay 6.1
September 5, 2012 2:57 AM
Answer

Sreekanth Pola

Rank: New Member

Posts: 21

Join Date: September 5, 2012

Recent Posts

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!
Victor Zorin
RE: Document Library Util Methods in Liferay 6.1
September 5, 2012 3:14 AM
Answer

Victor Zorin

Rank: Liferay Legend

Posts: 1178

Join Date: April 14, 2008

Recent Posts

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
RE: Document Library Util Methods in Liferay 6.1
September 5, 2012 3:15 AM
Answer

Sreekanth Pola

Rank: New Member

Posts: 21

Join Date: September 5, 2012

Recent Posts

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();
Victor Zorin
RE: Document Library Util Methods in Liferay 6.1
September 5, 2012 3:21 AM
Answer

Victor Zorin

Rank: Liferay Legend

Posts: 1178

Join Date: April 14, 2008

Recent Posts

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
RE: Document Library Util Methods in Liferay 6.1
September 5, 2012 3:24 AM
Answer

Sreekanth Pola

Rank: New Member

Posts: 21

Join Date: September 5, 2012

Recent Posts

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.
Victor Zorin
RE: Document Library Util Methods in Liferay 6.1
September 5, 2012 3:43 AM
Answer

Victor Zorin

Rank: Liferay Legend

Posts: 1178

Join Date: April 14, 2008

Recent Posts

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.
Mika Koivisto
RE: Document Library Util Methods in Liferay 6.1
September 5, 2012 9:14 PM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1512

Join Date: August 7, 2006

Recent Posts

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
RE: Document Library Util Methods in Liferay 6.1
September 6, 2012 2:23 AM
Answer

Sreekanth Pola

Rank: New Member

Posts: 21

Join Date: September 5, 2012

Recent Posts

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)
Mika Koivisto
RE: Document Library Util Methods in Liferay 6.1
September 6, 2012 9:24 AM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1512

Join Date: August 7, 2006

Recent Posts

RepositoryId is the scopeGroupId for Liferay Repository.
Sreekanth Pola
RE: Document Library Util Methods in Liferay 6.1
September 7, 2012 4:25 AM
Answer

Sreekanth Pola

Rank: New Member

Posts: 21

Join Date: September 5, 2012

Recent Posts

Thank you.. It worked for me...emoticon
Tom Mahy
RE: Document Library Util Methods in Liferay 6.1
December 18, 2012 3:14 AM
Answer

Tom Mahy

Rank: Junior Member

Posts: 38

Join Date: May 2, 2012

Recent Posts

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}

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



What am i doing wrong ?