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.journal.service.impl.JournalArticleLocalServiceImpl.java
License:Open Source License
/** * Updates the translation of the web content article. * * @param groupId the primary key of the web content article's group * @param articleId the primary key of the web content article * @param version the web content article's version * @param locale the locale of the web content article's display template * @param title the translated web content article title * @param description the translated web content article description * @param content the HTML content wrapped in XML. For more information, * see the content example in the {@link #addArticle(long, long, * long, long, long, String, boolean, double, Map, Map, String, * String, String, String, int, int, int, int, int, int, int, int, * int, int, boolean, int, int, int, int, int, boolean, boolean, * boolean, String, File, Map, String, ServiceContext)} description. * @param images the web content's images * @param serviceContext the service context to be applied. Can set the * modification date and URL title for the web content article. * @return the updated web content article */// w w w.j av a 2s .co m @Indexable(type = IndexableType.REINDEX) @Override public JournalArticle updateArticleTranslation(long groupId, String articleId, double version, Locale locale, String title, String description, String content, Map<String, byte[]> images, ServiceContext serviceContext) throws PortalException { validateContent(content); JournalArticle oldArticle = getLatestArticle(groupId, articleId, WorkflowConstants.STATUS_ANY); double oldVersion = oldArticle.getVersion(); if ((version > 0) && (version != oldVersion)) { StringBundler sb = new StringBundler(4); sb.append("Version "); sb.append(version); sb.append(" is not the same as "); sb.append(oldVersion); throw new ArticleVersionException(sb.toString()); } boolean incrementVersion = false; if (oldArticle.isApproved() || oldArticle.isExpired()) { incrementVersion = true; } if (serviceContext != null) { serviceContext.validateModifiedDate(oldArticle, ArticleVersionException.class); } JournalArticle article = null; User user = userLocalService.fetchUser(oldArticle.getUserId()); if (user == null) { user = userLocalService.getDefaultUser(oldArticle.getCompanyId()); } Locale defaultLocale = getArticleDefaultLocale(content); if (incrementVersion) { double newVersion = getNextVersion(oldArticle); long id = counterLocalService.increment(); article = journalArticlePersistence.create(id); article.setResourcePrimKey(oldArticle.getResourcePrimKey()); article.setGroupId(oldArticle.getGroupId()); article.setCompanyId(oldArticle.getCompanyId()); article.setUserId(oldArticle.getUserId()); article.setUserName(user.getFullName()); article.setCreateDate(oldArticle.getCreateDate()); article.setFolderId(oldArticle.getFolderId()); article.setClassNameId(oldArticle.getClassNameId()); article.setClassPK(oldArticle.getClassPK()); article.setArticleId(articleId); article.setVersion(newVersion); article.setUrlTitle( getUniqueUrlTitle(id, groupId, articleId, title, oldArticle.getUrlTitle(), serviceContext)); article.setDDMStructureKey(oldArticle.getDDMStructureKey()); article.setDDMTemplateKey(oldArticle.getDDMTemplateKey()); article.setDefaultLanguageId(LocaleUtil.toLanguageId(defaultLocale)); article.setLayoutUuid(oldArticle.getLayoutUuid()); article.setDisplayDate(oldArticle.getDisplayDate()); article.setExpirationDate(oldArticle.getExpirationDate()); article.setReviewDate(oldArticle.getReviewDate()); article.setIndexable(oldArticle.getIndexable()); article.setSmallImage(oldArticle.getSmallImage()); article.setSmallImageId(oldArticle.getSmallImageId()); if (article.getSmallImageId() == 0) { article.setSmallImageId(counterLocalService.increment()); } article.setSmallImageURL(oldArticle.getSmallImageURL()); article.setStatus(WorkflowConstants.STATUS_DRAFT); article.setStatusDate(new Date()); ExpandoBridgeUtil.copyExpandoBridgeAttributes(oldArticle.getExpandoBridge(), article.getExpandoBridge()); // Article localization _addArticleLocalizedFields(article.getCompanyId(), article.getId(), oldArticle.getTitleMap(), oldArticle.getDescriptionMap()); // Dynamic data mapping updateDDMLinks(id, groupId, oldArticle.getDDMStructureKey(), oldArticle.getDDMTemplateKey(), true); } else { article = oldArticle; } _updateArticleLocalizedFields(article.getCompanyId(), article.getId(), title, description, LocaleUtil.toLanguageId(locale)); content = format(user, groupId, article, content); article.setContent(content); journalArticlePersistence.update(article); return article; }
From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java
License:Open Source License
protected JournalArticle fetchLatestLiveArticle(JournalArticle article) throws PortalException { Group group = groupLocalService.getGroup(article.getGroupId()); long liveGroupId = group.getLiveGroupId(); if (liveGroupId == 0) { return null; }//from w w w. j a v a 2 s. c o m JournalArticleResource articleResource = journalArticleResourceLocalService .fetchJournalArticleResourceByUuidAndGroupId(article.getArticleResourceUuid(), liveGroupId); if (articleResource == null) { return null; } return journalArticleLocalService.fetchLatestArticle(articleResource.getResourcePrimKey(), WorkflowConstants.STATUS_ANY, false); }
From source file:com.liferay.journal.service.impl.JournalArticleLocalServiceImpl.java
License:Open Source License
protected JournalArticle getFirstArticle(long groupId, String articleId, int status, OrderByComparator<JournalArticle> orderByComparator) throws PortalException { if (status == WorkflowConstants.STATUS_ANY) { return journalArticlePersistence.findByG_A_NotST_First(groupId, articleId, WorkflowConstants.STATUS_IN_TRASH, orderByComparator); } else {//from w ww . j a va2s . c o m return journalArticlePersistence.findByG_A_ST_First(groupId, articleId, status, orderByComparator); } }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Returns all the web content articles matching the group and folder. * * @param groupId the primary key of the web content article's group * @param folderId the primary key of the web content article folder * @return the matching web content articles *///from w w w.j a v a 2 s . c o m @Override public List<JournalArticle> getArticles(long groupId, long folderId) { QueryDefinition<JournalArticle> queryDefinition = new QueryDefinition<>(WorkflowConstants.STATUS_ANY); List<Long> folderIds = new ArrayList<>(); folderIds.add(folderId); return journalArticleFinder.filterFindByG_F(groupId, folderIds, queryDefinition); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Returns an ordered range of all the web content articles matching the * group and folder./* w ww . j a va 2s . com*/ * * <p> * Useful when paginating results. Returns a maximum of <code>end - * start</code> instances. <code>start</code> and <code>end</code> are not * primary keys, they are indexes in the result set. Thus, <code>0</code> * refers to the first result in the set. Setting both <code>start</code> * and <code>end</code> to {@link * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full * result set. * </p> * * @param groupId the primary key of the web content article's group * @param folderId the primary key of the web content article folder * @param start the lower bound of the range of web content articles to * return * @param end the upper bound of the range of web content articles to * return (not inclusive) * @param obc the comparator to order the web content articles * @return the matching web content articles */ @Override public List<JournalArticle> getArticles(long groupId, long folderId, int start, int end, OrderByComparator<JournalArticle> obc) { QueryDefinition<JournalArticle> queryDefinition = new QueryDefinition<>(WorkflowConstants.STATUS_ANY, start, end, obc); List<Long> folderIds = new ArrayList<>(); folderIds.add(folderId); return journalArticleFinder.filterFindByG_F(groupId, folderIds, queryDefinition); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Returns an ordered range of all the web content articles matching the * group, default class name ID, and DDM structure key. * * <p>//from w w w. jav a2 s .c o m * Useful when paginating results. Returns a maximum of <code>end - * start</code> instances. <code>start</code> and <code>end</code> are not * primary keys, they are indexes in the result set. Thus, <code>0</code> * refers to the first result in the set. Setting both <code>start</code> * and <code>end</code> to {@link * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full * result set. * </p> * * @param groupId the primary key of the web content article's group * @param ddmStructureKey the primary key of the web content article's DDM * structure * @param start the lower bound of the range of web content articles to * return * @param end the upper bound of the range of web content articles to * return (not inclusive) * @param obc the comparator to order the web content articles * @return the range of matching web content articles ordered by the * comparator */ @Override public List<JournalArticle> getArticlesByStructureId(long groupId, String ddmStructureKey, int start, int end, OrderByComparator<JournalArticle> obc) { return getArticlesByStructureId(groupId, ddmStructureKey, WorkflowConstants.STATUS_ANY, start, end, obc); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Returns the number of web content articles matching the group and folder. * * @param groupId the primary key of the web content article's group * @param folderId the primary key of the web content article folder * @return the number of matching web content articles *///w w w .j ava 2s .c o m @Override public int getArticlesCount(long groupId, long folderId) { return getArticlesCount(groupId, folderId, WorkflowConstants.STATUS_ANY); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Returns the number of web content articles matching the group, default * class name ID, and DDM structure key. * * @param groupId the primary key of the web content article's group * @param ddmStructureKey the primary key of the web content article's DDM * structure/*w ww. j a v a 2s . c o m*/ * @return the number of matching web content articles */ @Override public int getArticlesCountByStructureId(long groupId, String ddmStructureKey) { return getArticlesCountByStructureId(groupId, ddmStructureKey, WorkflowConstants.STATUS_ANY); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Returns an ordered range of all the web content articles matching the * group, user, the root folder or any of its subfolders. * * <p>/*from w w w. j a va2 s .c o m*/ * Useful when paginating results. Returns a maximum of <code>end - * start</code> instances. <code>start</code> and <code>end</code> are not * primary keys, they are indexes in the result set. Thus, <code>0</code> * refers to the first result in the set. Setting both <code>start</code> * and <code>end</code> to {@link * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full * result set. * </p> * * @param groupId the primary key of the web content article's group * @param userId the primary key of the user (optionally <code>0</code>) * @param rootFolderId the primary key of the root folder to begin the * search * @param start the lower bound of the range of web content articles to * return * @param end the upper bound of the range of web content articles to * return (not inclusive) * @param orderByComparator the comparator to order the web content * articles * @return the range of matching web content articles ordered by the * comparator */ @Override public List<JournalArticle> getGroupArticles(long groupId, long userId, long rootFolderId, int start, int end, OrderByComparator<JournalArticle> orderByComparator) throws PortalException { return getGroupArticles(groupId, userId, rootFolderId, WorkflowConstants.STATUS_ANY, start, end, orderByComparator); }
From source file:com.liferay.journal.service.impl.JournalArticleServiceImpl.java
License:Open Source License
/** * Returns the number of web content articles matching the group, user, and * the root folder or any of its subfolders. * * @param groupId the primary key of the web content article's group * @param userId the primary key of the user (optionally <code>0</code>) * @param rootFolderId the primary key of the root folder to begin the * search//from w ww . j a va 2s. c o m * @return the number of matching web content articles */ @Override public int getGroupArticlesCount(long groupId, long userId, long rootFolderId) throws PortalException { return getGroupArticlesCount(groupId, userId, rootFolderId, WorkflowConstants.STATUS_ANY); }