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