public class CmsContentService extends CmsGwtService implements I_CmsContentService
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ATTR_EDITOR_SAVING
Request context attribute to mark a writeFile() triggered by the user saving in the content editor.
|
protected static org.apache.commons.logging.Log |
LOG
The logger for this class.
|
perThreadRequest, perThreadResponseDICT_CONTENT_DEFINITION, PARAM_BACKLINK| Constructor and Description |
|---|
CmsContentService() |
| Modifier and Type | Method and Description |
|---|---|
CmsContentDefinition |
callEditorChangeHandlers(java.lang.String entityId,
CmsEntity editedLocaleEntity,
java.util.Collection<java.lang.String> skipPaths,
java.util.Collection<java.lang.String> changedScopes)
Calls the editor change handlers.
|
void |
copyLocale(java.util.Collection<java.lang.String> locales,
CmsEntity sourceLocale)
Copies the given source locale to the target locales.
|
protected java.lang.String |
decodeNewLink(java.lang.String newLink)
Decodes the newlink request parameter if possible.
|
static java.lang.String |
defaultCreateResourceToEdit(CmsObject cms,
java.lang.String newLink,
java.util.Locale locale,
java.lang.String referenceSitePath,
java.lang.String modelFileSitePath,
java.lang.String mode,
java.lang.String postCreateHandler)
Creates a new resource to edit, delegating to an edit handler if edit handler data is passed in.
|
static java.lang.String |
getAttributeName(I_CmsXmlContentValue contentValue)
Returns the entity attribute name representing the given content value.
|
static java.lang.String |
getAttributeName(java.lang.String elementName,
java.lang.String parentType)
Returns the entity attribute name to use for this element.
|
CmsObject |
getCmsObject()
Returns the current cms context.
|
protected java.lang.String |
getElementName(java.lang.String attributeName)
Returns the element name to the given element.
|
static java.lang.String |
getEntityId(I_CmsXmlContentValue contentValue)
Returns the entity id to the given content value.
|
protected java.lang.String |
getFileEncoding(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 java.lang.String |
getRdfaAttributes(I_CmsXmlContentValue value)
Returns the RDF annotations required for in line editing.
|
static java.lang.String |
getRdfaAttributes(I_CmsXmlContentValue parentValue,
java.lang.String childNames)
Returns the RDF annotations required for in line editing.
|
static java.lang.String |
getRdfaAttributes(I_CmsXmlDocument document,
java.util.Locale contentLocale,
java.lang.String elementPath)
Returns the RDF annotations required for in line editing.
|
static java.lang.String |
getTypeUri(CmsXmlContentDefinition xmlContentDefinition)
Returns the type URI.
|
CmsContentDefinition |
loadContentDefinition(java.lang.String entityId)
Loads the content definition for a given entity.
|
CmsContentDefinition |
loadDefinition(java.lang.String entityId,
java.lang.String clientId,
CmsEntity editedLocaleEntity,
java.util.Collection<java.lang.String> skipPaths,
java.util.Map<java.lang.String,java.lang.String> settingPresets)
Loads the content definition for a given entity.
|
CmsContentDefinition |
loadInitialDefinition(java.lang.String entityId,
java.lang.String clientId,
java.lang.String newLink,
CmsUUID modelFileId,
java.lang.String editContext,
java.lang.String mainLocale,
java.lang.String mode,
java.lang.String postCreateHandler,
CmsEditHandlerData editHandlerDataForNew,
java.util.Map<java.lang.String,java.lang.String> settingPresets)
Loads the content definition for a given entity.
|
CmsContentDefinition |
loadNewDefinition(java.lang.String entityId,
java.lang.String clientId,
CmsEntity editedLocaleEntity,
java.util.Collection<java.lang.String> skipPaths,
java.util.Map<java.lang.String,java.lang.String> settingPresets)
Loads new entity definition.
|
CmsContentDefinition |
prefetch()
Returns the content definition of the resource requested through parameter 'resource'.
|
static CmsContentDefinition |
prefetch(javax.servlet.http.HttpServletRequest request)
Fetches the initial content definition.
|
protected CmsEntity |
readEntity(CmsXmlContent content,
org.dom4j.Element element,
java.util.Locale locale,
java.lang.String entityId,
java.lang.String parentPath,
java.lang.String typeName,
CmsContentTypeVisitor visitor,
boolean includeInvisible,
CmsEntity editedLocalEntity)
Parses the element into an entity.
|
protected java.util.Map<java.lang.String,CmsType> |
readTypes(CmsXmlContentDefinition xmlContentDefinition,
java.util.Locale locale)
Reads the types from the given content definition and adds the to the map of already registered
types if necessary.
|
CmsSaveResult |
saveAndDeleteEntities(CmsEntity lastEditedEntity,
java.lang.String clientId,
java.util.List<java.lang.String> deletedEntities,
java.util.Collection<java.lang.String> skipPaths,
java.lang.String lastEditedLocale,
boolean clearOnSuccess)
Saves and deletes the given entities.
|
CmsValidationResult |
saveEntities(java.util.List<CmsEntity> entities)
Saves the given entities and returns a validation result in case of invalid entities.
|
CmsValidationResult |
saveEntity(CmsEntity entity)
Saves the given entity and returns a validation result in case of invalid entities.
|
java.lang.String |
saveValue(java.lang.String contentId,
java.lang.String contentPath,
java.lang.String localeString,
java.lang.String newValue)
Saves a value in an existing XML content.
|
protected void |
synchronizeLocaleIndependentFields(CmsFile file,
CmsXmlContent content,
java.util.Collection<java.lang.String> skipPaths,
java.util.Collection<CmsEntity> entities,
java.util.Locale lastEdited)
Synchronizes the locale independent fields.
|
protected void |
transferInvisibleValues(CmsEntity original,
CmsEntity target,
CmsContentTypeVisitor visitor)
Transfers values marked as invisible from the original entity to the target entity.
|
CmsEntityHtml |
updateEntityHtml(CmsEntity entity,
java.lang.String contextUri,
java.lang.String htmlContextInfo)
Retrieves the updated entity HTML representation.
|
CmsValidationResult |
validateEntity(CmsEntity changedEntity)
Validates the given entity and returns maps of error and warning messages in case of invalid attributes.
|
checkPermissions, clearThreadStorage, doGetSerializationPolicy, doUnexpectedFailure, ensureLock, ensureLock, ensureLock, ensureSession, error, getPropertiesByName, getRequest, getResponse, log, log, logError, service, setCms, setContext, setRequest, setResponse, tryUnlockcheckPermutationStrongName, getCodeServerPolicyUrl, getRequestModuleBasePath, getSerializationPolicy, init, loadPolicyFromCodeServer, onAfterResponseSerialized, onBeforeRequestDeserialized, processCall, processCall, processPost, shouldCompressResponsedoPost, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContentdoDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, servicepublic static final java.lang.String ATTR_EDITOR_SAVING
protected static final org.apache.commons.logging.Log LOG
public CmsContentService()
public static java.lang.String defaultCreateResourceToEdit(CmsObject cms, java.lang.String newLink, java.util.Locale locale, java.lang.String referenceSitePath, java.lang.String modelFileSitePath, java.lang.String mode, java.lang.String postCreateHandler) throws CmsException
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 an I_CmsCollectorPostCreateHandler which is invoked after the content has been created.CmsException - if something goes wrongpublic static java.lang.String getAttributeName(I_CmsXmlContentValue contentValue)
contentValue - the content valuepublic static java.lang.String getAttributeName(java.lang.String elementName, java.lang.String parentType)
elementName - the element nameparentType - the parent typepublic static java.lang.String getEntityId(I_CmsXmlContentValue contentValue)
contentValue - the content valuepublic static java.lang.String getRdfaAttributes(I_CmsXmlContentValue value)
value - the XML content valuepublic static java.lang.String getRdfaAttributes(I_CmsXmlContentValue parentValue, java.lang.String childNames)
parentValue - the parent XML content valuechildNames - the child attribute names separated by '|'public static java.lang.String getRdfaAttributes(I_CmsXmlDocument document, java.util.Locale contentLocale, java.lang.String elementPath)
document - the parent XML documentcontentLocale - the content localeelementPath - the element xpath to get the RDF annotation forpublic static java.lang.String getTypeUri(CmsXmlContentDefinition xmlContentDefinition)
xmlContentDefinition - the type content definitionpublic static CmsContentDefinition prefetch(javax.servlet.http.HttpServletRequest request) throws CmsRpcException
request - the current requestCmsRpcException - if something goes wrongpublic CmsContentDefinition callEditorChangeHandlers(java.lang.String entityId, CmsEntity editedLocaleEntity, java.util.Collection<java.lang.String> skipPaths, java.util.Collection<java.lang.String> changedScopes) throws CmsRpcException
I_CmsContentServiceentityId - the edited entity ideditedLocaleEntity - the edited entityskipPaths - the locale synchronization value paths to skipchangedScopes - the changed content value pathsCmsRpcException - in case anything goes wrongI_CmsContentService.callEditorChangeHandlers(java.lang.String, org.opencms.acacia.shared.CmsEntity, java.util.Collection, java.util.Collection)public void copyLocale(java.util.Collection<java.lang.String> locales, CmsEntity sourceLocale) throws CmsRpcException
I_CmsContentServicelocales - the target localessourceLocale - the source localeCmsRpcException - if something goes wrongI_CmsContentService.copyLocale(java.util.Collection, org.opencms.acacia.shared.CmsEntity)public CmsObject getCmsObject()
CmsGwtServicegetCmsObject in class CmsGwtServiceCmsGwtService.getCmsObject()public CmsContentDefinition loadContentDefinition(java.lang.String entityId) throws CmsRpcException
I_CmsContentServiceloadContentDefinition in interface I_CmsContentServiceentityId - the entity id/URICmsRpcExceptionI_CmsContentService.loadContentDefinition(java.lang.String)public CmsContentDefinition loadDefinition(java.lang.String entityId, java.lang.String clientId, CmsEntity editedLocaleEntity, java.util.Collection<java.lang.String> skipPaths, java.util.Map<java.lang.String,java.lang.String> settingPresets) throws CmsRpcException
I_CmsContentServiceentityId - the entity id/URIclientId - the container element client id if availableeditedLocaleEntity - the edited locale entityskipPaths - the paths to skip during locale synchronizationsettingPresets - the presets for container element settingsCmsRpcExceptionI_CmsContentService.loadDefinition(java.lang.String, java.lang.String, org.opencms.acacia.shared.CmsEntity, java.util.Collection, java.util.Map)public CmsContentDefinition loadInitialDefinition(java.lang.String entityId, java.lang.String clientId, java.lang.String newLink, CmsUUID modelFileId, java.lang.String editContext, java.lang.String mainLocale, java.lang.String mode, java.lang.String postCreateHandler, CmsEditHandlerData editHandlerDataForNew, java.util.Map<java.lang.String,java.lang.String> settingPresets) throws CmsRpcException
I_CmsContentServiceentityId - the entity id/URIclientId - the container element client id if availablenewLink - the new linkmodelFileId - the optional model file ideditContext - the container page currently being edited (may be null)mainLocale - the main language to copy in case the element language node does not exist yetmode - the content creation modepostCreateHandler - the post-create handler class nameeditHandlerDataForNew - the edit handler data, if an edit handler is used for creating a new element; null otherwisesettingPresets - the presets for container element settingsCmsRpcException - if something goes wrong processing the requestI_CmsContentService.loadInitialDefinition(java.lang.String, java.lang.String, java.lang.String, org.opencms.util.CmsUUID, java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.opencms.ade.contenteditor.shared.CmsEditHandlerData, java.util.Map)public CmsContentDefinition loadNewDefinition(java.lang.String entityId, java.lang.String clientId, CmsEntity editedLocaleEntity, java.util.Collection<java.lang.String> skipPaths, java.util.Map<java.lang.String,java.lang.String> settingPresets) throws CmsRpcException
I_CmsContentServiceThis will load the entity representation of a new locale node.
entityId - the entity id/URIclientId - the container element client id if availableeditedLocaleEntity - the edited locale entityskipPaths - the paths to skip during locale synchronizationsettingPresets - the presets for container element settingsCmsRpcException - if something goes wrong processing the requestI_CmsContentService.loadNewDefinition(java.lang.String, java.lang.String, org.opencms.acacia.shared.CmsEntity, java.util.Collection, java.util.Map)public CmsContentDefinition prefetch() throws CmsRpcException
I_CmsContentServiceCmsRpcException - if something goes wrongI_CmsContentService.prefetch()public CmsSaveResult saveAndDeleteEntities(CmsEntity lastEditedEntity, java.lang.String clientId, java.util.List<java.lang.String> deletedEntities, java.util.Collection<java.lang.String> skipPaths, java.lang.String lastEditedLocale, boolean clearOnSuccess) throws CmsRpcException
I_CmsContentServicelastEditedEntity - the last edited entityclientId - the container element client id if availabledeletedEntities - the entity id's to deleteskipPaths - the paths to skip during locale synchronizationlastEditedLocale - the last edited localeclearOnSuccess - true to unlock resource after savingCmsRpcException - if something goes wrong processing the requestI_CmsContentService.saveAndDeleteEntities(org.opencms.acacia.shared.CmsEntity, java.lang.String, java.util.List, java.util.Collection, java.lang.String, boolean)public CmsValidationResult saveEntities(java.util.List<CmsEntity> entities)
I_CmsContentServiceInvalid entities will not be saved.
saveEntities in interface I_CmsContentServiceentities - the entities to saveI_CmsContentService.saveEntities(java.util.List)public CmsValidationResult saveEntity(CmsEntity entity)
I_CmsContentServiceInvalid entities will not be saved.
saveEntity in interface I_CmsContentServiceentity - the entity to saveI_CmsContentService.saveEntity(org.opencms.acacia.shared.CmsEntity)public java.lang.String saveValue(java.lang.String contentId, java.lang.String contentPath, java.lang.String localeString, java.lang.String newValue) throws CmsRpcException
I_CmsContentServicecontentId - the structure id of the contentcontentPath - the xpath of the value to setlocaleString - the locale in which to set the valuenewValue - the value to setCmsRpcException - if something goes wrongI_CmsContentService.saveValue(java.lang.String, java.lang.String, java.lang.String, java.lang.String)public CmsEntityHtml updateEntityHtml(CmsEntity entity, java.lang.String contextUri, java.lang.String htmlContextInfo) throws java.lang.Exception
I_CmsContentServiceThe entity data will be validated but not persisted on the server.
updateEntityHtml in interface I_CmsContentServiceentity - the entitycontextUri - the context URIhtmlContextInfo - information about the HTML contextjava.lang.Exception - if something goes wrong processing the requestI_CmsContentService.updateEntityHtml(org.opencms.acacia.shared.CmsEntity, java.lang.String, java.lang.String)public CmsValidationResult validateEntity(CmsEntity changedEntity) throws CmsRpcException
I_CmsContentServicevalidateEntity in interface I_CmsContentServicechangedEntity - the entity to validateCmsRpcExceptionI_CmsContentService.validateEntity(org.opencms.acacia.shared.CmsEntity)protected java.lang.String decodeNewLink(java.lang.String newLink)
newLink - the parameter to decodeprotected java.lang.String getElementName(java.lang.String attributeName)
attributeName - the attribute nameprotected java.lang.String getFileEncoding(CmsObject cms, CmsResource file)
cms - the CmsObjectfile - the file which is to be checkedprotected CmsEntity readEntity(CmsXmlContent content, org.dom4j.Element element, java.util.Locale locale, java.lang.String entityId, java.lang.String parentPath, java.lang.String typeName, CmsContentTypeVisitor visitor, boolean includeInvisible, CmsEntity editedLocalEntity)
content - the entity contentelement - the current elementlocale - the content localeentityId - the entity idparentPath - the parent pathtypeName - the entity type namevisitor - the content type visitorincludeInvisible - include invisible attributeseditedLocalEntity - the edited locale entityprotected java.util.Map<java.lang.String,CmsType> readTypes(CmsXmlContentDefinition xmlContentDefinition, java.util.Locale locale)
xmlContentDefinition - the XML content definitionlocale - the messages localeprotected void synchronizeLocaleIndependentFields(CmsFile file, CmsXmlContent content, java.util.Collection<java.lang.String> skipPaths, java.util.Collection<CmsEntity> entities, java.util.Locale lastEdited) throws CmsXmlException
file - the content filecontent - the XML contentskipPaths - the paths to skip during locale synchronizationentities - the edited entitieslastEdited - the last edited localeCmsXmlException - if something goes wrongprotected void transferInvisibleValues(CmsEntity original, CmsEntity target, CmsContentTypeVisitor visitor)
original - the original entitytarget - the target entiyvisitor - the type visitor holding the content type configuration