Package org.opencms.gwt
Class CmsVfsService
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
com.google.gwt.user.server.rpc.RemoteServiceServlet
org.opencms.gwt.CmsGwtService
org.opencms.gwt.CmsVfsService
- All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService,com.google.gwt.user.server.rpc.SerializationPolicyProvider,Serializable,javax.servlet.Servlet,javax.servlet.ServletConfig,I_CmsVfsService
A service class for reading the VFS tree.
- Since:
- 8.0.0
- See Also:
-
Field Summary
Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CmsListInfoBeanaddLockInfo(CmsObject cms, CmsResource resource, CmsListInfoBean resourceInfo) Adds the lock state information to the resource info bean.static CmsListInfoBeanaddPageInfo(CmsObject cms, CmsResource resource, CmsListInfoBean listInfo) Gets page information of a resource and adds it to the given list info bean.voidcreateNewExternalLink(String title, String link, String resourceName, String parentFolderPath) Creates a new external link resource.voidCreates a new property definition.protected CmsBrokenLinkBeancreateSitemapBrokenLinkBean(CmsResource resource) Creates a "broken link" bean based on a resource.voiddeleteResource(String sitePath) Deletes a resource from the VFS.voiddeleteResource(CmsUUID structureId) Deletes a resource from the VFS.voidforceUnlock(CmsUUID structureId) Forces a resource to be unlocked.static StringformatDateTime(CmsObject cms, long date) Formats a date given the current user's workplace locale.getAliasesForPage(CmsUUID uuid) Fetches the aliases for a given page.getBrokenLinks(String sitePath) Returns a list of potentially broken links, if the given resource was deleted.getBrokenLinks(CmsUUID structureId) Returns a list of potentially broken links, if the given resource was deleted.getChildren(String path) Fetches the list of children of a path.getDataViewThumbnail(String config, String id) Loads a thumbnail for a dataview record.getDefaultProperties(List<CmsUUID> structureIds) Gets the default property configurations for the given structure ids.Gets the names of defined properties.getDetailName(CmsUUID id, String localeStr) Gets the detail name for the given structure id.getFileReplaceInfo(CmsUUID structureId) Returns the file replace info.getHistoryPreviewInfo(CmsUUID structureId, String locale, CmsHistoryVersion versionBean) Gets the preview information for a historic version.getLockReportInfo(CmsUUID structureId) Returns the lock report info.static StringgetNoPreviewReason(CmsObject cms, CmsResource resource) Returns the no preview reason if there is any.getPageInfo(String vfsPath) Returns aCmsListInfoBeanfor a given resource.static CmsListInfoBeangetPageInfo(CmsObject cms, CmsResource res) Gets page information of a resource.getPageInfo(CmsUUID structureId) Returns aCmsListInfoBeanfor a given resource.static CmsListInfoBeangetPageInfoWithLock(CmsObject cms, CmsResource resource) Returns a bean to display theincluding the lock state.invalid reference
org.opencms.gwt.client.ui.CmsListItemWidgetgetPreviewInfo(String sitePath, String locale) Returns the preview info for the given resource.getPreviewInfo(CmsUUID structureId, String locale) Returns the preview info for the given resource.getRenameInfo(CmsUUID structureId) Gets the information necessary for the rename dialog.getResourceHistory(CmsUUID structureId) Gets the resource history for a given structure id.getResourceHistoryInternal(CmsUUID structureId) Internal version of getResourceHistory.getResourceStatus(CmsUUID structureId, String contentLocale, boolean includeTargets, CmsUUID detailContentId, Map<String, String> context) Gets a bean containing status information for a given resource.getRestoreInfo(CmsUUID structureId) Gets the information which is necessary for opening the 'Restore' dialog for a resource.Returns the root entries of the VFS.getSitePath(CmsUUID structureId) Returns the site-path for the resource with the given id.getSitePaths(List<CmsUUID> ids) Gets the site paths corresponding to a list of structure ids.getStructureId(String vfsPath) Gets the structure id for a given site path.getUploadFolderInfo(String path) Gets the resource info to display for an upload folder.loadLinkInfo(CmsUUID structureId) Loads the external link info.Load the data necessary to edit the properties of a resource.Loads the items for the quick launch menu.protected CmsVfsEntryBeanmakeEntryBean(CmsResource resource, boolean root) Helper method for creating a VFS entry bean from a resource.protected List<CmsVfsEntryBean> makeEntryBeans(List<CmsResource> resources, boolean root) Helper method for creating a list of VFS entry beans from a list of the corresponding resources.prepareEdit(CmsUUID currentPageId, String pathWithMacros) Prepares to edit a file in the XML content editor.static StringprepareFileNameForEditor(CmsObject cms, CmsResource res, String pathWithMacros) Processes a file path, which may have macros in it, so it can be opened by the XML content editor.renameResource(CmsUUID structureId, String newName) Renames a resource.renameResourceInternal(CmsUUID structureId, String newName) Internal implementation for renaming a resource.voidrestoreResource(CmsUUID structureId, int version) Reverts a resource to a previous historic version.voidsaveAliases(CmsUUID structureId, List<CmsAliasBean> aliasBeans) Saves aliases for a page.voidsaveExternalLink(CmsUUID structureId, String title, String link, String fileName) Saves the external link.voidsaveProperties(CmsPropertyChangeSet changes, boolean updateIndex) Saves a set of property changes.voidSets the current cms context.substituteLinkForRootPath(String currentSiteRoot, String rootPath) Returns the absolute link to the given root path.voidsyncDeleteResource(CmsUUID structureId) Deletes a resource from the VFS.voidUndeletes a resource.voidundoChanges(CmsUUID structureId, boolean undoMove) Undoes the changes to a given resource, i.e.validateAliases(CmsUUID uuid, Map<String, String> aliasPaths) Validates alias paths for a page.Methods inherited from class org.opencms.gwt.CmsGwtService
checkPermissions, clearThreadStorage, doGetSerializationPolicy, doUnexpectedFailure, ensureLock, ensureLock, ensureLock, ensureLock, ensureSession, error, getCmsObject, getPropertiesByName, getRequest, getResponse, isBroadcastCall, log, log, logError, service, setBroadcastPoll, setContext, setRequest, setResponse, tryUnlockMethods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
checkPermutationStrongName, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processCall, processPost, shouldCompressResponseMethods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContentMethods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init
-
Constructor Details
-
CmsVfsService
public CmsVfsService()
-
-
Method Details
-
formatDateTime
Formats a date given the current user's workplace locale.- Parameters:
cms- the current CMS contextdate- the date to format- Returns:
- the formatted date
-
getNoPreviewReason
Returns the no preview reason if there is any.- Parameters:
cms- the current cms contextresource- the resource to check- Returns:
- the no preview reason if there is any
-
getPageInfo
Gets page information of a resource.- Parameters:
cms- the CMS contextres- the resource- Returns:
- gets the page information for the given resource
- Throws:
CmsException- if the resource info can not be read
-
getPageInfoWithLock
public static CmsListInfoBean getPageInfoWithLock(CmsObject cms, CmsResource resource) throws CmsLoaderException, CmsException Returns a bean to display theincluding the lock state.invalid reference
org.opencms.gwt.client.ui.CmsListItemWidget- Parameters:
cms- the CMS contextresource- the resource to get the page info for- Returns:
- a bean to display the
.
invalid reference
org.opencms.gwt.client.ui.CmsListItemWidget - Throws:
CmsLoaderException- if the resource type could not be foundCmsException- if something else goes wrong
-
prepareFileNameForEditor
public static String prepareFileNameForEditor(CmsObject cms, CmsResource res, String pathWithMacros) Processes a file path, which may have macros in it, so it can be opened by the XML content editor.- Parameters:
cms- the current CMS contextres- the resource for which the context menu option has been selectedpathWithMacros- the file path which may contain macros- Returns:
- the processed file path
-
createNewExternalLink
public void createNewExternalLink(String title, String link, String resourceName, String parentFolderPath) throws CmsRpcException Description copied from interface:I_CmsVfsServiceCreates a new external link resource.- Specified by:
createNewExternalLinkin interfaceI_CmsVfsService- Parameters:
title- the titlelink- the linkresourceName- the name of the link resource to createparentFolderPath- the parent folder site path- Throws:
CmsRpcException- if something goes wrong- See Also:
-
createPropertyDefinition
Description copied from interface:I_CmsVfsServiceCreates a new property definition.- Specified by:
createPropertyDefinitionin interfaceI_CmsVfsService- Parameters:
name- the name of the property- Throws:
CmsRpcException- if something goes wrong- See Also:
-
deleteResource
Description copied from interface:I_CmsVfsServiceDeletes a resource from the VFS.- Specified by:
deleteResourcein interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to delete- Throws:
CmsRpcException- if something goes wrong- See Also:
-
deleteResource
Description copied from interface:I_CmsVfsServiceDeletes a resource from the VFS.- Specified by:
deleteResourcein interfaceI_CmsVfsService- Parameters:
sitePath- the site path of the resource to delete- Throws:
CmsRpcException- if something goes wrong- See Also:
-
forceUnlock
Description copied from interface:I_CmsVfsServiceForces a resource to be unlocked. In case the given resource is a folder, all sub-resources are also unlocked.- Specified by:
forceUnlockin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to unlock- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getAliasesForPage
Description copied from interface:I_CmsVfsServiceFetches the aliases for a given page.- Specified by:
getAliasesForPagein interfaceI_CmsVfsService- Parameters:
uuid- the structure id of the page- Returns:
- the lists of aliases for the page
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getBrokenLinks
Description copied from interface:I_CmsVfsServiceReturns a list of potentially broken links, if the given resource was deleted.- Specified by:
getBrokenLinksin interfaceI_CmsVfsService- Parameters:
structureId- the resource structure id- Returns:
- a list of potentially broken links
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getBrokenLinks
Description copied from interface:I_CmsVfsServiceReturns a list of potentially broken links, if the given resource was deleted.- Specified by:
getBrokenLinksin interfaceI_CmsVfsService- Parameters:
sitePath- the resource site-path- Returns:
- a list of potentially broken links
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getChildren
Description copied from interface:I_CmsVfsServiceFetches the list of children of a path.- Specified by:
getChildrenin interfaceI_CmsVfsService- Parameters:
path- the path for which the list of children should be retrieved- Returns:
- the children of the path
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getDataViewThumbnail
Description copied from interface:I_CmsVfsServiceLoads a thumbnail for a dataview record.- Specified by:
getDataViewThumbnailin interfaceI_CmsVfsService- Parameters:
config- the dataview configuration stringid- the record id- Returns:
- the URL of the thumbnail
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getDefaultProperties
public Map<CmsUUID,Map<String, getDefaultPropertiesCmsXmlContentProperty>> (List<CmsUUID> structureIds) throws CmsRpcException Description copied from interface:I_CmsVfsServiceGets the default property configurations for the given structure ids.- Specified by:
getDefaultPropertiesin interfaceI_CmsVfsService- Parameters:
structureIds- the structure ids for which the property configurations should be fetched- Returns:
- a map from the given structure ids to their default property configurations
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getDefinedProperties
Description copied from interface:I_CmsVfsServiceGets the names of defined properties.- Specified by:
getDefinedPropertiesin interfaceI_CmsVfsService- Returns:
- the list of names for all defined properties
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getDetailName
Description copied from interface:I_CmsVfsServiceGets the detail name for the given structure id.- Specified by:
getDetailNamein interfaceI_CmsVfsService- Parameters:
id- the structure id of a contentlocaleStr- the locale to use- Returns:
- the detail name for the structure id
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getFileReplaceInfo
Description copied from interface:I_CmsVfsServiceReturns the file replace info.- Specified by:
getFileReplaceInfoin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the file to replace- Returns:
- the file replace info
- Throws:
CmsRpcException- if the RPC call goes wrong- See Also:
-
getLockReportInfo
Description copied from interface:I_CmsVfsServiceReturns the lock report info.- Specified by:
getLockReportInfoin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to get the report for- Returns:
- the lock report info
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getPageInfo
Description copied from interface:I_CmsVfsServiceReturns aCmsListInfoBeanfor a given resource.- Specified by:
getPageInfoin interfaceI_CmsVfsService- Parameters:
structureId- the structure id to create theCmsListInfoBeanfor- Returns:
- the
CmsListInfoBeanfor a given resource - Throws:
CmsRpcException- if the RPC call goes wrong- See Also:
-
getPageInfo
Description copied from interface:I_CmsVfsServiceReturns aCmsListInfoBeanfor a given resource.- Specified by:
getPageInfoin interfaceI_CmsVfsService- Parameters:
vfsPath- the vfs path to create theCmsListInfoBeanfor- Returns:
- the
CmsListInfoBeanfor a given resource - Throws:
CmsRpcException- if the RPC call goes wrong- See Also:
-
getPreviewInfo
Description copied from interface:I_CmsVfsServiceReturns the preview info for the given resource.- Specified by:
getPreviewInfoin interfaceI_CmsVfsService- Parameters:
structureId- the resource structure idlocale- the requested locale- Returns:
- the preview info
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getPreviewInfo
Description copied from interface:I_CmsVfsServiceReturns the preview info for the given resource.- Specified by:
getPreviewInfoin interfaceI_CmsVfsService- Parameters:
sitePath- the resource site pathlocale- the requested locale- Returns:
- the preview info
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getRenameInfo
Description copied from interface:I_CmsVfsServiceGets the information necessary for the rename dialog.- Specified by:
getRenameInfoin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to rename- Returns:
- the information needed for the rename dialog
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getResourceHistory
Description copied from interface:I_CmsVfsServiceGets the resource history for a given structure id.- Specified by:
getResourceHistoryin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of a resource- Returns:
- the history for the given resource
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getResourceHistoryInternal
public CmsHistoryResourceCollection getResourceHistoryInternal(CmsUUID structureId) throws CmsException Internal version of getResourceHistory.- Parameters:
structureId- the structure id of the resource- Returns:
- the resource history
- Throws:
CmsException- if something goes wrong
-
getResourceStatus
public CmsResourceStatusBean getResourceStatus(CmsUUID structureId, String contentLocale, boolean includeTargets, CmsUUID detailContentId, Map<String, String> context) throws CmsRpcExceptionDescription copied from interface:I_CmsVfsServiceGets a bean containing status information for a given resource.- Specified by:
getResourceStatusin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of a resourcecontentLocale- the locale for which we want the resource informationincludeTargets- true if relation targets should also be fetcheddetailContentId- the structure id of the detail content if presentcontext- additional context-dependent parameters used for providing additional information- Returns:
- the resource status
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getRestoreInfo
Description copied from interface:I_CmsVfsServiceGets the information which is necessary for opening the 'Restore' dialog for a resource.- Specified by:
getRestoreInfoin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource- Returns:
- the information for the resource
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getRootEntries
Description copied from interface:I_CmsVfsServiceReturns the root entries of the VFS.- Specified by:
getRootEntriesin interfaceI_CmsVfsService- Returns:
- a list of root entries
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getSitePath
Description copied from interface:I_CmsVfsServiceReturns the site-path for the resource with the given id.- Specified by:
getSitePathin interfaceI_CmsVfsService- Parameters:
structureId- the structure id- Returns:
- the site-path or
nullif not available - See Also:
-
getSitePaths
Description copied from interface:I_CmsVfsServiceGets the site paths corresponding to a list of structure ids.If for any of the structure ids in the input list the corresponding resource can not be read, it will be skipped.
- Specified by:
getSitePathsin interfaceI_CmsVfsService- Parameters:
ids- a list of structure ids- Returns:
- the list of paths corresponding to the structure ids
- See Also:
-
getStructureId
Description copied from interface:I_CmsVfsServiceGets the structure id for a given site path.- Specified by:
getStructureIdin interfaceI_CmsVfsService- Parameters:
vfsPath- the site path- Returns:
- the structure id
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
getUploadFolderInfo
Description copied from interface:I_CmsVfsServiceGets the resource info to display for an upload folder.- Specified by:
getUploadFolderInfoin interfaceI_CmsVfsService- Parameters:
path- the folder path- Returns:
- the info to display
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
loadLinkInfo
Description copied from interface:I_CmsVfsServiceLoads the external link info.- Specified by:
loadLinkInfoin interfaceI_CmsVfsService- Parameters:
structureId- the external link structure id- Returns:
- the external link info
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
loadPropertyData
Description copied from interface:I_CmsVfsServiceLoad the data necessary to edit the properties of a resource.- Specified by:
loadPropertyDatain interfaceI_CmsVfsService- Parameters:
id- the structure id of a resource- Returns:
- the property information for that resource
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
prepareEdit
public CmsPrepareEditResponse prepareEdit(CmsUUID currentPageId, String pathWithMacros) throws CmsRpcException Description copied from interface:I_CmsVfsServicePrepares to edit a file in the XML content editor.- Specified by:
prepareEditin interfaceI_CmsVfsService- Parameters:
currentPageId- the current page from which the editor should be openedpathWithMacros- the file name, which may contain macros- Returns:
- a bean with more information about the file to edit
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
renameResource
Description copied from interface:I_CmsVfsServiceRenames a resource.- Specified by:
renameResourcein interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to renamenewName- the new resource name- Returns:
- null or an error message
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
renameResourceInternal
Internal implementation for renaming a resource.- Parameters:
structureId- the structure id of the resource to renamenewName- the new resource name- Returns:
- either null if the rename was successful, or an error message
- Throws:
CmsException- if something goes wrong
-
restoreResource
Description copied from interface:I_CmsVfsServiceReverts a resource to a previous historic version.- Specified by:
restoreResourcein interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to revertversion- the version to which the resource should be reverted- Throws:
CmsRpcException- if something goes wrong- See Also:
-
saveAliases
Description copied from interface:I_CmsVfsServiceSaves aliases for a page.- Specified by:
saveAliasesin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the pagealiasBeans- the aliases which should be saved for the page- Throws:
CmsRpcException- if something goes wrong- See Also:
-
saveExternalLink
public void saveExternalLink(CmsUUID structureId, String title, String link, String fileName) throws CmsRpcException Description copied from interface:I_CmsVfsServiceSaves the external link.- Specified by:
saveExternalLinkin interfaceI_CmsVfsService- Parameters:
structureId- the link structure idtitle- the link titlelink- the linkfileName- the file name- Throws:
CmsRpcException- if something goes wrong- See Also:
-
setCms
Sets the current cms context.- Overrides:
setCmsin classCmsGwtService- Parameters:
cms- the current cms context to set
-
substituteLinkForRootPath
public String substituteLinkForRootPath(String currentSiteRoot, String rootPath) throws CmsRpcException Description copied from interface:I_CmsVfsServiceReturns the absolute link to the given root path.- Specified by:
substituteLinkForRootPathin interfaceI_CmsVfsService- Parameters:
currentSiteRoot- the current siterootPath- the root path- Returns:
- the absolute link
- Throws:
CmsRpcException- if something goes wrong processing the request- See Also:
-
syncDeleteResource
Description copied from interface:I_CmsVfsServiceDeletes a resource from the VFS.- Specified by:
syncDeleteResourcein interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to delete- Throws:
CmsRpcException- if something goes wrong- See Also:
-
undelete
Description copied from interface:I_CmsVfsServiceUndeletes a resource.- Specified by:
undeletein interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to undelete- Throws:
CmsRpcException- if something goes wrong- See Also:
-
undoChanges
Description copied from interface:I_CmsVfsServiceUndoes the changes to a given resource, i.e. restores its online content to its offline version.- Specified by:
undoChangesin interfaceI_CmsVfsService- Parameters:
structureId- the structure id of the resource to undoundoMove- true if move operations should be undone- Throws:
CmsRpcException- if something goes wrong- See Also:
-
validateAliases
public Map<String,String> validateAliases(CmsUUID uuid, Map<String, String> aliasPaths) throws CmsRpcExceptionDescription copied from interface:I_CmsVfsServiceValidates alias paths for a page.- Specified by:
validateAliasesin interfaceI_CmsVfsService- Parameters:
uuid- the structure id of the pagealiasPaths- a map from (arbitrary) id strings to alias paths- Returns:
- a map which maps the same id strings to validation results
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
createSitemapBrokenLinkBean
Creates a "broken link" bean based on a resource.- Parameters:
resource- the resource- Returns:
- the "broken link" bean with the data from the resource
- Throws:
CmsException- if something goes wrong
-
makeEntryBean
Helper method for creating a VFS entry bean from a resource.- Parameters:
resource- the resource whose data should be stored in the beanroot- true if the resource is a root resource- Returns:
- the data bean representing the resource
- Throws:
CmsException- if something goes wrong
-
makeEntryBeans
protected List<CmsVfsEntryBean> makeEntryBeans(List<CmsResource> resources, boolean root) throws CmsException Helper method for creating a list of VFS entry beans from a list of the corresponding resources.- Parameters:
resources- the list of resources which should be converted to entry beansroot- true if the resources in the list are root resources- Returns:
- the list of VFS entry beans for the resources
- Throws:
CmsException- if something goes wrong