Foren

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

Gwowen Fu, geändert vor 12 Jahren.

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

Expert Beiträge: 315 Beitrittsdatum: 27.12.10 Neueste Beiträge
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, geändert vor 12 Jahren.

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

Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
Gwowen Fu, geändert vor 12 Jahren.

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

Expert Beiträge: 315 Beitrittsdatum: 27.12.10 Neueste Beiträge
Juan Gonzalez P:
Why don't you use new DLAppServiceUtil?


Because none of DLAppServiceUtil's addFileEntry method takes fileEntryTypeId.
thumbnail
Juan Gonzalez P, geändert vor 12 Jahren.

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

Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
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, geändert vor 12 Jahren.

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

Expert Beiträge: 315 Beitrittsdatum: 27.12.10 Neueste Beiträge
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, geändert vor 12 Jahren.

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

Liferay Legend Beiträge: 3089 Beitrittsdatum: 28.10.08 Neueste Beiträge
Perfect!