gpt4 book ai didi

java - Liferay DLFileEntryLocalServiceUtil.addFileEntry 不创建 AssetEntry 记录

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:26:43 27 4
gpt4 key购买 nike

我有一个自定义 portlet,它提供了一个用户可以上传文件的表单。上传的文件应存储在文档和媒体 Portlet 中。我正在使用 DLFileEntryLocalServiceUtil.addFileEntry 创建文件条目。文件上传成功,在DLFileEntry表中创建记录,但在AssetEntry表中没有创建新记录。我想 Liferay 应该自动创建它,我错了吗?可能哪里出错了?

这是我的代码:

DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.addFileEntry(user.getUserId(),
groupId,
groupId, //repositoryId,
folder.getFolderId(),
fName,
mimeType,
title,
"", //description
"", //changeLog,
0, //fileEntryTypeId
null, //fieldsMaps
file,
null, //inputstream
file.length(),
serviceContext);

我从 UploadPortletRequest 对象获取表单数据(UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);)

我有以下 ServiceContext:

ServiceContext serviceContext = new ServiceContext();
long[] assetCategoryIds = new long[assetCategoryIdsList.size()];
for (int i = 0; i < assetCategoryIdsList.size(); i++) {
assetCategoryIds[i] = assetCategoryIdsList.get(i);
}
serviceContext.setAssetCategoryIds(assetCategoryIds);
serviceContext.setScopeGroupId(groupId);
if(!tagNames.equals("")) {
serviceContext.setAssetTagNames(tagNames.split(","));
}

最佳答案

仅调用 DLFileEntryLocalServiceUtil.addFileEntry 是不够的

addFileEntry 调用 DLFileEntryLocalServiceUtil.updateStatus(userId, fileVersionId, WorkflowConstants.STATUS_APPROVED, emptyMap, serviceContext);

使用此方法创建并发布AssetEntry

关于java - Liferay DLFileEntryLocalServiceUtil.addFileEntry 不创建 AssetEntry 记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20283885/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com