Package org.opencms.ade.containerpage
Class CmsContainerpageService
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.containerpage.CmsContainerpageService
- 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_CmsContainerpageService
The RPC service used by the container-page editor.
- Since:
- 8.0.0
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Additional info key for storing the "edit small elements" setting on the user.static final String
Session attribute name used to store the selected clipboard tab.static final int
Maximum number of reuse locations to display in the reuse warning dialog.static final String
The model group pages path fragment.static final String
Runtime property key to enable / disable placement mode.static final String
The source container page id settings key.Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToFavoriteList
(CmsContainerPageRpcContext context, String clientId) Adds an element specified by it's id to the favorite list.void
addToRecentList
(CmsContainerPageRpcContext context, String clientId) Adds an element specified by it's id to the recent list.boolean
checkContainerpageOrElementsChanged
(CmsUUID structureId, CmsUUID detailContentId, String contentLocale) Check if a page or its elements have been changed.checkCreateNewElement
(CmsUUID pageStructureId, CmsUUID detailContentId, String clientId, String resourceType, CmsContainer container, String locale) To create a new element of the given type this method will check if a model resource needs to be selected, otherwise creates the new element.boolean
checkNewWidgetsAvailable
(CmsUUID structureId) Checks whether the Acacia widgets are available for all fields of the content.Parses an element id.copyElement
(CmsUUID pageId, CmsUUID originalElementId, String locale) Creates a new element with a given model element and returns the copy'S structure id.createNewElement
(CmsUUID pageStructureId, CmsUUID detailContentId, String clientId, String resourceType, CmsUUID modelResourceStructureId, String locale) Creates a new element of the given type and returns the new element data containing structure id and site path.static List<CmsModelResourceInfo>
generateModelResourceList
(CmsObject cms, String resourceType, List<CmsResource> modelResources, Locale contentLocale) Generates the model resource data list.getCachedElement
(String clientId, String pageRootPath) Reads the cached element-bean for the given client-side-id from cache.This method is used for serialization purposes only.getDeleteOptions
(String clientId, CmsUUID pageId, String requestParams) Returns the delete options.getEditOptions
(String clientId, CmsUUID pageId, String requestParams, boolean isListElement) Returns the edit options.This method is used for serialization purposes only.getElementsData
(CmsContainerPageRpcContext context, CmsUUID detailContentId, String reqParams, Collection<String> clientIds, Collection<CmsContainer> containers, boolean allwaysCopy, String dndSource, String locale) Returns container element data by client id.getElementSettingsConfig
(CmsContainerPageRpcContext context, String clientId, String containerId, Collection<CmsContainer> containers, String locale) Returns container element settings config data.getElementsLockedForPublishing
(Set<CmsUUID> idsToCheck) Checks which structure ids of a given set belong to resources locked for publishing by the current user, and then returns those.getElementWithSettings
(CmsContainerPageRpcContext context, CmsUUID detailContentId, String uriParams, String clientId, Map<String, String> settings, Collection<CmsContainer> containers, String locale) Gets the element data for an id and a map of settings.getFavoriteList
(CmsUUID pageStructureId, CmsUUID detailContentId, Collection<CmsContainer> containers, String locale) Returns the container element data of the favorite list.getGalleryDataForPage
(List<CmsContainer> containers, CmsUUID elementView, String uri, CmsUUID detailContentId, String locale, CmsTemplateContextInfo templateContextInfo) Returns the gallery configuration data according to the current page containers and the selected element view.getListElementCreationOptions
(CmsUUID structureId, String jsonListAddData) Loads the data for the list element creation dialog.getNewElementData
(CmsContainerPageRpcContext context, CmsUUID detailContentId, String reqParams, String resourceType, Collection<CmsContainer> containers, String localeName) Returns new container element data for the given resource type name.getNewOptions
(String clientId, CmsUUID pageStructureId, String requestParams) Gets the edit handler options for creating a new element.getRecentList
(CmsUUID pageStructureId, CmsUUID detailContentId, Collection<CmsContainer> containers, String locale) Returns the container element data of the recent list.getRemovedElementStatus
(String id, CmsUUID containerpageId) Gets the status of a removed element.getReuseInfo
(CmsUUID pageId, CmsUUID detailId, CmsUUID elementId) Loads the reuse information for a container element.static String
getSerializedContainerInfo
(CmsContainer container) Returns serialized container data.static String
getSerializedElementInfo
(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, CmsContainerElementBean elementBean, CmsContainerPageBean page) Returns the serialized element data.void
handleDelete
(String clientId, String deleteOption, CmsUUID pageId, String requestParams) Handles the element deletion.internalGetRemovedElementStatus
(CmsUUID structureId, CmsUUID containerpageId) Internal helper method to get the status of a removed element.static boolean
isEditingModelGroups
(CmsObject cms, CmsResource containerPage) Checks whether the current page is a model group page.int
Loads the index of the clipboard tab last selected by the user.prefetch()
Returns the initialization data.static CmsCntPageData
prefetch
(javax.servlet.http.HttpServletRequest request) Fetches the container page data.prepareForEdit
(String clientId, String editOption, CmsUUID pageId, String requestParams) Prepares an element to be edited.replaceElement
(CmsContainerPageRpcContext context, CmsUUID detailContentId, String reqParams, String clientId, String replaceId, Collection<CmsContainer> containers, String locale) Returns the element data to replace a given content element with another while keeping it's settings.void
saveClipboardTab
(int tabIndex) Saves the index of the clipboard tab selected by the user.long
saveContainerpage
(CmsUUID pageStructureId, List<CmsContainer> containers) Saves the container-page.long
saveDetailContainers
(CmsUUID detailId, String detailContainerResource, List<CmsContainer> containers) Saves the detail containers.saveElementSettings
(CmsContainerPageRpcContext context, CmsUUID detailContentId, String reqParams, String clientId, Map<String, String> settings, List<CmsContainer> containers, String locale) Saves the settings for the given element to the container page and returns the updated element data.void
saveFavoriteList
(List<String> clientIds, String uri) Saves the favorite list.saveGroupContainer
(CmsContainerPageRpcContext context, CmsUUID detailContentId, String reqParams, CmsGroupContainer groupContainer, Collection<CmsContainer> containers, String locale) Saves a group-container element.saveInheritanceContainer
(CmsUUID pageStructureId, CmsUUID detailContentId, CmsInheritanceContainer inheritanceContainer, Collection<CmsContainer> containers, String locale) Saves an inheritance container.void
saveRecentList
(List<String> clientIds, String uri) Saves the recent list.void
setEditSmallElements
(boolean editSmallElements) Enables or disables editing for small elements on page load.void
setElementView
(CmsUUID elementView) Sets the element view.void
setLastPage
(CmsUUID pageId, CmsUUID detailId) Stores information about the container page last edited.void
Sets the session cache.static void
unlockPage
(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Unlocks a page or set of pages if they are locked by the current user.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
-
PARAM_PAGE_EDITOR_PLACEMENT_MODE_ENABLED
Runtime property key to enable / disable placement mode.- See Also:
-
ADDINFO_EDIT_SMALL_ELEMENTS
Additional info key for storing the "edit small elements" setting on the user.- See Also:
-
ATTR_CLIPBOARD_TAB
Session attribute name used to store the selected clipboard tab.- See Also:
-
MODEL_GROUP_PATH_FRAGMENT
The model group pages path fragment.- See Also:
-
SOURCE_CONTAINERPAGE_ID_SETTING
The source container page id settings key.- See Also:
-
MAX_VISIBLE_ELEMENT_USES
Maximum number of reuse locations to display in the reuse warning dialog.- See Also:
-
-
Constructor Details
-
CmsContainerpageService
public CmsContainerpageService()
-
-
Method Details
-
generateModelResourceList
public static List<CmsModelResourceInfo> generateModelResourceList(CmsObject cms, String resourceType, List<CmsResource> modelResources, Locale contentLocale) throws CmsException Generates the model resource data list.- Parameters:
cms
- the cms contextresourceType
- the resource type namemodelResources
- the model resourcecontentLocale
- the content locale- Returns:
- the model resources data
- Throws:
CmsException
- if something goes wrong reading the resource information
-
getSerializedElementInfo
public static String getSerializedElementInfo(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, CmsContainerElementBean elementBean, CmsContainerPageBean page) throws Exception Returns the serialized element data.- Parameters:
cms
- the cms contextrequest
- the servlet requestresponse
- the servlet responseelementBean
- the element to serializepage
- the container page- Returns:
- the serialized element data
- Throws:
Exception
- if something goes wrong
-
isEditingModelGroups
Checks whether the current page is a model group page.- Parameters:
cms
- the CMS contextcontainerPage
- the current page- Returns:
true
if the current page is a model group page
-
prefetch
public static CmsCntPageData prefetch(javax.servlet.http.HttpServletRequest request) throws CmsRpcException Fetches the container page data.- Parameters:
request
- the current request- Returns:
- the container page data
- Throws:
CmsRpcException
- if something goes wrong
-
unlockPage
public static void unlockPage(CmsObject cms, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception Unlocks a page or set of pages if they are locked by the current user.This is not called via the normal GWT-RPC mechanism, but with the browser's sendBeacon function.
- Parameters:
cms
- the CMS contextrequest
- the current requestresponse
- the current response- Throws:
Exception
- if something goes wrong
-
checkContainerpageOrElementsChanged
public boolean checkContainerpageOrElementsChanged(CmsUUID structureId, CmsUUID detailContentId, String contentLocale) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Check if a page or its elements have been changed.- Specified by:
checkContainerpageOrElementsChanged
in interfaceI_CmsContainerpageService
- Parameters:
structureId
- the structure id of the resourcedetailContentId
- the structure id of the detail content (may be null)contentLocale
- the content locale- Returns:
- true if there were changes in the page or its elements
- Throws:
CmsRpcException
- if the RPC call fails- See Also:
-
checkNewWidgetsAvailable
Description copied from interface:I_CmsContainerpageService
Checks whether the Acacia widgets are available for all fields of the content.- Specified by:
checkNewWidgetsAvailable
in interfaceI_CmsContainerpageService
- Parameters:
structureId
- the structure id of the content- Returns:
- true if Acacia widgets are available for all fields
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
convertToServerId
Parses an element id.- Parameters:
id
- the element id- Returns:
- the corresponding structure id
- Throws:
CmsIllegalArgumentException
- if the id has not the right format
-
copyElement
public CmsUUID copyElement(CmsUUID pageId, CmsUUID originalElementId, String locale) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Creates a new element with a given model element and returns the copy'S structure id.- Specified by:
copyElement
in interfaceI_CmsContainerpageService
- Parameters:
pageId
- the container page idoriginalElementId
- the model element idlocale
- the content locale- Returns:
- the structure id of the copy
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
createNewElement
public CmsContainerElement createNewElement(CmsUUID pageStructureId, CmsUUID detailContentId, String clientId, String resourceType, CmsUUID modelResourceStructureId, String locale) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Creates a new element of the given type and returns the new element data containing structure id and site path.- Specified by:
createNewElement
in interfaceI_CmsContainerpageService
- Parameters:
pageStructureId
- the container page structure iddetailContentId
- the structure id of the detail contentclientId
- the client id of the new element (this will be the structure id of the configured new resource)resourceType
- the resource tape of the new elementmodelResourceStructureId
- the model resource structure idlocale
- the content locale- Returns:
- the new element data containing structure id and site path
- Throws:
CmsRpcException
- if something goes wrong processing the request- See Also:
-
getCachedElement
public CmsContainerElementBean getCachedElement(String clientId, String pageRootPath) throws CmsException Reads the cached element-bean for the given client-side-id from cache.- Parameters:
clientId
- the client-side-idpageRootPath
- the container page root path- Returns:
- the cached container element bean
- Throws:
CmsException
- in case reading the element resource fails
-
getContainerInfo
Description copied from interface:I_CmsContainerpageService
This method is used for serialization purposes only.- Specified by:
getContainerInfo
in interfaceI_CmsContainerpageService
- Returns:
- container info
- See Also:
-
getDeleteOptions
public CmsDialogOptionsAndInfo getDeleteOptions(String clientId, CmsUUID pageId, String requestParams) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Returns the delete options.- Specified by:
getDeleteOptions
in interfaceI_CmsContainerpageService
- Parameters:
clientId
- the client element idpageId
- the current page structure idrequestParams
- optional request parameters- Returns:
- the delete options
- Throws:
CmsRpcException
- in case something goes wrong- See Also:
-
getEditOptions
public CmsDialogOptionsAndInfo getEditOptions(String clientId, CmsUUID pageId, String requestParams, boolean isListElement) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Returns the edit options.- Specified by:
getEditOptions
in interfaceI_CmsContainerpageService
- Parameters:
clientId
- the client element idpageId
- the current page structure idrequestParams
- optional request parametersisListElement
- in case a list element, not a container element is about to be edited- Returns:
- the edit options
- Throws:
CmsRpcException
- in case something goes wrong- See Also:
-
getElementInfo
Description copied from interface:I_CmsContainerpageService
This method is used for serialization purposes only.- Specified by:
getElementInfo
in interfaceI_CmsContainerpageService
- Returns:
- element info
- See Also:
-
getElementsLockedForPublishing
Description copied from interface:I_CmsContainerpageService
Checks which structure ids of a given set belong to resources locked for publishing by the current user, and then returns those.- Specified by:
getElementsLockedForPublishing
in interfaceI_CmsContainerpageService
- Parameters:
idsToCheck
- the set of ids to check- Returns:
- the subset of ids which belong to resources locked for publishing by the current user
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getFavoriteList
public List<CmsContainerElementData> getFavoriteList(CmsUUID pageStructureId, CmsUUID detailContentId, Collection<CmsContainer> containers, String locale) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Returns the container element data of the favorite list.- Specified by:
getFavoriteList
in interfaceI_CmsContainerpageService
- Parameters:
pageStructureId
- the container page structure iddetailContentId
- the detail content structure idcontainers
- the containers of the current pagelocale
- the content locale- Returns:
- the favorite list element data
- Throws:
CmsRpcException
- if something goes wrong processing the request- See Also:
-
getListElementCreationOptions
public CmsListElementCreationDialogData getListElementCreationOptions(CmsUUID structureId, String jsonListAddData) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Loads the data for the list element creation dialog.- Specified by:
getListElementCreationOptions
in interfaceI_CmsContainerpageService
- Parameters:
structureId
- the structure id of the container element for which we want to load the optionsjsonListAddData
- the list-add metadata read from the DOM- Returns:
- the data for the list element creation dialog
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getNewOptions
public CmsDialogOptionsAndInfo getNewOptions(String clientId, CmsUUID pageStructureId, String requestParams) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Gets the edit handler options for creating a new element.- Specified by:
getNewOptions
in interfaceI_CmsContainerpageService
- Parameters:
clientId
- the client id of the selected elementpageStructureId
- the container page structure idrequestParams
- the request parameter string- Returns:
- the dialog option data from the edit handler
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getRecentList
public List<CmsContainerElementData> getRecentList(CmsUUID pageStructureId, CmsUUID detailContentId, Collection<CmsContainer> containers, String locale) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Returns the container element data of the recent list.- Specified by:
getRecentList
in interfaceI_CmsContainerpageService
- Parameters:
pageStructureId
- the container page structure iddetailContentId
- the detail content structure idcontainers
- the containers of the current pagelocale
- the content locale- Returns:
- the recent list element data
- Throws:
CmsRpcException
- if something goes wrong processing the request- See Also:
-
getRemovedElementStatus
public CmsRemovedElementStatus getRemovedElementStatus(String id, CmsUUID containerpageId) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Gets the status of a removed element.- Specified by:
getRemovedElementStatus
in interfaceI_CmsContainerpageService
- Parameters:
id
- the client id of the removed elementcontainerpageId
- the id of the page which should be excluded from the relation check, or null if no page should be excluded- Returns:
- the status of the removed element
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
getReuseInfo
public CmsReuseInfo getReuseInfo(CmsUUID pageId, CmsUUID detailId, CmsUUID elementId) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Loads the reuse information for a container element.- Specified by:
getReuseInfo
in interfaceI_CmsContainerpageService
- Parameters:
pageId
- the current page iddetailId
- the current detail idelementId
- the id of the element to check- Returns:
- the reuse information for the element
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
handleDelete
public void handleDelete(String clientId, String deleteOption, CmsUUID pageId, String requestParams) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Handles the element deletion.- Specified by:
handleDelete
in interfaceI_CmsContainerpageService
- Parameters:
clientId
- the client element iddeleteOption
- the selected delete optionpageId
- the current page structure idrequestParams
- optional request parameters- Throws:
CmsRpcException
- in case something goes wrong- See Also:
-
internalGetRemovedElementStatus
public CmsRemovedElementStatus internalGetRemovedElementStatus(CmsUUID structureId, CmsUUID containerpageId) throws CmsException Internal helper method to get the status of a removed element.- Parameters:
structureId
- the structure id of the removed elementcontainerpageId
- the id of the page to exclude from the relation check, or null if no page should be excluded- Returns:
- the status of the removed element
- Throws:
CmsException
- in case reading the resource fails
-
loadClipboardTab
Description copied from interface:I_CmsContainerpageService
Loads the index of the clipboard tab last selected by the user.- Specified by:
loadClipboardTab
in interfaceI_CmsContainerpageService
- Returns:
- the clipboard tab index
- See Also:
-
prefetch
Description copied from interface:I_CmsContainerpageService
Returns the initialization data.- Specified by:
prefetch
in interfaceI_CmsContainerpageService
- Returns:
- the initialization data
- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
prepareForEdit
public CmsUUID prepareForEdit(String clientId, String editOption, CmsUUID pageId, String requestParams) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Prepares an element to be edited.- Specified by:
prepareForEdit
in interfaceI_CmsContainerpageService
- Parameters:
clientId
- the client element ideditOption
- the selected delete optionpageId
- the current page structure idrequestParams
- optional request parameters- Returns:
- the structure ID of the content to edit
- Throws:
CmsRpcException
- in case something goes wrong- See Also:
-
saveClipboardTab
Description copied from interface:I_CmsContainerpageService
Saves the index of the clipboard tab selected by the user.- Specified by:
saveClipboardTab
in interfaceI_CmsContainerpageService
- Parameters:
tabIndex
- the index of the selected clipboard tab- See Also:
-
saveContainerpage
public long saveContainerpage(CmsUUID pageStructureId, List<CmsContainer> containers) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Saves the container-page.- Specified by:
saveContainerpage
in interfaceI_CmsContainerpageService
- Parameters:
pageStructureId
- the container page structure idcontainers
- the container-page's containers- Returns:
- the server time stamp of time of saving
- Throws:
CmsRpcException
- if something goes wrong processing the request- See Also:
-
saveDetailContainers
public long saveDetailContainers(CmsUUID detailId, String detailContainerResource, List<CmsContainer> containers) throws CmsRpcException Description copied from interface:I_CmsContainerpageService
Saves the detail containers.- Specified by:
saveDetailContainers
in interfaceI_CmsContainerpageService
- Parameters:
detailId
- the detail content iddetailContainerResource
- the detail container resource pathcontainers
- the container-page's containers- Returns:
- the server time stamp of time of saving
- Throws:
CmsRpcException
- if something goes wrong processing the request- See Also:
-
saveFavoriteList
Description copied from interface:I_CmsContainerpageService
Saves the favorite list.- Specified by:
saveFavoriteList
in interfaceI_CmsContainerpageService
- Parameters:
clientIds
- favorite list element id'suri
- the container page URI- Throws:
CmsRpcException
- if something goes wrong processing the request- See Also:
-
saveRecentList
Description copied from interface:I_CmsContainerpageService
Saves the recent list.- Specified by:
saveRecentList
in interfaceI_CmsContainerpageService
- Parameters:
clientIds
- recent list element id'suri
- the container page URI- Throws:
CmsRpcException
- if something goes wrong processing the request- See Also:
-
setEditSmallElements
Description copied from interface:I_CmsContainerpageService
Enables or disables editing for small elements on page load.- Specified by:
setEditSmallElements
in interfaceI_CmsContainerpageService
- Parameters:
editSmallElements
- the defautl setting for the small element editability- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
setElementView
Description copied from interface:I_CmsContainerpageService
Sets the element view.- Specified by:
setElementView
in interfaceI_CmsContainerpageService
- Parameters:
elementView
- the element view- See Also:
-
setLastPage
Description copied from interface:I_CmsContainerpageService
Stores information about the container page last edited.- Specified by:
setLastPage
in interfaceI_CmsContainerpageService
- Parameters:
pageId
- the page iddetailId
- the detail content id- Throws:
CmsRpcException
- if something goes wrong- See Also:
-
setSessionCache
Sets the session cache.- Parameters:
cache
- the session cache
-