Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
Arthur Grohe
Document Library API recommended usage ?
9 de Novembro de 2012 06:44

Arthur Grohe

Ranking: Junior Member

Mensagens: 49

Data de entrada: 5 de Novembro de 2012

Mensagens recentes

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:
2long userId, long groupId, long repositoryId, boolean mountPoint, long parentFolderId,
3String name, String description, ServiceContext serviceContext)

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

..and that:
2long userId, long groupId, long repositoryId, long folderId, String sourceFileName,
3String mimeType, String title, String description, String changeLog, long fileEntryTypeId,
4Map<String,Fields> fieldsMap, File file, InputStream is, long size, ServiceContext serviceContext)

+ 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?
Mika Koivisto
RE: Document Library API recommended usage ?
3 de Dezembro de 2012 17:53

Mika Koivisto

Ranking: Liferay Legend

Mensagens: 1518

Data de entrada: 7 de Agosto de 2006

Mensagens recentes

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.
Chandra Bhanu Rastogi
RE: Document Library API recommended usage ?
31 de Janeiro de 2013 00:55

Chandra Bhanu Rastogi

Ranking: New Member

Mensagens: 7

Data de entrada: 26 de Dezembro de 2012

Mensagens recentes

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.

Chandra bhanu
Enrique Valdes Lacasa
RE: Document Library API recommended usage ?
30 de Julho de 2015 10:28

Enrique Valdes Lacasa

Ranking: Junior Member

Mensagens: 70

Data de entrada: 29 de Julho de 2014

Mensagens recentes

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:
1Path path = Paths.get(file.getAbsolutePath());
2byte[] data = Files.readAllBytes(path);

Using the following imports:
1import java.nio.file.Paths;
2import 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.

Participate in the State of Liferay Community 2017. Help the community and even win some prizes!