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