如何将具有附加属性的文件添加到 Liferay 的文档库中
我想弄清楚这一点,我在 中问这个问题Liferay 的论坛在这里 - 最后一个条目。
我唯一能想到的就是创建一个 Expando 用于FileEntry,看起来很复杂。谁知道这是否有意义。我不喜欢 Expando 功能,因为我无法通过休眠正确查询它们。
有人知道 Liferay 论坛中我的问题的答案吗?
问题是,
DLAppLocalServiceUtil.addFileEntry(...);
DLLocalServiceUtil.addFile(....);
不允许您存储有关文件的任何附加信息/属性。因此,必须直接使用 JackRabbit,而不是使用 Liferay 的 JCRHook。但是您失去了文档库带来的所有优势。
I'm trying to figure this out, I was asking this question in Liferay's forum here - the last entry.
And only thing I'm able to come up with is creating an Expando for FileEntry, which seems very complicated. Who knows if it makes sense. I don't like the expando feature since I couldn't query them via hibernate properly.
Does anybody know the answer for my question in that Liferay forum ?
The problem is that,
DLAppLocalServiceUtil.addFileEntry(...);
DLLocalServiceUtil.addFile(....);
doesn't let you store any additional information / properties about the file. As a result, one would have to use JackRabbit directly, instead of using Liferay's JCRHook. But you loose all the advantages that Document Library brings.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,唯一的选择是使用 Expando AKA 自定义属性/字段。对于 fileEntry,您不需要以编程方式创建表和列,但您可以在“控制面板”>“控制面板”中进行设置。自定义字段。
之后,您可以选择如何填充扩展值。
或者如果你从视图层获取属性
,然后
serviceContext 被 actionRequest 中的参数填充,然后你只需调用
最后,你可能需要查询具有特定属性的 fileEntries
当然,这个解决方案可能看起来有点复杂,因为 Liferay 文档库不是 JCR 内容存储库,但它实际上是一个文档库,它通过 Hooks 为具体存储库实现提供抽象层,例如 JCRHook(其中文件存储到 jackrabbit 存储库)、CMIS 支持、迁移支持等。它还处理权限检查、文件版本控制、文档工作流程和资产管理。
因此,如果您打算做一些更复杂的事情,则必须查询属性/元数据、更改它们并扩展它们。您应该考虑直接使用 JCR 存储库...
Yep, the only option is to use Expando AKA custom properties/fields. In case of fileEntry you don't need to create table and columns programmatically but you can set it up in Control Panel > custom fields.
After that you have a few options how to populate the expando values.
or if you get the properties from view layer
and then
serviceContext gets populated by parameters in actionRequest and you then just call
Finally, you may need to query for fileEntries with particular properties
Of course, this solution may seem a little complicated, because Liferay Document Library is not a JCR content repository, but it's literally a document library that provides abstraction layer for concrete repo implementations via Hooks, such as JCRHook ( where files are stored into jackrabbit repository ), CMIS support, migration support etc. It also handles permissionChecking, fileVersioning, document workflow and asset management.
So if you intend to do something more complicated and you will have to query the properties/metadata, change them and expand them. You should consider using JCR repository directly...