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