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