Liferay Document Management System Workflow

Posted by Rajkumar on Stack Overflow See other posts from Stack Overflow or by Rajkumar
Published on 2014-08-24T20:13:11Z Indexed on 2014/08/25 16:20 UTC
Read the original article Hit count: 283

Filed under:
|
|

I am creating a DMS in Liferay. So far I could upload documents in Liferay in document library. And also i can see documents in document and media portlet. The problem is though status for the document is in pending state, the workflow is not started. Below is my code. Anyone please help. Very urgent.

                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();

    } 

I have even used WorkflowHandlerRegistryUtil.startWorkflowInstance(companyId, userId, fileEntry.getClass().getName(), fileEntry.getClassPK, fileEntry, serviceContext); But still i have the same problem

© Stack Overflow or respective owner

Related posts about liferay

Related posts about Workflow