001 /** 002 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved. 003 * 004 * This library is free software; you can redistribute it and/or modify it under 005 * the terms of the GNU Lesser General Public License as published by the Free 006 * Software Foundation; either version 2.1 of the License, or (at your option) 007 * any later version. 008 * 009 * This library is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 011 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 012 * details. 013 */ 014 015 package com.liferay.portal.service.impl; 016 017 import com.liferay.portal.NoSuchLayoutException; 018 import com.liferay.portal.kernel.exception.PortalException; 019 import com.liferay.portal.kernel.exception.SystemException; 020 import com.liferay.portal.kernel.messaging.DestinationNames; 021 import com.liferay.portal.kernel.scheduler.CronTrigger; 022 import com.liferay.portal.kernel.scheduler.SchedulerEngineHelperUtil; 023 import com.liferay.portal.kernel.scheduler.StorageType; 024 import com.liferay.portal.kernel.scheduler.Trigger; 025 import com.liferay.portal.kernel.util.GetterUtil; 026 import com.liferay.portal.kernel.util.StringPool; 027 import com.liferay.portal.kernel.util.Validator; 028 import com.liferay.portal.kernel.uuid.PortalUUIDUtil; 029 import com.liferay.portal.messaging.LayoutsLocalPublisherRequest; 030 import com.liferay.portal.messaging.LayoutsRemotePublisherRequest; 031 import com.liferay.portal.model.Group; 032 import com.liferay.portal.model.Layout; 033 import com.liferay.portal.model.LayoutConstants; 034 import com.liferay.portal.model.LayoutReference; 035 import com.liferay.portal.model.LayoutTypePortlet; 036 import com.liferay.portal.model.Plugin; 037 import com.liferay.portal.security.permission.ActionKeys; 038 import com.liferay.portal.security.permission.PermissionChecker; 039 import com.liferay.portal.service.ServiceContext; 040 import com.liferay.portal.service.base.LayoutServiceBaseImpl; 041 import com.liferay.portal.service.permission.GroupPermissionUtil; 042 import com.liferay.portal.service.permission.LayoutPermissionUtil; 043 import com.liferay.portal.util.PortletKeys; 044 import com.liferay.portlet.PortletPreferencesFactoryUtil; 045 046 import java.io.File; 047 import java.io.InputStream; 048 049 import java.util.ArrayList; 050 import java.util.Date; 051 import java.util.List; 052 import java.util.Locale; 053 import java.util.Map; 054 055 /** 056 * The implementation of the layout service. 057 * 058 * @author Brian Wing Shun Chan 059 * @author Wesley Gong 060 */ 061 public class LayoutServiceImpl extends LayoutServiceBaseImpl { 062 063 /** 064 * Adds a layout with additional parameters. 065 * 066 * <p> 067 * This method handles the creation of the layout including its resources, 068 * metadata, and internal data structures. It is not necessary to make 069 * subsequent calls to any methods to setup default groups, resources, ... 070 * etc. 071 * </p> 072 * 073 * @param groupId the primary key of the group 074 * @param privateLayout whether the layout is private to the group 075 * @param parentLayoutId the primary key of the parent layout (optionally 076 * {@link 077 * com.liferay.portal.model.LayoutConstants#DEFAULT_PARENT_LAYOUT_ID}) 078 * @param localeNamesMap the layout's locales and localized names 079 * @param localeTitlesMap the layout's locales and localized titles 080 * @param descriptionMap the layout's locales and localized descriptions 081 * @param keywordsMap the layout's locales and localized keywords 082 * @param robotsMap the layout's locales and localized robots 083 * @param type the layout's type (optionally {@link 084 * com.liferay.portal.model.LayoutConstants#TYPE_PORTLET}). The 085 * possible types can be found in {@link 086 * com.liferay.portal.model.LayoutConstants}. 087 * @param hidden whether the layout is hidden 088 * @param friendlyURL the layout's friendly URL (optionally {@link 089 * com.liferay.portal.util.PropsValues#DEFAULT_USER_PRIVATE_LAYOUT_FRIENDLY_URL} 090 * or {@link 091 * com.liferay.portal.util.PropsValues#DEFAULT_USER_PUBLIC_LAYOUT_FRIENDLY_URL}). 092 * The default values can be overridden in 093 * <code>portal-ext.properties</code> by specifying new values for 094 * the corresponding properties defined in {@link 095 * com.liferay.portal.util.PropsValues}. To see how the URL is 096 * normalized when accessed see {@link 097 * com.liferay.portal.kernel.util.FriendlyURLNormalizerUtil#normalize( 098 * String)}. 099 * @param serviceContext the service context. Must set the UUID for the 100 * layout. Can set the creation date, modification date and the 101 * expando bridge attributes for the layout. For layouts that belong 102 * to a layout set prototype, an attribute named 'layoutUpdateable' 103 * can be used to specify whether site administrators can modify 104 * this page within their site. 105 * @return the layout 106 * @throws PortalException if a group with the primary key could not be 107 * found, if the group did not have permission to manage the layouts 108 * involved, or if layout values were invalid 109 * @throws SystemException if a system exception occurred 110 */ 111 public Layout addLayout( 112 long groupId, boolean privateLayout, long parentLayoutId, 113 Map<Locale, String> localeNamesMap, 114 Map<Locale, String> localeTitlesMap, 115 Map<Locale, String> descriptionMap, Map<Locale, String> keywordsMap, 116 Map<Locale, String> robotsMap, String type, boolean hidden, 117 String friendlyURL, ServiceContext serviceContext) 118 throws PortalException, SystemException { 119 120 PermissionChecker permissionChecker = getPermissionChecker(); 121 122 if (parentLayoutId == LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) { 123 GroupPermissionUtil.check( 124 permissionChecker, groupId, ActionKeys.ADD_LAYOUT); 125 } 126 else { 127 LayoutPermissionUtil.check( 128 permissionChecker, groupId, privateLayout, parentLayoutId, 129 ActionKeys.ADD_LAYOUT); 130 } 131 132 return layoutLocalService.addLayout( 133 getUserId(), groupId, privateLayout, parentLayoutId, localeNamesMap, 134 localeTitlesMap, descriptionMap, keywordsMap, robotsMap, type, 135 hidden, friendlyURL, serviceContext); 136 } 137 138 /** 139 * Adds a layout with single entry maps for name, title, and description to 140 * the default locale. 141 * 142 * <p> 143 * This method handles the creation of the layout including its resources, 144 * metadata, and internal data structures. It is not necessary to make 145 * subsequent calls to any methods to setup default groups, resources, ... 146 * etc. 147 * </p> 148 * 149 * @param groupId the primary key of the group 150 * @param privateLayout whether the layout is private to the group 151 * @param parentLayoutId the primary key of the parent layout (optionally 152 * {@link 153 * com.liferay.portal.model.LayoutConstants#DEFAULT_PARENT_LAYOUT_ID}) 154 * @param name Map the layout's locales and localized names 155 * @param title Map the layout's locales and localized titles 156 * @param description Map the layout's locales and localized descriptions 157 * @param type the layout's type (optionally {@link 158 * com.liferay.portal.model.LayoutConstants#TYPE_PORTLET}). The 159 * possible types can be found in {@link 160 * com.liferay.portal.model.LayoutConstants}. 161 * @param hidden whether the layout is hidden 162 * @param friendlyURL the layout's friendly URL (optionally {@link 163 * com.liferay.portal.util.PropsValues#DEFAULT_USER_PRIVATE_LAYOUT_FRIENDLY_URL} 164 * or {@link 165 * com.liferay.portal.util.PropsValues#DEFAULT_USER_PUBLIC_LAYOUT_FRIENDLY_URL}). 166 * The default values can be overridden in 167 * <code>portal-ext.properties</code> by specifying new values for 168 * the corresponding properties defined in {@link 169 * com.liferay.portal.util.PropsValues}. To see how the URL is 170 * normalized when accessed see {@link 171 * com.liferay.portal.kernel.util.FriendlyURLNormalizerUtil#normalize( 172 * String)}. 173 * @param serviceContext the service context. Must set the UUID for the 174 * layout. Can specify the creation date, modification date and the 175 * expando bridge attributes for the layout. For layouts that belong 176 * to a layout set prototype, an attribute named 'layoutUpdateable' 177 * can be used to specify whether site administrators can modify 178 * this page within their site. 179 * @return the layout 180 * @throws PortalException if a group with the primary key could not be 181 * found, if the group did not have permission to manage the layouts 182 * involved, or if layout values were invalid 183 * @throws SystemException if a system exception occurred 184 */ 185 public Layout addLayout( 186 long groupId, boolean privateLayout, long parentLayoutId, 187 String name, String title, String description, String type, 188 boolean hidden, String friendlyURL, ServiceContext serviceContext) 189 throws PortalException, SystemException { 190 191 PermissionChecker permissionChecker = getPermissionChecker(); 192 193 if (parentLayoutId == LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) { 194 GroupPermissionUtil.check( 195 permissionChecker, groupId, ActionKeys.ADD_LAYOUT); 196 } 197 else { 198 LayoutPermissionUtil.check( 199 permissionChecker, groupId, privateLayout, parentLayoutId, 200 ActionKeys.ADD_LAYOUT); 201 } 202 203 return layoutLocalService.addLayout( 204 getUserId(), groupId, privateLayout, parentLayoutId, name, title, 205 description, type, hidden, friendlyURL, serviceContext); 206 } 207 208 /** 209 * Deletes the layout with the primary key, also deleting the layout's child 210 * layouts, and associated resources. 211 * 212 * @param groupId the primary key of the group 213 * @param privateLayout whether the layout is private to the group 214 * @param layoutId the primary key of the layout 215 * @param serviceContext the service context 216 * @throws PortalException if the user did not have permission to delete the 217 * layout, if a matching layout could not be found , or if some 218 * other portal exception occurred 219 * @throws SystemException if a system exception occurred 220 */ 221 public void deleteLayout( 222 long groupId, boolean privateLayout, long layoutId, 223 ServiceContext serviceContext) 224 throws PortalException, SystemException { 225 226 LayoutPermissionUtil.check( 227 getPermissionChecker(), groupId, privateLayout, layoutId, 228 ActionKeys.DELETE); 229 230 layoutLocalService.deleteLayout( 231 groupId, privateLayout, layoutId, serviceContext); 232 } 233 234 /** 235 * Deletes the layout with the plid, also deleting the layout's child 236 * layouts, and associated resources. 237 * 238 * @param plid the primary key of the layout 239 * @param serviceContext the service context 240 * @throws PortalException if the user did not have permission to delete the 241 * layout, if a layout with the primary key could not be found , or 242 * if some other portal exception occurred 243 * @throws SystemException if a system exception occurred 244 */ 245 public void deleteLayout(long plid, ServiceContext serviceContext) 246 throws PortalException, SystemException { 247 248 LayoutPermissionUtil.check( 249 getPermissionChecker(), plid, ActionKeys.DELETE); 250 251 layoutLocalService.deleteLayout(plid, serviceContext); 252 } 253 254 /** 255 * Exports the layouts that match the primary keys and the criteria as a 256 * byte array. 257 * 258 * @param groupId the primary key of the group 259 * @param privateLayout whether the layout is private to the group 260 * @param layoutIds the primary keys of the layouts to be exported 261 * @param parameterMap the mapping of parameters indicating which 262 * information to export. For information on the keys used in the 263 * map see {@link 264 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 265 * @param startDate the export's start date 266 * @param endDate the export's end date 267 * @return the layouts as a byte array 268 * @throws PortalException if a group or any layout with the primary key 269 * could not be found, if the group did not have permission to 270 * manage the layouts, or if some other portal exception occurred 271 * @throws SystemException if a system exception occurred 272 */ 273 public byte[] exportLayouts( 274 long groupId, boolean privateLayout, long[] layoutIds, 275 Map<String, String[]> parameterMap, Date startDate, Date endDate) 276 throws PortalException, SystemException { 277 278 GroupPermissionUtil.check( 279 getPermissionChecker(), groupId, ActionKeys.EXPORT_IMPORT_LAYOUTS); 280 281 return layoutLocalService.exportLayouts( 282 groupId, privateLayout, layoutIds, parameterMap, startDate, 283 endDate); 284 } 285 286 /** 287 * Exports all layouts that match the criteria as a byte array. 288 * 289 * @param groupId the primary key of the group 290 * @param privateLayout whether the layout is private to the group 291 * @param parameterMap the mapping of parameters indicating which 292 * information to export. For information on the keys used in the 293 * map see {@link 294 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 295 * @param startDate the export's start date 296 * @param endDate the export's end date 297 * @return the layout as a byte array 298 * @throws PortalException if a group with the primary key could not be 299 * found, if the group did not have permission to manage the 300 * layouts, or if some other portal exception occurred 301 * @throws SystemException if a system exception occurred 302 */ 303 public byte[] exportLayouts( 304 long groupId, boolean privateLayout, 305 Map<String, String[]> parameterMap, Date startDate, Date endDate) 306 throws PortalException, SystemException { 307 308 GroupPermissionUtil.check( 309 getPermissionChecker(), groupId, ActionKeys.EXPORT_IMPORT_LAYOUTS); 310 311 return layoutLocalService.exportLayouts( 312 groupId, privateLayout, parameterMap, startDate, endDate); 313 } 314 315 /** 316 * Exports all layouts that match the primary keys and criteria as a file. 317 * 318 * @param groupId the primary key of the group 319 * @param privateLayout whether the layout is private to the group 320 * @param layoutIds the primary keys of the layouts to be exported 321 * (optionally <code>null</code>) 322 * @param parameterMap the mapping of parameters indicating which 323 * information to export. For information on the keys used in the 324 * map see {@link 325 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 326 * @param startDate the export's start date 327 * @param endDate the export's end date 328 * @return the layouts as a File 329 * @throws PortalException if a group or any layout with the primary key 330 * could not be found, it the group did not have permission to 331 * manage the layouts, or if some other portal exception occurred 332 * @throws SystemException if a system exception occurred 333 */ 334 public File exportLayoutsAsFile( 335 long groupId, boolean privateLayout, long[] layoutIds, 336 Map<String, String[]> parameterMap, Date startDate, Date endDate) 337 throws PortalException, SystemException { 338 339 GroupPermissionUtil.check( 340 getPermissionChecker(), groupId, ActionKeys.EXPORT_IMPORT_LAYOUTS); 341 342 return layoutLocalService.exportLayoutsAsFile( 343 groupId, privateLayout, layoutIds, parameterMap, startDate, 344 endDate); 345 } 346 347 /** 348 * Exports the portlet information (categories, permissions, ... etc.) as a 349 * byte array. 350 * 351 * @param plid the primary key of the layout 352 * @param groupId the primary key of the group 353 * @param portletId the primary key of the portlet 354 * @param parameterMap the mapping of parameters indicating which 355 * information to export. For information on the keys used in the 356 * map see {@link 357 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 358 * @param startDate the export's start date 359 * @param endDate the export's end date 360 * @return the portlet information as a byte array 361 * @throws PortalException if a layout, group, or portlet with the primary 362 * key could not be found, if the group did not have permission to 363 * manage the layouts involved, or if some other portal exception 364 * occurred 365 * @throws SystemException if a system exception occurred 366 */ 367 public byte[] exportPortletInfo( 368 long plid, long groupId, String portletId, 369 Map<String, String[]> parameterMap, Date startDate, Date endDate) 370 throws PortalException, SystemException { 371 372 Layout layout = layoutLocalService.getLayout(plid); 373 374 GroupPermissionUtil.check( 375 getPermissionChecker(), layout.getGroupId(), 376 ActionKeys.EXPORT_IMPORT_PORTLET_INFO); 377 378 return layoutLocalService.exportPortletInfo( 379 plid, groupId, portletId, parameterMap, startDate, endDate); 380 } 381 382 /** 383 * Exports the portlet information (categories, permissions, ... etc.) as a 384 * file. 385 * 386 * @param plid the primary key of the layout 387 * @param groupId the primary key of the group 388 * @param portletId the primary key of the portlet 389 * @param parameterMap the mapping of parameters indicating which 390 * information to export. For information on the keys used in the 391 * map see {@link 392 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 393 * @param startDate the export's start date 394 * @param endDate the export's end date 395 * @return the portlet information as a file 396 * @throws PortalException if a layout, group, or portlet with the primary 397 * key could not be found, it the group did not have permission to 398 * manage the layouts involved, or if some other portal exception 399 * occurred 400 * @throws SystemException if a system exception occurred 401 */ 402 public File exportPortletInfoAsFile( 403 long plid, long groupId, String portletId, 404 Map<String, String[]> parameterMap, Date startDate, Date endDate) 405 throws PortalException, SystemException { 406 407 Layout layout = layoutLocalService.getLayout(plid); 408 409 GroupPermissionUtil.check( 410 getPermissionChecker(), layout.getGroupId(), 411 ActionKeys.EXPORT_IMPORT_PORTLET_INFO); 412 413 return layoutLocalService.exportPortletInfoAsFile( 414 plid, groupId, portletId, parameterMap, startDate, endDate); 415 } 416 417 /** 418 * Returns all the ancestor layouts of the layout. 419 * 420 * @param plid the primary key of the layout 421 * @return the ancestor layouts of the layout 422 * @throws PortalException if a matching layout could not be found or if a 423 * portal exception occurred 424 * @throws SystemException if a system exception occurred 425 */ 426 public List<Layout> getAncestorLayouts(long plid) 427 throws PortalException, SystemException { 428 429 Layout layout = layoutLocalService.getLayout(plid); 430 431 List<Layout> ancestors = layout.getAncestors(); 432 433 return filterLayouts(ancestors); 434 } 435 436 /** 437 * Returns the primary key of the default layout for the group. 438 * 439 * @param groupId the primary key of the group 440 * @param scopeGroupId the primary key of the scope group. See {@link 441 * com.liferay.portal.service.ServiceContext#getScopeGroupId()}. 442 * @param privateLayout whether the layout is private to the group 443 * @param portletId the primary key of the portlet 444 * @return Returns the primary key of the default layout group; {@link 445 * com.liferay.portal.model.LayoutConstants#DEFAULT_PLID} otherwise 446 * @throws PortalException if a group, layout, or portlet with the primary 447 * key could not be found 448 * @throws SystemException if a system exception occurred 449 */ 450 public long getDefaultPlid( 451 long groupId, long scopeGroupId, boolean privateLayout, 452 String portletId) 453 throws PortalException, SystemException { 454 455 if (groupId <= 0) { 456 return LayoutConstants.DEFAULT_PLID; 457 } 458 459 PermissionChecker permissionChecker = getPermissionChecker(); 460 461 String scopeGroupLayoutUuid = null; 462 463 Group scopeGroup = groupLocalService.getGroup(scopeGroupId); 464 465 if (scopeGroup.isLayout()) { 466 Layout scopeGroupLayout = layoutLocalService.getLayout( 467 scopeGroup.getClassPK()); 468 469 scopeGroupLayoutUuid = scopeGroupLayout.getUuid(); 470 } 471 472 Map<Long, javax.portlet.PortletPreferences> jxPreferencesMap = 473 PortletPreferencesFactoryUtil.getPortletSetupMap( 474 scopeGroup.getCompanyId(), groupId, 475 PortletKeys.PREFS_OWNER_ID_DEFAULT, 476 PortletKeys.PREFS_OWNER_TYPE_LAYOUT, portletId, privateLayout); 477 478 for (Map.Entry<Long, javax.portlet.PortletPreferences> entry : 479 jxPreferencesMap.entrySet()) { 480 481 long plid = entry.getKey(); 482 483 Layout layout = null; 484 485 try { 486 layout = layoutLocalService.getLayout(plid); 487 } 488 catch (NoSuchLayoutException nsle) { 489 continue; 490 } 491 492 if (!LayoutPermissionUtil.contains( 493 permissionChecker, layout, ActionKeys.VIEW)) { 494 495 continue; 496 } 497 498 if (!layout.isTypePortlet()) { 499 continue; 500 } 501 502 LayoutTypePortlet layoutTypePortlet = 503 (LayoutTypePortlet)layout.getLayoutType(); 504 505 if (!layoutTypePortlet.hasPortletId(portletId)) { 506 continue; 507 } 508 509 javax.portlet.PortletPreferences jxPreferences = entry.getValue(); 510 511 String scopeType = GetterUtil.getString( 512 jxPreferences.getValue("lfrScopeType", null)); 513 514 if (scopeGroup.isLayout()) { 515 String scopeLayoutUuid = GetterUtil.getString( 516 jxPreferences.getValue("lfrScopeLayoutUuid", null)); 517 518 if (Validator.isNotNull(scopeType) && 519 Validator.isNotNull(scopeLayoutUuid) && 520 scopeLayoutUuid.equals(scopeGroupLayoutUuid)) { 521 522 return layout.getPlid(); 523 } 524 } 525 else if (scopeGroup.isCompany()) { 526 if (Validator.isNotNull(scopeType) && 527 scopeType.equals("company")) { 528 529 return layout.getPlid(); 530 } 531 } 532 else { 533 if (Validator.isNull(scopeType)) { 534 return layout.getPlid(); 535 } 536 } 537 } 538 539 return LayoutConstants.DEFAULT_PLID; 540 } 541 542 /** 543 * @param uuid the layout's UUID 544 * @param groupId the primary key of the group 545 * @param privateLayout whether the layout is private to the group 546 * @return the matching layout 547 * @throws PortalException if a matching layout could not be found, if the 548 * user did not have permission to view the layout, or if some other 549 * portal exception occurred 550 * @throws SystemException if a system exception occurred 551 */ 552 public Layout getLayoutByUuidAndGroupId( 553 String uuid, long groupId, boolean privateLayout) 554 throws PortalException, SystemException { 555 556 Layout layout = layoutLocalService.getLayoutByUuidAndGroupId( 557 uuid, groupId, privateLayout); 558 559 LayoutPermissionUtil.check( 560 getPermissionChecker(), layout, ActionKeys.VIEW); 561 562 return layout; 563 } 564 565 /** 566 * Returns the name of the layout. 567 * 568 * @param groupId the primary key of the group 569 * @param privateLayout whether the layout is private to the group 570 * @param layoutId the primary key of the layout 571 * @param languageId the primary key of the language. For more information 572 * See {@link java.util.Locale}. 573 * @return the layout's name 574 * @throws PortalException if a matching layout could not be found 575 * @throws SystemException if a system exception occurred 576 */ 577 public String getLayoutName( 578 long groupId, boolean privateLayout, long layoutId, 579 String languageId) 580 throws PortalException, SystemException { 581 582 Layout layout = layoutLocalService.getLayout( 583 groupId, privateLayout, layoutId); 584 585 return layout.getName(languageId); 586 } 587 588 /** 589 * Returns the layout references for all the layouts that belong to the 590 * company and belong to the portlet that matches the preferences. 591 * 592 * @param companyId the primary key of the company 593 * @param portletId the primary key of the portlet 594 * @param preferencesKey the portlet's preference key 595 * @param preferencesValue the portlet's preference value 596 * @return the layout references of the matching layouts 597 * @throws SystemException if a system exception occurred 598 */ 599 public LayoutReference[] getLayoutReferences( 600 long companyId, String portletId, String preferencesKey, 601 String preferencesValue) 602 throws SystemException { 603 604 return layoutLocalService.getLayouts( 605 companyId, portletId, preferencesKey, preferencesValue); 606 } 607 608 public List<Layout> getLayouts(long groupId, boolean privateLayout) 609 throws SystemException { 610 611 return layoutPersistence.filterFindByG_P(groupId, privateLayout); 612 } 613 614 public List<Layout> getLayouts( 615 long groupId, boolean privateLayout, long parentLayoutId) 616 throws SystemException { 617 618 return layoutPersistence.filterFindByG_P_P( 619 groupId, privateLayout, parentLayoutId); 620 } 621 622 public List<Layout> getLayouts( 623 long groupId, boolean privateLayout, long parentLayoutId, 624 boolean incomplete, int start, int end) 625 throws PortalException, SystemException { 626 627 List<Layout> layouts = layoutLocalService.getLayouts( 628 groupId, privateLayout, parentLayoutId, incomplete, start, end); 629 630 return filterLayouts(layouts); 631 } 632 633 /** 634 * Imports the layouts from the byte array. 635 * 636 * @param groupId the primary key of the group 637 * @param privateLayout whether the layout is private to the group 638 * @param parameterMap the mapping of parameters indicating which 639 * information will be imported. For information on the keys used in 640 * the map see {@link 641 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 642 * @param bytes the byte array with the data 643 * @throws PortalException if a group with the primary key could not be 644 * found, if the group did not have permission to manage the 645 * layouts, or if some other portal exception occurred 646 * @throws SystemException if a system exception occurred 647 * @see com.liferay.portal.lar.LayoutImporter 648 */ 649 public void importLayouts( 650 long groupId, boolean privateLayout, 651 Map<String, String[]> parameterMap, byte[] bytes) 652 throws PortalException, SystemException { 653 654 GroupPermissionUtil.check( 655 getPermissionChecker(), groupId, ActionKeys.EXPORT_IMPORT_LAYOUTS); 656 657 layoutLocalService.importLayouts( 658 getUserId(), groupId, privateLayout, parameterMap, bytes); 659 } 660 661 /** 662 * Imports the layouts from the file. 663 * 664 * @param groupId the primary key of the group 665 * @param privateLayout whether the layout is private to the group 666 * @param parameterMap the mapping of parameters indicating which 667 * information will be imported. For information on the keys used in 668 * the map see {@link 669 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 670 * @param file the LAR file with the data 671 * @throws PortalException if a group with the primary key could not be 672 * found, if the group did not have permission to manage the layouts 673 * and publish, or if some other portal exception occurred 674 * @throws SystemException if a system exception occurred 675 * @see com.liferay.portal.lar.LayoutImporter 676 */ 677 public void importLayouts( 678 long groupId, boolean privateLayout, 679 Map<String, String[]> parameterMap, File file) 680 throws PortalException, SystemException { 681 682 GroupPermissionUtil.check( 683 getPermissionChecker(), groupId, ActionKeys.EXPORT_IMPORT_LAYOUTS); 684 685 layoutLocalService.importLayouts( 686 getUserId(), groupId, privateLayout, parameterMap, file); 687 } 688 689 /** 690 * Imports the layouts from the input stream. 691 * 692 * @param groupId the primary key of the group 693 * @param privateLayout whether the layout is private to the group 694 * @param parameterMap the mapping of parameters indicating which 695 * information will be imported. For information on the keys used in 696 * the map see {@link 697 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 698 * @param is the input stream 699 * @throws PortalException if a group with the primary key could not be 700 * found, if the group did not have permission to manage the 701 * layouts, or if some other portal exception occurred 702 * @throws SystemException if a system exception occurred 703 * @see com.liferay.portal.lar.LayoutImporter 704 */ 705 public void importLayouts( 706 long groupId, boolean privateLayout, 707 Map<String, String[]> parameterMap, InputStream is) 708 throws PortalException, SystemException { 709 710 GroupPermissionUtil.check( 711 getPermissionChecker(), groupId, ActionKeys.EXPORT_IMPORT_LAYOUTS); 712 713 layoutLocalService.importLayouts( 714 getUserId(), groupId, privateLayout, parameterMap, is); 715 } 716 717 /** 718 * Imports the portlet information (categories, permissions, ... etc.) from 719 * the file. 720 * 721 * @param plid the primary key of the layout 722 * @param groupId the primary key of the group 723 * @param portletId the primary key of the portlet 724 * @param parameterMap the mapping of parameters indicating which 725 * information will be imported. For information on the keys used in 726 * the map see {@link 727 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 728 * @param file the LAR file with the data 729 * @throws PortalException if a group, layout, or portlet with the primary 730 * key could not be found, or if the group did not have permission 731 * to manage the layouts 732 * @throws SystemException if a system exception occurred 733 */ 734 public void importPortletInfo( 735 long plid, long groupId, String portletId, 736 Map<String, String[]> parameterMap, File file) 737 throws PortalException, SystemException { 738 739 GroupPermissionUtil.check( 740 getPermissionChecker(), groupId, 741 ActionKeys.EXPORT_IMPORT_PORTLET_INFO); 742 743 layoutLocalService.importPortletInfo( 744 getUserId(), plid, groupId, portletId, parameterMap, file); 745 } 746 747 /** 748 * Imports the portlet information (categories, permissions, ... etc.) from 749 * the input stream. 750 * 751 * @param plid the primary key of the layout 752 * @param groupId the primary key of the group 753 * @param portletId the primary key of the portlet 754 * @param parameterMap the mapping of parameters indicating which 755 * information will be imported. For information on the keys used in 756 * the map see {@link 757 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys}. 758 * @param is the input stream 759 * @throws PortalException if a group, portlet, or layout with the primary 760 * key could not be found or if the group did not have permission to 761 * manage the layouts 762 * @throws SystemException if a system exception occurred 763 */ 764 public void importPortletInfo( 765 long plid, long groupId, String portletId, 766 Map<String, String[]> parameterMap, InputStream is) 767 throws PortalException, SystemException { 768 769 GroupPermissionUtil.check( 770 getPermissionChecker(), groupId, 771 ActionKeys.EXPORT_IMPORT_PORTLET_INFO); 772 773 layoutLocalService.importPortletInfo( 774 getUserId(), plid, groupId, portletId, parameterMap, is); 775 } 776 777 /** 778 * Schedules a range of layouts to be published. 779 * 780 * @param sourceGroupId the primary key of the source group 781 * @param targetGroupId the primary key of the target group 782 * @param privateLayout whether the layout is private to the group 783 * @param layoutIdMap the layouts considered for publishing, specified by 784 * the layout IDs and booleans indicating whether they have children 785 * @param parameterMap the mapping of parameters indicating which 786 * information will be used. See {@link 787 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys} 788 * @param scope the scope of the pages. It can be <code>all-pages</code> or 789 * <code>selected-pages</code>. 790 * @param startDate the start date 791 * @param endDate the end date 792 * @param groupName the group name (optionally {@link 793 * com.liferay.portal.kernel.messaging.DestinationNames#LAYOUTS_LOCAL_PUBLISHER}). 794 * See {@link com.liferay.portal.kernel.messaging.DestinationNames}. 795 * @param cronText the cron text. See {@link 796 * com.liferay.portal.kernel.cal.RecurrenceSerializer #toCronText} 797 * @param schedulerStartDate the scheduler start date 798 * @param schedulerEndDate the scheduler end date 799 * @param description the scheduler description 800 * @throws PortalException if the group did not have permission to manage 801 * and publish 802 * @throws SystemException if a system exception occurred 803 */ 804 public void schedulePublishToLive( 805 long sourceGroupId, long targetGroupId, boolean privateLayout, 806 Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap, 807 String scope, Date startDate, Date endDate, String groupName, 808 String cronText, Date schedulerStartDate, Date schedulerEndDate, 809 String description) 810 throws PortalException, SystemException { 811 812 GroupPermissionUtil.check( 813 getPermissionChecker(), targetGroupId, ActionKeys.PUBLISH_STAGING); 814 815 String jobName = PortalUUIDUtil.generate(); 816 817 Trigger trigger = new CronTrigger( 818 jobName, groupName, schedulerStartDate, schedulerEndDate, cronText); 819 820 String command = StringPool.BLANK; 821 822 if (scope.equals("all-pages")) { 823 command = LayoutsLocalPublisherRequest.COMMAND_ALL_PAGES; 824 } 825 else if (scope.equals("selected-pages")) { 826 command = LayoutsLocalPublisherRequest.COMMAND_SELECTED_PAGES; 827 } 828 829 LayoutsLocalPublisherRequest publisherRequest = 830 new LayoutsLocalPublisherRequest( 831 command, getUserId(), sourceGroupId, targetGroupId, 832 privateLayout, layoutIdMap, parameterMap, startDate, endDate); 833 834 SchedulerEngineHelperUtil.schedule( 835 trigger, StorageType.PERSISTED, description, 836 DestinationNames.LAYOUTS_LOCAL_PUBLISHER, publisherRequest, 0); 837 } 838 839 /** 840 * Schedules a range of layouts to be stored. 841 * 842 * @param sourceGroupId the primary key of the source group 843 * @param privateLayout whether the layout is private to the group 844 * @param layoutIdMap the layouts considered for publishing, specified by 845 * the layout IDs and booleans indicating whether they have children 846 * @param parameterMap the mapping of parameters indicating which 847 * information will be used. See {@link 848 * com.liferay.portal.kernel.lar.PortletDataHandlerKeys} 849 * @param remoteAddress the remote address 850 * @param remotePort the remote port 851 * @param remotePathContext the remote path context 852 * @param secureConnection whether the connection is secure 853 * @param remoteGroupId the primary key of the remote group 854 * @param remotePrivateLayout whether remote group's layout is private 855 * @param startDate the start date 856 * @param endDate the end date 857 * @param groupName the group name. Optionally {@link 858 * com.liferay.portal.kernel.messaging.DestinationNames#LAYOUTS_LOCAL_PUBLISHER}). 859 * See {@link com.liferay.portal.kernel.messaging.DestinationNames}. 860 * @param cronText the cron text. See {@link 861 * com.liferay.portal.kernel.cal.RecurrenceSerializer #toCronText} 862 * @param schedulerStartDate the scheduler start date 863 * @param schedulerEndDate the scheduler end date 864 * @param description the scheduler description 865 * @throws PortalException if a group with the source group primary key was 866 * not found or if the group did not have permission to publish 867 * @throws SystemException if a system exception occurred 868 */ 869 public void schedulePublishToRemote( 870 long sourceGroupId, boolean privateLayout, 871 Map<Long, Boolean> layoutIdMap, Map<String, String[]> parameterMap, 872 String remoteAddress, int remotePort, String remotePathContext, 873 boolean secureConnection, long remoteGroupId, 874 boolean remotePrivateLayout, Date startDate, Date endDate, 875 String groupName, String cronText, Date schedulerStartDate, 876 Date schedulerEndDate, String description) 877 throws PortalException, SystemException { 878 879 GroupPermissionUtil.check( 880 getPermissionChecker(), sourceGroupId, ActionKeys.PUBLISH_STAGING); 881 882 LayoutsRemotePublisherRequest publisherRequest = 883 new LayoutsRemotePublisherRequest( 884 getUserId(), sourceGroupId, privateLayout, layoutIdMap, 885 parameterMap, remoteAddress, remotePort, remotePathContext, 886 secureConnection, remoteGroupId, remotePrivateLayout, startDate, 887 endDate); 888 889 String jobName = PortalUUIDUtil.generate(); 890 891 Trigger trigger = new CronTrigger( 892 jobName, groupName, schedulerStartDate, schedulerEndDate, cronText); 893 894 SchedulerEngineHelperUtil.schedule( 895 trigger, StorageType.PERSISTED, description, 896 DestinationNames.LAYOUTS_REMOTE_PUBLISHER, publisherRequest, 0); 897 } 898 899 /** 900 * Sets the layouts for the group, replacing and prioritizing all layouts of 901 * the parent layout. 902 * 903 * @param groupId the primary key of the group 904 * @param privateLayout whether the layout is private to the group 905 * @param parentLayoutId the primary key of the parent layout 906 * @param layoutIds the primary keys of the layouts 907 * @param serviceContext the service context 908 * @throws PortalException if a group or layout with the primary key could 909 * not be found, if the group did not have permission to manage the 910 * layouts, if no layouts were specified, if the first layout was 911 * not page-able, if the first layout was hidden, or if some other 912 * portal exception occurred 913 * @throws SystemException if a system exception occurred 914 */ 915 public void setLayouts( 916 long groupId, boolean privateLayout, long parentLayoutId, 917 long[] layoutIds, ServiceContext serviceContext) 918 throws PortalException, SystemException { 919 920 GroupPermissionUtil.check( 921 getPermissionChecker(), groupId, ActionKeys.UPDATE); 922 923 layoutLocalService.setLayouts( 924 groupId, privateLayout, parentLayoutId, layoutIds, serviceContext); 925 } 926 927 /** 928 * Deletes the job from the scheduler's queue. 929 * 930 * @param groupId the primary key of the group 931 * @param jobName the job name 932 * @param groupName the group name (optionally {@link 933 * com.liferay.portal.kernel.messaging.DestinationNames#LAYOUTS_LOCAL_PUBLISHER}). 934 * See {@link com.liferay.portal.kernel.messaging.DestinationNames}. 935 * @throws PortalException if the group did not permission to manage staging 936 * and publish 937 * @throws SystemException if a system exception occurred 938 */ 939 public void unschedulePublishToLive( 940 long groupId, String jobName, String groupName) 941 throws PortalException, SystemException { 942 943 GroupPermissionUtil.check( 944 getPermissionChecker(), groupId, ActionKeys.PUBLISH_STAGING); 945 946 SchedulerEngineHelperUtil.delete( 947 jobName, groupName, StorageType.PERSISTED); 948 } 949 950 /** 951 * Deletes the job from the scheduler's persistent queue. 952 * 953 * @param groupId the primary key of the group 954 * @param jobName the job name 955 * @param groupName the group name (optionally {@link 956 * com.liferay.portal.kernel.messaging.DestinationNames#LAYOUTS_LOCAL_PUBLISHER}). 957 * See {@link com.liferay.portal.kernel.messaging.DestinationNames}. 958 * @throws PortalException if a group with the primary key could not be 959 * found or if the group did not have permission to publish 960 * @throws SystemException if a system exception occurred 961 */ 962 public void unschedulePublishToRemote( 963 long groupId, String jobName, String groupName) 964 throws PortalException, SystemException { 965 966 GroupPermissionUtil.check( 967 getPermissionChecker(), groupId, ActionKeys.PUBLISH_STAGING); 968 969 SchedulerEngineHelperUtil.delete( 970 jobName, groupName, StorageType.PERSISTED); 971 } 972 973 /** 974 * Updates the layout. 975 * 976 * @param groupId the primary key of the group 977 * @param privateLayout whether the layout is private to the group 978 * @param layoutId the primary key of the layout 979 * @param parentLayoutId the primary key of the layout's new parent layout 980 * @param localeNamesMap the layout's locales and localized names 981 * @param localeTitlesMap the layout's locales and localized titles 982 * @param descriptionMap the locales and localized descriptions to merge 983 * (optionally <code>null</code>) 984 * @param keywordsMap the locales and localized keywords to merge 985 * (optionally <code>null</code>) 986 * @param robotsMap the locales and localized robots to merge (optionally 987 * <code>null</code>) 988 * @param type the layout's new type (optionally {@link 989 * com.liferay.portal.model.LayoutConstants#TYPE_PORTLET}) 990 * @param hidden whether the layout is hidden 991 * @param friendlyURL the layout's new friendly URL (optionally {@link 992 * com.liferay.portal.util.PropsValues#DEFAULT_USER_PRIVATE_LAYOUT_FRIENDLY_URL} 993 * or {@link 994 * com.liferay.portal.util.PropsValues#DEFAULT_USER_PRIVATE_LAYOUT_FRIENDLY_URL}). 995 * The default values can be overridden in 996 * <code>portal-ext.properties</code> by specifying new values for 997 * the corresponding properties defined in {@link 998 * com.liferay.portal.util.PropsValues}. To see how the URL is 999 * normalized when accessed see {@link 1000 * com.liferay.portal.kernel.util.FriendlyURLNormalizerUtil#normalize( 1001 * String)}. 1002 * @param iconImage whether the icon image will be updated 1003 * @param iconBytes the byte array of the layout's new icon image 1004 * @param serviceContext the service context. Can set the modification date 1005 * and expando bridge attributes for the layout. 1006 * @return the updated layout 1007 * @throws PortalException if a group or layout with the primary key could 1008 * not be found, if the user did not have permission to update the 1009 * layout, if a unique friendly URL could not be generated, if a 1010 * valid parent layout ID to use could not be found, or if the 1011 * layout parameters were invalid 1012 * @throws SystemException if a system exception occurred 1013 */ 1014 public Layout updateLayout( 1015 long groupId, boolean privateLayout, long layoutId, 1016 long parentLayoutId, Map<Locale, String> localeNamesMap, 1017 Map<Locale, String> localeTitlesMap, 1018 Map<Locale, String> descriptionMap, Map<Locale, String> keywordsMap, 1019 Map<Locale, String> robotsMap, String type, boolean hidden, 1020 String friendlyURL, Boolean iconImage, byte[] iconBytes, 1021 ServiceContext serviceContext) 1022 throws PortalException, SystemException { 1023 1024 LayoutPermissionUtil.check( 1025 getPermissionChecker(), groupId, privateLayout, layoutId, 1026 ActionKeys.UPDATE); 1027 1028 return layoutLocalService.updateLayout( 1029 groupId, privateLayout, layoutId, parentLayoutId, localeNamesMap, 1030 localeTitlesMap, descriptionMap, keywordsMap, robotsMap, type, 1031 hidden, friendlyURL, iconImage, iconBytes, serviceContext); 1032 } 1033 1034 /** 1035 * Updates the layout replacing its type settings. 1036 * 1037 * @param groupId the primary key of the group 1038 * @param privateLayout whether the layout is private to the group 1039 * @param layoutId the primary key of the layout 1040 * @param typeSettings the settings to load the unicode properties object. 1041 * See {@link com.liferay.portal.kernel.util.UnicodeProperties 1042 * #fastLoad(String)}. 1043 * @return the updated layout 1044 * @throws PortalException if a matching layout could not be found or if the 1045 * user did not have permission to update the layout 1046 * @throws SystemException if a system exception occurred 1047 */ 1048 public Layout updateLayout( 1049 long groupId, boolean privateLayout, long layoutId, 1050 String typeSettings) 1051 throws PortalException, SystemException { 1052 1053 LayoutPermissionUtil.check( 1054 getPermissionChecker(), groupId, privateLayout, layoutId, 1055 ActionKeys.UPDATE); 1056 1057 return layoutLocalService.updateLayout( 1058 groupId, privateLayout, layoutId, typeSettings); 1059 } 1060 1061 /** 1062 * Updates the look and feel of the layout. 1063 * 1064 * @param groupId the primary key of the group 1065 * @param privateLayout whether the layout is private to the group 1066 * @param layoutId the primary key of the layout 1067 * @param themeId the primary key of the layout's new theme 1068 * @param colorSchemeId the primary key of the layout's new color scheme 1069 * @param css the layout's new CSS 1070 * @param wapTheme whether the theme is for WAP browsers 1071 * @return the updated layout 1072 * @throws PortalException if a matching layout could not be found, or if 1073 * the user did not have permission to update the layout and 1074 * permission to apply the theme 1075 * @throws SystemException if a system exception occurred 1076 */ 1077 public Layout updateLookAndFeel( 1078 long groupId, boolean privateLayout, long layoutId, String themeId, 1079 String colorSchemeId, String css, boolean wapTheme) 1080 throws PortalException, SystemException { 1081 1082 LayoutPermissionUtil.check( 1083 getPermissionChecker(), groupId, privateLayout, layoutId, 1084 ActionKeys.UPDATE); 1085 1086 if (Validator.isNotNull(themeId)) { 1087 pluginSettingLocalService.checkPermission( 1088 getUserId(), themeId, Plugin.TYPE_THEME); 1089 } 1090 1091 return layoutLocalService.updateLookAndFeel( 1092 groupId, privateLayout, layoutId, themeId, colorSchemeId, css, 1093 wapTheme); 1094 } 1095 1096 /** 1097 * Updates the name of the layout matching the group, layout ID, and 1098 * privacy. 1099 * 1100 * @param groupId the primary key of the group 1101 * @param privateLayout whether the layout is private to the group 1102 * @param layoutId the primary key of the layout 1103 * @param name the layout's new name 1104 * @param languageId the primary key of the language. For more information 1105 * see {@link java.util.Locale}. 1106 * @return the updated layout 1107 * @throws PortalException if a matching layout could not be found, if the 1108 * user did not have permission to update the layout, or if the new 1109 * name was <code>null</code> 1110 * @throws SystemException if a system exception occurred 1111 */ 1112 public Layout updateName( 1113 long groupId, boolean privateLayout, long layoutId, String name, 1114 String languageId) 1115 throws PortalException, SystemException { 1116 1117 LayoutPermissionUtil.check( 1118 getPermissionChecker(), groupId, privateLayout, layoutId, 1119 ActionKeys.UPDATE); 1120 1121 return layoutLocalService.updateName( 1122 groupId, privateLayout, layoutId, name, languageId); 1123 } 1124 1125 /** 1126 * Updates the name of the layout matching the primary key. 1127 * 1128 * @param plid the primary key of the layout 1129 * @param name the name to be assigned 1130 * @param languageId the primary key of the language. For more information 1131 * see {@link java.util.Locale}. 1132 * @return the updated layout 1133 * @throws PortalException if a layout with the primary key could not be 1134 * found, or if the user did not have permission to update the 1135 * layout, or if the name was <code>null</code> 1136 * @throws SystemException if a system exception occurred 1137 */ 1138 public Layout updateName(long plid, String name, String languageId) 1139 throws PortalException, SystemException { 1140 1141 LayoutPermissionUtil.check( 1142 getPermissionChecker(), plid, ActionKeys.UPDATE); 1143 1144 return layoutLocalService.updateName(plid, name, languageId); 1145 } 1146 1147 /** 1148 * Updates the parent layout ID of the layout matching the group, layout ID, 1149 * and privacy. 1150 * 1151 * @param groupId the primary key of the group 1152 * @param privateLayout whether the layout is private to the group 1153 * @param layoutId the primary key of the layout 1154 * @param parentLayoutId the primary key to be assigned to the parent 1155 * layout 1156 * @return the matching layout 1157 * @throws PortalException if a valid parent layout ID to use could not be 1158 * found, if a matching layout could not be found, or if the user 1159 * did not have permission to update the layout 1160 * @throws SystemException if a system exception occurred 1161 */ 1162 public Layout updateParentLayoutId( 1163 long groupId, boolean privateLayout, long layoutId, 1164 long parentLayoutId) 1165 throws PortalException, SystemException { 1166 1167 LayoutPermissionUtil.check( 1168 getPermissionChecker(), groupId, privateLayout, layoutId, 1169 ActionKeys.UPDATE); 1170 1171 return layoutLocalService.updateParentLayoutId( 1172 groupId, privateLayout, layoutId, parentLayoutId); 1173 } 1174 1175 /** 1176 * Updates the parent layout ID of the layout matching the primary key. If a 1177 * layout matching the parent primary key is found, the layout ID of that 1178 * layout is assigned, otherwise {@link 1179 * com.liferay.portal.model.LayoutConstants#DEFAULT_PARENT_LAYOUT_ID} is 1180 * assigned. 1181 * 1182 * @param plid the primary key of the layout 1183 * @param parentPlid the primary key of the parent layout 1184 * @return the layout matching the primary key 1185 * @throws PortalException if a layout with the primary key could not be 1186 * found, if the user did not have permission to update the layout, 1187 * or if a valid parent layout ID to use could not be found 1188 * @throws SystemException if a system exception occurred 1189 */ 1190 public Layout updateParentLayoutId(long plid, long parentPlid) 1191 throws PortalException, SystemException { 1192 1193 LayoutPermissionUtil.check( 1194 getPermissionChecker(), plid, ActionKeys.UPDATE); 1195 1196 return layoutLocalService.updateParentLayoutId(plid, parentPlid); 1197 } 1198 1199 /** 1200 * Updates the priority of the layout matching the group, layout ID, and 1201 * privacy. 1202 * 1203 * @param groupId the primary key of the group 1204 * @param privateLayout whether the layout is private to the group 1205 * @param layoutId the primary key of the layout 1206 * @param priority the layout's new priority 1207 * @return the updated layout 1208 * @throws PortalException if a matching layout could not be found or if the 1209 * user did not have permission to update the layout 1210 * @throws SystemException if a system exception occurred 1211 */ 1212 public Layout updatePriority( 1213 long groupId, boolean privateLayout, long layoutId, int priority) 1214 throws PortalException, SystemException { 1215 1216 LayoutPermissionUtil.check( 1217 getPermissionChecker(), groupId, privateLayout, layoutId, 1218 ActionKeys.UPDATE); 1219 1220 return layoutLocalService.updatePriority( 1221 groupId, privateLayout, layoutId, priority); 1222 } 1223 1224 /** 1225 * Updates the priority of the layout matching the primary key. 1226 * 1227 * @param plid the primary key of the layout 1228 * @param priority the layout's new priority 1229 * @return the updated layout 1230 * @throws PortalException if a layout with the primary key could not be 1231 * found 1232 * @throws SystemException if a system exception occurred 1233 */ 1234 public Layout updatePriority(long plid, int priority) 1235 throws PortalException, SystemException { 1236 1237 LayoutPermissionUtil.check( 1238 getPermissionChecker(), plid, ActionKeys.UPDATE); 1239 1240 return layoutLocalService.updatePriority(plid, priority); 1241 } 1242 1243 protected List<Layout> filterLayouts(List<Layout> layouts) 1244 throws PortalException, SystemException { 1245 1246 List<Layout> filteredLayouts = new ArrayList<Layout>(); 1247 1248 for (Layout layout : layouts) { 1249 if (LayoutPermissionUtil.contains( 1250 getPermissionChecker(), layout.getPlid(), 1251 ActionKeys.VIEW)) { 1252 1253 filteredLayouts.add(layout); 1254 } 1255 } 1256 1257 return filteredLayouts; 1258 } 1259 1260 }