List of usage examples for com.liferay.portal.kernel.workflow WorkflowTaskManagerUtil getWorkflowTaskCountByUserRoles
public static int getWorkflowTaskCountByUserRoles(long companyId, long userId, Boolean completed) throws WorkflowException
From source file:it.tref.liferay.statusworkflow.portlet.StatusWorkflowPortlet.java
License:Open Source License
@Override public void serveResource(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws IOException, PortletException { String id = resourceRequest.getResourceID(); try {//from www.j a v a 2 s . com ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest); long companyId = serviceContext.getCompanyId(); long userId = serviceContext.getUserId(); int count = 0; if ("countTasksUser".equals(id)) { try { count = WorkflowTaskManagerUtil.getWorkflowTaskCountByUser(companyId, userId, false); } catch (WorkflowException e) { } } else if ("countTasksUserRoles".equals(id)) { try { count = WorkflowTaskManagerUtil.getWorkflowTaskCountByUserRoles(companyId, userId, false); } catch (WorkflowException e) { } } writeJSON(resourceRequest, resourceResponse, JSONFactoryUtil.createJSONObject().put("count", count)); } catch (PortalException e) { _log.error("Error", e); throw new PortletException(e); } catch (SystemException e) { _log.error("Error", e); throw new PortletException(e); } }