@Override public int compare(Object obj1, Object obj2) { JournalStructure structure1 = (JournalStructure) obj1; JournalStructure structure2 = (JournalStructure) obj2; int value = 0; if (structure1.getId() < structure2.getId()) { value = -1; } else if (structure1.getId() > structure2.getId()) { value = 1; } if (_ascending) { return value; } else { return -value; } }
public static void getArticle(HttpServletRequest request) throws Exception { long groupId = ParamUtil.getLong(request, "groupId"); long classNameId = ParamUtil.getLong(request, "classNameId"); long classPK = ParamUtil.getLong(request, "classPK"); String articleId = ParamUtil.getString(request, "articleId"); String structureId = ParamUtil.getString(request, "structureId"); JournalArticle article = null; if (Validator.isNotNull(articleId)) { article = JournalArticleServiceUtil.getLatestArticle( groupId, articleId, WorkflowConstants.STATUS_ANY); } else if ((classNameId > 0) && (classPK > 0)) { String className = PortalUtil.getClassName(classNameId); article = JournalArticleServiceUtil.getLatestArticle(groupId, className, classPK); } else if (Validator.isNotNull(structureId)) { JournalStructure structure = null; try { structure = JournalStructureServiceUtil.getStructure(groupId, structureId); } catch (NoSuchStructureException nsse1) { ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); if (groupId == themeDisplay.getCompanyGroupId()) { return; } try { structure = JournalStructureServiceUtil.getStructure( themeDisplay.getCompanyGroupId(), structureId); } catch (NoSuchStructureException nsse2) { return; } } article = JournalArticleServiceUtil.getArticle( groupId, JournalStructure.class.getName(), structure.getId()); article.setNew(true); article.setId(0); article.setClassNameId(0); article.setClassPK(0); article.setArticleId(null); article.setVersion(0); } request.setAttribute(WebKeys.JOURNAL_ARTICLE, article); }
public void deleteStructure(JournalStructure structure) throws PortalException, SystemException { if (journalArticlePersistence.countByG_S(structure.getGroupId(), structure.getStructureId()) > 0) { throw new RequiredStructureException(); } if (journalStructurePersistence.countByG_P(structure.getGroupId(), structure.getStructureId()) > 0) { throw new RequiredStructureException(); } if (journalTemplatePersistence.countByG_S(structure.getGroupId(), structure.getStructureId()) > 0) { throw new RequiredStructureException(); } // WebDAVProps webDAVPropsLocalService.deleteWebDAVProps(JournalStructure.class.getName(), structure.getId()); // Expando expandoValueLocalService.deleteValues(JournalStructure.class.getName(), structure.getId()); // Resources resourceLocalService.deleteResource( structure.getCompanyId(), JournalStructure.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, structure.getId()); // Structure journalStructurePersistence.remove(structure); }
public void addStructureResources( JournalStructure structure, String[] communityPermissions, String[] guestPermissions) throws PortalException, SystemException { resourceLocalService.addModelResources( structure.getCompanyId(), structure.getGroupId(), structure.getUserId(), JournalStructure.class.getName(), structure.getId(), communityPermissions, guestPermissions); }
public void addStructureResources( JournalStructure structure, boolean addCommunityPermissions, boolean addGuestPermissions) throws PortalException, SystemException { resourceLocalService.addResources( structure.getCompanyId(), structure.getGroupId(), structure.getUserId(), JournalStructure.class.getName(), structure.getId(), false, addCommunityPermissions, addGuestPermissions); }