Package org.opencms.gwt
Class CmsCoreService
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.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
Provides general core services.
- Since:
- 8.0.0
- See Also:
- 
Field SummaryFields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServletperThreadRequest, perThreadResponse
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic List<CmsCategoryTreeEntry> buildCategoryTree(CmsObject cms, List<CmsCategory> categories) Builds the tree structure for the given categories.changePassword(String oldPassword, String newPassword, String newPasswordConfirm) Changes the password of the current user.Creates a new UUID.Returns the latest messages for the current user.Collect GWT build ids from the different ADE modules.getCategories(String fromPath, boolean includeSubCats, String refPath, boolean showWithRepositories, Set<String> selected) Returns the categories for the given search parameters.getCategoriesForSitePath(String sitePath) Returns the categories for the given reference site-path.static List<CmsCategoryTreeEntry> getCategoriesForSitePathStatic(CmsObject cms, String sitePath) Helper method for getting the category beans for the given site path.static List<CmsCategoryTreeEntry> getCategoriesForSitePathStatic(CmsObject cms, String sitePath, String localCategoryRepositoryPath) Helper method for getting the category beans for the given site path.getCategoryInfo(CmsUUID structureId) Returns the category information for the given resource.static List<CmsContextMenuEntryBean> getContextMenuEntries(CmsObject cms, CmsUUID structureId, CmsCoreData.AdeContext context, Map<String, String> params) Returns the context menu entries for the given URI.getContextMenuEntries(CmsUUID structureId, CmsCoreData.AdeContext context) Returns the context menu entries for the given URI.getContextMenuEntries(CmsUUID structureId, CmsCoreData.AdeContext context, Map<String, String> params) Returns the context menu entries for the given URI.static StringgetFileExplorerLink(CmsObject cms, String siteRoot) Returns the file explorer link prefix.getLinkForReturnCode(String returnCode) Given a return code, returns the link to the page which corresponds to the return code.protected CmsLockInfoHelper method for locking a resource which returns some information on whether the locking failed, and why.protected CmsLockInfoHelper method for locking a resource which returns some information on whether the locking failed, and why.getResourceState(CmsUUID structureId) Gets the resource state for a resource with a given path.getUniqueFileName(String parentFolder, String baseName) Returns a unique filename for the given base name and the parent folder.Returns the user info.static StringgetVaadinWorkplaceLink(CmsObject cms, String resourceRootFolder) Returns the workplace link.static StringgetVaadinWorkplaceLink(CmsObject cms, CmsUUID structureId) Returns the workplace link.static I_CmsValidationServicegetValidationService(String name) Internal helper method for getting a validation service.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.Gets the workplace link for the given path.static <T> Tinstantiate(Class<T> anInterface, String className) Instantiates a class given its name using its default constructor.static CmsReturnLinkInfointernalGetLinkForReturnCode(CmsObject cms, String returnCode) Implementation method for getting the link for a given return code.Loads the upload restriction info.Loads the user settings for the current user.lockIfExists(String sitePath) Locks the given resource with a temporary lock if it exists.lockIfExists(String sitePath, long loadTime) Locks the given resource with a temporary lock if it exists.Locks the given resource with a temporary lock.Locks the given resource with a temporary lock.prefetch()Generates core data for prefetching in the host page.static CmsCoreDataprefetch(javax.servlet.http.HttpServletRequest request) Fetches the core data.voidsaveUsedCategory(String category) Saves a category used by the current user.voidSaves the user settings for the current user.voidsetResourceCategories(CmsUUID structureId, List<String> categories) Sets the categories of the given resource.voidsetShowEditorHelp(boolean visible) Sets the show editor help flag.voidsetToolbarVisible(boolean visible) Writes the tool-bar visibility into the session cache.Unlocks the given resource.Unlocks the given resource.validate(String formValidatorClass, Map<String, CmsValidationQuery> validationQueries, Map<String, String> values, String config) Performs a batch of validations using a custom form validator class.validate(Map<String, CmsValidationQuery> validationQueries) Performs a batch of validations and returns the results.Methods inherited from class org.opencms.gwt.CmsGwtServicecheckPermissions, clearThreadStorage, doGetSerializationPolicy, doUnexpectedFailure, ensureLock, ensureLock, ensureLock, ensureLock, ensureSession, error, getCmsObject, getPropertiesByName, getRequest, getResponse, isBroadcastCall, log, log, logError, service, setBroadcastPoll, setCms, setContext, setRequest, setResponse, tryUnlockMethods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServletcheckPermutationStrongName, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processCall, processPost, shouldCompressResponseMethods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServletdoPost, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContentMethods inherited from class javax.servlet.http.HttpServletdoDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.servlet.GenericServletdestroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init
- 
Constructor Details- 
CmsCoreServicepublic CmsCoreService()
 
- 
- 
Method Details- 
buildCategoryTreepublic static List<CmsCategoryTreeEntry> buildCategoryTree(CmsObject cms, List<CmsCategory> categories) Builds the tree structure for the given categories.- Parameters:
- cms- the current cms context
- categories- the categories
- Returns:
- the tree root element
 
- 
getCategoriesForSitePathStaticpublic static List<CmsCategoryTreeEntry> getCategoriesForSitePathStatic(CmsObject cms, String sitePath) throws CmsException Helper method for getting the category beans for the given site path.- Parameters:
- cms- the CMS context to use
- sitePath- the site path
- Returns:
- the list of category beans
- Throws:
- CmsException- if something goes wrong
 
- 
getCategoriesForSitePathStaticpublic static List<CmsCategoryTreeEntry> getCategoriesForSitePathStatic(CmsObject cms, String sitePath, String localCategoryRepositoryPath) throws CmsException Helper method for getting the category beans for the given site path.- Parameters:
- cms- the CMS context to use
- sitePath- the site path
- localCategoryRepositoryPath- the categories for this repository are added separately
- Returns:
- the list of category beans
- Throws:
- CmsException- if something goes wrong
 
- 
getFileExplorerLinkReturns the file explorer link prefix. Append resource site path for complete link.- Parameters:
- cms- the cms context
- siteRoot- the site root
- Returns:
- the file explorer link prefix
 
- 
getVaadinWorkplaceLinkReturns the workplace link.- Parameters:
- cms- the cms context
- structureId- the structure id of the current resource
- Returns:
- the workplace link
 
- 
getVaadinWorkplaceLinkReturns the workplace link.- Parameters:
- cms- the cms context
- resourceRootFolder- the resource folder root path
- Returns:
- the workplace link
 
- 
getValidationServiceInternal 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
 
- 
instantiateInstantiates 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
 
- 
internalGetLinkForReturnCodepublic static CmsReturnLinkInfo internalGetLinkForReturnCode(CmsObject cms, String returnCode) throws CmsException Implementation method for getting the link for a given return code.- Parameters:
- cms- the CMS context
- returnCode- the return code
- Returns:
- the link for the return code
- Throws:
- CmsException- if something goes wrong
 
- 
prefetchFetches the core data.- Parameters:
- request- the current request
- Returns:
- the core data
 
- 
changePasswordpublic String changePassword(String oldPassword, String newPassword, String newPasswordConfirm) throws CmsRpcException Description copied from interface:I_CmsCoreServiceChanges the password of the current user.- Specified by:
- changePasswordin interface- I_CmsCoreService
- Parameters:
- oldPassword- the old password
- newPassword- the value entered for the new password
- newPasswordConfirm- the value entered for the confirmation of the new password
- Returns:
- an error message if an error occurred, or null if the password was successfully changed
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
createUUIDDescription copied from interface:I_CmsCoreServiceCreates a new UUID.- Specified by:
- createUUIDin interface- I_CmsCoreService
- Returns:
- the created UUID
- See Also:
 
- 
getBroadcastDescription copied from interface:I_CmsCoreServiceReturns the latest messages for the current user.- Specified by:
- getBroadcastin interface- I_CmsCoreService
- Returns:
- the messages
- See Also:
 
- 
getCategoriespublic List<CmsCategoryTreeEntry> getCategories(String fromPath, boolean includeSubCats, String refPath, boolean showWithRepositories, Set<String> selected) throws CmsRpcException Description copied from interface:I_CmsCoreServiceReturns the categories for the given search parameters.- Specified by:
- getCategoriesin interface- I_CmsCoreService
- Parameters:
- fromPath- the category path to start with, can be- nullor empty to use the root
- includeSubCats- if to include all categories, or first level child categories only
- refPath- the reference path (site-relative path according to which the available category repositories are determined), can be- nullto only use the system repository
- showWithRepositories- flag, indicating if also the category repositories should be returned as category
- selected- a set of paths of currently selected categories (which should be included in the result even if they are marked as hidden)
- Returns:
- the resource categories
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
getCategoriesForSitePathDescription copied from interface:I_CmsCoreServiceReturns the categories for the given reference site-path.- Specified by:
- getCategoriesForSitePathin 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:
 
- 
getCategoryInfoDescription copied from interface:I_CmsCoreServiceReturns the category information for the given resource.- Specified by:
- getCategoryInfoin interface- I_CmsCoreService
- Parameters:
- structureId- the resource structure id
- Returns:
- the category information
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
getLinkForReturnCodeDescription copied from interface:I_CmsCoreServiceGiven a return code, returns the link to the page which corresponds to the return code.- Specified by:
- getLinkForReturnCodein interface- I_CmsCoreService
- Parameters:
- returnCode- the return code
- Returns:
- the link for the return code
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
getResourceStateDescription copied from interface:I_CmsCoreServiceGets the resource state for a resource with a given path.- Specified by:
- getResourceStatein interface- I_CmsCoreService
- Parameters:
- structureId- the resource structure id
- Returns:
- the resource state of the resource
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
getUniqueFileNameDescription copied from interface:I_CmsCoreServiceReturns a unique filename for the given base name and the parent folder.- Specified by:
- getUniqueFileNamein interface- I_CmsCoreService
- Parameters:
- parentFolder- the parent folder of the file
- baseName- the proposed file name
- Returns:
- the unique file name
- See Also:
 
- 
getUserInfoDescription copied from interface:I_CmsCoreServiceReturns the user info.- Specified by:
- getUserInfoin interface- I_CmsCoreService
- Returns:
- the user info
- See Also:
 
- 
getWorkplaceLinkDescription copied from interface:I_CmsCoreServiceReturns 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:
- getWorkplaceLinkin 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:
 
- 
getWorkplaceLinkForPathDescription copied from interface:I_CmsCoreServiceGets the workplace link for the given path.- Specified by:
- getWorkplaceLinkForPathin interface- I_CmsCoreService
- Parameters:
- path- the path
- Returns:
- the workplace link for the path
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
loadUploadRestrictionInfoDescription copied from interface:I_CmsCoreServiceLoads the upload restriction info.- Specified by:
- loadUploadRestrictionInfoin interface- I_CmsCoreService
- Returns:
- the upload restriction info
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
loadUserSettingsDescription copied from interface:I_CmsCoreServiceLoads the user settings for the current user.- Specified by:
- loadUserSettingsin interface- I_CmsCoreService
- Returns:
- the user settings for the current user
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
lockIfExistsDescription copied from interface:I_CmsCoreServiceLocks the given resource with a temporary lock if it exists.If the resource does not exist yet, the closest existing ancestor folder will check if it is lockable. - Specified by:
- lockIfExistsin interface- I_CmsCoreService
- Parameters:
- sitePath- the site path of the resource to lock
- Returns:
- nullif successful, an error message if not
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
lockIfExistsDescription copied from interface:I_CmsCoreServiceLocks the given resource with a temporary lock if it exists.If the resource does not exist yet, the closest existing ancestor folder will check if it is lockable. - Specified by:
- lockIfExistsin interface- I_CmsCoreService
- Parameters:
- sitePath- the site path of the resource to lock
- loadTime- the time when the requested resource was loaded
- Returns:
- nullif successful, an error message if not
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
lockTempDescription copied from interface:I_CmsCoreServiceLocks the given resource with a temporary lock.- Specified by:
- lockTempin interface- I_CmsCoreService
- Parameters:
- structureId- the structure id of the resource to lock
- Returns:
- nullif successful, an error message if not
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
lockTempDescription copied from interface:I_CmsCoreServiceLocks the given resource with a temporary lock.Locking will fail in case the requested resource has been changed since the given load time. - Specified by:
- lockTempin interface- I_CmsCoreService
- Parameters:
- structureId- the resource structure id
- loadTime- the time when the requested resource was loaded
- Returns:
- nullif successful, an error message if not
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
prefetchDescription copied from interface:I_CmsCoreServiceGenerates core data for prefetching in the host page.- Specified by:
- prefetchin interface- I_CmsCoreService
- Returns:
- the core data
- See Also:
 
- 
saveUsedCategoryDescription copied from interface:I_CmsCoreServiceSaves a category used by the current user.- Specified by:
- saveUsedCategoryin interface- I_CmsCoreService
- Parameters:
- category- the category
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
saveUserSettingspublic void saveUserSettings(Map<String, String> userSettings, Set<String> edited) throws CmsRpcExceptionDescription copied from interface:I_CmsCoreServiceSaves the user settings for the current user.- Specified by:
- saveUserSettingsin interface- I_CmsCoreService
- Parameters:
- userSettings- the new values for the user settings
- edited- the keys of the user settings which were actually edited
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
setResourceCategoriespublic void setResourceCategories(CmsUUID structureId, List<String> categories) throws CmsRpcException Description copied from interface:I_CmsCoreServiceSets the categories of the given resource. Will remove all other categories.- Specified by:
- setResourceCategoriesin interface- I_CmsCoreService
- Parameters:
- structureId- the resource structure id
- categories- the categories to set
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
setShowEditorHelpDescription copied from interface:I_CmsCoreServiceSets the show editor help flag.- Specified by:
- setShowEditorHelpin interface- I_CmsCoreService
- Parameters:
- visible- the show help flag
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
setToolbarVisibleDescription copied from interface:I_CmsCoreServiceWrites the tool-bar visibility into the session cache.- Specified by:
- setToolbarVisiblein interface- I_CmsCoreService
- Parameters:
- visible-- trueif the tool-bar is visible
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
unlockDescription copied from interface:I_CmsCoreServiceUnlocks the given resource.- Specified by:
- unlockin interface- I_CmsCoreService
- Parameters:
- structureId- the structure id of the resource to unlock
- Returns:
- nullif successful, an error message if not
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
unlockDescription copied from interface:I_CmsCoreServiceUnlocks the given resource.- Specified by:
- unlockin interface- I_CmsCoreService
- Parameters:
- sitePath- the root path of the resource to unlock
- Returns:
- nullif successful, an error message if not
- Throws:
- CmsRpcException- if something goes wrong
- See Also:
 
- 
validatepublic Map<String,CmsValidationResult> validate(Map<String, CmsValidationQuery> validationQueries) throws CmsRpcExceptionDescription copied from interface:I_CmsCoreServicePerforms a batch of validations and returns the results.- Specified by:
- validatein 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:
 
- 
validatepublic Map<String,CmsValidationResult> validate(String formValidatorClass, Map<String, CmsValidationQuery> validationQueries, Map<String, throws CmsRpcExceptionString> values, String config) Description copied from interface:I_CmsCoreServicePerforms a batch of validations using a custom form validator class.- Specified by:
- validatein 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:
 
- 
getBuildIdsCollect GWT build ids from the different ADE modules.- Returns:
- the map of GWT build ids
 
- 
getLockHelper 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
 
- 
getLockHelper 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
 
 
-