Fórum

RE: Need help to add document that doesn't use the default type (Urgent)

Gwowen Fu, modificado 12 Anos atrás.

Need help to add document that doesn't use the default type (Urgent)

Expert Postagens: 315 Data de Entrada: 27/12/10 Postagens Recentes
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
thumbnail
Juan Gonzalez P, modificado 12 Anos atrás.

RE: Need help to add document that doesn't use the default type (Urgent)

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Gwowen Fu, modificado 12 Anos atrás.

RE: Need help to add document that doesn't use the default type (Urgent)

Expert Postagens: 315 Data de Entrada: 27/12/10 Postagens Recentes
Juan Gonzalez P:
Why don't you use new DLAppServiceUtil?


Because none of DLAppServiceUtil's addFileEntry method takes fileEntryTypeId.
thumbnail
Juan Gonzalez P, modificado 12 Anos atrás.

RE: Need help to add document that doesn't use the default type (Urgent)

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
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, modificado 12 Anos atrás.

RE: Need help to add document that doesn't use the default type (Urgent) (Resposta)

Expert Postagens: 315 Data de Entrada: 27/12/10 Postagens Recentes
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.
thumbnail
Juan Gonzalez P, modificado 12 Anos atrás.

RE: Need help to add document that doesn't use the default type (Urgent)

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Perfect!