org.opencms.gwt
Class CmsCoreService

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.CmsCoreService
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_CmsCoreService

public class CmsCoreService
extends CmsGwtService
implements I_CmsCoreService

Provides general core services.

Since:
8.0.0
See Also:
CmsCoreService, I_CmsCoreService, I_CmsCoreServiceAsync, Serialized Form

Field Summary
 
Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse
 
Fields inherited from interface org.opencms.gwt.shared.rpc.I_CmsCoreService
CONTEXT_CONTAINERPAGE, CONTEXT_SITEMAP
 
Constructor Summary
CmsCoreService()
           
 
Method Summary
 CmsUUID createUUID()
          Creates a new UUID.
 List<CmsCategoryTreeEntry> getCategories(String fromPath, boolean includeSubCats, List<String> refPaths)
          Returns the categories for the given search parameters.
 List<CmsCategoryTreeEntry> getCategoriesForSitePath(String sitePath)
          Returns the categories for the given reference site-path.
 List<CmsContextMenuEntryBean> getContextMenuEntries(CmsUUID structureId, CmsCoreData.AdeContext context)
          Returns the context menu entries for the given URI.
 CmsReturnLinkInfo getLinkForReturnCode(String returnCode)
          Given a return code, returns the link to the page which corresponds to the return code.
protected  CmsLockInfo getLock(CmsUUID structureId)
          Helper method for locking a resource which returns some information on whether the locking failed, and why.
protected  CmsLockInfo getLock(String sitepath)
          Helper method for locking a resource which returns some information on whether the locking failed, and why.
 CmsResourceState getResourceState(CmsUUID structureId)
          Gets the resource state for a resource with a given path.
 String getUniqueFileName(String parentFolder, String baseName)
          Returns a unique filename for the given base name and the parent folder.
static I_CmsValidationService getValidationService(String name)
          Internal helper method for getting a validation service.
 String getWorkplaceLink(CmsUUID structureId)
          Returns a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.
static
<T> T
instantiate(Class<T> anInterface, String className)
          Instantiates a class given its name using its default constructor.
 CmsReturnLinkInfo internalGetLinkForReturnCode(String returnCode)
          Implementation method for getting the link for a given return code.
 String lockTemp(CmsUUID structureId)
          Locks the given resource with a temporary lock.
 CmsLockInfo lockTempAndCheckModification(CmsUUID structureId, long modification)
          Locks the given resource with a temporary lock additionally checking that the given resource has not been modified after the given timestamp.
static CmsCoreService newInstance(javax.servlet.http.HttpServletRequest request)
          Returns a new configured service instance.
 void ping()
          An RPC method which does nothing and is just used to keep the session alive.
 CmsCoreData prefetch()
          Generates core data for prefetching in the host page.
 void setAvailabilityInfo(CmsUUID structureId, CmsAvailabilityInfoBean bean)
          Applies the changes stored in the info bean to the vfs of OpenCms.
 void setAvailabilityInfo(String uri, CmsAvailabilityInfoBean bean)
          Applies the changes stored in the info bean to the vfs of OpenCms.
 void setToolbarVisible(boolean visible)
          Writes the tool-bar visibility into the session cache.
 String unlock(CmsUUID structureId)
          Unlocks the given resource.
 Map<String,CmsValidationResult> validate(Map<String,CmsValidationQuery> validationQueries)
          Performs a batch of validations and returns the results.
 Map<String,CmsValidationResult> validate(String formValidatorClass, Map<String,CmsValidationQuery> validationQueries, Map<String,String> values, String config)
          Performs a batch of validations using a custom form validator class.
 
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

CmsCoreService

public CmsCoreService()
Method Detail

getValidationService

public static I_CmsValidationService getValidationService(String name)
                                                   throws CmsException
Internal helper method for getting a validation service.

Parameters:
name - the class name of the validation service
Returns:
the validation service
Throws:
CmsException - if something goes wrong

instantiate

public static <T> T instantiate(Class<T> anInterface,
                                String className)
                     throws CmsException
Instantiates a class given its name using its default constructor.

Also checks whether the class with the given name is the subclass of another class/interface.

Type Parameters:
T - the type of the interface/class passed as a parameter
Parameters:
anInterface - the interface or class against which the class should be checked
className - the name of the class
Returns:
a new instance of the class
Throws:
CmsException - if the instantiation fails

newInstance

public static CmsCoreService newInstance(javax.servlet.http.HttpServletRequest request)
Returns a new configured service instance.

Parameters:
request - the current request
Returns:
a new service instance

createUUID

public CmsUUID createUUID()
Description copied from interface: I_CmsCoreService
Creates a new UUID.

Specified by:
createUUID in interface I_CmsCoreService
Returns:
the created UUID
See Also:
I_CmsCoreService.createUUID()

getCategories

public List<CmsCategoryTreeEntry> getCategories(String fromPath,
                                                boolean includeSubCats,
                                                List<String> refPaths)
                                         throws CmsRpcException
Description copied from interface: I_CmsCoreService
Returns the categories for the given search parameters.

Specified by:
getCategories in interface I_CmsCoreService
Parameters:
fromPath - the category path to start with, can be null or empty to use the root
includeSubCats - if to include all categories, or first level child categories only
refPaths - the reference paths, can be null to only use the system repository
Returns:
the resource categories
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.getCategories(java.lang.String, boolean, java.util.List)

getCategoriesForSitePath

public List<CmsCategoryTreeEntry> getCategoriesForSitePath(String sitePath)
                                                    throws CmsRpcException
Description copied from interface: I_CmsCoreService
Returns the categories for the given reference site-path.

Specified by:
getCategoriesForSitePath in interface I_CmsCoreService
Parameters:
sitePath - the reference site-path
Returns:
the categories for the given reference site-path
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.getCategoriesForSitePath(java.lang.String)

getContextMenuEntries

public List<CmsContextMenuEntryBean> getContextMenuEntries(CmsUUID structureId,
                                                           CmsCoreData.AdeContext context)
                                                    throws CmsRpcException
Description copied from interface: I_CmsCoreService
Returns the context menu entries for the given URI.

Specified by:
getContextMenuEntries in interface I_CmsCoreService
Parameters:
structureId - the currently requested structure id
context - the ade context (sitemap or containerpage)
Returns:
the context menu entries
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.getContextMenuEntries(org.opencms.util.CmsUUID, org.opencms.gwt.shared.CmsCoreData.AdeContext)

getLinkForReturnCode

public CmsReturnLinkInfo getLinkForReturnCode(String returnCode)
                                       throws CmsRpcException
Description copied from interface: I_CmsCoreService
Given a return code, returns the link to the page which corresponds to the return code.

Specified by:
getLinkForReturnCode in interface I_CmsCoreService
Parameters:
returnCode - the return code
Returns:
the link for the return code
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.getLinkForReturnCode(java.lang.String)

getResourceState

public CmsResourceState getResourceState(CmsUUID structureId)
                                  throws CmsRpcException
Description copied from interface: I_CmsCoreService
Gets the resource state for a resource with a given path.

Specified by:
getResourceState in interface I_CmsCoreService
Parameters:
structureId - the resource structure id
Returns:
the resource state of the resource
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.getResourceState(org.opencms.util.CmsUUID)

getUniqueFileName

public String getUniqueFileName(String parentFolder,
                                String baseName)
Description copied from interface: I_CmsCoreService
Returns a unique filename for the given base name and the parent folder.

Specified by:
getUniqueFileName in interface I_CmsCoreService
Parameters:
parentFolder - the parent folder of the file
baseName - the proposed file name
Returns:
the unique file name
See Also:
I_CmsCoreService.getUniqueFileName(java.lang.String, java.lang.String)

getWorkplaceLink

public String getWorkplaceLink(CmsUUID structureId)
                        throws CmsRpcException
Description copied from interface: I_CmsCoreService
Returns a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.

Specified by:
getWorkplaceLink in interface I_CmsCoreService
Parameters:
structureId - the structure id of the resource for which to open the workplace
Returns:
a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the site of the given explorerRootPath and show the folder given in the explorerRootPath.
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.getWorkplaceLink(org.opencms.util.CmsUUID)

internalGetLinkForReturnCode

public CmsReturnLinkInfo internalGetLinkForReturnCode(String returnCode)
                                               throws CmsException
Implementation method for getting the link for a given return code.

Parameters:
returnCode - the return code
Returns:
the link for the return code
Throws:
CmsException - if something goes wrong

lockTemp

public String lockTemp(CmsUUID structureId)
                throws CmsRpcException
Description copied from interface: I_CmsCoreService
Locks the given resource with a temporary lock.

Specified by:
lockTemp in interface I_CmsCoreService
Parameters:
structureId - the structure id of the resource to lock
Returns:
null if successful, an error message if not
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.lockTemp(org.opencms.util.CmsUUID)

lockTempAndCheckModification

public CmsLockInfo lockTempAndCheckModification(CmsUUID structureId,
                                                long modification)
                                         throws CmsRpcException
Description copied from interface: I_CmsCoreService
Locks the given resource with a temporary lock additionally checking that the given resource has not been modified after the given timestamp.

Specified by:
lockTempAndCheckModification in interface I_CmsCoreService
Parameters:
structureId - the structure id of the resource to lock
modification - the timestamp to check
Returns:
null if successful, an error message if not
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.lockTempAndCheckModification(org.opencms.util.CmsUUID, long)

ping

public void ping()
Description copied from interface: I_CmsCoreService
An RPC method which does nothing and is just used to keep the session alive.

Specified by:
ping in interface I_CmsCoreService
See Also:
I_CmsCoreService.ping()

prefetch

public CmsCoreData prefetch()
Description copied from interface: I_CmsCoreService
Generates core data for prefetching in the host page.

Specified by:
prefetch in interface I_CmsCoreService
Returns:
the core data
See Also:
I_CmsCoreService.prefetch()

setAvailabilityInfo

public void setAvailabilityInfo(CmsUUID structureId,
                                CmsAvailabilityInfoBean bean)
                         throws CmsRpcException
Description copied from interface: I_CmsCoreService
Applies the changes stored in the info bean to the vfs of OpenCms.

Specified by:
setAvailabilityInfo in interface I_CmsCoreService
Parameters:
structureId - the structure id of the modified resource
bean - the bean with the information of the dialog
Throws:
CmsRpcException - if the RPC call goes wrong
See Also:
I_CmsCoreService.setAvailabilityInfo(org.opencms.util.CmsUUID, org.opencms.gwt.shared.CmsAvailabilityInfoBean)

setAvailabilityInfo

public void setAvailabilityInfo(String uri,
                                CmsAvailabilityInfoBean bean)
                         throws CmsRpcException
Description copied from interface: I_CmsCoreService
Applies the changes stored in the info bean to the vfs of OpenCms.

Specified by:
setAvailabilityInfo in interface I_CmsCoreService
Parameters:
uri - the vfs path of the modified resource
bean - the bean with the information of the dialog
Throws:
CmsRpcException - if the RPC call goes wrong
See Also:
I_CmsCoreService.setAvailabilityInfo(java.lang.String, org.opencms.gwt.shared.CmsAvailabilityInfoBean)

setToolbarVisible

public void setToolbarVisible(boolean visible)
                       throws CmsRpcException
Description copied from interface: I_CmsCoreService
Writes the tool-bar visibility into the session cache.

Specified by:
setToolbarVisible in interface I_CmsCoreService
Parameters:
visible - true if the tool-bar is visible
Throws:
CmsRpcException
See Also:
I_CmsCoreService.setToolbarVisible(boolean)

unlock

public String unlock(CmsUUID structureId)
              throws CmsRpcException
Description copied from interface: I_CmsCoreService
Unlocks the given resource.

Specified by:
unlock in interface I_CmsCoreService
Parameters:
structureId - the structure id of the resource to unlock
Returns:
null if successful, an error message if not
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.unlock(org.opencms.util.CmsUUID)

validate

public Map<String,CmsValidationResult> validate(Map<String,CmsValidationQuery> validationQueries)
                                         throws CmsRpcException
Description copied from interface: I_CmsCoreService
Performs a batch of validations and returns the results.

Specified by:
validate in interface I_CmsCoreService
Parameters:
validationQueries - a map from field names to validation queries
Returns:
a map from field names to validation results
Throws:
CmsRpcException - if something goes wrong
See Also:
I_CmsCoreService.validate(java.util.Map)

validate

public Map<String,CmsValidationResult> validate(String formValidatorClass,
                                                Map<String,CmsValidationQuery> validationQueries,
                                                Map<String,String> values,
                                                String config)
                                         throws CmsRpcException
Description copied from interface: I_CmsCoreService
Performs a batch of validations using a custom form validator class.

Specified by:
validate in interface I_CmsCoreService
Parameters:
formValidatorClass - the class name of the form validator
validationQueries - a map from field names to validation queries
values - the map of all field values
config - the form validator configuration string
Returns:
a map from field names to validation results
Throws:
CmsRpcException - if the RPC call goes wrong
See Also:
I_CmsCoreService.validate(java.lang.String, java.util.Map, java.util.Map, java.lang.String)

getLock

protected CmsLockInfo getLock(CmsUUID structureId)
                       throws CmsException
Helper method for locking a resource which returns some information on whether the locking failed, and why.

Parameters:
structureId - the structure id of the resource
Returns:
the locking information
Throws:
CmsException - if something went wrong

getLock

protected CmsLockInfo getLock(String sitepath)
                       throws CmsException
Helper method for locking a resource which returns some information on whether the locking failed, and why.

Parameters:
sitepath - the site path of the resource to lock
Returns:
the locking information
Throws:
CmsException - if something went wrong