001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.journal.service.impl;
016    
017    import com.liferay.portal.kernel.dao.orm.QueryDefinition;
018    import com.liferay.portal.kernel.exception.PortalException;
019    import com.liferay.portal.kernel.portlet.PortletRequestModel;
020    import com.liferay.portal.kernel.search.Hits;
021    import com.liferay.portal.kernel.util.ArrayUtil;
022    import com.liferay.portal.kernel.util.OrderByComparator;
023    import com.liferay.portal.kernel.workflow.WorkflowConstants;
024    import com.liferay.portal.security.permission.ActionKeys;
025    import com.liferay.portal.service.ServiceContext;
026    import com.liferay.portal.theme.ThemeDisplay;
027    import com.liferay.portlet.journal.model.JournalArticle;
028    import com.liferay.portlet.journal.model.JournalArticleConstants;
029    import com.liferay.portlet.journal.model.JournalFolderConstants;
030    import com.liferay.portlet.journal.service.base.JournalArticleServiceBaseImpl;
031    import com.liferay.portlet.journal.service.permission.JournalArticlePermission;
032    import com.liferay.portlet.journal.service.permission.JournalFolderPermission;
033    import com.liferay.portlet.journal.service.permission.JournalPermission;
034    
035    import java.io.File;
036    import java.io.Serializable;
037    
038    import java.util.ArrayList;
039    import java.util.Date;
040    import java.util.HashMap;
041    import java.util.List;
042    import java.util.Locale;
043    import java.util.Map;
044    
045    /**
046     * Provides the remote service for accessing, adding, deleting, and updating web
047     * content articles. Its methods include permission checks.
048     *
049     * @author Brian Wing Shun Chan
050     * @author Raymond Aug??
051     * @author Levente Hud??k
052     * @see    com.liferay.portlet.journal.service.impl.JournalArticleLocalServiceImpl
053     */
054    public class JournalArticleServiceImpl extends JournalArticleServiceBaseImpl {
055    
056            /**
057             * Adds a web content article with additional parameters.
058             *
059             * @param  groupId the primary key of the web content article's group
060             * @param  folderId the primary key of the web content article folder
061             * @param  classNameId the primary key of the DDMStructure class if the web
062             *         content article is related to a DDM structure, the primary key of
063             *         the class name associated with the article, or {@link
064             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
065             * @param  classPK the primary key of the DDM structure, if the primary key
066             *         of the DDMStructure class is given as the
067             *         <code>classNameId</code> parameter, the primary key of the class
068             *         associated with the web content article, or <code>0</code>
069             *         otherwise
070             * @param  articleId the primary key of the web content article
071             * @param  autoArticleId whether to auto generate the web content article ID
072             * @param  titleMap the web content article's locales and localized titles
073             * @param  descriptionMap the web content article's locales and localized
074             *         descriptions
075             * @param  content the HTML content wrapped in XML. For more information,
076             *         see the content example in the class description for {@link
077             *         JournalArticleLocalServiceImpl}.
078             * @param  type the structure's type, if the web content article is related
079             *         to a DDM structure. For more information, see {@link
080             *         com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}.
081             * @param  ddmStructureKey the primary key of the web content article's DDM
082             *         structure, if the article is related to a DDM structure, or
083             *         <code>null</code> otherwise
084             * @param  ddmTemplateKey the primary key of the web content article's DDM
085             *         template
086             * @param  layoutUuid the unique string identifying the web content
087             *         article's display page
088             * @param  displayDateMonth the month the web content article is set to
089             *         display
090             * @param  displayDateDay the calendar day the web content article is set to
091             *         display
092             * @param  displayDateYear the year the web content article is set to
093             *         display
094             * @param  displayDateHour the hour the web content article is set to
095             *         display
096             * @param  displayDateMinute the minute the web content article is set to
097             *         display
098             * @param  expirationDateMonth the month the web content article is set to
099             *         expire
100             * @param  expirationDateDay the calendar day the web content article is set
101             *         to expire
102             * @param  expirationDateYear the year the web content article is set to
103             *         expire
104             * @param  expirationDateHour the hour the web content article is set to
105             *         expire
106             * @param  expirationDateMinute the minute the web content article is set to
107             *         expire
108             * @param  neverExpire whether the web content article is not set to auto
109             *         expire
110             * @param  reviewDateMonth the month the web content article is set for
111             *         review
112             * @param  reviewDateDay the calendar day the web content article is set for
113             *         review
114             * @param  reviewDateYear the year the web content article is set for review
115             * @param  reviewDateHour the hour the web content article is set for review
116             * @param  reviewDateMinute the minute the web content article is set for
117             *         review
118             * @param  neverReview whether the web content article is not set for review
119             * @param  indexable whether the web content article is searchable
120             * @param  smallImage whether the web content article has a small image
121             * @param  smallImageURL the web content article's small image URL
122             * @param  smallFile the web content article's small image file
123             * @param  images the web content's images
124             * @param  articleURL the web content article's accessible URL
125             * @param  serviceContext the service context to be applied. Can set the
126             *         UUID, creation date, modification date, expando bridge
127             *         attributes, guest permissions, group permissions, asset category
128             *         IDs, asset tag names, asset link entry IDs, the "urlTitle"
129             *         attribute, and workflow actions for the web content article. Can
130             *         also set whether to add the default guest and group permissions.
131             * @return the web content article
132             * @throws PortalException if the user did not have permission to add the
133             *         web content article or if a portal exception occurred
134             */
135            @Override
136            public JournalArticle addArticle(
137                            long groupId, long folderId, long classNameId, long classPK,
138                            String articleId, boolean autoArticleId,
139                            Map<Locale, String> titleMap, Map<Locale, String> descriptionMap,
140                            String content, String type, String ddmStructureKey,
141                            String ddmTemplateKey, String layoutUuid, int displayDateMonth,
142                            int displayDateDay, int displayDateYear, int displayDateHour,
143                            int displayDateMinute, int expirationDateMonth,
144                            int expirationDateDay, int expirationDateYear,
145                            int expirationDateHour, int expirationDateMinute,
146                            boolean neverExpire, int reviewDateMonth, int reviewDateDay,
147                            int reviewDateYear, int reviewDateHour, int reviewDateMinute,
148                            boolean neverReview, boolean indexable, boolean smallImage,
149                            String smallImageURL, File smallFile, Map<String, byte[]> images,
150                            String articleURL, ServiceContext serviceContext)
151                    throws PortalException {
152    
153                    JournalFolderPermission.check(
154                            getPermissionChecker(), groupId, folderId, ActionKeys.ADD_ARTICLE);
155    
156                    return journalArticleLocalService.addArticle(
157                            getUserId(), groupId, folderId, classNameId, classPK, articleId,
158                            autoArticleId, JournalArticleConstants.VERSION_DEFAULT, titleMap,
159                            descriptionMap, content, type, ddmStructureKey, ddmTemplateKey,
160                            layoutUuid, displayDateMonth, displayDateDay, displayDateYear,
161                            displayDateHour, displayDateMinute, expirationDateMonth,
162                            expirationDateDay, expirationDateYear, expirationDateHour,
163                            expirationDateMinute, neverExpire, reviewDateMonth, reviewDateDay,
164                            reviewDateYear, reviewDateHour, reviewDateMinute, neverReview,
165                            indexable, smallImage, smallImageURL, smallFile, images, articleURL,
166                            serviceContext);
167            }
168    
169            /**
170             * Adds a web content article without any images.
171             *
172             * @param  groupId the primary key of the web content article's group
173             * @param  folderId the primary key of the web content article folder
174             * @param  classNameId the primary key of the DDMStructure class if the web
175             *         content article is related to a DDM structure, the primary key of
176             *         the class name associated with the article, or {@link
177             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
178             * @param  classPK the primary key of the DDM structure, if the primary key
179             *         of the DDMStructure class is given as the
180             *         <code>classNameId</code> parameter, the primary key of the class
181             *         associated with the web content article, or <code>0</code>
182             *         otherwise
183             * @param  articleId the primary key of the web content article
184             * @param  autoArticleId whether to auto generate the web content article ID
185             * @param  titleMap the web content article's locales and localized titles
186             * @param  descriptionMap the web content article's locales and localized
187             *         descriptions
188             * @param  content the HTML content wrapped in XML. For more information,
189             *         see the content example in the class description for {@link
190             *         JournalArticleLocalServiceImpl}.
191             * @param  type the structure's type, if the web content article is related
192             *         to a DDM structure. For more information, see {@link
193             *         com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}.
194             * @param  ddmStructureKey the primary key of the web content article's DDM
195             *         structure, if the article is related to a DDM structure, or
196             *         <code>null</code> otherwise
197             * @param  ddmTemplateKey the primary key of the web content article's DDM
198             *         template
199             * @param  layoutUuid the unique string identifying the web content
200             *         article's display page
201             * @param  displayDateMonth the month the web content article is set to
202             *         display
203             * @param  displayDateDay the calendar day the web content article is set to
204             *         display
205             * @param  displayDateYear the year the web content article is set to
206             *         display
207             * @param  displayDateHour the hour the web content article is set to
208             *         display
209             * @param  displayDateMinute the minute the web content article is set to
210             *         display
211             * @param  expirationDateMonth the month the web content article is set to
212             *         expire
213             * @param  expirationDateDay the calendar day the web content article is set
214             *         to expire
215             * @param  expirationDateYear the year the web content article is set to
216             *         expire
217             * @param  expirationDateHour the hour the web content article is set to
218             *         expire
219             * @param  expirationDateMinute the minute the web content article is set to
220             *         expire
221             * @param  neverExpire whether the web content article is not set to auto
222             *         expire
223             * @param  reviewDateMonth the month the web content article is set for
224             *         review
225             * @param  reviewDateDay the calendar day the web content article is set for
226             *         review
227             * @param  reviewDateYear the year the web content article is set for review
228             * @param  reviewDateHour the hour the web content article is set for review
229             * @param  reviewDateMinute the minute the web content article is set for
230             *         review
231             * @param  neverReview whether the web content article is not set for review
232             * @param  indexable whether the web content article is searchable
233             * @param  articleURL the web content article's accessible URL
234             * @param  serviceContext the service context to be applied. Can set the
235             *         UUID, creation date, modification date, expando bridge
236             *         attributes, guest permissions, group permissions, asset category
237             *         IDs, asset tag names, asset link entry IDs, the "urlTitle"
238             *         attribute, and workflow actions for the web content article. Can
239             *         also set whether to add the default guest and group permissions.
240             * @return the web content article
241             * @throws PortalException if the user did not have permission to add the
242             *         web content article or if a portal exception occurred
243             */
244            @Override
245            public JournalArticle addArticle(
246                            long groupId, long folderId, long classNameId, long classPK,
247                            String articleId, boolean autoArticleId,
248                            Map<Locale, String> titleMap, Map<Locale, String> descriptionMap,
249                            String content, String type, String ddmStructureKey,
250                            String ddmTemplateKey, String layoutUuid, int displayDateMonth,
251                            int displayDateDay, int displayDateYear, int displayDateHour,
252                            int displayDateMinute, int expirationDateMonth,
253                            int expirationDateDay, int expirationDateYear,
254                            int expirationDateHour, int expirationDateMinute,
255                            boolean neverExpire, int reviewDateMonth, int reviewDateDay,
256                            int reviewDateYear, int reviewDateHour, int reviewDateMinute,
257                            boolean neverReview, boolean indexable, String articleURL,
258                            ServiceContext serviceContext)
259                    throws PortalException {
260    
261                    JournalFolderPermission.check(
262                            getPermissionChecker(), groupId, folderId, ActionKeys.ADD_ARTICLE);
263    
264                    return journalArticleLocalService.addArticle(
265                            getUserId(), groupId, folderId, classNameId, classPK, articleId,
266                            autoArticleId, JournalArticleConstants.VERSION_DEFAULT, titleMap,
267                            descriptionMap, content, type, ddmStructureKey, ddmTemplateKey,
268                            layoutUuid, displayDateMonth, displayDateDay, displayDateYear,
269                            displayDateHour, displayDateMinute, expirationDateMonth,
270                            expirationDateDay, expirationDateYear, expirationDateHour,
271                            expirationDateMinute, neverExpire, reviewDateMonth, reviewDateDay,
272                            reviewDateYear, reviewDateHour, reviewDateMinute, neverReview,
273                            indexable, false, null, null, null, articleURL, serviceContext);
274            }
275    
276            /**
277             * Copies the web content article matching the group, article ID, and
278             * version. This method creates a new article, extracting all the values
279             * from the old one and updating its article ID.
280             *
281             * @param  groupId the primary key of the web content article's group
282             * @param  oldArticleId the primary key of the old web content article
283             * @param  newArticleId the primary key of the new web content article
284             * @param  autoArticleId whether to auto-generate the web content article ID
285             * @param  version the web content article's version
286             * @return the new web content article
287             * @throws PortalException if the user did not have permission to add the
288             *         copy the web content article, if a matching web content article
289             *         could not be found, or if a portal exception occurred
290             */
291            @Override
292            public JournalArticle copyArticle(
293                            long groupId, String oldArticleId, String newArticleId,
294                            boolean autoArticleId, double version)
295                    throws PortalException {
296    
297                    JournalArticle article = journalArticleLocalService.getArticle(
298                            groupId, oldArticleId);
299    
300                    JournalFolderPermission.check(
301                            getPermissionChecker(), groupId, article.getFolderId(),
302                            ActionKeys.ADD_ARTICLE);
303    
304                    return journalArticleLocalService.copyArticle(
305                            getUserId(), groupId, oldArticleId, newArticleId, autoArticleId,
306                            version);
307            }
308    
309            /**
310             * Deletes the web content article and its resources matching the group,
311             * article ID, and version, optionally sending email notifying denial of the
312             * web content article if it had not yet been approved.
313             *
314             * @param  groupId the primary key of the web content article's group
315             * @param  articleId the primary key of the web content article
316             * @param  version the web content article's version
317             * @param  articleURL the web content article's accessible URL
318             * @param  serviceContext the service context to be applied. Can set the
319             *         portlet preferences that include email information to notify
320             *         recipients of the unapproved web content article's denial.
321             * @throws PortalException if the user did not have permission to delete the
322             *         web content article, if a matching web content article could not
323             *         be found, or if a portal exception occurred
324             */
325            @Override
326            public void deleteArticle(
327                            long groupId, String articleId, double version, String articleURL,
328                            ServiceContext serviceContext)
329                    throws PortalException {
330    
331                    JournalArticlePermission.check(
332                            getPermissionChecker(), groupId, articleId, version,
333                            ActionKeys.DELETE);
334    
335                    journalArticleLocalService.deleteArticle(
336                            groupId, articleId, version, articleURL, serviceContext);
337            }
338    
339            /**
340             * Deletes all web content articles and their resources matching the group
341             * and article ID, optionally sending email notifying denial of article if
342             * it had not yet been approved.
343             *
344             * @param  groupId the primary key of the web content article's group
345             * @param  articleId the primary key of the web content article
346             * @param  articleURL the web content article's accessible URL
347             * @param  serviceContext the service context to be applied. Can set the
348             *         portlet preferences that include email information to notify
349             *         recipients of the unapproved web content article's denial.
350             * @throws PortalException if the user did not have permission to delete the
351             *         web content article or if a portal exception occurred
352             */
353            @Override
354            public void deleteArticle(
355                            long groupId, String articleId, String articleURL,
356                            ServiceContext serviceContext)
357                    throws PortalException {
358    
359                    JournalArticlePermission.check(
360                            getPermissionChecker(), groupId, articleId, ActionKeys.DELETE);
361    
362                    journalArticleLocalService.deleteArticle(
363                            groupId, articleId, serviceContext);
364            }
365    
366            /**
367             * Expires the web content article matching the group, article ID, and
368             * version.
369             *
370             * @param  groupId the primary key of the web content article's group
371             * @param  articleId the primary key of the web content article
372             * @param  version the web content article's version
373             * @param  articleURL the web content article's accessible URL
374             * @param  serviceContext the service context to be applied. Can set the
375             *         modification date, status date, portlet preferences, and can set
376             *         whether to add the default command update for the web content
377             *         article. With respect to social activities, by setting the
378             *         service context's command to {@link
379             *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
380             *         is considered a web content update activity; otherwise it is
381             *         considered a web content add activity.
382             * @return the web content article
383             * @throws PortalException if the user did not have permission to expire the
384             *         web content article, if a matching web content article could not
385             *         be found, or if a portal exception occurred
386             */
387            @Override
388            public JournalArticle expireArticle(
389                            long groupId, String articleId, double version, String articleURL,
390                            ServiceContext serviceContext)
391                    throws PortalException {
392    
393                    JournalArticlePermission.check(
394                            getPermissionChecker(), groupId, articleId, version,
395                            ActionKeys.EXPIRE);
396    
397                    return journalArticleLocalService.expireArticle(
398                            getUserId(), groupId, articleId, version, articleURL,
399                            serviceContext);
400            }
401    
402            /**
403             * Expires the web content article matching the group and article ID,
404             * expiring all of its versions if the
405             * <code>journal.article.expire.all.versions</code> portal property is
406             * <code>true</code>, otherwise expiring only its latest approved version.
407             *
408             * @param  groupId the primary key of the web content article's group
409             * @param  articleId the primary key of the web content article
410             * @param  articleURL the web content article's accessible URL
411             * @param  serviceContext the service context to be applied. Can set the
412             *         modification date, status date, portlet preferences, and can set
413             *         whether to add the default command update for the web content
414             *         article. With respect to social activities, by setting the
415             *         service context's command to {@link
416             *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
417             *         is considered a web content update activity; otherwise it is
418             *         considered a web content add activity.
419             * @throws PortalException if the user did not have permission to expire the
420             *         web content article, if a matching web content article could not
421             *         be found, or if a portal exception occurred
422             */
423            @Override
424            public void expireArticle(
425                            long groupId, String articleId, String articleURL,
426                            ServiceContext serviceContext)
427                    throws PortalException {
428    
429                    JournalArticlePermission.check(
430                            getPermissionChecker(), groupId, articleId, ActionKeys.EXPIRE);
431    
432                    journalArticleLocalService.expireArticle(
433                            getUserId(), groupId, articleId, articleURL, serviceContext);
434            }
435    
436            /**
437             * Returns the web content article with the ID.
438             *
439             * @param  id the primary key of the web content article
440             * @return the web content article with the ID
441             * @throws PortalException if a matching web content article could not be
442             *         found or if the user did not have permission to view the web
443             *         content article
444             */
445            @Override
446            public JournalArticle getArticle(long id) throws PortalException {
447                    JournalArticle article = journalArticleLocalService.getArticle(id);
448    
449                    JournalArticlePermission.check(
450                            getPermissionChecker(), article, ActionKeys.VIEW);
451    
452                    return article;
453            }
454    
455            /**
456             * Returns the latest approved web content article, or the latest unapproved
457             * article if none are approved. Both approved and unapproved articles must
458             * match the group and article ID.
459             *
460             * @param  groupId the primary key of the web content article's group
461             * @param  articleId the primary key of the web content article
462             * @return the matching web content article
463             * @throws PortalException if the user did not have permission to view the
464             *         web content article or if a matching web content article could
465             *         not be found
466             */
467            @Override
468            public JournalArticle getArticle(long groupId, String articleId)
469                    throws PortalException {
470    
471                    JournalArticlePermission.check(
472                            getPermissionChecker(), groupId, articleId, ActionKeys.VIEW);
473    
474                    return journalArticleLocalService.getArticle(groupId, articleId);
475            }
476    
477            /**
478             * Returns the web content article matching the group, article ID, and
479             * version.
480             *
481             * @param  groupId the primary key of the web content article's group
482             * @param  articleId the primary key of the web content article
483             * @param  version the web content article's version
484             * @return the matching web content article
485             * @throws PortalException if the user did not have permission to view the
486             *         web content article or if a matching web content article could
487             *         not be found
488             */
489            @Override
490            public JournalArticle getArticle(
491                            long groupId, String articleId, double version)
492                    throws PortalException {
493    
494                    JournalArticlePermission.check(
495                            getPermissionChecker(), groupId, articleId, version,
496                            ActionKeys.VIEW);
497    
498                    return journalArticleLocalService.getArticle(
499                            groupId, articleId, version);
500            }
501    
502            /**
503             * Returns the web content article matching the group, class name, and class
504             * PK.
505             *
506             * @param  groupId the primary key of the web content article's group
507             * @param  className the DDMStructure class name if the web content article
508             *         is related to a DDM structure, the primary key of the class name
509             *         associated with the article, or {@link
510             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
511             * @param  classPK the primary key of the DDM structure, if the the
512             *         DDMStructure class name is given as the <code>className</code>
513             *         parameter, the primary key of the class associated with the web
514             *         content article, or <code>0</code> otherwise
515             * @return the matching web content article
516             * @throws PortalException if a matching web content article could not be
517             *         found or if the user did not have permission to view the web
518             *         content article
519             */
520            @Override
521            public JournalArticle getArticle(
522                            long groupId, String className, long classPK)
523                    throws PortalException {
524    
525                    JournalArticle article = journalArticleLocalService.getArticle(
526                            groupId, className, classPK);
527    
528                    JournalArticlePermission.check(
529                            getPermissionChecker(), groupId, article.getArticleId(),
530                            article.getVersion(), ActionKeys.VIEW);
531    
532                    return article;
533            }
534    
535            /**
536             * Returns the latest web content article that is approved, or the latest
537             * unapproved article if none are approved. Both approved and unapproved
538             * articles must match the group and URL title.
539             *
540             * @param  groupId the primary key of the web content article's group
541             * @param  urlTitle the web content article's accessible URL title
542             * @return the matching web content article
543             * @throws PortalException if the user did not have permission to view the
544             *         web content article or if a portal exception occurred
545             */
546            @Override
547            public JournalArticle getArticleByUrlTitle(long groupId, String urlTitle)
548                    throws PortalException {
549    
550                    JournalArticle article =
551                            journalArticleLocalService.getArticleByUrlTitle(groupId, urlTitle);
552    
553                    JournalArticlePermission.check(
554                            getPermissionChecker(), article, ActionKeys.VIEW);
555    
556                    return article;
557            }
558    
559            /**
560             * Returns the web content from the web content article matching the group,
561             * article ID, and version.
562             *
563             * @param  groupId the primary key of the web content article's group
564             * @param  articleId the primary key of the web content article
565             * @param  version the web content article's version
566             * @param  languageId the primary key of the language translation to get
567             * @param  portletRequestModel the portlet request model
568             * @param  themeDisplay the theme display
569             * @return the matching web content
570             * @throws PortalException if the user did not have permission to view the
571             *         web content article, if a matching web content article or DDM
572             *         template could not be found, or if a portal exception occurred
573             */
574            @Override
575            public String getArticleContent(
576                            long groupId, String articleId, double version, String languageId,
577                            PortletRequestModel portletRequestModel, ThemeDisplay themeDisplay)
578                    throws PortalException {
579    
580                    JournalArticlePermission.check(
581                            getPermissionChecker(), groupId, articleId, version,
582                            ActionKeys.VIEW);
583    
584                    return journalArticleLocalService.getArticleContent(
585                            groupId, articleId, version, null, null, languageId,
586                            portletRequestModel, themeDisplay);
587            }
588    
589            /**
590             * Returns the web content from the web content article matching the group,
591             * article ID, and version.
592             *
593             * @param      groupId the primary key of the web content article's group
594             * @param      articleId the primary key of the web content article
595             * @param      version the web content article's version
596             * @param      languageId the primary key of the language translation to get
597             * @param      themeDisplay the theme display
598             * @return     the matching web content
599             * @throws     PortalException if the user did not have permission to view
600             *             the web content article, if a matching web content article or
601             *             DDM template could not be found, or if a portal exception
602             *             occurred
603             * @deprecated As of 7.0.0, replaced by {@link #getArticleContent(long,
604             *             String, double, String, PortletRequestModel, ThemeDisplay)}
605             */
606            @Deprecated
607            @Override
608            public String getArticleContent(
609                            long groupId, String articleId, double version, String languageId,
610                            ThemeDisplay themeDisplay)
611                    throws PortalException {
612    
613                    JournalArticlePermission.check(
614                            getPermissionChecker(), groupId, articleId, version,
615                            ActionKeys.VIEW);
616    
617                    return journalArticleLocalService.getArticleContent(
618                            groupId, articleId, version, null, languageId, themeDisplay);
619            }
620    
621            /**
622             * Returns the latest web content from the web content article matching the
623             * group and article ID.
624             *
625             * @param  groupId the primary key of the web content article's group
626             * @param  articleId the primary key of the web content article
627             * @param  languageId the primary key of the language translation to get
628             * @param  portletRequestModel the portlet request model
629             * @param  themeDisplay the theme display
630             * @return the matching web content
631             * @throws PortalException if the user did not have permission to view the
632             *         web content article, if a matching web content article or DDM
633             *         template could not be found, or if a portal exception occurred
634             */
635            @Override
636            public String getArticleContent(
637                            long groupId, String articleId, String languageId,
638                            PortletRequestModel portletRequestModel, ThemeDisplay themeDisplay)
639                    throws PortalException {
640    
641                    JournalArticlePermission.check(
642                            getPermissionChecker(), groupId, articleId, ActionKeys.VIEW);
643    
644                    return journalArticleLocalService.getArticleContent(
645                            groupId, articleId, null, null, languageId, portletRequestModel,
646                            themeDisplay);
647            }
648    
649            /**
650             * Returns the latest web content from the web content article matching the
651             * group and article ID.
652             *
653             * @param      groupId the primary key of the web content article's group
654             * @param      articleId the primary key of the web content article
655             * @param      languageId the primary key of the language translation to get
656             * @param      themeDisplay the theme display
657             * @return     the matching web content
658             * @throws     PortalException if the user did not have permission to view
659             *             the web content article, if a matching web content article or
660             *             DDM template could not be found, or if a portal exception
661             *             occurred
662             * @deprecated As of 7.0.0, replaced by {@link #getArticleContent(long,
663             *             String, String, PortletRequestModel, ThemeDisplay)}
664             */
665            @Deprecated
666            @Override
667            public String getArticleContent(
668                            long groupId, String articleId, String languageId,
669                            ThemeDisplay themeDisplay)
670                    throws PortalException {
671    
672                    JournalArticlePermission.check(
673                            getPermissionChecker(), groupId, articleId, ActionKeys.VIEW);
674    
675                    return journalArticleLocalService.getArticleContent(
676                            groupId, articleId, null, languageId, themeDisplay);
677            }
678    
679            /**
680             * Returns all the web content articles matching the group and folder.
681             *
682             * @param  groupId the primary key of the web content article's group
683             * @param  folderId the primary key of the web content article folder
684             * @return the matching web content articles
685             */
686            @Override
687            public List<JournalArticle> getArticles(long groupId, long folderId) {
688                    QueryDefinition<JournalArticle> queryDefinition =
689                            new QueryDefinition<JournalArticle>(WorkflowConstants.STATUS_ANY);
690    
691                    List<Long> folderIds = new ArrayList<Long>();
692    
693                    folderIds.add(folderId);
694    
695                    return journalArticleFinder.filterFindByG_F(
696                            groupId, folderIds, queryDefinition);
697            }
698    
699            /**
700             * Returns an ordered range of all the web content articles matching the
701             * group and folder.
702             *
703             * <p>
704             * Useful when paginating results. Returns a maximum of <code>end -
705             * start</code> instances. <code>start</code> and <code>end</code> are not
706             * primary keys, they are indexes in the result set. Thus, <code>0</code>
707             * refers to the first result in the set. Setting both <code>start</code>
708             * and <code>end</code> to {@link
709             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
710             * result set.
711             * </p>
712             *
713             * @param  groupId the primary key of the web content article's group
714             * @param  folderId the primary key of the web content article folder
715             * @param  start the lower bound of the range of web content articles to
716             *         return
717             * @param  end the upper bound of the range of web content articles to
718             *         return (not inclusive)
719             * @param  obc the comparator to order the web content articles
720             * @return the matching web content articles
721             */
722            @Override
723            public List<JournalArticle> getArticles(
724                    long groupId, long folderId, int start, int end,
725                    OrderByComparator<JournalArticle> obc) {
726    
727                    QueryDefinition<JournalArticle> queryDefinition =
728                            new QueryDefinition<JournalArticle>(
729                                    WorkflowConstants.STATUS_ANY, start, end, obc);
730    
731                    List<Long> folderIds = new ArrayList<Long>();
732    
733                    folderIds.add(folderId);
734    
735                    return journalArticleFinder.filterFindByG_F(
736                            groupId, folderIds, queryDefinition);
737            }
738    
739            /**
740             * Returns an ordered range of all the web content articles matching the
741             * group and article ID.
742             *
743             * <p>
744             * Useful when paginating results. Returns a maximum of <code>end -
745             * start</code> instances. <code>start</code> and <code>end</code> are not
746             * primary keys, they are indexes in the result set. Thus, <code>0</code>
747             * refers to the first result in the set. Setting both <code>start</code>
748             * and <code>end</code> to {@link
749             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
750             * result set.
751             * </p>
752             *
753             * @param  groupId the primary key of the web content article's group
754             * @param  articleId the primary key of the web content article
755             * @param  start the lower bound of the range of web content articles to
756             *         return
757             * @param  end the upper bound of the range of web content articles to
758             *         return (not inclusive)
759             * @param  obc the comparator to order the web content articles
760             * @return the range of matching web content articles ordered by the
761             *         comparator
762             */
763            @Override
764            public List<JournalArticle> getArticlesByArticleId(
765                    long groupId, String articleId, int start, int end,
766                    OrderByComparator<JournalArticle> obc) {
767    
768                    return journalArticlePersistence.filterFindByG_A(
769                            groupId, articleId, start, end, obc);
770            }
771    
772            /**
773             * Returns all the web content articles matching the group and layout UUID.
774             *
775             * @param  groupId the primary key of the web content article's group
776             * @param  layoutUuid the unique string identifying the web content
777             *         article's display page
778             * @return the matching web content articles
779             */
780            @Override
781            public List<JournalArticle> getArticlesByLayoutUuid(
782                    long groupId, String layoutUuid) {
783    
784                    return journalArticlePersistence.filterFindByG_L(groupId, layoutUuid);
785            }
786    
787            /**
788             * Returns an ordered range of all the web content articles matching the
789             * group, class name ID, DDM structure key, and workflow status.
790             *
791             * <p>
792             * Useful when paginating results. Returns a maximum of <code>end -
793             * start</code> instances. <code>start</code> and <code>end</code> are not
794             * primary keys, they are indexes in the result set. Thus, <code>0</code>
795             * refers to the first result in the set. Setting both <code>start</code>
796             * and <code>end</code> to {@link
797             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
798             * result set.
799             * </p>
800             *
801             * @param  groupId the primary key of the web content article's group
802             * @param  classNameId the primary key of the DDMStructure class if the web
803             *         content article is related to a DDM structure, the primary key of
804             *         the class name associated with the article, or {@link
805             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
806             * @param  ddmStructureKey the primary key of the web content article's DDM
807             *         structure
808             * @param  status the web content article's workflow status. For more
809             *         information see {@link WorkflowConstants} for constants starting
810             *         with the "STATUS_" prefix.
811             * @param  start the lower bound of the range of web content articles to
812             *         return
813             * @param  end the upper bound of the range of web content articles to
814             *         return (not inclusive)
815             * @param  obc the comparator to order the web content articles
816             * @return the range of matching web content articles ordered by the
817             *         comparator
818             */
819            @Override
820            public List<JournalArticle> getArticlesByStructureId(
821                    long groupId, long classNameId, String ddmStructureKey, int status,
822                    int start, int end, OrderByComparator<JournalArticle> obc) {
823    
824                    QueryDefinition<JournalArticle> queryDefinition =
825                            new QueryDefinition<JournalArticle>(status, start, end, obc);
826    
827                    return journalArticleFinder.filterFindByG_C_S(
828                            groupId, classNameId, ddmStructureKey, queryDefinition);
829            }
830    
831            /**
832             * Returns an ordered range of all the web content articles matching the
833             * group, default class name ID, and DDM structure key.
834             *
835             * <p>
836             * Useful when paginating results. Returns a maximum of <code>end -
837             * start</code> instances. <code>start</code> and <code>end</code> are not
838             * primary keys, they are indexes in the result set. Thus, <code>0</code>
839             * refers to the first result in the set. Setting both <code>start</code>
840             * and <code>end</code> to {@link
841             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
842             * result set.
843             * </p>
844             *
845             * @param  groupId the primary key of the web content article's group
846             * @param  ddmStructureKey the primary key of the web content article's DDM
847             *         structure
848             * @param  start the lower bound of the range of web content articles to
849             *         return
850             * @param  end the upper bound of the range of web content articles to
851             *         return (not inclusive)
852             * @param  obc the comparator to order the web content articles
853             * @return the range of matching web content articles ordered by the
854             *         comparator
855             */
856            @Override
857            public List<JournalArticle> getArticlesByStructureId(
858                    long groupId, String ddmStructureKey, int start, int end,
859                    OrderByComparator<JournalArticle> obc) {
860    
861                    QueryDefinition<JournalArticle> queryDefinition =
862                            new QueryDefinition<JournalArticle>(
863                                    WorkflowConstants.STATUS_ANY, start, end, obc);
864    
865                    return journalArticleFinder.filterFindByG_C_S(
866                            groupId, JournalArticleConstants.CLASSNAME_ID_DEFAULT,
867                            ddmStructureKey, queryDefinition);
868            }
869    
870            /**
871             * Returns the number of web content articles matching the group and folder.
872             *
873             * @param  groupId the primary key of the web content article's group
874             * @param  folderId the primary key of the web content article folder
875             * @return the number of matching web content articles
876             */
877            @Override
878            public int getArticlesCount(long groupId, long folderId) {
879                    return getArticlesCount(
880                            groupId, folderId, WorkflowConstants.STATUS_ANY);
881            }
882    
883            /**
884             * Returns the number of web content articles matching the group, folder,
885             * and status.
886             *
887             * @param  groupId the primary key of the web content article's group
888             * @param  folderId the primary key of the web content article's folder
889             * @param  status the web content article's workflow status. For more
890             *         information see {@link WorkflowConstants} for constants starting
891             *         with the "STATUS_" prefix.
892             * @return the number of matching web content articles
893             */
894            @Override
895            public int getArticlesCount(long groupId, long folderId, int status) {
896                    QueryDefinition<JournalArticle> queryDefinition =
897                            new QueryDefinition<JournalArticle>(status);
898    
899                    List<Long> folderIds = new ArrayList<Long>();
900    
901                    folderIds.add(folderId);
902    
903                    return journalArticleFinder.filterCountByG_F(
904                            groupId, folderIds, queryDefinition);
905            }
906    
907            /**
908             * Returns the number of web content articles matching the group and article
909             * ID.
910             *
911             * @param  groupId the primary key of the web content article's group
912             * @param  articleId the primary key of the web content article
913             * @return the number of matching web content articles
914             */
915            @Override
916            public int getArticlesCountByArticleId(long groupId, String articleId) {
917                    return journalArticlePersistence.filterCountByG_A(groupId, articleId);
918            }
919    
920            /**
921             * Returns the number of web content articles matching the group, class name
922             * ID, DDM structure key, and workflow status.
923             *
924             * @param  groupId the primary key of the web content article's group
925             * @param  classNameId the primary key of the DDMStructure class if the web
926             *         content article is related to a DDM structure, the primary key of
927             *         the class name associated with the article, or {@link
928             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
929             * @param  ddmStructureKey the primary key of the web content article's DDM
930             *         structure
931             * @param  status the web content article's workflow status. For more
932             *         information see {@link WorkflowConstants} for constants starting
933             *         with the "STATUS_" prefix.
934             * @return the number of matching web content articles
935             */
936            @Override
937            public int getArticlesCountByStructureId(
938                    long groupId, long classNameId, String ddmStructureKey, int status) {
939    
940                    return journalArticleFinder.filterCountByG_C_S(
941                            groupId, classNameId, ddmStructureKey,
942                            new QueryDefinition<JournalArticle>(status));
943            }
944    
945            /**
946             * Returns the number of web content articles matching the group, default
947             * class name ID, and DDM structure key.
948             *
949             * @param  groupId the primary key of the web content article's group
950             * @param  ddmStructureKey the primary key of the web content article's DDM
951             *         structure
952             * @return the number of matching web content articles
953             */
954            @Override
955            public int getArticlesCountByStructureId(
956                    long groupId, String ddmStructureKey) {
957    
958                    return getArticlesCountByStructureId(
959                            groupId, JournalArticleConstants.CLASSNAME_ID_DEFAULT,
960                            ddmStructureKey, WorkflowConstants.STATUS_ANY);
961            }
962    
963            /**
964             * Returns the web content article matching the URL title that is currently
965             * displayed or next to be displayed if no article is currently displayed.
966             *
967             * @param  groupId the primary key of the web content article's group
968             * @param  urlTitle the web content article's accessible URL title
969             * @return the web content article matching the URL title that is currently
970             *         displayed, or next one to be displayed if no version of the
971             *         article is currently displayed
972             * @throws PortalException if the user did not have permission to view the
973             *         web content article or if no approved matching web content
974             *         articles could be found
975             */
976            @Override
977            public JournalArticle getDisplayArticleByUrlTitle(
978                            long groupId, String urlTitle)
979                    throws PortalException {
980    
981                    JournalArticle article =
982                            journalArticleLocalService.getDisplayArticleByUrlTitle(
983                                    groupId, urlTitle);
984    
985                    JournalArticlePermission.check(
986                            getPermissionChecker(), article, ActionKeys.VIEW);
987    
988                    return article;
989            }
990    
991            /**
992             * Returns the number of folders containing web content articles belonging
993             * to the group.
994             *
995             * @param  groupId the primary key of the web content article's group
996             * @param  folderIds the primary keys of the web content article folders
997             *         (optionally {@link java.util.Collections#EMPTY_LIST})
998             * @return the number of matching folders containing web content articles
999             */
1000            @Override
1001            public int getFoldersAndArticlesCount(long groupId, List<Long> folderIds) {
1002                    return journalArticlePersistence.filterCountByG_F(
1003                            groupId,
1004                            ArrayUtil.toArray(folderIds.toArray(new Long[folderIds.size()])));
1005            }
1006    
1007            /**
1008             * Returns an ordered range of all the web content articles matching the
1009             * group, user, the root folder or any of its subfolders.
1010             *
1011             * <p>
1012             * Useful when paginating results. Returns a maximum of <code>end -
1013             * start</code> instances. <code>start</code> and <code>end</code> are not
1014             * primary keys, they are indexes in the result set. Thus, <code>0</code>
1015             * refers to the first result in the set. Setting both <code>start</code>
1016             * and <code>end</code> to {@link
1017             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
1018             * result set.
1019             * </p>
1020             *
1021             * @param  groupId the primary key of the web content article's group
1022             * @param  userId the primary key of the user (optionally <code>0</code>)
1023             * @param  rootFolderId the primary key of the root folder to begin the
1024             *         search
1025             * @param  status the web content article's workflow status. For more
1026             *         information see {@link WorkflowConstants} for constants starting
1027             *         with the "STATUS_" prefix.
1028             * @param  start the lower bound of the range of web content articles to
1029             *         return
1030             * @param  end the upper bound of the range of web content articles to
1031             *         return (not inclusive)
1032             * @param  orderByComparator the comparator to order the web content
1033             *         articles
1034             * @return the range of matching web content articles ordered by the
1035             *         comparator
1036             * @throws PortalException if a portal exception occurred
1037             */
1038            @Override
1039            public List<JournalArticle> getGroupArticles(
1040                            long groupId, long userId, long rootFolderId, int status, int start,
1041                            int end, OrderByComparator<JournalArticle> orderByComparator)
1042                    throws PortalException {
1043    
1044                    List<Long> folderIds = new ArrayList<Long>();
1045    
1046                    if (rootFolderId != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
1047                            folderIds = journalFolderService.getFolderIds(
1048                                    groupId, rootFolderId);
1049                    }
1050    
1051                    QueryDefinition<JournalArticle> queryDefinition =
1052                            new QueryDefinition<JournalArticle>(
1053                                    status, start, end, orderByComparator);
1054    
1055                    return journalArticleFinder.filterFindByG_U_F_C(
1056                            groupId, userId, folderIds,
1057                            JournalArticleConstants.CLASSNAME_ID_DEFAULT, queryDefinition);
1058            }
1059    
1060            /**
1061             * Returns an ordered range of all the web content articles matching the
1062             * group, user, the root folder or any of its subfolders.
1063             *
1064             * <p>
1065             * Useful when paginating results. Returns a maximum of <code>end -
1066             * start</code> instances. <code>start</code> and <code>end</code> are not
1067             * primary keys, they are indexes in the result set. Thus, <code>0</code>
1068             * refers to the first result in the set. Setting both <code>start</code>
1069             * and <code>end</code> to {@link
1070             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
1071             * result set.
1072             * </p>
1073             *
1074             * @param  groupId the primary key of the web content article's group
1075             * @param  userId the primary key of the user (optionally <code>0</code>)
1076             * @param  rootFolderId the primary key of the root folder to begin the
1077             *         search
1078             * @param  start the lower bound of the range of web content articles to
1079             *         return
1080             * @param  end the upper bound of the range of web content articles to
1081             *         return (not inclusive)
1082             * @param  orderByComparator the comparator to order the web content
1083             *         articles
1084             * @return the range of matching web content articles ordered by the
1085             *         comparator
1086             * @throws PortalException if the root folder could not be found, if the
1087             *         current user did not have permission to view the root folder, or
1088             *         if a portal exception occurred
1089             */
1090            @Override
1091            public List<JournalArticle> getGroupArticles(
1092                            long groupId, long userId, long rootFolderId, int start, int end,
1093                            OrderByComparator<JournalArticle> orderByComparator)
1094                    throws PortalException {
1095    
1096                    return getGroupArticles(
1097                            groupId, userId, rootFolderId, WorkflowConstants.STATUS_ANY, start,
1098                            end, orderByComparator);
1099            }
1100    
1101            /**
1102             * Returns the number of web content articles matching the group, user, and
1103             * the root folder or any of its subfolders.
1104             *
1105             * @param  groupId the primary key of the web content article's group
1106             * @param  userId the primary key of the user (optionally <code>0</code>)
1107             * @param  rootFolderId the primary key of the root folder to begin the
1108             *         search
1109             * @return the number of matching web content articles
1110             * @throws PortalException if the root folder could not be found, if the
1111             *         current user did not have permission to view the root folder, or
1112             *         if a portal exception occurred
1113             */
1114            @Override
1115            public int getGroupArticlesCount(
1116                            long groupId, long userId, long rootFolderId)
1117                    throws PortalException {
1118    
1119                    return getGroupArticlesCount(
1120                            groupId, userId, rootFolderId, WorkflowConstants.STATUS_ANY);
1121            }
1122    
1123            /**
1124             * Returns the number of web content articles matching the group, user, and
1125             * the root folder or any of its subfolders.
1126             *
1127             * @param  groupId the primary key of the web content article's group
1128             * @param  userId the primary key of the user (optionally <code>0</code>)
1129             * @param  rootFolderId the primary key of the root folder to begin the
1130             *         search
1131             * @param  status the web content article's workflow status. For more
1132             *         information see {@link WorkflowConstants} for constants starting
1133             *         with the "STATUS_" prefix.
1134             * @return the number of matching web content articles
1135             * @throws PortalException if a portal exception occurred
1136             */
1137            @Override
1138            public int getGroupArticlesCount(
1139                            long groupId, long userId, long rootFolderId, int status)
1140                    throws PortalException {
1141    
1142                    List<Long> folderIds = new ArrayList<Long>();
1143    
1144                    if (rootFolderId != JournalFolderConstants.DEFAULT_PARENT_FOLDER_ID) {
1145                            folderIds = journalFolderService.getFolderIds(
1146                                    groupId, rootFolderId);
1147                    }
1148    
1149                    QueryDefinition<JournalArticle> queryDefinition =
1150                            new QueryDefinition<JournalArticle>(status);
1151    
1152                    return journalArticleFinder.filterCountByG_U_F_C(
1153                            groupId, userId, folderIds,
1154                            JournalArticleConstants.CLASSNAME_ID_DEFAULT, queryDefinition);
1155            }
1156    
1157            /**
1158             * Returns the latest web content article matching the resource primary key,
1159             * preferring articles with approved workflow status.
1160             *
1161             * @param  resourcePrimKey the primary key of the resource instance
1162             * @return the latest web content article matching the resource primary key,
1163             *         preferring articles with approved workflow status
1164             * @throws PortalException if the user did not have permission to view the
1165             *         web content article or if a matching web content article could
1166             *         not be found
1167             */
1168            @Override
1169            public JournalArticle getLatestArticle(long resourcePrimKey)
1170                    throws PortalException {
1171    
1172                    JournalArticlePermission.check(
1173                            getPermissionChecker(), resourcePrimKey, ActionKeys.VIEW);
1174    
1175                    return journalArticleLocalService.getLatestArticle(resourcePrimKey);
1176            }
1177    
1178            /**
1179             * Returns the latest web content article matching the group, article ID,
1180             * and workflow status.
1181             *
1182             * @param  groupId the primary key of the web content article's group
1183             * @param  articleId the primary key of the web content article
1184             * @param  status the web content article's workflow status. For more
1185             *         information see {@link WorkflowConstants} for constants starting
1186             *         with the "STATUS_" prefix.
1187             * @return the latest matching web content article
1188             * @throws PortalException if the user did not have permission to view the
1189             *         web content article or if a matching web content article could
1190             *         not be found
1191             */
1192            @Override
1193            public JournalArticle getLatestArticle(
1194                            long groupId, String articleId, int status)
1195                    throws PortalException {
1196    
1197                    JournalArticlePermission.check(
1198                            getPermissionChecker(), groupId, articleId, status,
1199                            ActionKeys.VIEW);
1200    
1201                    return journalArticleLocalService.getLatestArticle(
1202                            groupId, articleId, status);
1203            }
1204    
1205            /**
1206             * Returns the latest web content article matching the group, class name ID,
1207             * and class PK.
1208             *
1209             * @param  groupId the primary key of the web content article's group
1210             * @param  className the DDMStructure class name if the web content article
1211             *         is related to a DDM structure, the class name associated with the
1212             *         article, or {@link JournalArticleConstants#CLASSNAME_ID_DEFAULT}
1213             *         otherwise
1214             * @param  classPK the primary key of the DDM structure, if the DDMStructure
1215             *         class name is given as the <code>className</code> parameter, the
1216             *         primary key of the class associated with the web content article,
1217             *         or <code>0</code> otherwise
1218             * @return the latest matching web content article
1219             * @throws PortalException if a matching web content article could not be
1220             *         found or if the user did not have permission to view the web
1221             *         content article
1222             */
1223            @Override
1224            public JournalArticle getLatestArticle(
1225                            long groupId, String className, long classPK)
1226                    throws PortalException {
1227    
1228                    JournalArticle article = journalArticleLocalService.getLatestArticle(
1229                            groupId, className, classPK);
1230    
1231                    JournalArticlePermission.check(
1232                            getPermissionChecker(), groupId, article.getArticleId(),
1233                            article.getVersion(), ActionKeys.VIEW);
1234    
1235                    return article;
1236            }
1237    
1238            /**
1239             * Moves all versions of the the web content article matching the group and
1240             * article ID to the folder.
1241             *
1242             * @param  groupId the primary key of the web content article's group
1243             * @param  articleId the primary key of the web content article
1244             * @param  newFolderId the primary key of the web content article's new
1245             *         folder
1246             * @throws PortalException if the user did not have permission to update any
1247             *         one of the versions of the web content article or if any one of
1248             *         the versions of the web content article could not be moved to the
1249             *         folder
1250             */
1251            @Override
1252            public void moveArticle(long groupId, String articleId, long newFolderId)
1253                    throws PortalException {
1254    
1255                    JournalFolderPermission.check(
1256                            getPermissionChecker(), groupId, newFolderId,
1257                            ActionKeys.ADD_ARTICLE);
1258    
1259                    List<JournalArticle> articles = journalArticlePersistence.findByG_A(
1260                            groupId, articleId);
1261    
1262                    for (JournalArticle article : articles) {
1263                            JournalArticlePermission.check(
1264                                    getPermissionChecker(), article, ActionKeys.UPDATE);
1265    
1266                            journalArticleLocalService.moveArticle(
1267                                    groupId, articleId, newFolderId);
1268                    }
1269            }
1270    
1271            /**
1272             * Moves the web content article from the Recycle Bin to the folder.
1273             *
1274             * @param  groupId the primary key of the web content article's group
1275             * @param  resourcePrimKey the primary key of the resource instance
1276             * @param  newFolderId the primary key of the web content article's new
1277             *         folder
1278             * @param  serviceContext the service context to be applied. Can set the
1279             *         modification date, portlet preferences, and can set whether to
1280             *         add the default command update for the web content article. With
1281             *         respect to social activities, by setting the service context's
1282             *         command to {@link
1283             *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
1284             *         is considered a web content update activity; otherwise it is
1285             *         considered a web content add activity.
1286             * @return the updated web content article, which was moved from the Recycle
1287             *         Bin to the folder
1288             * @throws PortalException if the user did not have permission to view or
1289             *         update the web content article, if a matching trashed web content
1290             *         article could not be found, or if a portal exception occurred
1291             */
1292            @Override
1293            public JournalArticle moveArticleFromTrash(
1294                            long groupId, long resourcePrimKey, long newFolderId,
1295                            ServiceContext serviceContext)
1296                    throws PortalException {
1297    
1298                    JournalArticle article = getLatestArticle(resourcePrimKey);
1299    
1300                    JournalArticlePermission.check(
1301                            getPermissionChecker(), article, ActionKeys.UPDATE);
1302    
1303                    return journalArticleLocalService.moveArticleFromTrash(
1304                            getUserId(), groupId, article, newFolderId, serviceContext);
1305            }
1306    
1307            /**
1308             * Moves the web content article from the Recycle Bin to the folder.
1309             *
1310             * @param  groupId the primary key of the web content article's group
1311             * @param  articleId the primary key of the web content article
1312             * @param  newFolderId the primary key of the web content article's new
1313             *         folder
1314             * @param  serviceContext the service context to be applied. Can set the
1315             *         modification date, portlet preferences, and can set whether to
1316             *         add the default command update for the web content article. With
1317             *         respect to social activities, by setting the service context's
1318             *         command to {@link
1319             *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
1320             *         is considered a web content update activity; otherwise it is
1321             *         considered a web content add activity.
1322             * @return the updated web content article, which was moved from the Recycle
1323             *         Bin to the folder
1324             * @throws PortalException if the user did not have permission to view or
1325             *         update the web content article, if a trashed web content article
1326             *         with the primary key could not be found, or if a portal exception
1327             *         occurred
1328             */
1329            @Override
1330            public JournalArticle moveArticleFromTrash(
1331                            long groupId, String articleId, long newFolderId,
1332                            ServiceContext serviceContext)
1333                    throws PortalException {
1334    
1335                    JournalArticle article = getLatestArticle(
1336                            groupId, articleId, WorkflowConstants.STATUS_IN_TRASH);
1337    
1338                    JournalArticlePermission.check(
1339                            getPermissionChecker(), groupId, articleId, ActionKeys.UPDATE);
1340    
1341                    return journalArticleLocalService.moveArticleFromTrash(
1342                            getUserId(), groupId, article, newFolderId, serviceContext);
1343            }
1344    
1345            /**
1346             * Moves the latest version of the web content article matching the group
1347             * and article ID to the recycle bin.
1348             *
1349             * @param  groupId the primary key of the web content article's group
1350             * @param  articleId the primary key of the web content article
1351             * @return the moved web content article or <code>null</code> if no matching
1352             *         article was found
1353             * @throws PortalException if the user did not have permission to move the
1354             *         article to the Recycle Bin or if a portal exception occurred
1355             */
1356            @Override
1357            public JournalArticle moveArticleToTrash(long groupId, String articleId)
1358                    throws PortalException {
1359    
1360                    JournalArticlePermission.check(
1361                            getPermissionChecker(), groupId, articleId, ActionKeys.DELETE);
1362    
1363                    return journalArticleLocalService.moveArticleToTrash(
1364                            getUserId(), groupId, articleId);
1365            }
1366    
1367            /**
1368             * Removes the web content of all the company's web content articles
1369             * matching the language.
1370             *
1371             * @param  companyId the primary key of the web content article's company
1372             * @param  languageId the primary key of the language locale to remove
1373             * @throws PortalException if the user did not have permission to update any
1374             *         one of the the web content articles or if web content matching
1375             *         the language could not be found for any one of the articles
1376             */
1377            @Override
1378            public void removeArticleLocale(long companyId, String languageId)
1379                    throws PortalException {
1380    
1381                    for (JournalArticle article :
1382                                    journalArticlePersistence.findByCompanyId(companyId)) {
1383    
1384                            removeArticleLocale(
1385                                    article.getGroupId(), article.getArticleId(),
1386                                    article.getVersion(), languageId);
1387                    }
1388            }
1389    
1390            /**
1391             * Removes the web content of the web content article matching the group,
1392             * article ID, and version, and language.
1393             *
1394             * @param  groupId the primary key of the web content article's group
1395             * @param  articleId the primary key of the web content article
1396             * @param  version the web content article's version
1397             * @param  languageId the primary key of the language locale to remove
1398             * @return the updated web content article with the locale removed
1399             * @throws PortalException if the user did not have permission to update the
1400             *         web content article or if a matching web content article could
1401             *         not be found
1402             */
1403            @Override
1404            public JournalArticle removeArticleLocale(
1405                            long groupId, String articleId, double version, String languageId)
1406                    throws PortalException {
1407    
1408                    JournalArticlePermission.check(
1409                            getPermissionChecker(), groupId, articleId, version,
1410                            ActionKeys.UPDATE);
1411    
1412                    return journalArticleLocalService.removeArticleLocale(
1413                            groupId, articleId, version, languageId);
1414            }
1415    
1416            /**
1417             * Restores the web content article associated with the resource primary key
1418             * from the Recycle Bin.
1419             *
1420             * @param  resourcePrimKey the primary key of the resource instance
1421             * @throws PortalException if a matching web content article could not be
1422             *         found in the Recycle Bin, if the user did not have permission to
1423             *         view or restore the article, or if a portal exception occurred
1424             */
1425            @Override
1426            public void restoreArticleFromTrash(long resourcePrimKey)
1427                    throws PortalException {
1428    
1429                    JournalArticle article = getLatestArticle(resourcePrimKey);
1430    
1431                    JournalArticlePermission.check(
1432                            getPermissionChecker(), article, ActionKeys.DELETE);
1433    
1434                    journalArticleLocalService.restoreArticleFromTrash(
1435                            getUserId(), article);
1436            }
1437    
1438            /**
1439             * Restores the web content article from the Recycle Bin.
1440             *
1441             * @param  groupId the primary key of the web content article's group
1442             * @param  articleId the primary key of the web content article
1443             * @throws PortalException if the web content article with the primary key
1444             *         could not be found in the Recycle Bin, if the user did not have
1445             *         permission to restore the article, or if a portal exception
1446             *         occurred
1447             */
1448            @Override
1449            public void restoreArticleFromTrash(long groupId, String articleId)
1450                    throws PortalException {
1451    
1452                    JournalArticle article = getLatestArticle(
1453                            groupId, articleId, WorkflowConstants.STATUS_IN_TRASH);
1454    
1455                    restoreArticleFromTrash(article.getResourcePrimKey());
1456            }
1457    
1458            /**
1459             * Returns a range of all the web content articles matching the group, creator,
1460             * creator, and workflow status using the indexer. It is preferable to use this
1461             * method instead of the non-indexed version whenever possible for performance
1462             * reasons.
1463             *
1464             * <p>
1465             * Useful when paginating results. Returns a maximum of <code>end -
1466             * start</code> instances. <code>start</code> and <code>end</code> are not
1467             * primary keys, they are indexes in the result set. Thus, <code>0</code>
1468             * refers to the first result in the set. Setting both <code>start</code>
1469             * and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full
1470             * result set.
1471             * </p>
1472             *
1473             * @param  groupId the primary key of the web content article's group
1474             * @param  creatorUserId the primary key of the web content article's
1475             *         creator
1476             * @param  status the web content article's workflow status. For more
1477             *         information see {@link WorkflowConstants} for constants starting
1478             *         with the "STATUS_" prefix.
1479             * @param  start the lower bound of the range of web content articles to
1480             *         return
1481             * @param  end the upper bound of the range of web content articles to
1482             *         return (not inclusive)
1483             * @return the matching web content articles
1484             * @throws PortalException if a portal exception occurred
1485             */
1486            @Override
1487            public Hits search(
1488                            long groupId, long creatorUserId, int status, int start, int end)
1489                    throws PortalException {
1490    
1491                    return journalArticleLocalService.search(
1492                            groupId, getUserId(), creatorUserId, status, start, end);
1493            }
1494    
1495            /**
1496             * Returns an ordered range of all the web content articles matching the
1497             * parameters, including a keywords parameter for matching with the
1498             * article's ID, title, description, and content, a DDM structure key
1499             * parameter, and a DDM template key parameter.
1500             *
1501             * <p>
1502             * Useful when paginating results. Returns a maximum of <code>end -
1503             * start</code> instances. <code>start</code> and <code>end</code> are not
1504             * primary keys, they are indexes in the result set. Thus, <code>0</code>
1505             * refers to the first result in the set. Setting both <code>start</code>
1506             * and <code>end</code> to {@link
1507             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
1508             * result set.
1509             * </p>
1510             *
1511             * @param  companyId the primary key of the web content article's company
1512             * @param  groupId the primary key of the group (optionally <code>0</code>)
1513             * @param  folderIds the primary keys of the web content article folders
1514             *         (optionally {@link java.util.Collections#EMPTY_LIST})
1515             * @param  classNameId the primary key of the DDMStructure class if the web
1516             *         content article is related to a DDM structure, the primary key of
1517             *         the class name associated with the article, or {@link
1518             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
1519             * @param  keywords the keywords (space separated), which may occur in the
1520             *         web content article ID, title, description, or content
1521             *         (optionally <code>null</code>). If the keywords value is not
1522             *         <code>null</code>, the search uses the OR operator in connecting
1523             *         query criteria; otherwise it uses the AND operator.
1524             * @param  version the web content article's version (optionally
1525             *         <code>null</code>)
1526             * @param  type the web content article's type (optionally
1527             *         <code>null</code>)
1528             * @param  ddmStructureKey the primary key of the web content article's DDM
1529             *         structure, if the article is related to a DDM structure, or
1530             *         <code>null</code> otherwise
1531             * @param  ddmTemplateKey the primary key of the web content article's DDM
1532             *         template
1533             * @param  displayDateGT the date after which a matching web content
1534             *         article's display date must be after (optionally
1535             *         <code>null</code>)
1536             * @param  displayDateLT the date before which a matching web content
1537             *         article's display date must be before (optionally
1538             *         <code>null</code>)
1539             * @param  status the web content article's workflow status. For more
1540             *         information see {@link WorkflowConstants} for constants starting
1541             *         with the "STATUS_" prefix.
1542             * @param  reviewDate the web content article's scheduled review date
1543             *         (optionally <code>null</code>)
1544             * @param  start the lower bound of the range of web content articles to
1545             *         return
1546             * @param  end the upper bound of the range of web content articles to
1547             *         return (not inclusive)
1548             * @param  obc the comparator to order the web content articles
1549             * @return the range of matching web content articles ordered by the
1550             *         comparator
1551             */
1552            @Override
1553            public List<JournalArticle> search(
1554                    long companyId, long groupId, List<Long> folderIds, long classNameId,
1555                    String keywords, Double version, String type, String ddmStructureKey,
1556                    String ddmTemplateKey, Date displayDateGT, Date displayDateLT,
1557                    int status, Date reviewDate, int start, int end,
1558                    OrderByComparator<JournalArticle> obc) {
1559    
1560                    return journalArticleFinder.filterFindByKeywords(
1561                            companyId, groupId, folderIds, classNameId, keywords, version, type,
1562                            ddmStructureKey, ddmTemplateKey, displayDateGT, displayDateLT,
1563                            status, reviewDate, start, end, obc);
1564            }
1565    
1566            /**
1567             * Returns an ordered range of all the web content articles matching the
1568             * parameters, including keyword parameters for article ID, title,
1569             * description, and content, a DDM structure key parameter, a DDM template
1570             * key parameter, and an AND operator switch.
1571             *
1572             * <p>
1573             * Useful when paginating results. Returns a maximum of <code>end -
1574             * start</code> instances. <code>start</code> and <code>end</code> are not
1575             * primary keys, they are indexes in the result set. Thus, <code>0</code>
1576             * refers to the first result in the set. Setting both <code>start</code>
1577             * and <code>end</code> to {@link
1578             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
1579             * result set.
1580             * </p>
1581             *
1582             * @param  companyId the primary key of the web content article's company
1583             * @param  groupId the primary key of the group (optionally <code>0</code>)
1584             * @param  folderIds the primary keys of the web content article folders
1585             *         (optionally {@link java.util.Collections#EMPTY_LIST})
1586             * @param  classNameId the primary key of the DDMStructure class if the web
1587             *         content article is related to a DDM structure, the primary key of
1588             *         the class name associated with the article, or {@link
1589             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
1590             * @param  articleId the article ID keywords (space separated, optionally
1591             *         <code>null</code>)
1592             * @param  version the web content article's version (optionally
1593             *         <code>null</code>)
1594             * @param  title the title keywords (space separated, optionally
1595             *         <code>null</code>)
1596             * @param  description the description keywords (space separated, optionally
1597             *         <code>null</code>)
1598             * @param  content the content keywords (space separated, optionally
1599             *         <code>null</code>)
1600             * @param  type the web content article's type (optionally
1601             *         <code>null</code>)
1602             * @param  ddmStructureKey the primary key of the web content article's DDM
1603             *         structure, if the article is related to a DDM structure, or
1604             *         <code>null</code> otherwise
1605             * @param  ddmTemplateKey the primary key of the web content article's DDM
1606             *         template
1607             * @param  displayDateGT the date after which a matching web content
1608             *         article's display date must be after (optionally
1609             *         <code>null</code>)
1610             * @param  displayDateLT the date before which a matching web content
1611             *         article's display date must be before (optionally
1612             *         <code>null</code>)
1613             * @param  status the web content article's workflow status. For more
1614             *         information see {@link WorkflowConstants} for constants starting
1615             *         with the "STATUS_" prefix.
1616             * @param  reviewDate the web content article's scheduled review date
1617             *         (optionally <code>null</code>)
1618             * @param  andOperator whether every field must match its value or keywords,
1619             *         or just one field must match. Company, group, folder IDs, class
1620             *         name ID, and status must all match their values.
1621             * @param  start the lower bound of the range of web content articles to
1622             *         return
1623             * @param  end the upper bound of the range of web content articles to
1624             *         return (not inclusive)
1625             * @param  obc the comparator to order the web content articles
1626             * @return the range of matching web content articles ordered by the
1627             *         comparator
1628             */
1629            @Override
1630            public List<JournalArticle> search(
1631                    long companyId, long groupId, List<Long> folderIds, long classNameId,
1632                    String articleId, Double version, String title, String description,
1633                    String content, String type, String ddmStructureKey,
1634                    String ddmTemplateKey, Date displayDateGT, Date displayDateLT,
1635                    int status, Date reviewDate, boolean andOperator, int start, int end,
1636                    OrderByComparator<JournalArticle> obc) {
1637    
1638                    QueryDefinition<JournalArticle> queryDefinition =
1639                            new QueryDefinition<JournalArticle>(status, start, end, obc);
1640    
1641                    return journalArticleFinder.filterFindByC_G_F_C_A_V_T_D_C_T_S_T_D_R(
1642                            companyId, groupId, folderIds, classNameId, articleId, version,
1643                            title, description, content, type, ddmStructureKey, ddmTemplateKey,
1644                            displayDateGT, displayDateLT, reviewDate, andOperator,
1645                            queryDefinition);
1646            }
1647    
1648            /**
1649             * Returns an ordered range of all the web content articles matching the
1650             * parameters, including keyword parameters for article ID, title,
1651             * description, and content, a DDM structure keys (plural) parameter, a DDM
1652             * template keys (plural) parameter, and an AND operator switch.
1653             *
1654             * <p>
1655             * Useful when paginating results. Returns a maximum of <code>end -
1656             * start</code> instances. <code>start</code> and <code>end</code> are not
1657             * primary keys, they are indexes in the result set. Thus, <code>0</code>
1658             * refers to the first result in the set. Setting both <code>start</code>
1659             * and <code>end</code> to {@link
1660             * com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full
1661             * result set.
1662             * </p>
1663             *
1664             * @param  companyId the primary key of the web content article's company
1665             * @param  groupId the primary key of the group (optionally <code>0</code>)
1666             * @param  folderIds the primary keys of the web content article folders
1667             *         (optionally {@link java.util.Collections#EMPTY_LIST})
1668             * @param  classNameId the primary key of the DDMStructure class if the web
1669             *         content article is related to a DDM structure, the primary key of
1670             *         the class name associated with the article, or {@link
1671             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
1672             * @param  articleId the article ID keywords (space separated, optionally
1673             *         <code>null</code>)
1674             * @param  version the web content article's version (optionally
1675             *         <code>null</code>)
1676             * @param  title the title keywords (space separated, optionally
1677             *         <code>null</code>)
1678             * @param  description the description keywords (space separated, optionally
1679             *         <code>null</code>)
1680             * @param  content the content keywords (space separated, optionally
1681             *         <code>null</code>)
1682             * @param  type the web content article's type (optionally
1683             *         <code>null</code>)
1684             * @param  ddmStructureKeys the primary keys of the web content article's
1685             *         DDM structures, if the article is related to a DDM structure, or
1686             *         <code>null</code> otherwise
1687             * @param  ddmTemplateKeys the primary keys of the web content article's DDM
1688             *         templates (originally <code>null</code>). If the articles are
1689             *         related to a DDM structure, the template's structure must match
1690             *         it.
1691             * @param  displayDateGT the date after which a matching web content
1692             *         article's display date must be after (optionally
1693             *         <code>null</code>)
1694             * @param  displayDateLT the date before which a matching web content
1695             *         article's display date must be before (optionally
1696             *         <code>null</code>)
1697             * @param  status the web content article's workflow status. For more
1698             *         information see {@link WorkflowConstants} for constants starting
1699             *         with the "STATUS_" prefix.
1700             * @param  reviewDate the web content article's scheduled review date
1701             *         (optionally <code>null</code>)
1702             * @param  andOperator whether every field must match its value or keywords,
1703             *         or just one field must match.  Company, group, folder IDs, class
1704             *         name ID, and status must all match their values.
1705             * @param  start the lower bound of the range of web content articles to
1706             *         return
1707             * @param  end the upper bound of the range of web content articles to
1708             *         return (not inclusive)
1709             * @param  obc the comparator to order the web content articles
1710             * @return the range of matching web content articles ordered by the
1711             *         comparator
1712             */
1713            @Override
1714            public List<JournalArticle> search(
1715                    long companyId, long groupId, List<Long> folderIds, long classNameId,
1716                    String articleId, Double version, String title, String description,
1717                    String content, String type, String[] ddmStructureKeys,
1718                    String[] ddmTemplateKeys, Date displayDateGT, Date displayDateLT,
1719                    int status, Date reviewDate, boolean andOperator, int start, int end,
1720                    OrderByComparator<JournalArticle> obc) {
1721    
1722                    QueryDefinition<JournalArticle> queryDefinition =
1723                            new QueryDefinition<JournalArticle>(status, start, end, obc);
1724    
1725                    return journalArticleFinder.filterFindByC_G_F_C_A_V_T_D_C_T_S_T_D_R(
1726                            companyId, groupId, folderIds, classNameId, articleId, version,
1727                            title, description, content, type, ddmStructureKeys,
1728                            ddmTemplateKeys, displayDateGT, displayDateLT, reviewDate,
1729                            andOperator, queryDefinition);
1730            }
1731    
1732            /**
1733             * Returns the number of web content articles matching the parameters,
1734             * including a keywords parameter for matching with the article's ID, title,
1735             * description, and content, a DDM structure key parameter, and a DDM
1736             * template key parameter.
1737             *
1738             * @param  companyId the primary key of the web content article's company
1739             * @param  groupId the primary key of the group (optionally <code>0</code>)
1740             * @param  folderIds the primary keys of the web content article folders
1741             *         (optionally {@link java.util.Collections#EMPTY_LIST})
1742             * @param  classNameId the primary key of the DDMStructure class if the web
1743             *         content article is related to a DDM structure, the primary key of
1744             *         the class name associated with the article, or {@link
1745             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
1746             * @param  keywords the keywords (space separated), which may occur in the
1747             *         web content article ID, title, description, or content
1748             *         (optionally <code>null</code>). If the keywords value is not
1749             *         <code>null</code>, the search uses the OR operator in connecting
1750             *         query criteria; otherwise it uses the AND operator.
1751             * @param  version the web content article's version (optionally
1752             *         <code>null</code>)
1753             * @param  type the web content article's type (optionally
1754             *         <code>null</code>)
1755             * @param  ddmStructureKey the primary key of the web content article's DDM
1756             *         structure, if the article is related to a DDM structure, or
1757             *         <code>null</code> otherwise
1758             * @param  ddmTemplateKey the primary key of the web content article's DDM
1759             *         template
1760             * @param  displayDateGT the date after which a matching web content
1761             *         article's display date must be after (optionally
1762             *         <code>null</code>)
1763             * @param  displayDateLT the date before which a matching web content
1764             *         article's display date must be before (optionally
1765             *         <code>null</code>)
1766             * @param  status the web content article's workflow status. For more
1767             *         information see {@link WorkflowConstants} for constants starting
1768             *         with the "STATUS_" prefix.
1769             * @param  reviewDate the web content article's scheduled review date
1770             *         (optionally <code>null</code>)
1771             * @return the number of matching web content articles
1772             */
1773            @Override
1774            public int searchCount(
1775                    long companyId, long groupId, List<Long> folderIds, long classNameId,
1776                    String keywords, Double version, String type, String ddmStructureKey,
1777                    String ddmTemplateKey, Date displayDateGT, Date displayDateLT,
1778                    int status, Date reviewDate) {
1779    
1780                    return journalArticleFinder.filterCountByKeywords(
1781                            companyId, groupId, folderIds, classNameId, keywords, version, type,
1782                            ddmStructureKey, ddmTemplateKey, displayDateGT, displayDateLT,
1783                            status, reviewDate);
1784            }
1785    
1786            /**
1787             * Returns the number of web content articles matching the parameters,
1788             * including keyword parameters for article ID, title, description, and
1789             * content, a DDM structure key parameter, a DDM template key parameter, and
1790             * an AND operator switch.
1791             *
1792             * @param  companyId the primary key of the web content article's company
1793             * @param  groupId the primary key of the group (optionally <code>0</code>)
1794             * @param  folderIds the primary keys of the web content article folders
1795             *         (optionally {@link java.util.Collections#EMPTY_LIST})
1796             * @param  classNameId the primary key of the DDMStructure class if the web
1797             *         content article is related to a DDM structure, the primary key of
1798             *         the class name associated with the article, or {@link
1799             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
1800             * @param  articleId the article ID keywords (space separated, optionally
1801             *         <code>null</code>)
1802             * @param  version the web content article's version (optionally
1803             *         <code>null</code>)
1804             * @param  title the title keywords (space separated, optionally
1805             *         <code>null</code>)
1806             * @param  description the description keywords (space separated, optionally
1807             *         <code>null</code>)
1808             * @param  content the content keywords (space separated, optionally
1809             *         <code>null</code>)
1810             * @param  type the web content article's type (optionally
1811             *         <code>null</code>)
1812             * @param  ddmStructureKey the primary key of the web content article's DDM
1813             *         structure, if the article is related to a DDM structure, or
1814             *         <code>null</code> otherwise
1815             * @param  ddmTemplateKey the primary key of the web content article's DDM
1816             *         template
1817             * @param  displayDateGT the date after which a matching web content
1818             *         article's display date must be after (optionally
1819             *         <code>null</code>)
1820             * @param  displayDateLT the date before which a matching web content
1821             *         article's display date must be before (optionally
1822             *         <code>null</code>)
1823             * @param  status the web content article's workflow status. For more
1824             *         information see {@link WorkflowConstants} for constants starting
1825             *         with the "STATUS_" prefix.
1826             * @param  reviewDate the web content article's scheduled review date
1827             *         (optionally <code>null</code>)
1828             * @param  andOperator whether every field must match its value or keywords,
1829             *         or just one field must match. Group, folder IDs, class name ID,
1830             *         and status must all match their values.
1831             * @return the number of matching web content articles
1832             */
1833            @Override
1834            public int searchCount(
1835                    long companyId, long groupId, List<Long> folderIds, long classNameId,
1836                    String articleId, Double version, String title, String description,
1837                    String content, String type, String ddmStructureKey,
1838                    String ddmTemplateKey, Date displayDateGT, Date displayDateLT,
1839                    int status, Date reviewDate, boolean andOperator) {
1840    
1841                    return journalArticleFinder.filterCountByC_G_F_C_A_V_T_D_C_T_S_T_D_R(
1842                            companyId, groupId, folderIds, classNameId, articleId, version,
1843                            title, description, content, type, ddmStructureKey, ddmTemplateKey,
1844                            displayDateGT, displayDateLT, reviewDate, andOperator,
1845                            new QueryDefinition<JournalArticle>(status));
1846            }
1847    
1848            /**
1849             * Returns the number of web content articles matching the parameters,
1850             * including keyword parameters for article ID, title, description, and
1851             * content, a DDM structure keys (plural) parameter, a DDM template keys
1852             * (plural) parameter, and an AND operator switch.
1853             *
1854             * @param  companyId the primary key of the web content article's company
1855             * @param  groupId the primary key of the group (optionally <code>0</code>)
1856             * @param  folderIds the primary keys of the web content article folders
1857             *         (optionally {@link java.util.Collections#EMPTY_LIST})
1858             * @param  classNameId the primary key of the DDMStructure class if the web
1859             *         content article is related to a DDM structure, the primary key of
1860             *         the class name associated with the article, or {@link
1861             *         JournalArticleConstants#CLASSNAME_ID_DEFAULT} otherwise
1862             * @param  articleId the article ID keywords (space separated, optionally
1863             *         <code>null</code>)
1864             * @param  version the web content article's version (optionally
1865             *         <code>null</code>)
1866             * @param  title the title keywords (space separated, optionally
1867             *         <code>null</code>)
1868             * @param  description the description keywords (space separated, optionally
1869             *         <code>null</code>)
1870             * @param  content the content keywords (space separated, optionally
1871             *         <code>null</code>)
1872             * @param  type the web content article's type (optionally
1873             *         <code>null</code>)
1874             * @param  ddmStructureKeys the primary keys of the web content article's
1875             *         DDM structures, if the article is related to a DDM structure, or
1876             *         <code>null</code> otherwise
1877             * @param  ddmTemplateKeys the primary keys of the web content article's DDM
1878             *         templates (originally <code>null</code>). If the articles are
1879             *         related to a DDM structure, the template's structure must match
1880             *         it.
1881             * @param  displayDateGT the date after which a matching web content
1882             *         article's display date must be after (optionally
1883             *         <code>null</code>)
1884             * @param  displayDateLT the date before which a matching web content
1885             *         article's display date must be before (optionally
1886             *         <code>null</code>)
1887             * @param  status the web content article's workflow status. For more
1888             *         information see {@link WorkflowConstants} for constants starting
1889             *         with the "STATUS_" prefix.
1890             * @param  reviewDate the web content article's scheduled review date
1891             *         (optionally <code>null</code>)
1892             * @param  andOperator whether every field must match its value or keywords,
1893             *         or just one field must match.  Group, folder IDs, class name ID,
1894             *         and status must all match their values.
1895             * @return the number of matching web content articles
1896             */
1897            @Override
1898            public int searchCount(
1899                    long companyId, long groupId, List<Long> folderIds, long classNameId,
1900                    String articleId, Double version, String title, String description,
1901                    String content, String type, String[] ddmStructureKeys,
1902                    String[] ddmTemplateKeys, Date displayDateGT, Date displayDateLT,
1903                    int status, Date reviewDate, boolean andOperator) {
1904    
1905                    return journalArticleFinder.filterCountByC_G_F_C_A_V_T_D_C_T_S_T_D_R(
1906                            companyId, groupId, folderIds, classNameId, articleId, version,
1907                            title, description, content, type, ddmStructureKeys,
1908                            ddmTemplateKeys, displayDateGT, displayDateLT, reviewDate,
1909                            andOperator, new QueryDefinition<JournalArticle>(status));
1910            }
1911    
1912            /**
1913             * Subscribes the user to changes in elements that belong to the web content
1914             * article's DDM structure.
1915             *
1916             * @param  groupId the primary key of the folder's group
1917             * @param  userId the primary key of the user to be subscribed
1918             * @param  ddmStructureId the primary key of the structure to subscribe to
1919             * @throws PortalException if a matching user or group could not be found
1920             */
1921            @Override
1922            public void subscribeStructure(
1923                            long groupId, long userId, long ddmStructureId)
1924                    throws PortalException {
1925    
1926                    JournalPermission.check(
1927                            getPermissionChecker(), groupId, ActionKeys.SUBSCRIBE);
1928    
1929                    journalArticleLocalService.subscribeStructure(
1930                            groupId, userId, ddmStructureId);
1931            }
1932    
1933            /**
1934             * Unsubscribes the user from changes in elements that belong to the web
1935             * content article's DDM structure.
1936             *
1937             * @param  groupId the primary key of the folder's group
1938             * @param  userId the primary key of the user to be subscribed
1939             * @param  ddmStructureId the primary key of the structure to subscribe to
1940             * @throws PortalException if a matching user or subscription could not be
1941             *         found
1942             */
1943            @Override
1944            public void unsubscribeStructure(
1945                            long groupId, long userId, long ddmStructureId)
1946                    throws PortalException {
1947    
1948                    JournalPermission.check(
1949                            getPermissionChecker(), groupId, ActionKeys.SUBSCRIBE);
1950    
1951                    journalArticleLocalService.unsubscribeStructure(
1952                            groupId, userId, ddmStructureId);
1953            }
1954    
1955            /**
1956             * Updates the web content article matching the version, replacing its
1957             * folder, title, description, content, and layout UUID.
1958             *
1959             * @param  userId the primary key of the user updating the web content
1960             *         article
1961             * @param  groupId the primary key of the web content article's group
1962             * @param  folderId the primary key of the web content article folder
1963             * @param  articleId the primary key of the web content article
1964             * @param  version the web content article's version
1965             * @param  titleMap the web content article's locales and localized titles
1966             * @param  descriptionMap the web content article's locales and localized
1967             *         descriptions
1968             * @param  content the HTML content wrapped in XML. For more information,
1969             *         see the content example in the class description for {@link
1970             *         JournalArticleLocalServiceImpl}.
1971             * @param  layoutUuid the unique string identifying the web content
1972             *         article's display page
1973             * @param  serviceContext the service context to be applied. Can set the
1974             *         modification date, expando bridge attributes, asset category IDs,
1975             *         asset tag names, asset link entry IDs, workflow actions, the
1976             *         "defaultLanguageId" and "urlTitle" attributes, and can set
1977             *         whether to add the default command update for the web content
1978             *         article. With respect to social activities, by setting the
1979             *         service context's command to {@link
1980             *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
1981             *         is considered a web content update activity; otherwise it is
1982             *         considered a web content add activity.
1983             * @return the updated web content article
1984             * @throws PortalException if a user with the primary key or a matching web
1985             *         content article could not be found, or if a portal exception
1986             *         occurred
1987             */
1988            @Override
1989            public JournalArticle updateArticle(
1990                            long userId, long groupId, long folderId, String articleId,
1991                            double version, Map<Locale, String> titleMap,
1992                            Map<Locale, String> descriptionMap, String content,
1993                            String layoutUuid, ServiceContext serviceContext)
1994                    throws PortalException {
1995    
1996                    return journalArticleLocalService.updateArticle(
1997                            userId, groupId, folderId, articleId, version, titleMap,
1998                            descriptionMap, content, layoutUuid, serviceContext);
1999            }
2000    
2001            /**
2002             * Updates the web content article with additional parameters.
2003             *
2004             * @param  groupId the primary key of the web content article's group
2005             * @param  folderId the primary key of the web content article folder
2006             * @param  articleId the primary key of the web content article
2007             * @param  version the web content article's version
2008             * @param  titleMap the web content article's locales and localized titles
2009             * @param  descriptionMap the web content article's locales and localized
2010             *         descriptions
2011             * @param  content the HTML content wrapped in XML. For more information,
2012             *         see the content example in the class description for {@link
2013             *         JournalArticleLocalServiceImpl}.
2014             * @param  type the structure's type, if the web content article is related
2015             *         to a DDM structure. For more information, see {@link
2016             *         com.liferay.portlet.dynamicdatamapping.model.DDMStructureConstants}.
2017             * @param  ddmStructureKey the primary key of the web content article's DDM
2018             *         structure, if the article is related to a DDM structure, or
2019             *         <code>null</code> otherwise
2020             * @param  ddmTemplateKey the primary key of the web content article's DDM
2021             *         template
2022             * @param  layoutUuid the unique string identifying the web content
2023             *         article's display page
2024             * @param  displayDateMonth the month the web content article is set to
2025             *         display
2026             * @param  displayDateDay the calendar day the web content article is set to
2027             *         display
2028             * @param  displayDateYear the year the web content article is set to
2029             *         display
2030             * @param  displayDateHour the hour the web content article is set to
2031             *         display
2032             * @param  displayDateMinute the minute the web content article is set to
2033             *         display
2034             * @param  expirationDateMonth the month the web content article is set to
2035             *         expire
2036             * @param  expirationDateDay the calendar day the web content article is set
2037             *         to expire
2038             * @param  expirationDateYear the year the web content article is set to
2039             *         expire
2040             * @param  expirationDateHour the hour the web content article is set to
2041             *         expire
2042             * @param  expirationDateMinute the minute the web content article is set to
2043             *         expire
2044             * @param  neverExpire whether the web content article is not set to auto
2045             *         expire
2046             * @param  reviewDateMonth the month the web content article is set for
2047             *         review
2048             * @param  reviewDateDay the calendar day the web content article is set for
2049             *         review
2050             * @param  reviewDateYear the year the web content article is set for review
2051             * @param  reviewDateHour the hour the web content article is set for review
2052             * @param  reviewDateMinute the minute the web content article is set for
2053             *         review
2054             * @param  neverReview whether the web content article is not set for review
2055             * @param  indexable whether the web content is searchable
2056             * @param  smallImage whether to update web content article's a small image.
2057             *         A file must be passed in as <code>smallImageFile</code> value,
2058             *         otherwise the current small image is deleted.
2059             * @param  smallImageURL the web content article's small image URL
2060             *         (optionally <code>null</code>)
2061             * @param  smallFile the web content article's new small image file
2062             *         (optionally <code>null</code>). Must pass in
2063             *         <code>smallImage</code> value of <code>true</code> to replace the
2064             *         article's small image file.
2065             * @param  images the web content's images (optionally <code>null</code>)
2066             * @param  articleURL the web content article's accessible URL (optionally
2067             *         <code>null</code>)
2068             * @param  serviceContext the service context to be applied. Can set the
2069             *         modification date, expando bridge attributes, asset category IDs,
2070             *         asset tag names, asset link entry IDs, workflow actions, the
2071             *         "defaultLanguageId" and "urlTitle" attributes, and can set
2072             *         whether to add the default command update for the web content
2073             *         article. With respect to social activities, by setting the
2074             *         service context's command to {@link
2075             *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
2076             *         is considered a web content update activity; otherwise it is
2077             *         considered a web content add activity.
2078             * @return the updated web content article
2079             * @throws PortalException if the user did not have permission to update the
2080             *         web content article, if a user with the primary key or a matching
2081             *         web content article could not be found, or if a portal exception
2082             *         occurred
2083             */
2084            @Override
2085            public JournalArticle updateArticle(
2086                            long groupId, long folderId, String articleId, double version,
2087                            Map<Locale, String> titleMap, Map<Locale, String> descriptionMap,
2088                            String content, String type, String ddmStructureKey,
2089                            String ddmTemplateKey, String layoutUuid, int displayDateMonth,
2090                            int displayDateDay, int displayDateYear, int displayDateHour,
2091                            int displayDateMinute, int expirationDateMonth,
2092                            int expirationDateDay, int expirationDateYear,
2093                            int expirationDateHour, int expirationDateMinute,
2094                            boolean neverExpire, int reviewDateMonth, int reviewDateDay,
2095                            int reviewDateYear, int reviewDateHour, int reviewDateMinute,
2096                            boolean neverReview, boolean indexable, boolean smallImage,
2097                            String smallImageURL, File smallFile, Map<String, byte[]> images,
2098                            String articleURL, ServiceContext serviceContext)
2099                    throws PortalException {
2100    
2101                    JournalArticlePermission.check(
2102                            getPermissionChecker(), groupId, articleId, version,
2103                            ActionKeys.UPDATE);
2104    
2105                    return journalArticleLocalService.updateArticle(
2106                            getUserId(), groupId, folderId, articleId, version, titleMap,
2107                            descriptionMap, content, type, ddmStructureKey, ddmTemplateKey,
2108                            layoutUuid, displayDateMonth, displayDateDay, displayDateYear,
2109                            displayDateHour, displayDateMinute, expirationDateMonth,
2110                            expirationDateDay, expirationDateYear, expirationDateHour,
2111                            expirationDateMinute, neverExpire, reviewDateMonth, reviewDateDay,
2112                            reviewDateYear, reviewDateHour, reviewDateMinute, neverReview,
2113                            indexable, smallImage, smallImageURL, smallFile, images, articleURL,
2114                            serviceContext);
2115            }
2116    
2117            /**
2118             * Updates the web content article matching the version, replacing its
2119             * folder and content.
2120             *
2121             * @param  groupId the primary key of the web content article's group
2122             * @param  folderId the primary key of the web content article folder
2123             * @param  articleId the primary key of the web content article
2124             * @param  version the web content article's version
2125             * @param  content the HTML content wrapped in XML. For more information,
2126             *         see the content example in the class description for {@link
2127             *         JournalArticleLocalServiceImpl}.
2128             * @param  serviceContext the service context to be applied. Can set the
2129             *         modification date, expando bridge attributes, asset category IDs,
2130             *         asset tag names, asset link entry IDs, workflow actions, the
2131             *         "defaultLanguageId" and "urlTitle" attributes, and can set
2132             *         whether to add the default command update for the web content
2133             *         article. With respect to social activities, by setting the
2134             *         service context's command to {@link
2135             *         com.liferay.portal.kernel.util.Constants#UPDATE}, the invocation
2136             *         is considered a web content update activity; otherwise it is
2137             *         considered a web content add activity.
2138             * @return the updated web content article
2139             * @throws PortalException if the user did not have permission to update the
2140             *         web content article, if a user with the primary key or a matching
2141             *         web content article could not be found, or if a portal exception
2142             *         occurred
2143             */
2144            @Override
2145            public JournalArticle updateArticle(
2146                            long groupId, long folderId, String articleId, double version,
2147                            String content, ServiceContext serviceContext)
2148                    throws PortalException {
2149    
2150                    JournalArticlePermission.check(
2151                            getPermissionChecker(), groupId, articleId, version,
2152                            ActionKeys.UPDATE);
2153    
2154                    return journalArticleLocalService.updateArticle(
2155                            getUserId(), groupId, folderId, articleId, version, content,
2156                            serviceContext);
2157            }
2158    
2159            /**
2160             * @deprecated As of 6.2.0, replaced by {@link
2161             *             #updateArticleTranslation(long, String, double, Locale,
2162             *             String, String, String, Map, ServiceContext)}
2163             */
2164            @Deprecated
2165            @Override
2166            public JournalArticle updateArticleTranslation(
2167                            long groupId, String articleId, double version, Locale locale,
2168                            String title, String description, String content,
2169                            Map<String, byte[]> images)
2170                    throws PortalException {
2171    
2172                    return updateArticleTranslation(
2173                            groupId, articleId, version, locale, title, description, content,
2174                            images, null);
2175            }
2176    
2177            /**
2178             * Updates the translation of the web content article.
2179             *
2180             * @param  groupId the primary key of the web content article's group
2181             * @param  articleId the primary key of the web content article
2182             * @param  version the web content article's version
2183             * @param  locale the locale of the web content article's display template
2184             * @param  title the translated web content article title
2185             * @param  description the translated web content article description
2186             * @param  content the HTML content wrapped in XML. For more information,
2187             *         see the content example in the class description for {@link
2188             *         JournalArticleLocalServiceImpl}.
2189             * @param  images the web content's images
2190             * @param  serviceContext the service context to be applied. Can set the
2191             *         modification date and "urlTitle" attribute for the web content
2192             *         article.
2193             * @return the updated web content article
2194             * @throws PortalException if the user did not have permission to update the
2195             *         web content article, if a user with the primary key or a matching
2196             *         web content article could not be found, or if a portal exception
2197             *         occurred
2198             */
2199            @Override
2200            public JournalArticle updateArticleTranslation(
2201                            long groupId, String articleId, double version, Locale locale,
2202                            String title, String description, String content,
2203                            Map<String, byte[]> images, ServiceContext serviceContext)
2204                    throws PortalException {
2205    
2206                    JournalArticlePermission.check(
2207                            getPermissionChecker(), groupId, articleId, version,
2208                            ActionKeys.UPDATE);
2209    
2210                    return journalArticleLocalService.updateArticleTranslation(
2211                            groupId, articleId, version, locale, title, description, content,
2212                            images, serviceContext);
2213            }
2214    
2215            /**
2216             * Updates the web content article matching the group, article ID, and
2217             * version, replacing its content.
2218             *
2219             * @param  groupId the primary key of the web content article's group
2220             * @param  articleId the primary key of the web content article
2221             * @param  version the web content article's version
2222             * @param  content the HTML content wrapped in XML. For more information,
2223             *         see the content example in the class description for {@link
2224             *         JournalArticleLocalServiceImpl}.
2225             * @return the updated web content article
2226             * @throws PortalException if the user did not have permission to update the
2227             *         web content article or if a matching web content article could
2228             *         not be found
2229             */
2230            @Override
2231            public JournalArticle updateContent(
2232                            long groupId, String articleId, double version, String content)
2233                    throws PortalException {
2234    
2235                    JournalArticlePermission.check(
2236                            getPermissionChecker(), groupId, articleId, version,
2237                            ActionKeys.UPDATE);
2238    
2239                    return journalArticleLocalService.updateContent(
2240                            groupId, articleId, version, content);
2241            }
2242    
2243            /**
2244             * Updates the workflow status of the web content article matching the
2245             * group, article ID, and version.
2246             *
2247             * @param  groupId the primary key of the web content article's group
2248             * @param  articleId the primary key of the web content article
2249             * @param  version the web content article's version
2250             * @param  status the web content article's workflow status. For more
2251             *         information see {@link WorkflowConstants} for constants starting
2252             *         with the "STATUS_" prefix.
2253             * @param  articleURL the web content article's accessible URL
2254             * @param  serviceContext the service context to be applied. Can set the
2255             *         modification date, portlet preferences, and can set whether to
2256             *         add the default command update for the web content article.
2257             * @return the updated web content article
2258             * @throws PortalException if the user did not have permission to update the
2259             *         web content article, if a matching web content article could not
2260             *         be found, or if a portal exception occurred
2261             */
2262            @Override
2263            public JournalArticle updateStatus(
2264                            long groupId, String articleId, double version, int status,
2265                            String articleURL, ServiceContext serviceContext)
2266                    throws PortalException {
2267    
2268                    JournalArticlePermission.check(
2269                            getPermissionChecker(), groupId, articleId, version,
2270                            ActionKeys.UPDATE);
2271    
2272                    return journalArticleLocalService.updateStatus(
2273                            getUserId(), groupId, articleId, version, status, articleURL,
2274                            new HashMap<String, Serializable>(), serviceContext);
2275            }
2276    
2277    }