liferay programatic上载到文档和库中时,行更改日志上的属性无效
06,我想上传文件到文档和库中,我已经搜索并编写了这样的代码,我得到了错误无效的属性更改日志。有人能纠正我的代码吗?我还怀疑存储库id和comapny id是否相同?在portlet中,它显示您输入了无效数据。请再试一次liferay programatic上载到文档和库中时,行更改日志上的属性无效,liferay,liferay-6,portal,Liferay,Liferay 6,Portal,06,我想上传文件到文档和库中,我已经搜索并编写了这样的代码,我得到了错误无效的属性更改日志。有人能纠正我的代码吗?我还怀疑存储库id和comapny id是否相同?在portlet中,它显示您输入了无效数据。请再试一次 public void uploadBook(ActionRequest actionRequest, ActionResponse actionRresponse) throws PortletException,
public void uploadBook(ActionRequest actionRequest,
ActionResponse actionRresponse) throws PortletException,
IOException, com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException {
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
String submissionFileName = uploadRequest.getFileName("file");//uploaded filename
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
ServiceContext serviceContext = ServiceContextFactory.getInstance(actionRequest);
File file = uploadRequest.getFile("file");
String contentType = MimeTypesUtil.getContentType(file);
InputStream inputStream = new FileInputStream(file);
String folderName="library";
long folderId = 11502;
long repositoryId =10132;
//java.io.File file = ( java.io.File)uploadRequest.getFile("file");
// InputStream is = new FileInputStream(file);
DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.addFileEntry(themeDisplay.getUserId(),
repositoryId,
folderId,
file.getName(),
contentType,
submissionFileName,
"no description",
"changeLog",
inputStream,
file.length(),
serviceContext);
//addFileEntry(long userId, long groupId, long folderId, String name, String title, String description, String changeLog, String extraSettings, byte[] bytes, ServiceContext serviceContext)
String successMessage ="File Uploaded Successfully";
SessionMessages.add(actionRequest, "request_rocessed",successMessage);
}
您可以参考EditFileEntryAction.java方法updateFileEntry(..)了解传递的参数 repositoryId默认为要添加文档的groupId(即站点或组织) FolderId必须是该组(站点或组织)的现有文件夹Id 更改日志将其作为空白“”传递 粘贴来自Tomcat的完整stacktrace/日志请参阅本文