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.sitemap.shared.rpc;
029
030import org.opencms.ade.sitemap.shared.CmsClientSitemapEntry;
031import org.opencms.ade.sitemap.shared.CmsGalleryFolderEntry;
032import org.opencms.ade.sitemap.shared.CmsGalleryType;
033import org.opencms.ade.sitemap.shared.CmsLocaleComparePropertyData;
034import org.opencms.ade.sitemap.shared.CmsModelInfo;
035import org.opencms.ade.sitemap.shared.CmsModelPageEntry;
036import org.opencms.ade.sitemap.shared.CmsNewResourceInfo;
037import org.opencms.ade.sitemap.shared.CmsSitemapAttributeData;
038import org.opencms.ade.sitemap.shared.CmsSitemapCategoryData;
039import org.opencms.ade.sitemap.shared.CmsSitemapChange;
040import org.opencms.ade.sitemap.shared.CmsSitemapData;
041import org.opencms.ade.sitemap.shared.CmsSitemapData.EditorMode;
042import org.opencms.gwt.shared.alias.CmsAliasEditValidationReply;
043import org.opencms.gwt.shared.alias.CmsAliasEditValidationRequest;
044import org.opencms.gwt.shared.alias.CmsAliasImportResult;
045import org.opencms.gwt.shared.alias.CmsAliasInitialFetchResult;
046import org.opencms.gwt.shared.alias.CmsAliasSaveValidationRequest;
047import org.opencms.gwt.shared.alias.CmsRewriteAliasValidationReply;
048import org.opencms.gwt.shared.alias.CmsRewriteAliasValidationRequest;
049import org.opencms.gwt.shared.property.CmsPropertyModification;
050import org.opencms.util.CmsUUID;
051
052import java.util.List;
053import java.util.Map;
054
055import com.google.gwt.user.client.rpc.AsyncCallback;
056
057/**
058 * Handles all RPC services related to the sitemap.<p>
059 *
060 * @since 8.0.0
061 *
062 * @see org.opencms.ade.sitemap.CmsVfsSitemapService
063 * @see org.opencms.ade.sitemap.shared.rpc.I_CmsSitemapService
064 * @see org.opencms.ade.sitemap.shared.rpc.I_CmsSitemapServiceAsync
065 */
066public interface I_CmsSitemapServiceAsync {
067
068    /**
069     * Sets the name and title of the given category.<p>
070     *
071     * @param entryPoint the current entry point
072     * @param id the category id
073     * @param title the new title
074     * @param name the new name
075     * @param callback the callback to call when done
076     */
077    void changeCategory(String entryPoint, CmsUUID id, String title, String name, AsyncCallback<Void> callback);
078
079    /**
080     * Creates a new category.<p>
081     *
082     * @param entryPoint the entry point
083     * @param id the parent category id
084     * @param title the title
085     * @param name the category name
086     * @param callback the result callback
087     */
088    void createCategory(String entryPoint, CmsUUID id, String title, String name, AsyncCallback<Void> callback);
089
090    /**
091     * Creates a new gallery folder.<p>
092     *
093     * @param parentFolder the parent folder path
094     * @param title the title property
095     * @param folderTypeId the resource type id
096     * @param callback the async callback
097     */
098    void createNewGalleryFolder(
099        String parentFolder,
100        String title,
101        int folderTypeId,
102        AsyncCallback<CmsGalleryFolderEntry> callback);
103
104    /**
105     * Creates a new model page.<p>
106     *
107     * @param entryPointUri the uri of the entry point
108     * @param title the title for the model page
109     * @param description the description for the model page
110     * @param copyId the structure id of the resource to copy to create a new model page; if null, the model page is created as an empty container page
111     * @param isModelGroup <code>true</code> to create a new model group page
112     * @param resultCallback the callback for the result
113     */
114    void createNewModelPage(
115        String entryPointUri,
116        String title,
117        String description,
118        CmsUUID copyId,
119        boolean isModelGroup,
120        AsyncCallback<CmsModelPageEntry> resultCallback);
121
122    /**
123     * Creates a sub-sitemap of the given sitemap starting from the given entry.<p>
124     *
125     * @param entryId the structure id of the sitemap entry to create a sub sitemap of
126     * @param callback the async callback
127     */
128    void createSubSitemap(CmsUUID entryId, AsyncCallback<CmsSitemapChange> callback);
129
130    /**
131     * Sets the disabled flag of a model page within the current sitemap configuration.<p>
132     *
133     * @param baseUri the base uri for the current sitemap
134     * @param modelPageId structure id of the model page to remove
135     * @param disabled the disabled flag
136     * @param callback the callback
137     */
138    void disableModelPage(String baseUri, CmsUUID modelPageId, boolean disabled, AsyncCallback<Void> callback);
139
140    /**
141     * Loads the data for the attribute editor dialog and locks the sitemap configuration.
142     *
143     * @param rootId the root ID of the current sitemap
144     * @param callback the result callback
145     */
146    void editAttributeData(CmsUUID rootId, AsyncCallback<CmsSitemapAttributeData> callback);
147
148    /**
149     * Gets the alias import results from the server.<p>
150     *
151     * @param resultKey the key which identifies the alias import results to get
152     * @param asyncCallback the asynchronous callback
153     */
154    void getAliasImportResult(String resultKey, AsyncCallback<List<CmsAliasImportResult>> asyncCallback);
155
156    /**
157     * Gets the initial data for the bulk alias editor.<p>
158     *
159     * @param callback the asynchronous callback
160     */
161    void getAliasTable(AsyncCallback<CmsAliasInitialFetchResult> callback);
162
163    /**
164     * Gets the category data for the given entry point.<p>
165     *
166     * @param entryPoint the entry point
167     * @param resultCallback the callback for the result
168     **/
169    void getCategoryData(String entryPoint, AsyncCallback<CmsSitemapCategoryData> resultCallback);
170
171    /**
172     * Returns the sitemap children for the given path.<p>
173     *
174     * @param entryPointUri the URI of the sitemap entry point
175     * @param entryId the entry id
176     * @param levels the count of child levels to read
177     * @param callback the async callback
178     */
179    void getChildren(String entryPointUri, CmsUUID entryId, int levels, AsyncCallback<CmsClientSitemapEntry> callback);
180
181    /**
182     * Returns the gallery data to this sub site.<p>
183     *
184     * @param entryPointUri the sub site folder
185     * @param callback the async callback
186     */
187    void getGalleryData(String entryPointUri, AsyncCallback<Map<CmsGalleryType, List<CmsGalleryFolderEntry>>> callback);
188
189    /**
190     * Gets the model pages for the given structure id of the sitemap root folder.<p>
191     *
192     * @param id structure id of a folder
193     * @param callback the callback for the result
194     */
195    void getModelInfos(CmsUUID id, AsyncCallback<CmsModelInfo> callback);
196
197    /**
198     * Loads the model page data for the "add" menu.<p>
199     *
200     * @param entryPointUri the entry point uri
201     * @param resultCallback the callback for the result
202     */
203    void getNewElementInfo(String entryPointUri, AsyncCallback<List<CmsNewResourceInfo>> resultCallback);
204
205    /**
206     * Fetches the link for a resource selected in the sitemap editor.<p>
207     *
208     * @param baseId the structure id of the current sitemap root entry
209     * @param sitePath the site path of a resource
210     * @param callback the callback to call with the result
211     */
212    void getResourceLink(CmsUUID baseId, String sitePath, AsyncCallback<String> callback);
213
214    /**
215     * Loads the data needed by the property editor in the locale comparison view.<p>
216     *
217     * @param id the id of the resource for which the property editor should be opened
218     * @param rootId the structure id of the resource which corresponds to the tree root in locale compare mode
219     *
220     * @param resultCallback the callback to call with the result
221     */
222    void loadPropertyDataForLocaleCompareView(
223        CmsUUID id,
224        CmsUUID rootId,
225        AsyncCallback<CmsLocaleComparePropertyData> resultCallback);
226
227    /**
228     * Merges a sub-sitemap into it's parent sitemap.<p>
229     *
230     * @param entryPoint the sitemap entry point
231     * @param subSitemapId the structure id of the sub sitemap folder
232     *
233     * @param callback the async callback
234     */
235    void mergeSubSitemap(String entryPoint, CmsUUID subSitemapId, AsyncCallback<CmsSitemapChange> callback);
236
237    /**
238     * Returns the initialization data for the given sitemap.<p>
239     *
240     * @param sitemapUri the site relative path
241     * @param callback the async callback
242     */
243    void prefetch(String sitemapUri, AsyncCallback<CmsSitemapData> callback);
244
245    /**
246     * Prepares sitemap reloading for the given sitemap root.<p>
247     *
248     * This method may change the currently set site root.
249     *
250     * @param rootId the structure id of the new sitemap root
251     * @param mode the new editor mode
252     *
253     * @param resultUrl the callback for the URL which should be used to reload the sitemap
254     */
255    void prepareReloadSitemap(CmsUUID rootId, EditorMode mode, AsyncCallback<String> resultUrl);
256
257    /**
258     * Removes a model page from the current sitemap configuration.<p>
259     *
260     * @param baseUri the base uri for the current sitemap
261     * @param modelPageId structure id of the model page to remove
262     * @param callback the callback
263     */
264    void removeModelPage(String baseUri, CmsUUID modelPageId, AsyncCallback<Void> callback);
265
266    /**
267     * Saves the change to the given sitemap.<p>
268     *
269     * @param sitemapUri the sitemap URI
270     * @param change the change to save
271     * @param callback the async callback
272     */
273    void save(String sitemapUri, CmsSitemapChange change, AsyncCallback<CmsSitemapChange> callback);
274
275    /**
276     * Saves the aliases for the bulk alias editor.<p>
277     *
278     * @param saveRequest the object containing the data to save
279     * @param callback the asynchronous callback
280     */
281    void saveAliases(CmsAliasSaveValidationRequest saveRequest, AsyncCallback<CmsAliasEditValidationReply> callback);
282
283    /**
284     * Saves the changed properties in locale comparison mode.<p>
285     *
286     * @param id the structure id
287     * @param newUrlName the new URL name
288     * @param propertyChanges the property changes
289     * @param editedName true if the name was edited
290     * @param callback the callback to call when done
291     */
292    void savePropertiesForLocaleCompareMode(
293        CmsUUID id,
294        String newUrlName,
295        List<CmsPropertyModification> propertyChanges,
296        boolean editedName,
297        AsyncCallback<Void> callback);
298
299    /**
300     * Saves the data from the sitemap attribute editor dialog to the sitemap configuration.
301     *
302     * @param rootId the root ID
303     * @param attributes the sitemap attributes
304     * @param callback the callback for the result
305     */
306    void saveSitemapAttributes(CmsUUID rootId, Map<String, String> attributes, AsyncCallback<Void> callback);
307
308    /**
309     * Sets the default model page for the given sub-sitemap, returns the updated model info.<p>
310     *
311     * @param rootId structure id of the sub-sitemap root folder
312     * @param modelId the id of the model page to set as default
313     * @param callback the callback for the result
314     */
315    void setDefaultModel(CmsUUID rootId, CmsUUID modelId, AsyncCallback<CmsModelInfo> callback);
316
317    /**
318     * Sets the editor mode in the current user session.<p>
319     *
320     * @param editorMode the editor mode to set
321     * @param callback the asynchronous callback
322     */
323    void setEditorMode(EditorMode editorMode, AsyncCallback<Void> callback);
324
325    /**
326     * Updates the alias editor status.<p>
327     *
328     * This is used to keep two users from editing the alias table for a site root concurrently.<p>
329     *
330     * @param editing true to indicate that the table is still being edited, false to indicate that the table isn't being edited anymore
331     * @param callback the asynchronous callback
332     */
333    void updateAliasEditorStatus(boolean editing, AsyncCallback<Void> callback);
334
335    /**
336     * Validates the aliases for the bulk alias editor.<p>
337     *
338     * @param validationRequest an object indicating the type of validation to perform
339     * @param callback the asynchronous callback
340     */
341    void validateAliases(
342        CmsAliasEditValidationRequest validationRequest,
343        AsyncCallback<CmsAliasEditValidationReply> callback);
344
345    /**
346    * Validates rewrite aliases.<p>
347    *
348    * @param validationRequest the rewrite alias data to validate
349    *
350    * @param callback the callback for the result
351    */
352    void validateRewriteAliases(
353        CmsRewriteAliasValidationRequest validationRequest,
354
355        AsyncCallback<CmsRewriteAliasValidationReply> callback);
356}