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