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     * Gets the detail name for the given structure id.
176     *
177     * @param id a structure id
178     * @param localeStr the locale as a string
179     * @param callback the callback for the result
180     */
181    void getDetailName(CmsUUID id, String localeStr, AsyncCallback<String> callback);
182
183    /**
184     * Returns the file replace info.<p>
185     *
186     * @param structureId the structure id of the file to replace
187     * @param callback the asynchronous callback
188     */
189    void getFileReplaceInfo(CmsUUID structureId, AsyncCallback<CmsReplaceInfo> callback);
190
191    /**
192     * Gets th historical preview information for the given resource.<p>
193     *
194     * @param structureId the structure id of the resource
195     * @param locale the locale for which to get the preview info
196     * @param version thee version for which to get the preview information
197     *
198     * @param resultCallback if something goe
199     */
200    void getHistoryPreviewInfo(
201        CmsUUID structureId,
202        String locale,
203        CmsHistoryVersion version,
204        AsyncCallback<CmsPreviewInfo> resultCallback);
205
206    /**
207     * Returns the lock report info.<p>
208     *
209     * @param structureId the structure id of the resource to get the report for
210     * @param callback the callback
211     */
212    void getLockReportInfo(CmsUUID structureId, AsyncCallback<CmsLockReportInfo> callback);
213
214    /**
215     * Gets a {@link CmsListInfoBean} for a given resource.<p>
216     *
217     * @param structureId the structure id to create the {@link CmsListInfoBean} for
218     * @param callback the asynchronous callback
219     */
220    void getPageInfo(CmsUUID structureId, AsyncCallback<CmsListInfoBean> callback);
221
222    /**
223     * Gets a {@link CmsListInfoBean} for a given resource.<p>
224     *
225     * @param vfsPath the vfs path to create the {@link CmsListInfoBean} for
226     * @param callback the asynchronous callback
227     */
228    void getPageInfo(String vfsPath, AsyncCallback<CmsListInfoBean> callback);
229
230    /**
231     * Returns the preview info for the given resource.<p>
232     *
233     * @param structureId the resource structure id
234     * @param locale the requested locale
235     * @param callback the call back
236     */
237    void getPreviewInfo(CmsUUID structureId, String locale, AsyncCallback<CmsPreviewInfo> callback);
238
239    /**
240     * Returns the preview info for the given resource.<p>
241     *
242     * @param sitePath the resource site path
243     * @param locale the requested locale
244     * @param callback the call back
245     */
246    void getPreviewInfo(String sitePath, String locale, AsyncCallback<CmsPreviewInfo> callback);
247
248    /**
249     * Gets the information needed for the Rename dialog.<p>
250     *
251     * @param structureId the structure id of the resource to rename
252     * @param callback the callback for the result
253     */
254    void getRenameInfo(CmsUUID structureId, AsyncCallback<CmsRenameInfoBean> callback);
255
256    /**
257     * Gets the history of a resource.<p>
258     *
259     * @param structureId the structure id of the resource
260     * @param resultCallback the callback to call with the result
261     */
262    void getResourceHistory(CmsUUID structureId, AsyncCallback<CmsHistoryResourceCollection> resultCallback);
263
264    /**
265     * Gets status information for a single resource.<p>
266     *
267     * @param structureId the structure id of the resource
268     * @param locale the locale for which we want the resource information
269     * @param includeTargets flag to control whether relation targets should also be fetched
270     * @param detailContentId the structure id of the detail content if present
271     * @param context a map of context-dependent parameters used to provide additional information
272     * @param callback the callback for the results
273     */
274    void getResourceStatus(
275        CmsUUID structureId,
276        String locale,
277        boolean includeTargets,
278        CmsUUID detailContentId,
279        Map<String, String> context,
280        AsyncCallback<CmsResourceStatusBean> callback);
281
282    /**
283     * Gets the information which is necessary for opening the 'Restore' dialog for a resource.<p>
284     *
285     * @param structureId the structure id of the resource
286     * @param resultCallback the callback for the result
287     */
288    void getRestoreInfo(CmsUUID structureId, AsyncCallback<CmsRestoreInfoBean> resultCallback);
289
290    /**
291     * Returns the root entries of the VFS.<p>
292     *
293     * @param callback the asynchronous callback
294     */
295    void getRootEntries(AsyncCallback<List<CmsVfsEntryBean>> callback);
296
297    /**
298     * Returns the site-path for the resource with the given id.<p>
299     *
300     * @param structureId the structure id
301     * @param callback the asynchronous callback
302     */
303    void getSitePath(CmsUUID structureId, AsyncCallback<String> callback);
304
305    /**
306     * Gets the site paths corresponding to a list of structure ids.
307     *
308     * <p>If for any of the structure ids in the input list the corresponding resource can not be read, it will be skipped.
309     *
310     * @param ids a list of structure ids
311     * @param callback the result callback
312     */
313    void getSitePaths(List<CmsUUID> ids, AsyncCallback<List<String>> callback);
314
315    /**
316     * Gets the structure id for the given site path.
317     *
318     * @param vfsPath a site path
319     * @param callback the callback for the result
320     */
321    void getStructureId(String vfsPath, AsyncCallback<CmsUUID> callback);
322
323    /**
324     * Gets the resource info to display for an upload folder.
325     *
326     * @param path the folder path
327     * @param callback the callback to call with the result
328     */
329    void getUploadFolderInfo(String path, AsyncCallback<CmsListInfoBean> callback);
330
331    /**
332     * Loads the external link info.<p>
333     *
334     * @param structureId the external link structure id
335     * @param callback the callback
336     */
337    void loadLinkInfo(CmsUUID structureId, AsyncCallback<CmsExternalLinkInfoBean> callback);
338
339    /**
340     * Load the data necessary to edit the properties of a resource.<p>
341     *
342     * @param id the structure id of a resource
343     * @param callback the asynchronous callback
344     */
345    void loadPropertyData(CmsUUID id, AsyncCallback<CmsPropertiesBean> callback);
346
347    /**
348     * Loads the items for the quick launch menu.<p>
349     *
350     * @param params the quick launch parameters
351     *
352     * @param resultCallback the callback for the result
353     */
354    void loadQuickLaunchItems(CmsQuickLaunchParams params, AsyncCallback<List<CmsQuickLaunchData>> resultCallback);
355
356    /**
357     * Prepares to edit a file in the XML content editor.<p>
358     *
359     * @param currentPage the current page from which the editor should be opened
360     * @param fileNameWithMacros the file name, which may contain macros
361     *
362     * @param callback the asynchronous callback
363     */
364    void prepareEdit(CmsUUID currentPage, String fileNameWithMacros, AsyncCallback<CmsPrepareEditResponse> callback);
365
366    /**
367     * Renames a resource.<p>
368     *
369     * @param structureId the structure id of the resource to rename
370     * @param newName the new resource name
371     *
372     * @param callback the asynchronous callback for the result
373     */
374    void renameResource(CmsUUID structureId, String newName, AsyncCallback<String> callback);
375
376    /**
377     * Restores a previous version of the resource.<p>
378     *
379     * @param structureId the structure id of the version
380     * @param version the number of the version to which  the resource should be reverted
381     * @param callback the callback to call with the results
382     */
383    void restoreResource(CmsUUID structureId, int version, AsyncCallback<Void> callback);
384
385    /**
386     * Saves aliases for a page.<p>
387     *
388     * @param structureId the structure id of the page
389     * @param aliases the aliases which should be saved for the page
390     * @param callback the async callback
391     */
392    void saveAliases(CmsUUID structureId, List<CmsAliasBean> aliases, AsyncCallback<Void> callback);
393
394    /**
395     * Saves the external link.<p>
396     *
397     * @param structureId the link structure id
398     * @param title the link title
399     * @param link the link
400     * @param fileName the file name
401     * @param callback the asynchronous callback
402     */
403    void saveExternalLink(
404        CmsUUID structureId,
405        String title,
406        String link,
407        String fileName,
408        AsyncCallback<Void> callback);
409
410    /**
411     * Saves a set of property changes.<p>
412     *
413     * @param changes the property changes
414     * @param updateIndex true if the index should be updated after saving the property changes
415     * @param callback the asynchronous callback
416     */
417    void saveProperties(CmsPropertyChangeSet changes, boolean updateIndex, AsyncCallback<Void> callback);
418
419    /**
420     * Returns the absolute link to the given root path.<p>
421     *
422     * @param currentSiteRoot the current site
423     * @param rootPath the root path
424     * @param callback the asynchronous callback
425     */
426    void substituteLinkForRootPath(String currentSiteRoot, String rootPath, AsyncCallback<String> callback);
427
428    /**
429     * Deletes a resource from the VFS.<p>
430     *
431     * @param structureId the structure id of the resource to delete
432     * @param callback the callback
433     */
434    @SynchronizedRpcRequest
435    void syncDeleteResource(CmsUUID structureId, AsyncCallback<Void> callback);
436
437    /**
438     * Undeletes a resource.<p>
439     *
440     * @param structureId the structure id of the resource
441     *
442     * @param callback the result callback
443     */
444    void undelete(CmsUUID structureId, AsyncCallback<Void> callback);
445
446    /**
447     * Undoes the changes to a given resource, i.e. restores its online content to its offline version.<p>
448     *
449     * @param structureId the structure id of the resource to undo
450     * @param undoMove true if move operations should be undone
451     * @param callback the callback for the result
452     */
453    void undoChanges(CmsUUID structureId, boolean undoMove, AsyncCallback<Void> callback);
454
455    /**
456     * Validates alias paths for a page.<p>
457     *
458     * @param structureId the structure id of the page
459     * @param aliasPaths a map from (arbitrary) id strings to alias paths
460     * @param callback the async callback
461     */
462    void validateAliases(
463        CmsUUID structureId,
464        Map<String, String> aliasPaths,
465        AsyncCallback<Map<String, String>> callback);
466
467}