001
014
015 package com.liferay.portal.workflow;
016
017 import com.liferay.portal.kernel.workflow.WorkflowTaskManagerUtil;
018 import com.liferay.portal.model.Portlet;
019 import com.liferay.portal.security.permission.PermissionChecker;
020
021
024 public class MyWorkflowTasksControlPanelEntry
025 extends WorkflowControlPanelEntry {
026
027 @Override
028 public boolean isVisible(
029 PermissionChecker permissionChecker, Portlet portlet)
030 throws Exception {
031
032 long companyId = permissionChecker.getCompanyId();
033 long userId = permissionChecker.getUserId();
034
035 if (WorkflowTaskManagerUtil.getWorkflowTaskCountByUser(
036 companyId, userId, Boolean.FALSE) > 0) {
037
038 return true;
039 }
040
041 if (WorkflowTaskManagerUtil.getWorkflowTaskCountByUser(
042 companyId, userId, Boolean.TRUE) > 0) {
043
044 return true;
045 }
046
047 if (WorkflowTaskManagerUtil.getWorkflowTaskCountByUserRoles(
048 companyId, userId, Boolean.FALSE) > 0) {
049
050 return true;
051 }
052
053 if (WorkflowTaskManagerUtil.getWorkflowTaskCountByUserRoles(
054 companyId, userId, Boolean.TRUE) > 0) {
055
056 return true;
057 }
058
059 return false;
060 }
061
062 }