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