List of usage examples for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED
int STATUS_APPROVED
To view the source code for com.liferay.portal.kernel.workflow WorkflowConstants STATUS_APPROVED.
Click Source Link
From source file:com.liferay.portlet.journal.util.JournalArticleIndexer.java
License:Open Source License
protected void reindexArticles(long companyId) throws PortalException, SystemException { ActionableDynamicQuery actionableDynamicQuery = new JournalArticleActionableDynamicQuery() { @Override//from www. j av a 2 s. c om protected void addCriteria(DynamicQuery dynamicQuery) { if (PropsValues.JOURNAL_ARTICLE_INDEX_ALL_VERSIONS) { return; } Property statusProperty = PropertyFactoryUtil.forName("status"); Integer[] statuses = { WorkflowConstants.STATUS_APPROVED, WorkflowConstants.STATUS_IN_TRASH, WorkflowConstants.STATUS_SCHEDULED }; dynamicQuery.add(statusProperty.in(statuses)); } @Override protected void performAction(Object object) throws PortalException { JournalArticle article = (JournalArticle) object; Document document = getDocument(article); addDocument(document); } }; actionableDynamicQuery.setCompanyId(companyId); actionableDynamicQuery.setSearchEngineId(getSearchEngineId()); actionableDynamicQuery.performActions(); }
From source file:com.liferay.portlet.journal.util.JournalIndexer.java
License:Open Source License
@Override public void postProcessContextQuery(BooleanQuery contextQuery, SearchContext searchContext) throws Exception { Long classNameId = (Long) searchContext.getAttribute(Field.CLASS_NAME_ID); if (classNameId != null) { contextQuery.addRequiredTerm("classNameId", classNameId.toString()); }/* w ww . ja v a 2 s . c o m*/ int status = GetterUtil.getInteger(searchContext.getAttribute(Field.STATUS), WorkflowConstants.STATUS_APPROVED); if (status != WorkflowConstants.STATUS_ANY) { contextQuery.addRequiredTerm(Field.STATUS, status); } String articleType = (String) searchContext.getAttribute("articleType"); if (Validator.isNotNull(articleType)) { contextQuery.addRequiredTerm(Field.TYPE, articleType); } String structureId = (String) searchContext.getAttribute("structureId"); if (Validator.isNotNull(structureId)) { contextQuery.addRequiredTerm("structureId", structureId); } String templateId = (String) searchContext.getAttribute("templateId"); if (Validator.isNotNull(templateId)) { contextQuery.addRequiredTerm("templateId", templateId); } }
From source file:com.liferay.portlet.journal.util.JournalIndexer.java
License:Open Source License
@Override protected void doReindex(String className, long classPK) throws Exception { JournalArticle article = JournalArticleLocalServiceUtil.getLatestArticle(classPK, WorkflowConstants.STATUS_APPROVED); doReindex(article);//from w ww . ja v a 2 s . c o m }
From source file:com.liferay.portlet.journal.util.JournalIndexer.java
License:Open Source License
protected void reindexArticles(long companyId) throws Exception { int count = JournalArticleLocalServiceUtil.getCompanyArticlesCount(companyId, WorkflowConstants.STATUS_APPROVED); int pages = count / Indexer.DEFAULT_INTERVAL; for (int i = 0; i <= pages; i++) { int start = (i * Indexer.DEFAULT_INTERVAL); int end = start + Indexer.DEFAULT_INTERVAL; reindexArticles(companyId, start, end); }/* w w w . j av a 2s .c om*/ }
From source file:com.liferay.portlet.journal.util.JournalIndexer.java
License:Open Source License
protected void reindexArticles(long companyId, int start, int end) throws Exception { List<JournalArticle> articles = new ArrayList<JournalArticle>(); List<JournalArticle> approvedArticles = JournalArticleLocalServiceUtil.getCompanyArticles(companyId, WorkflowConstants.STATUS_APPROVED, start, end); articles.addAll(approvedArticles);/*w ww.j a v a 2 s.c o m*/ List<JournalArticle> draftArticles = JournalArticleLocalServiceUtil.getCompanyArticles(companyId, JournalArticleConstants.VERSION_DEFAULT, WorkflowConstants.STATUS_DRAFT, start, end); articles.addAll(draftArticles); if (articles.isEmpty()) { return; } Collection<Document> documents = new ArrayList<Document>(); for (JournalArticle article : articles) { if (!article.isIndexable()) { continue; } if (article.isApproved()) { JournalArticle latestArticle = JournalArticleLocalServiceUtil .getLatestArticle(article.getResourcePrimKey(), WorkflowConstants.STATUS_APPROVED); if (!latestArticle.isIndexable()) { continue; } } Document document = getDocument(article); documents.add(document); } SearchEngineUtil.updateDocuments(companyId, documents); }
From source file:com.liferay.portlet.journal.util.JournalRSSUtil.java
License:Open Source License
public static List<JournalArticle> getArticles(JournalFeed feed) throws SystemException { long companyId = feed.getCompanyId(); long groupId = feed.getGroupId(); String articleId = null;//from w w w. j a v a 2s .c om Double version = null; String title = null; String description = null; String content = null; String type = feed.getType(); if (Validator.isNull(type)) { type = null; } String structureId = feed.getStructureId(); if (Validator.isNull(structureId)) { structureId = null; } String templateId = feed.getTemplateId(); if (Validator.isNull(templateId)) { templateId = null; } Date displayDateGT = null; Date displayDateLT = new Date(); int status = WorkflowConstants.STATUS_APPROVED; Date reviewDate = null; boolean andOperator = true; int start = 0; int end = feed.getDelta(); String orderByCol = feed.getOrderByCol(); String orderByType = feed.getOrderByType(); boolean orderByAsc = orderByType.equals("asc"); OrderByComparator obc = new ArticleModifiedDateComparator(orderByAsc); if (orderByCol.equals("display-date")) { obc = new ArticleDisplayDateComparator(orderByAsc); } return JournalArticleLocalServiceUtil.search(companyId, groupId, 0, articleId, version, title, description, content, type, structureId, templateId, displayDateGT, displayDateLT, status, reviewDate, andOperator, start, end, obc); }
From source file:com.liferay.portlet.journalcontent.action.ViewAction.java
License:Open Source License
@Override public ActionForward render(ActionMapping mapping, ActionForm form, PortletConfig portletConfig, RenderRequest renderRequest, RenderResponse renderResponse) throws Exception { PortletPreferences preferences = renderRequest.getPreferences(); ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY); long groupId = ParamUtil.getLong(renderRequest, "groupId"); if (groupId <= 0) { groupId = GetterUtil.getLong(preferences.getValue("groupId", StringPool.BLANK)); }/*from w w w . ja v a2s .c o m*/ String articleId = ParamUtil.getString(renderRequest, "articleId"); String templateId = ParamUtil.getString(renderRequest, "templateId"); if (Validator.isNull(articleId)) { articleId = GetterUtil.getString(preferences.getValue("articleId", StringPool.BLANK)); templateId = GetterUtil.getString(preferences.getValue("templateId", StringPool.BLANK)); } String viewMode = ParamUtil.getString(renderRequest, "viewMode"); String languageId = LanguageUtil.getLanguageId(renderRequest); int page = ParamUtil.getInteger(renderRequest, "page", 1); String xmlRequest = PortletRequestUtil.toXML(renderRequest, renderResponse); JournalArticle article = null; JournalArticleDisplay articleDisplay = null; if ((groupId > 0) && Validator.isNotNull(articleId)) { try { article = JournalArticleLocalServiceUtil.getLatestArticle(groupId, articleId, WorkflowConstants.STATUS_APPROVED); } catch (NoSuchArticleException nsae) { } try { if (article == null) { article = JournalArticleLocalServiceUtil.getLatestArticle(groupId, articleId, WorkflowConstants.STATUS_ANY); } double version = article.getVersion(); articleDisplay = JournalContentUtil.getDisplay(groupId, articleId, version, templateId, viewMode, languageId, themeDisplay, page, xmlRequest); } catch (Exception e) { renderRequest.removeAttribute(WebKeys.JOURNAL_ARTICLE); articleDisplay = JournalContentUtil.getDisplay(groupId, articleId, templateId, viewMode, languageId, themeDisplay, page, xmlRequest); } } if (article != null) { renderRequest.setAttribute(WebKeys.JOURNAL_ARTICLE, article); } if (articleDisplay != null) { renderRequest.setAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY, articleDisplay); } else { renderRequest.removeAttribute(WebKeys.JOURNAL_ARTICLE_DISPLAY); } return mapping.findForward("portlet.journal_content.view"); }
From source file:com.liferay.portlet.js.service.impl.JSEntryLocalServiceImpl.java
License:Open Source License
public JSEntry addEntry(long classNameId, long classPK, double version, String js, ServiceContext serviceContext) throws SystemException { Date now = new Date(); JSEntry jsEntry = jsEntryPersistence.create(counterLocalService.increment()); jsEntry.setCreateDate(serviceContext.getCreateDate(now)); jsEntry.setUuid(serviceContext.getUuid()); jsEntry.setModifiedDate(serviceContext.getModifiedDate(now)); jsEntry.setClassNameId(classNameId); jsEntry.setClassPK(classPK);/*from www . j a va 2 s . c o m*/ jsEntry.setVersion(version); if (classNameId != PortalUtil.getClassNameId(Company.class)) { jsEntry.setGroupId(serviceContext.getScopeGroupId()); } jsEntry.setJs(js); jsEntry.setStatus(WorkflowConstants.STATUS_APPROVED); jsEntry.setStatusDate(serviceContext.getModifiedDate(now)); jsEntry.setExpandoBridgeAttributes(serviceContext); return jsEntryPersistence.update(jsEntry, false); }
From source file:com.liferay.portlet.js.service.impl.JSEntryLocalServiceImpl.java
License:Open Source License
public JSEntry updateEntry(long classNameId, long classPK, double version, String js, ServiceContext serviceContext) throws SystemException, PortalException { return updateEntry(classNameId, classPK, version, js, WorkflowConstants.STATUS_APPROVED, serviceContext); }
From source file:com.liferay.portlet.layoutsadmin.util.SitemapImpl.java
License:Open Source License
protected void visitArticles(Element element, Layout layout, ThemeDisplay themeDisplay) throws PortalException, SystemException { List<JournalArticle> journalArticles = JournalArticleServiceUtil .getArticlesByLayoutUuid(layout.getGroupId(), layout.getUuid()); if (journalArticles.isEmpty()) { return;//from ww w . j av a 2 s . c om } List<String> processedArticleIds = new ArrayList<String>(); for (JournalArticle journalArticle : journalArticles) { if (processedArticleIds.contains(journalArticle.getArticleId()) || (journalArticle.getStatus() != WorkflowConstants.STATUS_APPROVED)) { continue; } String portalURL = PortalUtil.getPortalURL(layout, themeDisplay); String groupFriendlyURL = PortalUtil.getGroupFriendlyURL( GroupLocalServiceUtil.getGroup(journalArticle.getGroupId()), false, themeDisplay); StringBundler sb = new StringBundler(4); if (!groupFriendlyURL.startsWith(portalURL)) { sb.append(portalURL); } sb.append(groupFriendlyURL); sb.append(JournalArticleConstants.CANONICAL_URL_SEPARATOR); sb.append(journalArticle.getUrlTitle()); String articleURL = PortalUtil.getCanonicalURL(sb.toString(), themeDisplay, layout); addURLElement(element, articleURL, null, journalArticle.getModifiedDate()); Locale[] availableLocales = LanguageUtil.getAvailableLocales(); if (availableLocales.length > 1) { Locale defaultLocale = LocaleUtil.getDefault(); for (Locale availableLocale : availableLocales) { if (!availableLocale.equals(defaultLocale)) { String alternateURL = PortalUtil.getAlternateURL(articleURL, themeDisplay, availableLocale); addURLElement(element, alternateURL, null, journalArticle.getModifiedDate()); } } } processedArticleIds.add(journalArticle.getArticleId()); } }