001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.containerpage.shared.rpc; 029 030import org.opencms.ade.containerpage.shared.CmsCntPageData; 031import org.opencms.ade.containerpage.shared.CmsContainer; 032import org.opencms.ade.containerpage.shared.CmsContainerElement; 033import org.opencms.ade.containerpage.shared.CmsContainerElementData; 034import org.opencms.ade.containerpage.shared.CmsContainerPageGalleryData; 035import org.opencms.ade.containerpage.shared.CmsContainerPageRpcContext; 036import org.opencms.ade.containerpage.shared.CmsCreateElementData; 037import org.opencms.ade.containerpage.shared.CmsDialogOptionsAndInfo; 038import org.opencms.ade.containerpage.shared.CmsElementSettingsConfig; 039import org.opencms.ade.containerpage.shared.CmsGroupContainer; 040import org.opencms.ade.containerpage.shared.CmsGroupContainerSaveResult; 041import org.opencms.ade.containerpage.shared.CmsInheritanceContainer; 042import org.opencms.ade.containerpage.shared.CmsPageSaveStatus; 043import org.opencms.ade.containerpage.shared.CmsRemovedElementStatus; 044import org.opencms.ade.containerpage.shared.CmsReuseInfo; 045import org.opencms.gwt.CmsRpcException; 046import org.opencms.gwt.shared.CmsListElementCreationDialogData; 047import org.opencms.gwt.shared.CmsTemplateContextInfo; 048import org.opencms.util.CmsUUID; 049 050import java.util.Collection; 051import java.util.List; 052import java.util.Map; 053import java.util.Set; 054 055import com.google.gwt.user.client.rpc.RemoteService; 056 057/** 058 * The RPC service interface used by the container-page editor.<p> 059 * 060 * @since 8.0.0 061 */ 062public interface I_CmsContainerpageService extends RemoteService { 063 064 /** 065 * Adds an element specified by it's id to the favorite list.<p> 066 * 067 * @param context the rpc context 068 * @param clientId the element id 069 * 070 * @throws CmsRpcException if something goes wrong processing the request 071 */ 072 void addToFavoriteList(CmsContainerPageRpcContext context, String clientId) throws CmsRpcException; 073 074 /** 075 * Adds an element specified by it's id to the recent list.<p> 076 * 077 * @param context the rpc context 078 * @param clientId the element id 079 * 080 * @throws CmsRpcException if something goes wrong processing the request 081 */ 082 void addToRecentList(CmsContainerPageRpcContext context, String clientId) throws CmsRpcException; 083 084 /** 085 * Check if a page or its elements have been changed.<p> 086 * 087 * @param structureId the structure id of the resource 088 * @param detailContentId the structure id of the detail content (may be null) 089 * @param contentLocale the content locale 090 * 091 * @return true if there were changes in the page or its elements 092 * 093 * @throws CmsRpcException if the RPC call fails 094 */ 095 boolean checkContainerpageOrElementsChanged(CmsUUID structureId, CmsUUID detailContentId, String contentLocale) 096 throws CmsRpcException; 097 098 /** 099 * To create a new element of the given type this method will check if a model resource needs to be selected, otherwise creates the new element. 100 * Returns a bean containing either the new element data or a list of model resources to select.<p> 101 * 102 * @param pageStructureId the container page structure id 103 * @param detailContentId the structure id of the detail content 104 * @param clientId the client id of the new element (this will be the structure id of the configured new resource) 105 * @param resourceType the resource tape of the new element 106 * @param container the parent container 107 * @param locale the content locale 108 * 109 * @return the bean containing either the new element data or a list of model resources to select 110 * 111 * @throws CmsRpcException if something goes wrong processing the request 112 */ 113 CmsCreateElementData checkCreateNewElement( 114 CmsUUID pageStructureId, 115 CmsUUID detailContentId, 116 String clientId, 117 String resourceType, 118 CmsContainer container, 119 String locale) 120 throws CmsRpcException; 121 122 /** 123 * Checks whether the Acacia widgets are available for all fields of the content.<p> 124 * 125 * @param structureId the structure id of the content 126 * @return true if Acacia widgets are available for all fields 127 * 128 * @throws CmsRpcException if something goes wrong 129 */ 130 boolean checkNewWidgetsAvailable(CmsUUID structureId) throws CmsRpcException; 131 132 /** 133 * Creates a new element with a given model element and returns the copy'S structure id.<p> 134 * 135 * @param pageId the container page id 136 * @param originalElementId the model element id 137 * @param locale the content locale 138 * 139 * @return the structure id of the copy 140 * 141 * @throws CmsRpcException if something goes wrong 142 */ 143 CmsUUID copyElement(CmsUUID pageId, CmsUUID originalElementId, String locale) throws CmsRpcException; 144 145 /** 146 * Creates a new element of the given type and returns the new element data containing structure id and site path.<p> 147 * 148 * @param pageStructureId the container page structure id 149 * @param detailContentId the structure id of the detail content 150 * @param clientId the client id of the new element (this will be the structure id of the configured new resource) 151 * @param resourceType the resource tape of the new element 152 * @param modelResourceStructureId the model resource structure id 153 * @param locale the content locale 154 * 155 * @return the new element data containing structure id and site path 156 * 157 * @throws CmsRpcException if something goes wrong processing the request 158 */ 159 CmsContainerElement createNewElement( 160 CmsUUID pageStructureId, 161 CmsUUID detailContentId, 162 String clientId, 163 String resourceType, 164 CmsUUID modelResourceStructureId, 165 String locale) 166 throws CmsRpcException; 167 168 /** 169 * This method is used for serialization purposes only.<p> 170 * 171 * @return container info 172 */ 173 CmsContainer getContainerInfo(); 174 175 /** 176 * Returns the delete options.<p> 177 * 178 * @param clientId the client element id 179 * @param pageStructureId the current page structure id 180 * @param requestParams optional request parameters 181 * 182 * @return the delete options 183 * 184 * @throws CmsRpcException in case something goes wrong 185 */ 186 CmsDialogOptionsAndInfo getDeleteOptions(String clientId, CmsUUID pageStructureId, String requestParams) 187 throws CmsRpcException; 188 189 /** 190 * Returns the edit options.<p> 191 * 192 * @param clientId the client element id 193 * @param pageStructureId the current page structure id 194 * @param requestParams optional request parameters 195 * @param isListElement in case a list element, not a container element is about to be edited 196 * 197 * @return the edit options 198 * 199 * @throws CmsRpcException in case something goes wrong 200 */ 201 CmsDialogOptionsAndInfo getEditOptions( 202 String clientId, 203 CmsUUID pageStructureId, 204 String requestParams, 205 boolean isListElement) 206 throws CmsRpcException; 207 208 /** 209 * This method is used for serialization purposes only.<p> 210 * 211 * @return element info 212 */ 213 CmsContainerElement getElementInfo(); 214 215 /** 216 * Returns container element data by client id.<p> 217 * 218 * @param context the rpc context 219 * @param detailContentId the detail content structure id 220 * @param reqParams optional request parameters 221 * @param clientIds the requested element id's 222 * @param containers the containers of the current page 223 * @param alwaysCopy <code>true</code> in case reading data for a clipboard element used as a copy group 224 * @param dndSource the drag and drop source container (if we are getting the data for the drag and drop case) 225 * @param locale the content locale 226 * 227 * @return the element data 228 * 229 * @throws CmsRpcException if something goes wrong processing the request 230 */ 231 Map<String, CmsContainerElementData> getElementsData( 232 CmsContainerPageRpcContext context, 233 CmsUUID detailContentId, 234 String reqParams, 235 Collection<String> clientIds, 236 Collection<CmsContainer> containers, 237 boolean alwaysCopy, 238 String dndSource, 239 String locale) 240 throws CmsRpcException; 241 242 /** 243 * Returns container element settings config data.<p> 244 * 245 * @param context the rpc context 246 * @param clientId the requested element id 247 * @param containerId the parent container id 248 * @param containers the containers of the current page 249 * @param locale the content locale 250 * 251 * @return the element data 252 * 253 * @throws CmsRpcException if something goes wrong processing the request 254 */ 255 CmsElementSettingsConfig getElementSettingsConfig( 256 CmsContainerPageRpcContext context, 257 String clientId, 258 String containerId, 259 Collection<CmsContainer> containers, 260 String locale) 261 throws CmsRpcException; 262 263 /** 264 * Checks which structure ids of a given set belong to resources locked for publishing by the current user, and then returns those. 265 * 266 * @param idsToCheck the set of ids to check 267 * @return the subset of ids which belong to resources locked for publishing by the current user 268 * 269 * @throws CmsRpcException if something goes wrong 270 */ 271 Set<CmsUUID> getElementsLockedForPublishing(Set<CmsUUID> idsToCheck) throws CmsRpcException; 272 273 /** 274 * Gets the element data for an id and a map of settings.<p> 275 * 276 * @param context the RPC context 277 * @param detailContentId the detail content structure id 278 * @param reqParams optional request parameters 279 * @param clientId the requested element ids 280 * @param settings the settings for which the element data should be loaded 281 * @param containers the containers of the current page 282 * @param locale the content locale 283 * 284 * @return the element data 285 * 286 * @throws CmsRpcException if something goes wrong processing the request 287 */ 288 CmsContainerElementData getElementWithSettings( 289 CmsContainerPageRpcContext context, 290 CmsUUID detailContentId, 291 String reqParams, 292 String clientId, 293 Map<String, String> settings, 294 Collection<CmsContainer> containers, 295 String locale) 296 throws CmsRpcException; 297 298 /** 299 * Returns the container element data of the favorite list.<p> 300 * 301 * @param pageStructureId the container page structure id 302 * @param detailContentId the detail content structure id 303 * @param containers the containers of the current page 304 * @param locale the content locale 305 * 306 * @return the favorite list element data 307 * 308 * @throws CmsRpcException if something goes wrong processing the request 309 */ 310 List<CmsContainerElementData> getFavoriteList( 311 CmsUUID pageStructureId, 312 CmsUUID detailContentId, 313 Collection<CmsContainer> containers, 314 String locale) 315 throws CmsRpcException; 316 317 /** 318 * Returns the gallery configuration data according to the current page containers and the selected element view.<p> 319 * 320 * @param containers the page containers 321 * @param elementView the element view 322 * @param uri the page URI 323 * @param detailContentId the detail content id 324 * @param locale the content locale 325 * @param contextInfo the template context information 326 * 327 * @return the gallery data 328 * 329 * @throws CmsRpcException in case something goes wrong 330 */ 331 CmsContainerPageGalleryData getGalleryDataForPage( 332 List<CmsContainer> containers, 333 CmsUUID elementView, 334 String uri, 335 CmsUUID detailContentId, 336 String locale, 337 CmsTemplateContextInfo contextInfo) 338 throws CmsRpcException; 339 340 /** 341 * Loads the data for the list element creation dialog. 342 * 343 * @param structureId the structure id of the container element for which we want to load the options 344 * @param jsonListAddData the list-add metadata read from the DOM 345 * @return the data for the list element creation dialog 346 * 347 * @throws CmsRpcException if something goes wrong 348 */ 349 CmsListElementCreationDialogData getListElementCreationOptions(CmsUUID structureId, String jsonListAddData) 350 throws CmsRpcException; 351 352 /** 353 * Returns new container element data for the given resource type name.<p> 354 * 355 * @param context the RPC context 356 * @param detailContentId the detail content structure id 357 * @param reqParams optional request parameters 358 * @param resourceType the requested element resource type name 359 * @param containers the containers of the current page 360 * @param locale the content locale 361 * 362 * @return the element data 363 * 364 * @throws CmsRpcException if something goes wrong processing the request 365 */ 366 CmsContainerElementData getNewElementData( 367 CmsContainerPageRpcContext context, 368 CmsUUID detailContentId, 369 String reqParams, 370 String resourceType, 371 Collection<CmsContainer> containers, 372 String locale) 373 throws CmsRpcException; 374 375 /** 376 * Gets the edit handler options for creating a new element.<p> 377 * 378 * @param clientId the client id of the selected element 379 * @param pageStructureId the container page structure id 380 * @param requestParams the request parameter string 381 * 382 * @return the dialog option data from the edit handler 383 * @throws CmsRpcException if something goes wrong 384 */ 385 CmsDialogOptionsAndInfo getNewOptions(String clientId, CmsUUID pageStructureId, String requestParams) 386 throws CmsRpcException; 387 388 /** 389 * Returns the container element data of the recent list.<p> 390 * 391 * @param pageStructureId the container page structure id 392 * @param detailContentId the detail content structure id 393 * @param containers the containers of the current page 394 * @param locale the content locale 395 * 396 * @return the recent list element data 397 * 398 * @throws CmsRpcException if something goes wrong processing the request 399 */ 400 List<CmsContainerElementData> getRecentList( 401 CmsUUID pageStructureId, 402 CmsUUID detailContentId, 403 Collection<CmsContainer> containers, 404 String locale) 405 throws CmsRpcException; 406 407 /** 408 * Gets the status of a removed element.<p> 409 * 410 * @param id the client id of the removed element 411 * @param contextId the id of the resource used to look up the sitemap configuration 412 * @param containerpageId the id of the page which should be excluded from the relation check, or null if no page should be excluded 413 * 414 * @return the status of the removed element 415 * 416 * @throws CmsRpcException if something goes wrong 417 */ 418 CmsRemovedElementStatus getRemovedElementStatus(String id, CmsUUID contextId, CmsUUID containerpageId) 419 throws CmsRpcException; 420 421 /** 422 * Loads the reuse information for a container element. 423 * 424 * @param pageId the current page id 425 * @param detailId the current detail id 426 * @param elementId the id of the element to check 427 * @return the reuse information for the element 428 * @throws CmsRpcException if something goes wrong 429 */ 430 CmsReuseInfo getReuseInfo(CmsUUID pageId, CmsUUID detailId, CmsUUID elementId) throws CmsRpcException; 431 432 /** 433 * Handles the element deletion.<p> 434 * 435 * @param clientId the client element id 436 * @param deleteOption the selected delete option 437 * @param pageStructureId the current page structure id 438 * @param requestParams optional request parameters 439 * 440 * @throws CmsRpcException in case something goes wrong 441 */ 442 void handleDelete(String clientId, String deleteOption, CmsUUID pageStructureId, String requestParams) 443 throws CmsRpcException; 444 445 /** 446 * Loads the index of the clipboard tab last selected by the user.<p> 447 * 448 * @return the clipboard tab index 449 */ 450 int loadClipboardTab(); 451 452 /** 453 * Returns the initialization data.<p> 454 * 455 * @return the initialization data 456 * 457 * @throws CmsRpcException if something goes wrong 458 */ 459 CmsCntPageData prefetch() throws CmsRpcException; 460 461 /** 462 * Prepares an element to be edited.<p> 463 * 464 * @param clientId the client element id 465 * @param editOption the selected delete option 466 * @param pageStructureId the current page structure id 467 * @param requestParams optional request parameters 468 * 469 * @return the structure ID of the content to edit 470 * 471 * @throws CmsRpcException in case something goes wrong 472 */ 473 CmsUUID prepareForEdit(String clientId, String editOption, CmsUUID pageStructureId, String requestParams) 474 throws CmsRpcException; 475 476 /** 477 * Returns the element data to replace a given content element with another while keeping it's settings.<p> 478 * 479 * @param context the rpc context 480 * @param detailContentId the detail content structure id 481 * @param reqParams optional request parameters 482 * @param clientId the id of the element to replace 483 * @param replaceId the id of the replacing element 484 * @param containers the containers of the current page 485 * @param locale the content locale 486 * 487 * @return the element data 488 * 489 * @throws CmsRpcException if something goes wrong processing the request 490 */ 491 CmsContainerElementData replaceElement( 492 CmsContainerPageRpcContext context, 493 CmsUUID detailContentId, 494 String reqParams, 495 String clientId, 496 String replaceId, 497 Collection<CmsContainer> containers, 498 String locale) 499 throws CmsRpcException; 500 501 /** 502 * Saves the index of the clipboard tab selected by the user.<p> 503 * 504 * @param tabIndex the index of the selected clipboard tab 505 */ 506 void saveClipboardTab(int tabIndex); 507 508 /** 509 * Saves the container-page.<p> 510 * 511 * @param pageStructureId the container page structure id 512 * @param containers the container-page's containers 513 * 514 * @return the page save status 515 * 516 * @throws CmsRpcException if something goes wrong processing the request 517 */ 518 CmsPageSaveStatus saveContainerpage(CmsUUID pageStructureId, List<CmsContainer> containers) throws CmsRpcException; 519 520 /** 521 * Saves the detail containers.<p> 522 * 523 * @param detailId the detail content id 524 * @param detailContainerResource the detail container resource path 525 * @param containers the container-page's containers 526 * 527 * @return the page save status 528 * 529 * @throws CmsRpcException if something goes wrong processing the request 530 */ 531 CmsPageSaveStatus saveDetailContainers( 532 CmsUUID detailId, 533 String detailContainerResource, 534 List<CmsContainer> containers) 535 throws CmsRpcException; 536 537 /** 538 * Saves the settings for the given element to the container page and returns the updated element data.<p> 539 * 540 * @param context the RPC context 541 * @param detailContentId the detail content structure id 542 * @param reqParams optional request parameters 543 * @param clientId the requested element ids 544 * @param settings the settings for which the element data should be loaded 545 * @param containers the containers of the current page 546 * @param locale the content locale 547 * @return the element data 548 * 549 * @throws CmsRpcException if something goes wrong processing the request 550 */ 551 CmsContainerElementData saveElementSettings( 552 CmsContainerPageRpcContext context, 553 CmsUUID detailContentId, 554 String reqParams, 555 String clientId, 556 Map<String, String> settings, 557 List<CmsContainer> containers, 558 String locale) 559 throws CmsRpcException; 560 561 /** 562 * Saves the favorite list.<p> 563 * 564 * @param clientIds favorite list element id's 565 * @param uri the container page URI 566 * 567 * @throws CmsRpcException if something goes wrong processing the request 568 */ 569 void saveFavoriteList(List<String> clientIds, String uri) throws CmsRpcException; 570 571 /** 572 * Saves a group-container element.<p> 573 * 574 * @param context the RPC context 575 * @param detailContentId the detail content structure id 576 * @param reqParams optional request parameters 577 * @param groupContainer the group-container to save 578 * @param containers the containers of the current page 579 * @param locale the content locale 580 * 581 * @return the data of the saved group container 582 * 583 * @throws CmsRpcException if something goes wrong processing the request 584 */ 585 CmsGroupContainerSaveResult saveGroupContainer( 586 CmsContainerPageRpcContext context, 587 CmsUUID detailContentId, 588 String reqParams, 589 CmsGroupContainer groupContainer, 590 Collection<CmsContainer> containers, 591 String locale) 592 throws CmsRpcException; 593 594 /** 595 * Saves an inheritance container.<p> 596 * 597 * @param pageStructureId the current page's structure id 598 * @param detailContentId the detail content structure id 599 * @param inheritanceContainer the inheritance container to save 600 * @param containers the containers of the current page 601 * @param locale the requested locale 602 * 603 * @return the element data of the saved container 604 * 605 * @throws CmsRpcException if something goes wrong 606 */ 607 Map<String, CmsContainerElementData> saveInheritanceContainer( 608 CmsUUID pageStructureId, 609 CmsUUID detailContentId, 610 CmsInheritanceContainer inheritanceContainer, 611 Collection<CmsContainer> containers, 612 String locale) 613 throws CmsRpcException; 614 615 /** 616 * Saves the recent list.<p> 617 * 618 * @param clientIds recent list element id's 619 * @param uri the container page URI 620 * 621 * @throws CmsRpcException if something goes wrong processing the request 622 */ 623 void saveRecentList(List<String> clientIds, String uri) throws CmsRpcException; 624 625 /** 626 * Enables or disables editing for small elements on page load.<p> 627 * 628 * @param editSmallElements the defautl setting for the small element editability 629 * 630 * @throws CmsRpcException if something goes wrong 631 */ 632 void setEditSmallElements(boolean editSmallElements) throws CmsRpcException; 633 634 /** 635 * Sets the element view.<p> 636 * 637 * @param elementView the element view 638 * 639 * @throws CmsRpcException if something goes wrong processing the request 640 */ 641 void setElementView(CmsUUID elementView) throws CmsRpcException; 642 643 /** 644 * Stores information about the container page last edited.<p> 645 * 646 * @param pageId the page id 647 * @param detailId the detail content id 648 * 649 * @throws CmsRpcException if something goes wrong 650 */ 651 void setLastPage(CmsUUID pageId, CmsUUID detailId) throws CmsRpcException; 652 653}