protected void deleteAssets(KBArticle kbArticle) throws PortalException, SystemException { assetEntryLocalService.deleteEntry(KBArticle.class.getName(), kbArticle.getClassPK()); if (!kbArticle.isApproved() && !kbArticle.isFirstVersion()) { assetEntryLocalService.deleteEntry(KBArticle.class.getName(), kbArticle.getResourcePrimKey()); } }
protected void deleteKBArticleAttachments(KBArticle kbArticle) throws PortalException, SystemException { deleteKBArticleAttachments(kbArticle, kbArticle.getClassPK()); if (!kbArticle.isApproved() && !kbArticle.isFirstVersion()) { deleteKBArticleAttachments(kbArticle, kbArticle.getResourcePrimKey()); } }
public void updateViewCount(long userId, long resourcePrimKey, int viewCount) throws PortalException, SystemException { KBArticle kbArticle = getLatestKBArticle(resourcePrimKey, WorkflowConstants.STATUS_ANY); kbArticle.setViewCount(viewCount); kbArticlePersistence.update(kbArticle, false); if (kbArticle.isApproved() || kbArticle.isFirstVersion()) { return; } kbArticle = getLatestKBArticle(resourcePrimKey, WorkflowConstants.STATUS_APPROVED); kbArticle.setViewCount(viewCount); kbArticlePersistence.update(kbArticle, false); }
public void moveKBArticle( long userId, long resourcePrimKey, long parentResourcePrimKey, double priority) throws PortalException, SystemException { // KB article validate(priority); updatePermissionFields(resourcePrimKey, parentResourcePrimKey); List<KBArticle> kbArticles = getKBArticleVersions( resourcePrimKey, WorkflowConstants.STATUS_ANY, QueryUtil.ALL_POS, QueryUtil.ALL_POS, new KBArticleVersionComparator()); for (KBArticle kbArticle : kbArticles) { kbArticle.setParentResourcePrimKey(parentResourcePrimKey); kbArticle.setPriority(priority); kbArticlePersistence.update(kbArticle, false); } // Social KBArticle kbArticle = getLatestKBArticle(resourcePrimKey, WorkflowConstants.STATUS_ANY); if (kbArticle.isApproved() || !kbArticle.isFirstVersion()) { socialActivityLocalService.addActivity( userId, kbArticle.getGroupId(), KBArticle.class.getName(), resourcePrimKey, AdminActivityKeys.MOVE_KB_ARTICLE, StringPool.BLANK, 0); } }