Class DefaultContentCreator
java.lang.Object
com.atlassian.confluence.content.apisupport.DefaultContentCreator
- All Implemented Interfaces:
- ContentCreator
- 
Constructor SummaryConstructorsConstructorDescriptionDefaultContentCreator(SpaceManager spaceManager, ContentBodyConversionService contentBodyConversionService, PermissionManager permissionManager, PageManagerInternal pageManager, CustomContentManager customContentEntityManager, com.atlassian.event.api.EventPublisher eventPublisher, DraftAttributesCopier draftAttributesCopier, LabelManagerInternal labelManager, RelationManager relationManager, ContentEntityManagerInternal contentEntityManager) 
- 
Method SummaryModifier and TypeMethodDescription<T extends ContentEntityObject>
 TcloneForUpdate(T ceo) <T extends ContentEntityObject>
 TsaveNewContent(T entity, @Nullable Version version, @Nullable Draft draft) Save a newly created content entity object<T extends ContentEntityObject>
 TsaveNewVersion(T ceo, T originalCEO, Version version) Save a new version of the CEO due to an updatebooleansetCommonMetadata(Content updatedContent, ContentEntityObject entity) Sets the common metadata on the entityvoidsetCommonPropertiesForCreate(Content newContent, ContentEntityObject entity, ConfluenceUser authenticatedUser) Sets common properties on a newly created entity in preparation for being saved.booleansetCommonPropertiesForUpdate(Content updatedContent, ContentEntityObject entity) Sets common properties on the entity in preparation for an update.booleansetContentBodyOnEntity(Content updatedContent, ContentEntityObject entity) Sets the body content in updatedContent on the entitybooleansetContentStatusOnEntity(Content updatedContent, ContentEntityObject entity) Sets the content status from updatedContent on the entitybooleansetLabelsMetadataOnEntity(Content updatedContent, ContentEntityObject entity) Sets the labels metadata on the entitybooleansetOriginalVersionOnEntity(Content updatedContent, ContentEntityObject entity) This property only applies to shared drafts.voidsetSpaceForCreate(Content newContent, SpaceContentEntityObject spacedEntity, ConfluenceUser authenticatedUser) Sets the space in newContent on this spacedEntitybooleansetTitleOnEntity(Content updatedContent, ContentEntityObject entity) Sets the title in updatedContent on the entity<T extends ContentEntityObject>
 TSaves CEOvalidateCreate(ConfluenceUser confluenceUser, Content newContent, Class<? extends ContentEntityObject> entityClass) Perform common validation checks for creation of content in a spacevalidateUpdate(ConfluenceUser user, Content updatedContent, ContentEntityObject entity) Perform common validation checks for updating content
- 
Constructor Details- 
DefaultContentCreatorpublic DefaultContentCreator(SpaceManager spaceManager, ContentBodyConversionService contentBodyConversionService, PermissionManager permissionManager, PageManagerInternal pageManager, CustomContentManager customContentEntityManager, com.atlassian.event.api.EventPublisher eventPublisher, DraftAttributesCopier draftAttributesCopier, LabelManagerInternal labelManager, RelationManager relationManager, ContentEntityManagerInternal contentEntityManager) 
 
- 
- 
Method Details- 
setCommonPropertiesForCreatepublic void setCommonPropertiesForCreate(Content newContent, ContentEntityObject entity, ConfluenceUser authenticatedUser) Sets common properties on a newly created entity in preparation for being saved.The properties set include the title and content body, and if the entity is a SpacedContentEntityObject also the space - Specified by:
- setCommonPropertiesForCreatein interface- ContentCreator
- Parameters:
- newContent- the content containing the new properties to set on the entity
- entity- the entity to set the new properties on
- authenticatedUser- the user that performing the operation
 
- 
validateUpdatepublic ValidationResult validateUpdate(ConfluenceUser user, Content updatedContent, ContentEntityObject entity) Perform common validation checks for updating content- Specified by:
- validateUpdatein interface- ContentCreator
- Parameters:
- user- the user to perform permission checks on
- updatedContent- the content to be updated
- entity- the entity to be updated
- Returns:
- a validation result indicating any validation errors that would occur on update
 
- 
validateCreatepublic ValidationResult validateCreate(ConfluenceUser confluenceUser, Content newContent, Class<? extends ContentEntityObject> entityClass) Perform common validation checks for creation of content in a space- Specified by:
- validateCreatein interface- ContentCreator
- Parameters:
- confluenceUser- the user to perform permission checks on
- newContent- the content to be created
- entityClass- the class of content to create
- Returns:
- a validation result indicating any errors that would occur attempting to create content
 
- 
setCommonPropertiesForUpdateSets common properties on the entity in preparation for an update. For properties initialized include the title and the content body.- Specified by:
- setCommonPropertiesForUpdatein interface- ContentCreator
- Parameters:
- updatedContent- the content containing the properties to update on the entity
- entity- the entity to be updated
- Returns:
- true if the entity was updated and requires being saved to the database
 
- 
setLabelsMetadataOnEntitySets the labels metadata on the entity- Specified by:
- setLabelsMetadataOnEntityin interface- ContentCreator
- Parameters:
- updatedContent- the content with the new body content
- entity- the entity to be updated
- Returns:
- true if the entity was updated with labels metadata different to what it already had
 
- 
setCommonMetadataSets the common metadata on the entity- Specified by:
- setCommonMetadatain interface- ContentCreator
- Parameters:
- updatedContent- the content containing the properties to update on the entity
- entity- the entity to be updated
- Returns:
- true if the entity was updated
 
- 
setTitleOnEntitySets the title in updatedContent on the entity- Specified by:
- setTitleOnEntityin interface- ContentCreator
- Parameters:
- updatedContent- the content with the new title
- entity- the entity to be updated
- Returns:
- true if the entity was updated with a different title to what it already had
 
- 
setContentBodyOnEntitySets the body content in updatedContent on the entity- Specified by:
- setContentBodyOnEntityin interface- ContentCreator
- Parameters:
- updatedContent- the content with the new body content
- entity- the entity to be updated
- Returns:
- true if the entity was updated with body content different to what it already had
 
- 
setContentStatusOnEntitySets the content status from updatedContent on the entity- Specified by:
- setContentStatusOnEntityin interface- ContentCreator
- Parameters:
- updatedContent- the content with the new title
- entity- the entity to be updated
- Returns:
- true if the content status was updated
 
- 
setOriginalVersionOnEntityThis property only applies to shared drafts. If the content to be persisted is a draft, and the contentId provided already references an existing piece of content with CURRENT status, we set the original version on the draft to link the draft to the existing content.- Specified by:
- setOriginalVersionOnEntityin interface- ContentCreator
- Parameters:
- updatedContent- the content with the existing contentId
- entity- the entity to be updated
- Returns:
- true if the original version was updated
 
- 
setSpaceForCreatepublic void setSpaceForCreate(Content newContent, SpaceContentEntityObject spacedEntity, ConfluenceUser authenticatedUser) Sets the space in newContent on this spacedEntity- Specified by:
- setSpaceForCreatein interface- ContentCreator
- Parameters:
- newContent- the content with the new space to set
- spacedEntity- the entity to be updated with the space
 
- 
saveNewVersionSave a new version of the CEO due to an update- Specified by:
- saveNewVersionin interface- ContentCreator
- Parameters:
- ceo- the new version of the CEO
- originalCEO- the original version of the ceo
- version- the version object with information about the new version to be saved
- Returns:
- the latest version of the CEO fetched from the database
 
- 
updateSaves CEO- Specified by:
- updatein interface- ContentCreator
- Parameters:
- ceo- CEO
- originalCEO- ceo we are updating from
- version- current version to update to
- Returns:
- the latest version of the CEO fetched from the database
 
- 
saveNewContentpublic <T extends ContentEntityObject> T saveNewContent(T entity, @Nullable Version version, @Nullable Draft draft) Save a newly created content entity object- Specified by:
- saveNewContentin interface- ContentCreator
- Parameters:
- entity- the entity object to be saved
- version- the version
- draft- the draft object contains metadata which will be transferred into the entity
- Returns:
- the latest version of the content entity object fetched from the database
- Since:
- 6.13.0
 
- 
cloneForUpdate- Specified by:
- cloneForUpdatein interface- ContentCreator
 
 
-