Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Gwowen Fu
Need help to add document that doesn't use the default type (Urgent)
April 13, 2012 7:56 AM
Answer

Gwowen Fu

Rank: Expert

Posts: 315

Join Date: December 27, 2010

Recent Posts

Hi,

I need to migrate documents through Document Library API. These documents will not be saved as "Basic Document" but a new document type created by content admin.

I looked at these two methods but couldn't figure out how to use them.

1. DLFileEntryLocalServiceUtil.addDLFileEntry(DLFileEntry dlFileEntry)
How do I create a DLFileEntry object?

2. DLFileEntryLocalServiceUtil.addFileEntry(long userId, long groupId, long repositoryId, long folderId, String sourceFileName, String mimeType, String title, String description, String changeLog, long fileEntryTypeId, Map<String,Fields> fieldsMap, File file, InputStream is, long size, ServiceContext serviceContext)
What is repositoryId?
What is fieldsMap used for?
Do I need to pass both File and InputStream?


Thanks!
Gwowen
Juan Gonzalez
RE: Need help to add document that doesn't use the default type (Urgent)
April 13, 2012 11:56 PM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2849

Join Date: October 28, 2008

Recent Posts

Gwowen Fu
RE: Need help to add document that doesn't use the default type (Urgent)
April 16, 2012 7:59 AM
Answer

Gwowen Fu

Rank: Expert

Posts: 315

Join Date: December 27, 2010

Recent Posts

Juan Gonzalez P:
Why don't you use new DLAppServiceUtil?


Because none of DLAppServiceUtil's addFileEntry method takes fileEntryTypeId.
Juan Gonzalez
RE: Need help to add document that doesn't use the default type (Urgent)
April 16, 2012 9:53 AM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2849

Join Date: October 28, 2008

Recent Posts

Gwowen Fu:


Because none of DLAppServiceUtil's addFileEntry method takes fileEntryTypeId.


Yes, you can.

As you can read in Javadocs, fileEntryType can be specified in ServiceContext parameter, addFileEntry method.
Gwowen Fu
RE: Need help to add document that doesn't use the default type (Urgent)
April 18, 2012 12:50 PM
Answer

Gwowen Fu

Rank: Expert

Posts: 315

Join Date: December 27, 2010

Recent Posts

Juan Gonzalez P:
Gwowen Fu:


Because none of DLAppServiceUtil's addFileEntry method takes fileEntryTypeId.


Yes, you can.

As you can read in Javadocs, fileEntryType can be specified in ServiceContext parameter, addFileEntry method.



Thanks a lot! After reading the Liferay source code, I know how to do it now.
Juan Gonzalez
RE: Need help to add document that doesn't use the default type (Urgent)
April 18, 2012 1:56 PM
Answer

Juan Gonzalez

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2849

Join Date: October 28, 2008

Recent Posts

Perfect!