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 structure id for the given site path.
307     *
308     * @param vfsPath a site path
309     * @param callback the callback for the result
310     */
311    void getStructureId(String vfsPath, AsyncCallback<CmsUUID> callback);
312
313    /**
314     * Gets the resource info to display for an upload folder.
315     *
316     * @param path the folder path
317     * @param callback the callback to call with the result
318     */
319    void getUploadFolderInfo(String path, AsyncCallback<CmsListInfoBean> callback);
320
321    /**
322     * Loads the external link info.<p>
323     *
324     * @param structureId the external link structure id
325     * @param callback the callback
326     */
327    void loadLinkInfo(CmsUUID structureId, AsyncCallback<CmsExternalLinkInfoBean> callback);
328
329    /**
330     * Load the data necessary to edit the properties of a resource.<p>
331     *
332     * @param id the structure id of a resource
333     * @param callback the asynchronous callback
334     */
335    void loadPropertyData(CmsUUID id, AsyncCallback<CmsPropertiesBean> callback);
336
337    /**
338     * Loads the items for the quick launch menu.<p>
339     *
340     * @param params the quick launch parameters
341     *
342     * @param resultCallback the callback for the result
343     */
344    void loadQuickLaunchItems(CmsQuickLaunchParams params, AsyncCallback<List<CmsQuickLaunchData>> resultCallback);
345
346    /**
347     * Prepares to edit a file in the XML content editor.<p>
348     *
349     * @param currentPage the current page from which the editor should be opened
350     * @param fileNameWithMacros the file name, which may contain macros
351     *
352     * @param callback the asynchronous callback
353     */
354    void prepareEdit(CmsUUID currentPage, String fileNameWithMacros, AsyncCallback<CmsPrepareEditResponse> callback);
355
356    /**
357     * Renames a resource.<p>
358     *
359     * @param structureId the structure id of the resource to rename
360     * @param newName the new resource name
361     *
362     * @param callback the asynchronous callback for the result
363     */
364    void renameResource(CmsUUID structureId, String newName, AsyncCallback<String> callback);
365
366    /**
367     * Restores a previous version of the resource.<p>
368     *
369     * @param structureId the structure id of the version
370     * @param version the number of the version to which  the resource should be reverted
371     * @param callback the callback to call with the results
372     */
373    void restoreResource(CmsUUID structureId, int version, AsyncCallback<Void> callback);
374
375    /**
376     * Saves aliases for a page.<p>
377     *
378     * @param structureId the structure id of the page
379     * @param aliases the aliases which should be saved for the page
380     * @param callback the async callback
381     */
382    void saveAliases(CmsUUID structureId, List<CmsAliasBean> aliases, AsyncCallback<Void> callback);
383
384    /**
385     * Saves the external link.<p>
386     *
387     * @param structureId the link structure id
388     * @param title the link title
389     * @param link the link
390     * @param fileName the file name
391     * @param callback the asynchronous callback
392     */
393    void saveExternalLink(
394        CmsUUID structureId,
395        String title,
396        String link,
397        String fileName,
398        AsyncCallback<Void> callback);
399
400    /**
401     * Saves a set of property changes.<p>
402     *
403     * @param changes the property changes
404     * @param updateIndex true if the index should be updated after saving the property changes
405     * @param callback the asynchronous callback
406     */
407    void saveProperties(CmsPropertyChangeSet changes, boolean updateIndex, AsyncCallback<Void> callback);
408
409    /**
410     * Returns the absolute link to the given root path.<p>
411     *
412     * @param currentSiteRoot the current site
413     * @param rootPath the root path
414     * @param callback the asynchronous callback
415     */
416    void substituteLinkForRootPath(String currentSiteRoot, String rootPath, AsyncCallback<String> callback);
417
418    /**
419     * Deletes a resource from the VFS.<p>
420     *
421     * @param structureId the structure id of the resource to delete
422     * @param callback the callback
423     */
424    @SynchronizedRpcRequest
425    void syncDeleteResource(CmsUUID structureId, AsyncCallback<Void> callback);
426
427    /**
428     * Undeletes a resource.<p>
429     *
430     * @param structureId the structure id of the resource
431     *
432     * @param callback the result callback
433     */
434    void undelete(CmsUUID structureId, AsyncCallback<Void> callback);
435
436    /**
437     * Undoes the changes to a given resource, i.e. restores its online content to its offline version.<p>
438     *
439     * @param structureId the structure id of the resource to undo
440     * @param undoMove true if move operations should be undone
441     * @param callback the callback for the result
442     */
443    void undoChanges(CmsUUID structureId, boolean undoMove, AsyncCallback<Void> callback);
444
445    /**
446     * Validates alias paths for a page.<p>
447     *
448     * @param structureId the structure id of the page
449     * @param aliasPaths a map from (arbitrary) id strings to alias paths
450     * @param callback the async callback
451     */
452    void validateAliases(
453        CmsUUID structureId,
454        Map<String, String> aliasPaths,
455        AsyncCallback<Map<String, String>> callback);
456
457}