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