Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Gwowen Fu
Need help to add document that doesn't use the default type (Urgent)
13. April 2012 07:56
Antwort

Gwowen Fu

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 27. Dezember 2010

Neue 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
Juan Gonzalez
RE: Need help to add document that doesn't use the default type (Urgent)
13. April 2012 23:56
Antwort

Juan Gonzalez

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 1983

Eintrittsdatum: 28. Oktober 2008

Neue Beiträge

Gwowen Fu
RE: Need help to add document that doesn't use the default type (Urgent)
16. April 2012 07:59
Antwort

Gwowen Fu

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 27. Dezember 2010

Neue Beiträge

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)
16. April 2012 09:53
Antwort

Juan Gonzalez

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 1983

Eintrittsdatum: 28. Oktober 2008

Neue 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
RE: Need help to add document that doesn't use the default type (Urgent)
18. April 2012 12:50
Antwort

Gwowen Fu

Rang: Expert

Nachrichten: 280

Eintrittsdatum: 27. Dezember 2010

Neue 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.
Juan Gonzalez
RE: Need help to add document that doesn't use the default type (Urgent)
18. April 2012 13:56
Antwort

Juan Gonzalez

LIFERAY STAFF

Rang: Liferay Legend

Nachrichten: 1983

Eintrittsdatum: 28. Oktober 2008

Neue Beiträge

Perfect!