掲示板

Document Library API recommended usage ?

thumbnail
11年前 に Arthur Grohe によって更新されました。

Document Library API recommended usage ?

Junior Member 投稿: 49 参加年月日: 12/11/05 最新の投稿
Hi guys,

I have some questions about the DL Api:

What is the best practice to...
+ Add/Delete Folders
+ Add/Delete FileEntries
+ Set Permissions to FileEntries


What I found is this:
DLFolderLocalServiceUtil.addFolder(
long userId, long groupId, long repositoryId, boolean mountPoint, long parentFolderId, 
String name, String description, ServiceContext serviceContext) 


+ How do I get the repositoryId and what is a repository in liferay?
+ What does mountPoint do?

..and that:
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) </string,fields>


+ What should I put in "changeLog"?
+ What is a FileEntryTypeId?
+ What are the fieldsMap?

further question:
+ What parameters are optional / can be set to null?
thumbnail
11年前 に Mika Koivisto によって更新されました。

RE: Document Library API recommended usage ?

Liferay Legend 投稿: 1519 参加年月日: 06/08/07 最新の投稿
First of all starting from Liferay 6.1 use DLAppServiceUtil or DLAppLocalServiceUtil instead of DLFileEntry or DLFolder services as those are internal implementation for LiferayRepository. The repositoryId is the scopeGroupId for LiferayRepository and some other value for a mounted repository.
11年前 に Chandra Rastogi によって更新されました。

RE: Document Library API recommended usage ?

New Member 投稿: 7 参加年月日: 12/12/27 最新の投稿
Hello Mika..
How will i get "changeLog",and "bytes" to use this method.
DLAppLocalServiceUtil.addFileEntry(userId, repositoryId, folderId, sourceFileName, mimeType, title, description, changeLog, bytes, serviceContext)

I am trying to upload file from browser to liferay server in dl. i created one folder in dl and get repositoryId and folderId. if there is any another method to upload file, please tell me or resolve my problem regarding this method's parameters.

Thanks
Chandra bhanu
thumbnail
8年前 に Enrique Valdes Lacasa によって更新されました。

RE: Document Library API recommended usage ?

Junior Member 投稿: 92 参加年月日: 14/07/29 最新の投稿
First, I added the changeLog value as a String. Since I wasn't sure of what to add, I just use "changeLog" as the value, and that's it.

On the other hand, the bytes parameter is the file converted into an array of bytes. To do this, you simply need to do the following, being file your instance of File:
Path path = Paths.get(file.getAbsolutePath());
byte[] data = Files.readAllBytes(path);

Using the following imports:
import java.nio.file.Paths;
import java.nio.file.Files;

The nio packages are available in Java 7 and they offer a good way to avoid having to add and use external libraries to convert a file into an array of bytes.