-1

Liferay で DMS を作成しています。これまでのところ、Liferay のドキュメント ライブラリにドキュメントをアップロードできました。また、ドキュメントおよびメディア ポートレットでドキュメントを表示できます。問題は、ドキュメントのステータスが保留状態であっても、ワークフローが開始されていないことです。以下は私のコードです。

                Folder folder = null;
//  getting folder
                try {

                folder =    DLAppLocalServiceUtil.getFolder(10181, 0, folderName);
                System.out.println("getting folder");
                } catch(NoSuchFolderException e)
                {
//                  creating folder
                    System.out.println("creating folder");
                    try {
                        folder = DLAppLocalServiceUtil.addFolder(userId, 10181, 0, folderName, description, serviceContext);

                    } catch (PortalException e3) {
                        // TODO Auto-generated catch block
                        e3.printStackTrace();
                    } catch (SystemException e3) {
                        // TODO Auto-generated catch block
                        e3.printStackTrace();
                    }

                }

                catch (PortalException e4) {
                    // TODO Auto-generated catch block
                    e4.printStackTrace();
                } catch (SystemException e4) {
                    // TODO Auto-generated catch block
                    e4.printStackTrace();
                }


//                  adding file

                    try {
                        System.out.println("New File");

fileEntry = DLAppLocalServiceUtil.addFileEntry(userId,
                                10181, folder.getFolderId(), sourceFileName,
                                mimeType, title, "testing description",
                                "changeLog", sampleChapter, serviceContext);

Map<String, Serializable> workflowContext = new HashMap<String, Serializable>();
workflowContext.put("event",DLSyncConstants.EVENT_CHECK_IN);

DLFileEntryLocalServiceUtil.updateStatus(userId, fileEntry.getFileVersion().getFileVersionId(), WorkflowConstants.ACTION_PUBLISH, workflowContext, serviceContext);
System.out.println("after entry"+ fileEntry.getFileEntryId());

                    } catch (DuplicateFileException e) {

                            } catch (PortalException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                            } catch (SystemException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();
                            }
                        } catch (PortalException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        } catch (SystemException e) {
                            // TODO Auto-generated catch block
                            e.printStackTrace();
                        }

                    }

            return fileEntry.getFileEntryId();

    } 

私も使用WorkflowHandlerRegistryUtil.startWorkflowInstance(companyId, userId, fileEntry.getClass().getName(), fileEntry.getClassPK, fileEntry, serviceContext); しましたが、それでも同じ問題があります

4

2 に答える 2

0

これは、fileentry をドキュメント ライブラリに正しく挿入するコードです。設定に注意してくださいserviceContext

                    ServiceContext serviceContext = new ServiceContext();
                    serviceContext.setAddGroupPermissions(true);
                    serviceContext.setUserId(userDest.getUserId());
                    serviceContext.setScopeGroupId(userDest.getGroupId());
                    serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);

                    FileEntry newfile =
                        DLAppLocalServiceUtil.addFileEntry(
                            userDest.getUserId(),
                            userDest.getGroupId(),
                            folder.getFolderId(),
                            item.getFileName(),
                            MimeTypesUtil.getContentType(item.getFileName()),
                            item.getFileName(), null, null, bytes,
                            serviceContext);
于 2014-08-25T16:16:27.770 に答える