org.opencms.gwt
Class CmsVfsService

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
              extended by com.google.gwt.user.server.rpc.RemoteServiceServlet
                  extended by org.opencms.gwt.CmsGwtService
                      extended by 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

public class CmsVfsService
extends CmsGwtService
implements I_CmsVfsService

A service class for reading the VFS tree.

Since:
8.0.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse
 
Constructor Summary
CmsVfsService()
           
 
Method Summary
protected  Map<String,CmsClientProperty> convertProperties(List<CmsProperty> properties)
          Converts CmsProperty objects to CmsClientProperty objects.
protected  CmsBrokenLinkBean createSitemapBrokenLinkBean(CmsResource resource)
          Creates a "broken link" bean based on a resource.
 void deleteResource(String sitePath)
          Deletes a resource from the VFS.
 void forceUnlock(CmsUUID structureId)
          Forces a resource to be unlocked.
 CmsAvailabilityInfoBean getAvailabilityInfo(CmsUUID structureId)
          Returns a CmsAvailabilityInfoBean for a given resource.
 CmsAvailabilityInfoBean getAvailabilityInfo(String vfsPath)
          Returns a CmsAvailabilityInfoBean for a given resource.
 CmsDeleteResourceBean getBrokenLinks(String sitePath)
          Returns a list of potentially broken links, if the given resource was deleted.
 List<CmsVfsEntryBean> getChildren(String path)
          Fetches the list of children of a path.
 CmsLockReportInfo getLockReportInfo(CmsUUID structureId)
          Returns the lock report info.
 CmsListInfoBean getPageInfo(CmsUUID structureId)
          Returns a CmsListInfoBean for a given resource.
 CmsListInfoBean getPageInfo(String vfsPath)
          Returns a CmsListInfoBean for a given resource.
 List<CmsVfsEntryBean> getRootEntries()
          Returns the root entries of the VFS.
 String getSitePath(CmsUUID structureId)
          Returns the site-path for the resource with the given id.
protected  void internalSaveProperties(CmsPropertyChangeSet changes)
          Saves a set of property changes.
 void internalUpdateProperties(CmsObject cms, CmsResource ownRes, List<CmsPropertyModification> propertyModifications)
          Updates properties for a resource and possibly its detail page.
 CmsPropertiesBean loadPropertyData(CmsUUID id)
          Load the data necessary to edit the properties of a resource.
protected  CmsVfsEntryBean makeEntryBean(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.
 CmsPrepareEditResponse prepareEdit(CmsUUID currentPageId, String pathWithMacros)
          Prepares to edit a file in the XML content editor.
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.
 void saveProperties(CmsPropertyChangeSet changes)
          Saves a set of property changes.
 String substituteLinkForRootPath(String currentSiteRoot, String rootPath)
          Returns the absolute link to the given root path.
 
Methods inherited from class org.opencms.gwt.CmsGwtService
checkPermissions, doGetSerializationPolicy, doUnexpectedFailure, ensureLock, ensureLock, ensureLock, ensureSession, error, getCmsObject, getPropertiesByName, getRequest, getResponse, log, log, logError, service, setCms, setContext, setRequest, tryUnlock
 
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
checkPermutationStrongName, getSerializationPolicy, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processPost, shouldCompressResponse
 
Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsVfsService

public CmsVfsService()
Method Detail

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 context
res - the resource for which the context menu option has been selected
pathWithMacros - the file path which may contain macros
Returns:
the processed file path

deleteResource

public void deleteResource(String sitePath)
                    throws CmsRpcException
Description copied from interface: I_CmsVfsService
Deletes a resource from the VFS.

Specified by:
deleteResource in interface I_CmsVfsService
Parameters:
sitePath - the site path of the resource to delete
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsVfsService.deleteResource(java.lang.String)

forceUnlock

public void forceUnlock(CmsUUID structureId)
                 throws CmsRpcException
Description copied from interface: I_CmsVfsService
Forces a resource to be unlocked. In case the given resource is a folder, all sub-resources are also unlocked.

Specified by:
forceUnlock in interface I_CmsVfsService
Parameters:
structureId - the structure id of the resource to unlock
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsVfsService.forceUnlock(org.opencms.util.CmsUUID)

getAvailabilityInfo

public CmsAvailabilityInfoBean getAvailabilityInfo(CmsUUID structureId)
                                            throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns a CmsAvailabilityInfoBean for a given resource.

Specified by:
getAvailabilityInfo in interface I_CmsVfsService
Parameters:
structureId - the structure id to create the CmsAvailabilityInfoBean for
Returns:
the CmsAvailabilityInfoBean for a given resource
Throws:
CmsRpcException - if the RPC call goes wrong
See Also:
I_CmsVfsService.getAvailabilityInfo(org.opencms.util.CmsUUID)

getAvailabilityInfo

public CmsAvailabilityInfoBean getAvailabilityInfo(String vfsPath)
                                            throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns a CmsAvailabilityInfoBean for a given resource.

Specified by:
getAvailabilityInfo in interface I_CmsVfsService
Parameters:
vfsPath - the vfs path to create the CmsAvailabilityInfoBean for
Returns:
the CmsAvailabilityInfoBean for a given resource
Throws:
CmsRpcException - if the RPC call goes wrong
See Also:
I_CmsVfsService.getAvailabilityInfo(java.lang.String)

getBrokenLinks

public CmsDeleteResourceBean getBrokenLinks(String sitePath)
                                     throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns a list of potentially broken links, if the given resource was deleted.

Specified by:
getBrokenLinks in interface I_CmsVfsService
Parameters:
sitePath - the resource site-path
Returns:
a list of potentially broken links
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsVfsService.getBrokenLinks(java.lang.String)

getChildren

public List<CmsVfsEntryBean> getChildren(String path)
                                  throws CmsRpcException
Description copied from interface: I_CmsVfsService
Fetches the list of children of a path.

Specified by:
getChildren in interface I_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:
I_CmsVfsService.getChildren(java.lang.String)

getLockReportInfo

public CmsLockReportInfo getLockReportInfo(CmsUUID structureId)
                                    throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns the lock report info.

Specified by:
getLockReportInfo in interface I_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:
I_CmsVfsService.getLockReportInfo(org.opencms.util.CmsUUID)

getPageInfo

public CmsListInfoBean getPageInfo(CmsUUID structureId)
                            throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns a CmsListInfoBean for a given resource.

Specified by:
getPageInfo in interface I_CmsVfsService
Parameters:
structureId - the structure id to create the CmsListInfoBean for
Returns:
the CmsListInfoBean for a given resource
Throws:
CmsRpcException - if the RPC call goes wrong
See Also:
I_CmsVfsService.getPageInfo(org.opencms.util.CmsUUID)

getPageInfo

public CmsListInfoBean getPageInfo(String vfsPath)
                            throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns a CmsListInfoBean for a given resource.

Specified by:
getPageInfo in interface I_CmsVfsService
Parameters:
vfsPath - the vfs path to create the CmsListInfoBean for
Returns:
the CmsListInfoBean for a given resource
Throws:
CmsRpcException - if the RPC call goes wrong
See Also:
I_CmsVfsService.getPageInfo(java.lang.String)

getRootEntries

public List<CmsVfsEntryBean> getRootEntries()
                                     throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns the root entries of the VFS.

Specified by:
getRootEntries in interface I_CmsVfsService
Returns:
a list of root entries
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsVfsService.getRootEntries()

getSitePath

public String getSitePath(CmsUUID structureId)
Description copied from interface: I_CmsVfsService
Returns the site-path for the resource with the given id.

Specified by:
getSitePath in interface I_CmsVfsService
Parameters:
structureId - the structure id
Returns:
the site-path or null if not available
See Also:
I_CmsVfsService.getSitePath(org.opencms.util.CmsUUID)

internalUpdateProperties

public void internalUpdateProperties(CmsObject cms,
                                     CmsResource ownRes,
                                     List<CmsPropertyModification> propertyModifications)
                              throws CmsException
Updates properties for a resource and possibly its detail page.

Parameters:
cms - the CMS context
ownRes - the resource
propertyModifications - the property modifications
Throws:
CmsException - if something goes wrong

loadPropertyData

public CmsPropertiesBean loadPropertyData(CmsUUID id)
                                   throws CmsRpcException
Description copied from interface: I_CmsVfsService
Load the data necessary to edit the properties of a resource.

Specified by:
loadPropertyData in interface I_CmsVfsService
Parameters:
id - the structure id of a resource
Returns:
the property information for that resource
Throws:
CmsRpcException
See Also:
I_CmsVfsService.loadPropertyData(org.opencms.util.CmsUUID)

prepareEdit

public CmsPrepareEditResponse prepareEdit(CmsUUID currentPageId,
                                          String pathWithMacros)
                                   throws CmsRpcException
Description copied from interface: I_CmsVfsService
Prepares to edit a file in the XML content editor.

Specified by:
prepareEdit in interface I_CmsVfsService
Parameters:
currentPageId - the current page from which the editor should be opened
pathWithMacros - the file name, which may contain macros
Returns:
a bean with more information about the file to edit
Throws:
CmsRpcException
See Also:
I_CmsVfsService.prepareEdit(org.opencms.util.CmsUUID, java.lang.String)

saveProperties

public void saveProperties(CmsPropertyChangeSet changes)
                    throws CmsRpcException
Description copied from interface: I_CmsVfsService
Saves a set of property changes.

Specified by:
saveProperties in interface I_CmsVfsService
Parameters:
changes - a set of property changes
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsVfsService.saveProperties(org.opencms.gwt.shared.property.CmsPropertyChangeSet)

substituteLinkForRootPath

public String substituteLinkForRootPath(String currentSiteRoot,
                                        String rootPath)
                                 throws CmsRpcException
Description copied from interface: I_CmsVfsService
Returns the absolute link to the given root path.

Specified by:
substituteLinkForRootPath in interface I_CmsVfsService
Parameters:
currentSiteRoot - the current site
rootPath - the root path
Returns:
the absolute link
Throws:
CmsRpcException - if something goes wrong processing the request
See Also:
I_CmsVfsService.substituteLinkForRootPath(java.lang.String, java.lang.String)

convertProperties

protected Map<String,CmsClientProperty> convertProperties(List<CmsProperty> properties)
Converts CmsProperty objects to CmsClientProperty objects.

Parameters:
properties - a list of server-side properties
Returns:
a map of client-side properties

createSitemapBrokenLinkBean

protected CmsBrokenLinkBean createSitemapBrokenLinkBean(CmsResource resource)
                                                 throws CmsException
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

internalSaveProperties

protected void internalSaveProperties(CmsPropertyChangeSet changes)
                               throws CmsException
Saves a set of property changes.

Parameters:
changes - the set of property changes
Throws:
CmsException - if something goes wrong

makeEntryBean

protected CmsVfsEntryBean makeEntryBean(CmsResource resource,
                                        boolean root)
                                 throws CmsException
Helper method for creating a VFS entry bean from a resource.

Parameters:
resource - the resource whose data should be stored in the bean
root - 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 beans
root - 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