List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants LABEL_APPROVED
String LABEL_APPROVED
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants LABEL_APPROVED.
Click Source Link
From source file:com.mpower.services.service.impl.BookLocalServiceImpl.java
License:Open Source License
public Book updateStatus(long userId, long resourcePrimKey, int status, ServiceContext serviceContext) { Book book = null;/* w w w . j av a 2 s.co m*/ System.out.println("BookLocalServiceImpl:updateStatus"); try { User user = userPersistence.findByPrimaryKey(userId); book = bookPersistence.findByPrimaryKey(resourcePrimKey); String labelStatus = ""; if (book != null) { if (status == 2) { labelStatus = WorkflowConstants.LABEL_DRAFT; labelStatus = labelStatus.substring(0, 1).toUpperCase() + labelStatus.substring(1); } else if (status == 1) { labelStatus = WorkflowConstants.LABEL_PENDING; labelStatus = labelStatus.substring(0, 1).toUpperCase() + labelStatus.substring(1); } else if (status == 0) { labelStatus = WorkflowConstants.LABEL_APPROVED; labelStatus = labelStatus.substring(0, 1).toUpperCase() + labelStatus.substring(1); } else { labelStatus = WorkflowConstants.LABEL_DENIED; labelStatus = labelStatus.substring(0, 1).toUpperCase() + labelStatus.substring(1); } if (book != null) { book.setStatus(labelStatus); bookPersistence.update(book, true); //update extworkflowtable /*ExtWorkFlow extWorkFlow = ExtWorkFlowLocalServiceUtil.getExtWorkFlow(book.getBookId()); extWorkFlow.setStatus(status); ExtWorkFlowLocalServiceUtil.updateExtWorkFlow(extWorkFlow, true);*/ } if (labelStatus.equalsIgnoreCase(WorkflowConstants.LABEL_APPROVED)) { return book; } } } catch (Exception e) { e.printStackTrace(); } return book; }