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