Package org.opencms.ade.contenteditor
Class CmsContentService
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.contenteditor.CmsContentService
- 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_CmsContentService,I_CmsContentService
Service to provide entity persistence within OpenCms.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRequest context attribute to mark a writeFile() triggered by the user saving in the content editor.protected static final org.apache.commons.logging.LogThe logger for this class.Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponseFields inherited from interface org.opencms.ade.contenteditor.shared.rpc.I_CmsContentService
DICT_CONTENT_DEFINITION, PARAM_BACKLINK -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncallEditorChangeHandlers(String entityId, CmsEntity editedLocaleEntity, Collection<String> skipPaths, Collection<String> changedScopes) Calls the editor change handlers.voidcopyLocale(Collection<String> locales, CmsEntity sourceLocale) Copies the given source locale to the target locales.protected StringdecodeNewLink(String newLink) Decodes the newlink request parameter if possible.static StringdefaultCreateResourceToEdit(CmsObject cms, String newLink, Locale locale, String referenceSitePath, String modelFileSitePath, String mode, String postCreateHandler) Creates a new resource to edit, delegating to an edit handler if edit handler data is passed in.static StringgetAttributeName(String elementName, String parentType) Returns the entity attribute name to use for this element.static StringgetAttributeName(I_CmsXmlContentValue contentValue) Returns the entity attribute name representing the given content value.Returns the current cms context.protected StringgetElementName(String attributeName) Returns the element name to the given element.static StringgetEntityId(I_CmsXmlContentValue contentValue) Returns the entity id to the given content value.protected StringgetFileEncoding(CmsObject cms, CmsResource file) Helper method to determine the encoding of the given file in the VFS, which must be set using the "content-encoding" property.static StringgetRdfaAttributes(I_CmsXmlDocument document, Locale contentLocale, String elementPath) Returns the RDF annotations required for in line editing.static StringReturns the RDF annotations required for in line editing.static StringgetRdfaAttributes(I_CmsXmlContentValue parentValue, String childNames) Returns the RDF annotations required for in line editing.static StringgetTypeUri(CmsXmlContentDefinition xmlContentDefinition) Returns the type URI.loadContentDefinition(String entityId) Loads the content definition for a given entity.loadDefinition(String entityId, String clientId, CmsEntity editedLocaleEntity, Collection<String> skipPaths, Map<String, String> settingPresets) Loads the content definition for a given entity.loadInitialDefinition(String entityId, String clientId, String newLink, CmsUUID modelFileId, String editContext, String mainLocale, String mode, String postCreateHandler, CmsEditHandlerData editHandlerDataForNew, Map<String, String> settingPresets, String editorStylesheet) Loads the content definition for a given entity.loadNewDefinition(String entityId, String clientId, CmsEntity editedLocaleEntity, Collection<String> skipPaths, Map<String, String> settingPresets) Loads new entity definition.prefetch()Returns the content definition of the resource requested through parameter 'resource'.static CmsContentDefinitionprefetch(javax.servlet.http.HttpServletRequest request) Fetches the initial content definition.protected CmsEntityreadEntity(CmsXmlContent content, org.dom4j.Element element, Locale locale, String entityId, String parentPath, String typeName, CmsContentTypeVisitor visitor, boolean includeInvisible, CmsEntity editedLocalEntity) Parses the element into an entity.readTypes(CmsXmlContentDefinition xmlContentDefinition, Locale locale) Reads the types from the given content definition and adds the to the map of already registered types if necessary.saveAndDeleteEntities(CmsEntity lastEditedEntity, String clientId, List<String> deletedEntities, Collection<String> skipPaths, String lastEditedLocale, boolean clearOnSuccess, boolean failOnWarnings) Saves and deletes the given entities.saveEntities(List<CmsEntity> entities) Saves the given entities and returns a validation result in case of invalid entities.saveEntity(CmsEntity entity) Saves the given entity and returns a validation result in case of invalid entities.Saves a value in an existing XML content.protected voidsynchronizeLocaleIndependentFields(CmsFile file, CmsXmlContent content, Collection<String> skipPaths, Collection<CmsEntity> entities, Locale lastEdited) Synchronizes the locale independent fields.protected voidtransferInvisibleValues(CmsEntity original, CmsEntity target, CmsContentTypeVisitor visitor) Transfers values marked as invisible from the original entity to the target entity.updateEntityHtml(CmsEntity entity, String contextUri, String htmlContextInfo) Retrieves the updated entity HTML representation.validateEntities(CmsEntity lastEditedEntity, String clientId, List<String> deletedEntities, Collection<String> skipPaths, String lastEditedLocale) Validates the edited XML content, taking all current changes into account.validateEntity(CmsEntity changedEntity) Validates the given entity and returns maps of error and warning messages in case of invalid attributes.Methods inherited from class org.opencms.gwt.CmsGwtService
checkPermissions, clearThreadStorage, doGetSerializationPolicy, doUnexpectedFailure, ensureLock, ensureLock, ensureLock, ensureLock, ensureSession, error, getPropertiesByName, getRequest, getResponse, isBroadcastCall, log, log, logError, service, setBroadcastPoll, setCms, setContext, setRequest, setResponse, tryUnlockMethods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
checkPermutationStrongName, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processCall, processPost, shouldCompressResponseMethods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContentMethods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, serviceMethods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init
-
Field Details
-
ATTR_EDITOR_SAVING
Request context attribute to mark a writeFile() triggered by the user saving in the content editor.- See Also:
-
LOG
The logger for this class.
-
-
Constructor Details
-
CmsContentService
public CmsContentService()
-
-
Method Details
-
defaultCreateResourceToEdit
public static String defaultCreateResourceToEdit(CmsObject cms, String newLink, Locale locale, String referenceSitePath, String modelFileSitePath, String mode, String postCreateHandler) throws CmsException Creates a new resource to edit, delegating to an edit handler if edit handler data is passed in.- Parameters:
cms- The CmsObject of the current request context.newLink- A string, specifying where which new content should be created.locale- The locale for which thereferenceSitePath- site path of the currently edited content.modelFileSitePath- site path of the model filemode- optional creation modepostCreateHandler- optional class name of anI_CmsCollectorPostCreateHandlerwhich is invoked after the content has been created.- Returns:
- The site-path of the newly created resource.
- Throws:
CmsException- if something goes wrong
-
getAttributeName
Returns the entity attribute name representing the given content value.- Parameters:
contentValue- the content value- Returns:
- the attribute name
-
getAttributeName
Returns the entity attribute name to use for this element.- Parameters:
elementName- the element nameparentType- the parent type- Returns:
- the attribute name
-
getEntityId
Returns the entity id to the given content value.- Parameters:
contentValue- the content value- Returns:
- the entity id
-
getRdfaAttributes
Returns the RDF annotations required for in line editing.- Parameters:
value- the XML content value- Returns:
- the RDFA
-
getRdfaAttributes
Returns the RDF annotations required for in line editing.- Parameters:
parentValue- the parent XML content valuechildNames- the child attribute names separated by '|'- Returns:
- the RDFA
-
getRdfaAttributes
public static String getRdfaAttributes(I_CmsXmlDocument document, Locale contentLocale, String elementPath) Returns the RDF annotations required for in line editing.- Parameters:
document- the parent XML documentcontentLocale- the content localeelementPath- the element xpath to get the RDF annotation for- Returns:
- the RDFA
-
getTypeUri
Returns the type URI.- Parameters:
xmlContentDefinition- the type content definition- Returns:
- the type URI
-
prefetch
public static CmsContentDefinition prefetch(javax.servlet.http.HttpServletRequest request) throws CmsRpcException Fetches the initial content definition.- Parameters:
request- the current request- Returns:
- the initial content definition
- Throws:
CmsRpcException- if something goes wrong
-
getCmsObject
Description copied from class:CmsGwtServiceReturns the current cms context.- Overrides:
getCmsObjectin classCmsGwtService- Returns:
- the current cms context
- See Also:
-
loadContentDefinition
Description copied from interface:I_CmsContentServiceLoads the content definition for a given entity.- Specified by:
loadContentDefinitionin interfaceI_CmsContentService- Parameters:
entityId- the entity id/URI- Returns:
- the content type definition
- Throws:
CmsRpcException- See Also:
-
prefetch
Description copied from interface:I_CmsContentServiceReturns the content definition of the resource requested through parameter 'resource'.- Specified by:
prefetchin interfaceI_CmsContentService- Returns:
- the content definition
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
saveEntities
Description copied from interface:I_CmsContentServiceSaves the given entities and returns a validation result in case of invalid entities.Invalid entities will not be saved.
- Specified by:
saveEntitiesin interfaceI_CmsContentService- Parameters:
entities- the entities to save- Returns:
- the validation result in case of invalid entities
- See Also:
-
saveValue
public String saveValue(String contentId, String contentPath, String localeString, String newValue) throws CmsRpcException Description copied from interface:I_CmsContentServiceSaves a value in an existing XML content.- Specified by:
saveValuein interfaceI_CmsContentService- Parameters:
contentId- the structure id of the contentcontentPath- the xpath of the value to setlocaleString- the locale in which to set the valuenewValue- the value to set- Returns:
- not used
- Throws:
CmsRpcException- if something goes wrong- See Also:
-
decodeNewLink
Decodes the newlink request parameter if possible.- Parameters:
newLink- the parameter to decode- Returns:
- the decoded value
-
getElementName
Returns the element name to the given element.- Parameters:
attributeName- the attribute name- Returns:
- the element name
-
getFileEncoding
Helper method to determine the encoding of the given file in the VFS, which must be set using the "content-encoding" property.- Parameters:
cms- the CmsObjectfile- the file which is to be checked- Returns:
- the encoding for the file
-
readTypes
protected Map<String,CmsType> readTypes(CmsXmlContentDefinition xmlContentDefinition, Locale locale) Reads the types from the given content definition and adds the to the map of already registered types if necessary.- Parameters:
xmlContentDefinition- the XML content definitionlocale- the messages locale- Returns:
- the types of the given content definition
-
synchronizeLocaleIndependentFields
protected void synchronizeLocaleIndependentFields(CmsFile file, CmsXmlContent content, Collection<String> skipPaths, Collection<CmsEntity> entities, Locale lastEdited) throws CmsXmlException Synchronizes the locale independent fields.- Parameters:
file- the content filecontent- the XML contentskipPaths- the paths to skip during locale synchronizationentities- the edited entitieslastEdited- the last edited locale- Throws:
CmsXmlException- if something goes wrong
-