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
,java.io.Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
,I_CmsGalleryService
public class CmsGalleryService extends CmsGwtService implements I_CmsGalleryService
Handles all RPC services related to the gallery dialog.- Since:
- 8.0.0
- See Also:
CmsGalleryService
,I_CmsGalleryService
,I_CmsGalleryServiceAsync
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
CmsGalleryService.CmsGalleryTypeInfo
Gallery info object.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FOLDER_FILTER_ADD_INFO_KEY
Key for additional info gallery folder filter.static int
INITIAL_SEARCH_MAX_RESULTS
Limit to the number results loaded on initial search.static java.lang.String
KEY_LAST_USED_GALLERY_ADEVIEW
The key used for storing the last used gallery in adeview mode.static java.lang.String
PREF_GALLERY_SHOW_INVALID_DEFAULT
Name for the 'galleryShowInvalidDefault' preference.static java.lang.String
RESULT_VIEW_TYPE_ADD_INFO_KEY
Key for additional info gallery result view type.
-
Constructor Summary
Constructors Constructor Description CmsGalleryService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<CmsResourceTypeBean>
buildTypesList(java.util.List<I_CmsResourceType> resourceTypes, java.util.Set<java.lang.String> creatableTypes, java.util.Set<java.lang.String> deactivatedTypes, java.util.List<java.lang.String> typesForTypeTab)
Returns the resource types beans.void
deleteResource(java.lang.String resourcePath)
Deletes the given resource.static CmsVfsEntryBean
generateVfsPreloadData(CmsObject cms, CmsTreeOpenState vfsState, java.util.Set<java.lang.String> folders)
Generates the pre-loaded contents for the VFS tab of the gallery dialog.CmsGalleryConfiguration
getAdeViewModeConfiguration()
Loads the gallery configuration for the adeView mode.java.util.List<CmsGalleryFolderBean>
getGalleries(java.util.List<java.lang.String> resourceTypes)
Returns the available galleries depending on the given resource types.CmsGalleryActionInfo
getGalleryActionInfo(java.lang.String sitePath)
Gets the gallery upload action information for the given path.CmsResultItemBean
getInfoForResource(java.lang.String linkPath, java.lang.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.CmsGalleryDataBean
getInitialSettings(CmsGalleryConfiguration conf)
Returns the initial data for the given gallery mode.CmsGalleryDataBean
getInitialSettingsForContainerPage(java.util.List<CmsResourceTypeBean> types, java.lang.String uri, java.lang.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.CmsGallerySearchBean
getSearch(CmsGalleryDataBean data)
Performs an initial search based on the given data bean and the available parameters of the request.CmsGallerySearchBean
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 java.util.List<CmsResource>
getSitemapSubEntryResources(java.lang.String rootPath)
Gets the sitemap sub entries for a given path as resources.java.util.List<CmsSitemapEntryBean>
getSubEntries(java.lang.String rootPath, boolean isRoot, java.lang.String filter)
Returns the sub entries to the given sitemap path.protected java.util.List<CmsSitemapEntryBean>
getSubEntriesInternal(java.lang.String rootPath, boolean isRoot, java.lang.String filter)
Internal method for getting sitemap sub entries for a given root path.java.util.List<CmsVfsEntryBean>
getSubFolders(java.lang.String rootPath)
Gets the sub-folders of a folder.static java.lang.String
getTreeOpenStateAttributeName(java.lang.String treeName, java.lang.String treeToken)
Gets the attribute name for a tree open state.protected java.util.List<java.lang.String>
getTypeNames(CmsGalleryDataBean data)
Gets the type names from the gallery data bean.static CmsTreeOpenState
getVfsTreeState(javax.servlet.http.HttpServletRequest request, java.lang.String treeToken)
Convenience method for reading the saved VFS tree state from the session.static CmsVfsEntryBean
internalCreateVfsEntryBean(CmsObject cms, CmsResource resource, java.lang.String title, boolean isRoot, boolean isEditable, java.util.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.CmsVfsEntryBean
loadVfsEntryBean(java.lang.String path, java.lang.String filter)
Loads the root VFS entry bean for the given site root.protected java.util.List<CmsResource>
readAll(java.util.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(java.lang.String resultViewType)
Stores the result view type with the user.void
saveTreeOpenState(java.lang.String treeName, java.lang.String treeToken, java.lang.String siteRoot, java.util.Set<CmsUUID> openItems)
Saves the tree open state for a tree tab.void
updateIndex()
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
-
-
-
-
Field Detail
-
FOLDER_FILTER_ADD_INFO_KEY
public static final java.lang.String FOLDER_FILTER_ADD_INFO_KEY
Key for additional info gallery folder filter.- See Also:
- Constant Field Values
-
INITIAL_SEARCH_MAX_RESULTS
public static final int INITIAL_SEARCH_MAX_RESULTS
Limit to the number results loaded on initial search.- See Also:
- Constant Field Values
-
KEY_LAST_USED_GALLERY_ADEVIEW
public static final java.lang.String KEY_LAST_USED_GALLERY_ADEVIEW
The key used for storing the last used gallery in adeview mode.- See Also:
- Constant Field Values
-
PREF_GALLERY_SHOW_INVALID_DEFAULT
public static final java.lang.String PREF_GALLERY_SHOW_INVALID_DEFAULT
Name for the 'galleryShowInvalidDefault' preference.- See Also:
- Constant Field Values
-
RESULT_VIEW_TYPE_ADD_INFO_KEY
public static final java.lang.String RESULT_VIEW_TYPE_ADD_INFO_KEY
Key for additional info gallery result view type.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsGalleryService
public CmsGalleryService()
-
-
Method Detail
-
generateVfsPreloadData
public static CmsVfsEntryBean generateVfsPreloadData(CmsObject cms, CmsTreeOpenState vfsState, java.util.Set<java.lang.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
-
getInitialSettings
public static CmsGalleryDataBean getInitialSettings(javax.servlet.http.HttpServletRequest request, CmsGalleryConfiguration config) throws CmsRpcException
Returns the initial gallery settings.- Parameters:
request
- the current requestconfig
- the gallery configuration- Returns:
- the initial gallery settings
- Throws:
CmsRpcException
- if something goes wrong
-
getSearch
public static CmsGallerySearchBean getSearch(javax.servlet.http.HttpServletRequest request, CmsGalleryDataBean config)
Returns the initial search data.- Parameters:
request
- the current requestconfig
- the gallery configuration- Returns:
- the search data
-
getTreeOpenStateAttributeName
public static java.lang.String getTreeOpenStateAttributeName(java.lang.String treeName, java.lang.String treeToken)
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, java.lang.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, java.lang.String title, boolean isRoot, boolean isEditable, java.util.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 java.util.List<CmsResourceTypeBean> buildTypesList(java.util.List<I_CmsResourceType> resourceTypes, java.util.Set<java.lang.String> creatableTypes, java.util.Set<java.lang.String> deactivatedTypes, java.util.List<java.lang.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
public void deleteResource(java.lang.String resourcePath) throws CmsRpcException
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:
I_CmsGalleryService.deleteResource(java.lang.String)
-
getAdeViewModeConfiguration
public CmsGalleryConfiguration 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:
I_CmsGalleryService.getAdeViewModeConfiguration()
-
getGalleries
public java.util.List<CmsGalleryFolderBean> getGalleries(java.util.List<java.lang.String> resourceTypes)
Description copied from interface:I_CmsGalleryService
Returns the available galleries depending on the given resource types.- Specified by:
getGalleries
in interfaceI_CmsGalleryService
- Parameters:
resourceTypes
- the resource types- Returns:
- the galleries
- See Also:
I_CmsGalleryService.getGalleries(java.util.List)
-
getGalleryActionInfo
public CmsGalleryActionInfo getGalleryActionInfo(java.lang.String sitePath) throws CmsRpcException
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:
I_CmsGalleryService.getGalleryActionInfo(java.lang.String)
-
getInfoForResource
public CmsResultItemBean getInfoForResource(java.lang.String linkPath, java.lang.String locale) throws CmsRpcException
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:
I_CmsGalleryService.getInfoForResource(java.lang.String, java.lang.String)
-
getInitialSettings
public CmsGalleryDataBean getInitialSettings(CmsGalleryConfiguration conf) throws CmsRpcException
Description copied from interface:I_CmsGalleryService
Returns the initial data for the given gallery mode.- Specified by:
getInitialSettings
in interfaceI_CmsGalleryService
- Parameters:
conf
- the gallery configuration- Returns:
- the data bean
- Throws:
CmsRpcException
- if something goes wrong- See Also:
I_CmsGalleryService.getInitialSettings(org.opencms.ade.galleries.shared.CmsGalleryConfiguration)
-
getInitialSettingsForContainerPage
public CmsGalleryDataBean getInitialSettingsForContainerPage(java.util.List<CmsResourceTypeBean> types, java.lang.String uri, java.lang.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
-
getSearch
public CmsGallerySearchBean getSearch(CmsGalleryDataBean data)
Description copied from interface:I_CmsGalleryService
Performs an initial search based on the given data bean and the available parameters of the request.- Specified by:
getSearch
in interfaceI_CmsGalleryService
- Parameters:
data
- the data bean- Returns:
- the search result
- See Also:
I_CmsGalleryService.getSearch(org.opencms.ade.galleries.shared.CmsGalleryDataBean)
-
getSearch
public CmsGallerySearchBean getSearch(CmsGallerySearchBean searchObj) throws CmsRpcException
Description copied from interface:I_CmsGalleryService
Returns the gallery search object containing search results and the currant search parameter.- Specified by:
getSearch
in interfaceI_CmsGalleryService
- Parameters:
searchObj
- the current search object- Returns:
- the search object containing search results
- Throws:
CmsRpcException
- is something goes wrong- See Also:
I_CmsGalleryService.getSearch(CmsGallerySearchBean)
-
getSubEntries
public java.util.List<CmsSitemapEntryBean> getSubEntries(java.lang.String rootPath, boolean isRoot, java.lang.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:
I_CmsGalleryService.getSubEntries(java.lang.String, boolean, java.lang.String)
-
getSubFolders
public java.util.List<CmsVfsEntryBean> getSubFolders(java.lang.String rootPath) throws CmsRpcException
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:
I_CmsGalleryService.getSubFolders(java.lang.String)
-
loadVfsEntryBean
public CmsVfsEntryBean loadVfsEntryBean(java.lang.String path, java.lang.String filter) throws CmsRpcException
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:
I_CmsGalleryService.loadVfsEntryBean(java.lang.String, java.lang.String)
-
saveResultViewType
public void saveResultViewType(java.lang.String resultViewType)
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:
I_CmsGalleryService.saveResultViewType(java.lang.String)
-
saveTreeOpenState
public void saveTreeOpenState(java.lang.String treeName, java.lang.String treeToken, java.lang.String siteRoot, java.util.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:
I_CmsGalleryService.saveTreeOpenState(java.lang.String, java.lang.String, java.lang.String, java.util.Set)
-
updateIndex
public void updateIndex() throws CmsRpcException
Description copied from interface:I_CmsGalleryService
Updates the offline indices.- Specified by:
updateIndex
in interfaceI_CmsGalleryService
- Throws:
CmsRpcException
- if something goes wrong- See Also:
I_CmsGalleryService.updateIndex()
-
getSearchCms
protected CmsObject getSearchCms(CmsGallerySearchBean searchObj) throws CmsException
Gets an initialized CmsObject to be used for the actual search for a given search bean.- Parameters:
searchObj
- the search object- Returns:
- the initialized CmsObject
- Throws:
CmsException
- if something goes wrong
-
getSitemapSubEntryResources
protected java.util.List<CmsResource> getSitemapSubEntryResources(java.lang.String rootPath) throws CmsException
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 java.util.List<CmsSitemapEntryBean> getSubEntriesInternal(java.lang.String rootPath, boolean isRoot, java.lang.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
-
getTypeNames
protected java.util.List<java.lang.String> getTypeNames(CmsGalleryDataBean data)
Gets the type names from the gallery data bean.- Parameters:
data
- the gallery data bean- Returns:
- the type names
-
isSitemapEntry
protected boolean isSitemapEntry(CmsObject cms, CmsResource resource) throws CmsException
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
protected java.util.List<CmsResource> readAll(java.util.Collection<CmsUUID> structureIds, CmsResourceFilter filter)
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
-
-