List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY
int STATUS_ANY
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_ANY.
Click Source Link
From source file:com.liferay.knowledgebase.service.impl.KBArticleServiceImpl.java
License:Open Source License
@Override public int getKBArticlesCount(long groupId, long[] resourcePrimKeys, int status) { int count = 0; Long[][] params = new Long[][] { ArrayUtil.toArray(resourcePrimKeys) }; while ((params = KnowledgeBaseUtil.getParams(params[0])) != null) { if (status == WorkflowConstants.STATUS_ANY) { count += kbArticlePersistence.filterCountByR_G_L(ArrayUtil.toArray(params[1]), groupId, true); } else if (status == WorkflowConstants.STATUS_APPROVED) { count += kbArticlePersistence.filterCountByR_G_M(ArrayUtil.toArray(params[1]), groupId, true); } else {/*from ww w . ja v a 2 s. c om*/ count += kbArticlePersistence.filterCountByR_G_S(ArrayUtil.toArray(params[1]), groupId, status); } } return count; }
From source file:com.liferay.knowledgebase.service.impl.KBArticleServiceImpl.java
License:Open Source License
@Override public List<KBArticle> getKBArticleVersions(long groupId, long resourcePrimKey, int status, int start, int end, OrderByComparator<KBArticle> orderByComparator) { if (status == WorkflowConstants.STATUS_ANY) { return kbArticlePersistence.filterFindByR_G(resourcePrimKey, groupId, start, end, orderByComparator); }//from w w w. j av a2 s . c om return kbArticlePersistence.filterFindByR_G_S(resourcePrimKey, groupId, status, start, end, orderByComparator); }
From source file:com.liferay.knowledgebase.service.impl.KBArticleServiceImpl.java
License:Open Source License
@Override public int getKBArticleVersionsCount(long groupId, long resourcePrimKey, int status) { if (status == WorkflowConstants.STATUS_ANY) { return kbArticlePersistence.filterCountByR_G(resourcePrimKey, groupId); }/*from w ww .j ava 2 s . co m*/ return kbArticlePersistence.filterCountByR_G_S(resourcePrimKey, groupId, status); }
From source file:com.liferay.knowledgebase.service.impl.KBArticleServiceImpl.java
License:Open Source License
@Override public List<KBArticle> getSectionsKBArticles(long groupId, String[] sections, int status, int start, int end, OrderByComparator<KBArticle> orderByComparator) { String[] array = AdminUtil.escapeSections(sections); for (int i = 0; i < array.length; i++) { array[i] = StringUtil.quote(array[i], StringPool.PERCENT); }//www . ja v a2s . c om if (status == WorkflowConstants.STATUS_ANY) { return kbArticlePersistence.filterFindByG_P_S_L(groupId, KBFolderConstants.DEFAULT_PARENT_FOLDER_ID, array, true, start, end, orderByComparator); } else if (status == WorkflowConstants.STATUS_APPROVED) { return kbArticlePersistence.filterFindByG_P_S_M(groupId, KBFolderConstants.DEFAULT_PARENT_FOLDER_ID, array, true, start, end, orderByComparator); } return kbArticlePersistence.filterFindByG_P_S_S(groupId, KBFolderConstants.DEFAULT_PARENT_FOLDER_ID, array, status, start, end, orderByComparator); }
From source file:com.liferay.knowledgebase.service.impl.KBArticleServiceImpl.java
License:Open Source License
@Override public int getSectionsKBArticlesCount(long groupId, String[] sections, int status) { String[] array = AdminUtil.escapeSections(sections); for (int i = 0; i < array.length; i++) { array[i] = StringUtil.quote(array[i], StringPool.PERCENT); }//from ww w. j a va 2s . c o m if (status == WorkflowConstants.STATUS_ANY) { return kbArticlePersistence.filterCountByG_P_S_L(groupId, KBFolderConstants.DEFAULT_PARENT_FOLDER_ID, array, true); } else if (status == WorkflowConstants.STATUS_APPROVED) { return kbArticlePersistence.filterCountByG_P_S_M(groupId, KBFolderConstants.DEFAULT_PARENT_FOLDER_ID, array, true); } return kbArticlePersistence.filterCountByG_P_S_S(groupId, KBFolderConstants.DEFAULT_PARENT_FOLDER_ID, array, status); }
From source file:com.liferay.knowledgebase.service.permission.KBArticlePermission.java
License:Open Source License
public static boolean contains(PermissionChecker permissionChecker, long resourcePrimKey, String actionId) throws PortalException { KBArticle kbArticle = KBArticleLocalServiceUtil.getLatestKBArticle(resourcePrimKey, WorkflowConstants.STATUS_ANY); return contains(permissionChecker, kbArticle, actionId); }
From source file:com.liferay.knowledgebase.service.permission.KBCommentPermission.java
License:Open Source License
public static boolean contains(PermissionChecker permissionChecker, KBComment kbComment, String actionId) throws PortalException { if (permissionChecker.getUserId() == kbComment.getUserId()) { return true; }/*from ww w.ja va 2 s.c om*/ if (actionId.equals(ActionKeys.VIEW)) { return AdminPermission.contains(permissionChecker, kbComment.getGroupId(), ActionKeys.VIEW_KB_FEEDBACK); } if (!actionId.equals(ActionKeys.DELETE) && !actionId.equals(ActionKeys.UPDATE)) { return false; } String className = kbComment.getClassName(); if (className.equals(KBArticle.class.getName())) { KBArticle kbArticle = KBArticleLocalServiceUtil.getLatestKBArticle(kbComment.getClassPK(), WorkflowConstants.STATUS_ANY); return permissionChecker.hasPermission(kbArticle.getGroupId(), KBArticle.class.getName(), kbArticle.getPrimaryKey(), ActionKeys.UPDATE); } else if (className.equals(KBTemplate.class.getName())) { KBTemplate kbTemplate = KBTemplateLocalServiceUtil.getKBTemplate(kbComment.getClassPK()); return permissionChecker.hasPermission(kbTemplate.getGroupId(), KBTemplate.class.getName(), kbTemplate.getPrimaryKey(), ActionKeys.UPDATE); } return false; }
From source file:com.liferay.knowledgebase.service.permission.SuggestionPermission.java
License:Open Source License
public static boolean contains(PermissionChecker permissionChecker, long groupId, String className, long classPK, String actionId) throws PortalException { if (!className.equals(KBArticleConstants.getClassName())) { throw new IllegalArgumentException("Only KB articles support suggestions"); }/*from www . j av a2s .co m*/ KBArticle kbArticle = KBArticleLocalServiceUtil.getLatestKBArticle(classPK, WorkflowConstants.STATUS_ANY); return contains(permissionChecker, groupId, kbArticle, actionId); }
From source file:com.liferay.knowledgebase.util.KnowledgeBaseUtil.java
License:Open Source License
public static long getKBFolderId(long parentResourceClassNameId, long parentResourcePrimKey) throws PortalException { long kbFolderClassNameId = PortalUtil.getClassNameId(KBFolderConstants.getClassName()); if (parentResourceClassNameId == kbFolderClassNameId) { return parentResourcePrimKey; }/* w w w.j a v a 2 s . co m*/ KBArticle kbArticle = KBArticleServiceUtil.getLatestKBArticle(parentResourcePrimKey, WorkflowConstants.STATUS_ANY); return kbArticle.getKbFolderId(); }
From source file:com.liferay.knowledgebase.util.KnowledgeBaseUtil.java
License:Open Source License
protected static void addPortletBreadcrumbEntries(Map<String, Object> parameters, HttpServletRequest request, RenderResponse renderResponse) throws PortalException { PortletURL portletURL = renderResponse.createRenderURL(); for (Map.Entry<String, Object> entry : parameters.entrySet()) { Object value = entry.getValue(); portletURL.setParameter(entry.getKey(), value.toString()); }//from ww w. j a v a2 s . c o m long kbFolderClassNameId = PortalUtil.getClassNameId(KBFolderConstants.getClassName()); long parentResourceClassNameId = (Long) parameters.get("parentResourceClassNameId"); long parentResourcePrimKey = (Long) parameters.get("parentResourcePrimKey"); String mvcPath = (String) parameters.get("mvcPath"); if (parentResourcePrimKey == KBFolderConstants.DEFAULT_PARENT_FOLDER_ID) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); PortalUtil.addPortletBreadcrumbEntry(request, themeDisplay.translate("home"), portletURL.toString()); } else if (parentResourceClassNameId == kbFolderClassNameId) { KBFolder kbFolder = KBFolderServiceUtil.getKBFolder(parentResourcePrimKey); addPortletBreadcrumbEntries(kbFolder.getClassNameId(), kbFolder.getParentKBFolderId(), mvcPath, request, renderResponse); PortalUtil.addPortletBreadcrumbEntry(request, kbFolder.getName(), portletURL.toString()); } else { KBArticle kbArticle = KBArticleServiceUtil.getLatestKBArticle(parentResourcePrimKey, WorkflowConstants.STATUS_ANY); addPortletBreadcrumbEntries(kbArticle.getParentResourceClassNameId(), kbArticle.getParentResourcePrimKey(), mvcPath, request, renderResponse); PortalUtil.addPortletBreadcrumbEntry(request, kbArticle.getTitle(), portletURL.toString()); } }