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;
055import com.google.gwt.user.client.rpc.SynchronizedRpcRequest;
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     * Gets the alias import results from the server.<p>
142     *
143     * @param resultKey the key which identifies the alias import results to get
144     * @param asyncCallback the asynchronous callback
145     */
146    void getAliasImportResult(String resultKey, AsyncCallback<List<CmsAliasImportResult>> asyncCallback);
147
148    /**
149     * Gets the initial data for the bulk alias editor.<p>
150     *
151     * @param callback the asynchronous callback
152     */
153    void getAliasTable(AsyncCallback<CmsAliasInitialFetchResult> callback);
154
155    /**
156     * Gets the category data for the given entry point.<p>
157     *
158     * @param entryPoint the entry point
159     * @param resultCallback the callback for the result
160     **/
161    void getCategoryData(String entryPoint, AsyncCallback<CmsSitemapCategoryData> resultCallback);
162
163    /**
164     * Returns the sitemap children for the given path.<p>
165     *
166     * @param entryPointUri the URI of the sitemap entry point
167     * @param entryId the entry id
168     * @param levels the count of child levels to read
169     * @param callback the async callback
170     */
171    void getChildren(String entryPointUri, CmsUUID entryId, int levels, AsyncCallback<CmsClientSitemapEntry> callback);
172
173    /**
174     * Returns the gallery data to this sub site.<p>
175     *
176     * @param entryPointUri the sub site folder
177     * @param callback the async callback
178     */
179    void getGalleryData(String entryPointUri, AsyncCallback<Map<CmsGalleryType, List<CmsGalleryFolderEntry>>> callback);
180
181    /**
182     * Gets the model pages for the given structure id of the sitemap root folder.<p>
183     *
184     * @param id structure id of a folder
185     * @param callback the callback for the result
186     */
187    void getModelInfos(CmsUUID id, AsyncCallback<CmsModelInfo> callback);
188
189    /**
190     * Loads the model page data for the "add" menu.<p>
191     *
192     * @param entryPointUri the entry point uri
193     * @param resultCallback the callback for the result
194     */
195    void getNewElementInfo(String entryPointUri, AsyncCallback<List<CmsNewResourceInfo>> resultCallback);
196
197    /**
198     * Loads the data needed by the property editor in the locale comparison view.<p>
199     *
200     * @param id the id of the resource for which the property editor should be opened
201     * @param rootId the structure id of the resource which corresponds to the tree root in locale compare mode
202     *
203     * @param resultCallback the callback to call with the result
204     */
205    void loadPropertyDataForLocaleCompareView(
206        CmsUUID id,
207        CmsUUID rootId,
208        AsyncCallback<CmsLocaleComparePropertyData> resultCallback);
209
210    /**
211     * Merges a sub-sitemap into it's parent sitemap.<p>
212     *
213     * @param entryPoint the sitemap entry point
214     * @param subSitemapId the structure id of the sub sitemap folder
215     *
216     * @param callback the async callback
217     */
218    void mergeSubSitemap(String entryPoint, CmsUUID subSitemapId, AsyncCallback<CmsSitemapChange> callback);
219
220    /**
221     * Returns the initialization data for the given sitemap.<p>
222     *
223     * @param sitemapUri the site relative path
224     * @param callback the async callback
225     */
226    void prefetch(String sitemapUri, AsyncCallback<CmsSitemapData> callback);
227
228    /**
229     * Prepares sitemap reloading for the given sitemap root.<p>
230     *
231     * This method may change the currently set site root.
232     *
233     * @param rootId the structure id of the new sitemap root
234     * @param mode the new editor mode
235     *
236     * @param resultUrl the callback for the URL which should be used to reload the sitemap
237     */
238    void prepareReloadSitemap(CmsUUID rootId, EditorMode mode, AsyncCallback<String> resultUrl);
239
240    /**
241     * Removes a model page from the current sitemap configuration.<p>
242     *
243     * @param baseUri the base uri for the current sitemap
244     * @param modelPageId structure id of the model page to remove
245     * @param callback the callback
246     */
247    void removeModelPage(String baseUri, CmsUUID modelPageId, AsyncCallback<Void> callback);
248
249    /**
250     * Saves the change to the given sitemap.<p>
251     *
252     * @param sitemapUri the sitemap URI
253     * @param change the change to save
254     * @param callback the async callback
255     */
256    void save(String sitemapUri, CmsSitemapChange change, AsyncCallback<CmsSitemapChange> callback);
257
258    /**
259     * Saves the aliases for the bulk alias editor.<p>
260     *
261     * @param saveRequest the object containing the data to save
262     * @param callback the asynchronous callback
263     */
264    void saveAliases(CmsAliasSaveValidationRequest saveRequest, AsyncCallback<CmsAliasEditValidationReply> callback);
265
266    /**
267     * Saves the changed properties in locale comparison mode.<p>
268     *
269     * @param id the structure id
270     * @param newUrlName the new URL name
271     * @param propertyChanges the property changes
272     * @param editedName true if the name was edited
273     * @param callback the callback to call when done
274     */
275    void savePropertiesForLocaleCompareMode(
276        CmsUUID id,
277        String newUrlName,
278        List<CmsPropertyModification> propertyChanges,
279        boolean editedName,
280        AsyncCallback<Void> callback);
281
282    /**
283     * Save the change to the given sitemap.<p>
284     *
285     * @param sitemapUri the sitemap URI
286     * @param change the change to save
287     * @param callback the async callback
288     */
289    @SynchronizedRpcRequest
290    void saveSync(String sitemapUri, CmsSitemapChange change, AsyncCallback<CmsSitemapChange> callback);
291
292    /**
293     * Sets the default model page for the given sub-sitemap, returns the updated model info.<p>
294     *
295     * @param rootId structure id of the sub-sitemap root folder
296     * @param modelId the id of the model page to set as default
297     * @param callback the callback for the result
298     */
299    void setDefaultModel(CmsUUID rootId, CmsUUID modelId, AsyncCallback<CmsModelInfo> callback);
300
301    /**
302     * Sets the editor mode in the current user session.<p>
303     *
304     * @param editorMode the editor mode to set
305     * @param callback the asynchronous callback
306     */
307    void setEditorMode(EditorMode editorMode, AsyncCallback<Void> callback);
308
309    /**
310     * Updates the alias editor status.<p>
311     *
312     * This is used to keep two users from editing the alias table for a site root concurrently.<p>
313     *
314     * @param editing true to indicate that the table is still being edited, false to indicate that the table isn't being edited anymore
315     * @param callback the asynchronous callback
316     */
317    void updateAliasEditorStatus(boolean editing, AsyncCallback<Void> callback);
318
319    /**
320     * Validates the aliases for the bulk alias editor.<p>
321     *
322     * @param validationRequest an object indicating the type of validation to perform
323     * @param callback the asynchronous callback
324     */
325    void validateAliases(
326        CmsAliasEditValidationRequest validationRequest,
327        AsyncCallback<CmsAliasEditValidationReply> callback);
328
329    /**
330    * Validates rewrite aliases.<p>
331    *
332    * @param validationRequest the rewrite alias data to validate
333    *
334    * @param callback the callback for the result
335    */
336    void validateRewriteAliases(
337        CmsRewriteAliasValidationRequest validationRequest,
338        AsyncCallback<CmsRewriteAliasValidationReply> callback);
339
340}