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.gwt.shared.rpc;
029
030import org.opencms.gwt.shared.CmsDeleteResourceBean;
031import org.opencms.gwt.shared.CmsExternalLinkInfoBean;
032import org.opencms.gwt.shared.CmsHistoryResourceCollection;
033import org.opencms.gwt.shared.CmsHistoryVersion;
034import org.opencms.gwt.shared.CmsListInfoBean;
035import org.opencms.gwt.shared.CmsLockReportInfo;
036import org.opencms.gwt.shared.CmsPrepareEditResponse;
037import org.opencms.gwt.shared.CmsPreviewInfo;
038import org.opencms.gwt.shared.CmsQuickLaunchData;
039import org.opencms.gwt.shared.CmsQuickLaunchParams;
040import org.opencms.gwt.shared.CmsRenameInfoBean;
041import org.opencms.gwt.shared.CmsReplaceInfo;
042import org.opencms.gwt.shared.CmsResourceStatusBean;
043import org.opencms.gwt.shared.CmsRestoreInfoBean;
044import org.opencms.gwt.shared.CmsVfsEntryBean;
045import org.opencms.gwt.shared.alias.CmsAliasBean;
046import org.opencms.gwt.shared.property.CmsPropertiesBean;
047import org.opencms.gwt.shared.property.CmsPropertyChangeSet;
048import org.opencms.util.CmsUUID;
049import org.opencms.xml.content.CmsXmlContentProperty;
050
051import java.util.ArrayList;
052import java.util.List;
053import java.util.Map;
054
055import com.google.gwt.user.client.rpc.AsyncCallback;
056import com.google.gwt.user.client.rpc.SynchronizedRpcRequest;
057
058/**
059 * An asynchronous service interface for retrieving information about the VFS tree.<p>
060 *
061 * @since 8.0.0
062 */
063public interface I_CmsVfsServiceAsync {
064
065    /**
066     * Creates a new external link resource.<p>
067     *
068     * @param title the title
069     * @param link the link
070     * @param resourceName the name of the link resource to create
071     * @param parentFolderPath the parent folder site path
072     * @param callback the async callback
073     */
074    void createNewExternalLink(
075        String title,
076        String link,
077        String resourceName,
078        String parentFolderPath,
079        AsyncCallback<Void> callback);
080
081    /**
082     * Creates a property definition.<p>
083     *
084     * @param propertyName the new property name
085     *
086     * @param callback the callback
087     */
088    void createPropertyDefinition(String propertyName, AsyncCallback<Void> callback);
089
090    /**
091     * Deletes a resource from the VFS.<p>
092     *
093     * @param structureId the structure id of the resource to delete
094     * @param callback the callback
095     */
096    void deleteResource(CmsUUID structureId, AsyncCallback<Void> callback);
097
098    /**
099     * Deletes a resource from the VFS.<p>
100     *
101     * @param sitePath the site path of the resource to delete
102     * @param callback the callback
103     */
104    void deleteResource(String sitePath, AsyncCallback<Void> callback);
105
106    /**
107     * Forces a resource to be unlocked. In case the given resource is a folder, all sub-resources are also unlocked.<p>
108     *
109     * @param structureId the structure id of the resource to unlock
110     * @param callback the callback
111     */
112    void forceUnlock(CmsUUID structureId, AsyncCallback<Void> callback);
113
114    /**
115     * Fetches the aliases for a given page.<p>
116     *
117     * @param structureId the structure id of the page
118     * @param callback the async callback
119     *
120     */
121    void getAliasesForPage(CmsUUID structureId, AsyncCallback<List<CmsAliasBean>> callback);
122
123    /**
124     * Returns a list of potentially broken links, if the given resource was deleted.<p>
125     *
126     * @param structureId the resource structure id
127     * @param callback the callback
128     */
129    void getBrokenLinks(CmsUUID structureId, AsyncCallback<CmsDeleteResourceBean> callback);
130
131    /**
132     * Returns a list of potentially broken links, if the given resource was deleted.<p>
133     *
134     * @param sitePath the resource site-path
135     * @param callback the callback
136     */
137    void getBrokenLinks(String sitePath, AsyncCallback<CmsDeleteResourceBean> callback);
138
139    /**
140     * Fetches the list of children of a path.<p>
141     *
142     * @param path the path for which the list of children should be retrieved
143     * @param callback the asynchronous callback
144     */
145    void getChildren(String path, AsyncCallback<List<CmsVfsEntryBean>> callback);
146
147    /**
148     * Loads a thumbnail for the given dataview configuration and id.<p>
149     *
150     * @param config the dataview configuration
151     * @param id the data id
152     * @param imageCallback the callback to be called with the result URL
153     */
154    void getDataViewThumbnail(String config, String id, AsyncCallback<String> imageCallback);
155
156    /**
157     * Gets the default property configurations for a list of structure ids.<p>
158     *
159     * @param structureIds the structure ids for which to fetch the default property configurations
160     *
161     * @param callback the callback for the result
162     */
163    void getDefaultProperties(
164        List<CmsUUID> structureIds,
165        AsyncCallback<Map<CmsUUID, Map<String, CmsXmlContentProperty>>> callback);
166
167    /**
168     * Gets the names of defined properties.<p>
169     *
170     * @param callback the callback for the results
171     */
172    void getDefinedProperties(AsyncCallback<ArrayList<String>> callback);
173
174    /**
175     * Returns the file replace info.<p>
176     *
177     * @param structureId the structure id of the file to replace
178     * @param callback the asynchronous callback
179     */
180    void getFileReplaceInfo(CmsUUID structureId, AsyncCallback<CmsReplaceInfo> callback);
181
182    /**
183     * Gets th historical preview information for the given resource.<p>
184     *
185     * @param structureId the structure id of the resource
186     * @param locale the locale for which to get the preview info
187     * @param version thee version for which to get the preview information
188     *
189     * @param resultCallback if something goe
190     */
191    void getHistoryPreviewInfo(
192        CmsUUID structureId,
193        String locale,
194        CmsHistoryVersion version,
195        AsyncCallback<CmsPreviewInfo> resultCallback);
196
197    /**
198     * Returns the lock report info.<p>
199     *
200     * @param structureId the structure id of the resource to get the report for
201     * @param callback the callback
202     */
203    void getLockReportInfo(CmsUUID structureId, AsyncCallback<CmsLockReportInfo> callback);
204
205    /**
206     * Gets a {@link CmsListInfoBean} for a given resource.<p>
207     *
208     * @param structureId the structure id to create the {@link CmsListInfoBean} for
209     * @param callback the asynchronous callback
210     */
211    void getPageInfo(CmsUUID structureId, AsyncCallback<CmsListInfoBean> callback);
212
213    /**
214     * Gets a {@link CmsListInfoBean} for a given resource.<p>
215     *
216     * @param vfsPath the vfs path to create the {@link CmsListInfoBean} for
217     * @param callback the asynchronous callback
218     */
219    void getPageInfo(String vfsPath, AsyncCallback<CmsListInfoBean> callback);
220
221    /**
222     * Returns the preview info for the given resource.<p>
223     *
224     * @param structureId the resource structure id
225     * @param locale the requested locale
226     * @param callback the call back
227     */
228    void getPreviewInfo(CmsUUID structureId, String locale, AsyncCallback<CmsPreviewInfo> callback);
229
230    /**
231     * Returns the preview info for the given resource.<p>
232     *
233     * @param sitePath the resource site path
234     * @param locale the requested locale
235     * @param callback the call back
236     */
237    void getPreviewInfo(String sitePath, String locale, AsyncCallback<CmsPreviewInfo> callback);
238
239    /**
240     * Gets the information needed for the Rename dialog.<p>
241     *
242     * @param structureId the structure id of the resource to rename
243     * @param callback the callback for the result
244     */
245    void getRenameInfo(CmsUUID structureId, AsyncCallback<CmsRenameInfoBean> callback);
246
247    /**
248     * Gets the history of a resource.<p>
249     *
250     * @param structureId the structure id of the resource
251     * @param resultCallback the callback to call with the result
252     */
253    void getResourceHistory(CmsUUID structureId, AsyncCallback<CmsHistoryResourceCollection> resultCallback);
254
255    /**
256     * Gets status information for a single resource.<p>
257     *
258     * @param structureId the structure id of the resource
259     * @param locale the locale for which we want the resource information
260     * @param includeTargets flag to control whether relation targets should also be fetched
261     * @param detailContentId the structure id of the detail content if present
262     * @param context a map of context-dependent parameters used to provide additional information
263     * @param callback the callback for the results
264     */
265    void getResourceStatus(
266        CmsUUID structureId,
267        String locale,
268        boolean includeTargets,
269        CmsUUID detailContentId,
270        Map<String, String> context,
271        AsyncCallback<CmsResourceStatusBean> callback);
272
273    /**
274     * Gets the information which is necessary for opening the 'Restore' dialog for a resource.<p>
275     *
276     * @param structureId the structure id of the resource
277     * @param resultCallback the callback for the result
278     */
279    void getRestoreInfo(CmsUUID structureId, AsyncCallback<CmsRestoreInfoBean> resultCallback);
280
281    /**
282     * Returns the root entries of the VFS.<p>
283     *
284     * @param callback the asynchronous callback
285     */
286    void getRootEntries(AsyncCallback<List<CmsVfsEntryBean>> callback);
287
288    /**
289     * Returns the site-path for the resource with the given id.<p>
290     *
291     * @param structureId the structure id
292     * @param callback the asynchronous callback
293     */
294    void getSitePath(CmsUUID structureId, AsyncCallback<String> callback);
295
296    /**
297     * Loads the external link info.<p>
298     *
299     * @param structureId the external link structure id
300     * @param callback the callback
301     */
302    void loadLinkInfo(CmsUUID structureId, AsyncCallback<CmsExternalLinkInfoBean> callback);
303
304    /**
305     * Load the data necessary to edit the properties of a resource.<p>
306     *
307     * @param id the structure id of a resource
308     * @param callback the asynchronous callback
309     */
310    void loadPropertyData(CmsUUID id, AsyncCallback<CmsPropertiesBean> callback);
311
312    /**
313     * Loads the items for the quick launch menu.<p>
314     *
315     * @param params the quick launch parameters
316     *
317     * @param resultCallback the callback for the result
318     */
319    void loadQuickLaunchItems(CmsQuickLaunchParams params, AsyncCallback<List<CmsQuickLaunchData>> resultCallback);
320
321    /**
322     * Prepares to edit a file in the XML content editor.<p>
323     *
324     * @param currentPage the current page from which the editor should be opened
325     * @param fileNameWithMacros the file name, which may contain macros
326     *
327     * @param callback the asynchronous callback
328     */
329    void prepareEdit(CmsUUID currentPage, String fileNameWithMacros, AsyncCallback<CmsPrepareEditResponse> callback);
330
331    /**
332     * Renames a resource.<p>
333     *
334     * @param structureId the structure id of the resource to rename
335     * @param newName the new resource name
336     *
337     * @param callback the asynchronous callback for the result
338     */
339    void renameResource(CmsUUID structureId, String newName, AsyncCallback<String> callback);
340
341    /**
342     * Restores a previous version of the resource.<p>
343     *
344     * @param structureId the structure id of the version
345     * @param version the number of the version to which  the resource should be reverted
346     * @param callback the callback to call with the results
347     */
348    void restoreResource(CmsUUID structureId, int version, AsyncCallback<Void> callback);
349
350    /**
351     * Saves aliases for a page.<p>
352     *
353     * @param structureId the structure id of the page
354     * @param aliases the aliases which should be saved for the page
355     * @param callback the async callback
356     */
357    void saveAliases(CmsUUID structureId, List<CmsAliasBean> aliases, AsyncCallback<Void> callback);
358
359    /**
360     * Saves the external link.<p>
361     *
362     * @param structureId the link structure id
363     * @param title the link title
364     * @param link the link
365     * @param fileName the file name
366     * @param callback the asynchronous callback
367     */
368    void saveExternalLink(
369        CmsUUID structureId,
370        String title,
371        String link,
372        String fileName,
373        AsyncCallback<Void> callback);
374
375    /**
376     * Saves a set of property changes.<p>
377     *
378     * @param changes the property changes
379     *
380     * @param callback the asynchronous callback
381     */
382    void saveProperties(CmsPropertyChangeSet changes, AsyncCallback<Void> callback);
383
384    /**
385     * Returns the absolute link to the given root path.<p>
386     *
387     * @param currentSiteRoot the current site
388     * @param rootPath the root path
389     * @param callback the asynchronous callback
390     */
391    void substituteLinkForRootPath(String currentSiteRoot, String rootPath, AsyncCallback<String> callback);
392
393    /**
394     * Deletes a resource from the VFS.<p>
395     *
396     * @param structureId the structure id of the resource to delete
397     * @param callback the callback
398     */
399    @SynchronizedRpcRequest
400    void syncDeleteResource(CmsUUID structureId, AsyncCallback<Void> callback);
401
402    /**
403     * Undeletes a resource.<p>
404     *
405     * @param structureId the structure id of the resource
406     *
407     * @param callback the result callback
408     */
409    void undelete(CmsUUID structureId, AsyncCallback<Void> callback);
410
411    /**
412     * Undoes the changes to a given resource, i.e. restores its online content to its offline version.<p>
413     *
414     * @param structureId the structure id of the resource to undo
415     * @param undoMove true if move operations should be undone
416     * @param callback the callback for the result
417     */
418    void undoChanges(CmsUUID structureId, boolean undoMove, AsyncCallback<Void> callback);
419
420    /**
421     * Validates alias paths for a page.<p>
422     *
423     * @param structureId the structure id of the page
424     * @param aliasPaths a map from (arbitrary) id strings to alias paths
425     * @param callback the async callback
426     */
427    void validateAliases(
428        CmsUUID structureId,
429        Map<String, String> aliasPaths,
430        AsyncCallback<Map<String, String>> callback);
431
432}