Package org.opencms.ade.galleries
Class CmsGalleryService
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.ade.galleries.CmsGalleryService
- 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_CmsGalleryService
Handles all RPC services related to the gallery dialog.
- Since:
- 8.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Gallery info object. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key for additional info gallery folder filter.static final int
Limit to the number results loaded on initial search.static final String
The key used for storing the last used gallery in adeview mode.static final String
Name for the 'galleryShowInvalidDefault' preference.static final String
Key for additional info gallery result view type.Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuildTypesList
(List<I_CmsResourceType> resourceTypes, Set<String> creatableTypes, Set<String> deactivatedTypes, List<String> typesForTypeTab) Returns the resource types beans.void
deleteResource
(String resourcePath) Deletes the given resource.static CmsVfsEntryBean
generateVfsPreloadData
(CmsObject cms, CmsTreeOpenState vfsState, Set<String> folders) Generates the pre-loaded contents for the VFS tab of the gallery dialog.Loads the gallery configuration for the adeView mode.getGalleries
(String context, List<String> resourceTypes) Returns the available galleries depending on the given resource types.getGalleryActionInfo
(String sitePath) Gets the gallery upload action information for the given path.getInfoForResource
(String linkPath, String locale) Returns the resource info for a single resource.static CmsGalleryDataBean
getInitialSettings
(javax.servlet.http.HttpServletRequest request, CmsGalleryConfiguration config) Returns the initial gallery settings.Returns the initial data for the given gallery mode.getInitialSettingsForContainerPage
(List<CmsResourceTypeBean> types, String uri, String locale) Returns the initial gallery data for the container page editor.static CmsGallerySearchBean
getSearch
(javax.servlet.http.HttpServletRequest request, CmsGalleryDataBean config) Returns the initial search data.getSearch
(CmsGalleryDataBean data) Performs an initial search based on the given data bean and the available parameters of the request.getSearch
(CmsGallerySearchBean searchObj) Returns the gallery search object containing search results and the currant search parameter.protected CmsObject
getSearchCms
(CmsGallerySearchBean searchObj) Gets an initialized CmsObject to be used for the actual search for a given search bean.protected List<CmsResource>
getSitemapSubEntryResources
(String rootPath) Gets the sitemap sub entries for a given path as resources.getSubEntries
(String rootPath, boolean isRoot, String filter) Returns the sub entries to the given sitemap path.protected List<CmsSitemapEntryBean>
getSubEntriesInternal
(String rootPath, boolean isRoot, String filter) Internal method for getting sitemap sub entries for a given root path.getSubFolders
(String rootPath) Gets the sub-folders of a folder.static String
getTreeOpenStateAttributeName
(String treeName, String treeToken) Gets the attribute name for a tree open state.Gets the type names from the gallery data bean.static CmsTreeOpenState
getVfsTreeState
(javax.servlet.http.HttpServletRequest request, String treeToken) Convenience method for reading the saved VFS tree state from the session.static CmsVfsEntryBean
internalCreateVfsEntryBean
(CmsObject cms, CmsResource resource, String title, boolean isRoot, boolean isEditable, List<CmsVfsEntryBean> children, boolean isMatch) Creates the VFS entry bean for a resource.protected boolean
isSitemapEntry
(CmsObject cms, CmsResource resource) Checks whether a given resource is a sitemap entry.loadVfsEntryBean
(String path, String filter) Loads the root VFS entry bean for the given site root.protected List<CmsResource>
readAll
(Collection<CmsUUID> structureIds, CmsResourceFilter filter) Reads the resources for a collection of structure ids and returns the list of resources which could be read.void
saveResultViewType
(String resultViewType) Stores the result view type with the user.void
Saves the tree open state for a tree tab.void
Updates the offline indices.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, setCms, setContext, setRequest, setResponse, tryUnlock
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
checkPermutationStrongName, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, 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
-
Field Details
-
FOLDER_FILTER_ADD_INFO_KEY
Key for additional info gallery folder filter.- See Also:
-
INITIAL_SEARCH_MAX_RESULTS
Limit to the number results loaded on initial search.- See Also:
-
KEY_LAST_USED_GALLERY_ADEVIEW
The key used for storing the last used gallery in adeview mode.- See Also:
-
PREF_GALLERY_SHOW_INVALID_DEFAULT
Name for the 'galleryShowInvalidDefault' preference.- See Also:
-
RESULT_VIEW_TYPE_ADD_INFO_KEY
Key for additional info gallery result view type.- See Also:
-
-
Constructor Details
-
CmsGalleryService
public CmsGalleryService()
-
-
Method Details
-
generateVfsPreloadData
public static CmsVfsEntryBean generateVfsPreloadData(CmsObject cms, CmsTreeOpenState vfsState, Set<String> folders) Generates the pre-loaded contents for the VFS tab of the gallery dialog.- Parameters:
cms
- the current CMS contextvfsState
- the saved VFS tree state (may be null)folders
- the saved search folders (may be null)- Returns:
- the root tree entry for the VFS tab
-
getTreeOpenStateAttributeName
Gets the attribute name for a tree open state.- Parameters:
treeName
- the tree nametreeToken
- the tree token- Returns:
- the attribute name for the tree
-
getVfsTreeState
public static CmsTreeOpenState getVfsTreeState(javax.servlet.http.HttpServletRequest request, String treeToken) Convenience method for reading the saved VFS tree state from the session.- Parameters:
request
- the current requesttreeToken
- the tree token (may be null)- Returns:
- the saved tree open state (may be null)
-
internalCreateVfsEntryBean
public static CmsVfsEntryBean internalCreateVfsEntryBean(CmsObject cms, CmsResource resource, String title, boolean isRoot, boolean isEditable, List<CmsVfsEntryBean> children, boolean isMatch) throws CmsException Creates the VFS entry bean for a resource.- Parameters:
cms
- the CMS context to useresource
- the resource for which to create the VFS entry beantitle
- the titleisRoot
- true if this is a root entryisEditable
- true if this entry is editablechildren
- the children of the entryisMatch
- true if the VFS entry bean is a match for the quick search- Returns:
- the created VFS entry bean
- Throws:
CmsException
- if something goes wrong
-
buildTypesList
public List<CmsResourceTypeBean> buildTypesList(List<I_CmsResourceType> resourceTypes, Set<String> creatableTypes, Set<String> deactivatedTypes, List<String> typesForTypeTab) Returns the resource types beans.- Parameters:
resourceTypes
- the resource typescreatableTypes
- the creatable typesdeactivatedTypes
- the deactivated typestypesForTypeTab
- the types which should be shown in the types tab according to the gallery configuration- Returns:
- the resource types
-
deleteResource
Description copied from interface:I_CmsGalleryService
Deletes the given resource.- Specified by:
deleteResource
in interfaceI_CmsGalleryService
- Parameters:
resourcePath
- the resource path of the resource to delete- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getAdeViewModeConfiguration
Description copied from interface:I_CmsGalleryService
Loads the gallery configuration for the adeView mode.- Specified by:
getAdeViewModeConfiguration
in interfaceI_CmsGalleryService
- Returns:
- the gallery configuration
- See Also:
-
getGalleries
Description copied from interface:I_CmsGalleryService
Returns the available galleries depending on the given resource types.- Specified by:
getGalleries
in interfaceI_CmsGalleryService
- Parameters:
context
- URI of the current page or subsiteresourceTypes
- the resource types- Returns:
- the galleries
- See Also:
-
getGalleryActionInfo
Description copied from interface:I_CmsGalleryService
Gets the gallery upload action information for the given path.- Specified by:
getGalleryActionInfo
in interfaceI_CmsGalleryService
- Parameters:
sitePath
- the path of a gallery folder- Returns:
- the gallery upload action information for that folder (may be null if no folder is found)
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getInfoForResource
Description copied from interface:I_CmsGalleryService
Returns the resource info for a single resource.- Specified by:
getInfoForResource
in interfaceI_CmsGalleryService
- Parameters:
linkPath
- the resource pathlocale
- the content locale- Returns:
- the resource info
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getInitialSettingsForContainerPage
public CmsGalleryDataBean getInitialSettingsForContainerPage(List<CmsResourceTypeBean> types, String uri, String locale) Returns the initial gallery data for the container page editor.- Parameters:
types
- the available resource typesuri
- the page URIlocale
- the content locale- Returns:
- the gallery data
-
getSubEntries
public List<CmsSitemapEntryBean> getSubEntries(String rootPath, boolean isRoot, String filter) throws CmsRpcException Description copied from interface:I_CmsGalleryService
Returns the sub entries to the given sitemap path.- Specified by:
getSubEntries
in interfaceI_CmsGalleryService
- Parameters:
rootPath
- the root pathisRoot
-true
if the requested entry is the root entryfilter
- the search filter string- Returns:
- the sub entries
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getSubFolders
Description copied from interface:I_CmsGalleryService
Gets the sub-folders of a folder.- Specified by:
getSubFolders
in interfaceI_CmsGalleryService
- Parameters:
rootPath
- the path of a folder- Returns:
- beans representing the sub-folders of the folder
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
loadVfsEntryBean
Description copied from interface:I_CmsGalleryService
Loads the root VFS entry bean for the given site root.- Specified by:
loadVfsEntryBean
in interfaceI_CmsGalleryService
- Parameters:
path
- the site rootfilter
- the filter string- Returns:
- the root VFS entry bean for the given site root
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
saveResultViewType
Description copied from interface:I_CmsGalleryService
Stores the result view type with the user.- Specified by:
saveResultViewType
in interfaceI_CmsGalleryService
- Parameters:
resultViewType
- the result view type- See Also:
-
saveTreeOpenState
public void saveTreeOpenState(String treeName, String treeToken, String siteRoot, Set<CmsUUID> openItems) throws CmsRpcException Description copied from interface:I_CmsGalleryService
Saves the tree open state for a tree tab.- Specified by:
saveTreeOpenState
in interfaceI_CmsGalleryService
- Parameters:
treeName
- the tree name for which to save the tree statetreeToken
- the tree token for which to save the tree statesiteRoot
- the site rootopenItems
- the set of structure ids of open tree items- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
updateIndex
Description copied from interface:I_CmsGalleryService
Updates the offline indices.- Specified by:
updateIndex
in interfaceI_CmsGalleryService
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getSitemapSubEntryResources
Gets the sitemap sub entries for a given path as resources.- Parameters:
rootPath
- the root path- Returns:
- the sitemap sub entry resources
- Throws:
CmsException
- if something goes wrong
-
getSubEntriesInternal
protected List<CmsSitemapEntryBean> getSubEntriesInternal(String rootPath, boolean isRoot, String filter) throws CmsException Internal method for getting sitemap sub entries for a given root path.- Parameters:
rootPath
- the root pathisRoot
- true if this method is used to get the root entries of a sitemapfilter
- the filter string (only relevant if isRoot is true)- Returns:
- the list of sitemap sub-entry beans
- Throws:
CmsException
- if something goes wrong
-
isSitemapEntry
Checks whether a given resource is a sitemap entry.This is used for preselected entries in the gallery widget.
- Parameters:
cms
- the current CMS contextresource
- the resource to check- Returns:
- true if the resource is a sitemap entry
- Throws:
CmsException
- if something goes wrong
-
readAll
Reads the resources for a collection of structure ids and returns the list of resources which could be read.- Parameters:
structureIds
- the structure ids for which we want to read the resourcesfilter
- the filter used to read the resource- Returns:
- the list of resources for the given structure id
-