com.atlassian.confluence.content.apisupport
Class CustomContentTypeApiSupport

java.lang.Object
  extended by com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport<CustomContentEntityObject>
      extended by com.atlassian.confluence.content.apisupport.CustomContentTypeApiSupport
All Implemented Interfaces:
ContentTypeApiSupport<CustomContentEntityObject>
Direct Known Subclasses:
DummyAvailableContentTypeSupport

@ExperimentalSpi
public abstract class CustomContentTypeApiSupport
extends BaseContentTypeApiSupport<CustomContentEntityObject>


Constructor Summary
CustomContentTypeApiSupport(CustomContentApiSupportParams params)
           
 
Method Summary
 CustomContentEntityObject create(Content content)
          Create a new persistent entity for the given api content
protected abstract  void createCustomContentEntity(Content content, CustomContentEntityObject newVersion)
          Set the extension properties on the entity.
 Class<CustomContentEntityObject> getEntityClass()
          Get the class of the hibernate object used to persist the content type handled by this api support
 CustomContentEntityObject update(Content content, CustomContentEntityObject entity)
          Updates an existing persistent entity from the given api content
protected abstract  boolean updateCustomContentEntity(Content content, CustomContentEntityObject newVersion, CustomContentEntityObject original)
          Set the extension properties on the entity.
 
Methods inherited from class com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport
getChildren, getChildrenForThisType, getChildrenForThisType, getChildrenOfThisTypeForOtherType, getChildrenOfThisTypeForOtherType, getContainer, getExtensions, getLinks, supportsChildrenForParentType, supportsChildrenOfType, validateCreate, validateUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.confluence.content.apisupport.ContentTypeApiSupport
getHandledType
 

Constructor Detail

CustomContentTypeApiSupport

public CustomContentTypeApiSupport(CustomContentApiSupportParams params)
Method Detail

getEntityClass

public Class<CustomContentEntityObject> getEntityClass()
Description copied from interface: ContentTypeApiSupport
Get the class of the hibernate object used to persist the content type handled by this api support

Returns:
the class of the entity used to persist changes

create

public CustomContentEntityObject create(Content content)
Description copied from interface: ContentTypeApiSupport
Create a new persistent entity for the given api content

Specified by:
create in interface ContentTypeApiSupport<CustomContentEntityObject>
Overrides:
create in class BaseContentTypeApiSupport<CustomContentEntityObject>
Parameters:
content - the model object to create a persistent entity for
Returns:
the newly created persistent entity

update

public CustomContentEntityObject update(Content content,
                                        CustomContentEntityObject entity)
Description copied from interface: ContentTypeApiSupport
Updates an existing persistent entity from the given api content

Specified by:
update in interface ContentTypeApiSupport<CustomContentEntityObject>
Overrides:
update in class BaseContentTypeApiSupport<CustomContentEntityObject>
Parameters:
content - the updated content
entity - the existing entity
Returns:
the updated entity

updateCustomContentEntity

protected abstract boolean updateCustomContentEntity(Content content,
                                                     CustomContentEntityObject newVersion,
                                                     CustomContentEntityObject original)
Set the extension properties on the entity. Implementing classes can implement this to provide a lightweight hook into the content creation workflow to update extension properties whilst getting the default create behaviour. Implementors can also use this hook to fire relevant update events This method will be called from the default update method in this class. Common properties, including body and title are populated before this methods is called. Implementors that override create and update methods directly in this class should call this method for consistency.

Parameters:
content - the map of extension properties to set on the entity
newVersion - the entity to update
original - the original copy of the entity
Returns:
true if the method modified the entity and a save is required, false if a save is not required
Throws:
ServiceException

createCustomContentEntity

protected abstract void createCustomContentEntity(Content content,
                                                  CustomContentEntityObject newVersion)
Set the extension properties on the entity. Implementing classes can implement this to provide a lightweight hook into the content creation workflow to set extension properties whilst getting the default create behaviour. Implementors can also use this hook to fire relevant create events This method will be called from the default create method in this class. Common properties, including title, space and body are populated before this method is called. Implementors that override create and update behaviour directly in this class should call this method for consistency.

Parameters:
content - the map of extension properties to set on the entity
newVersion - the entity to update
Throws:
ServiceException


Copyright © 2003–2015 Atlassian. All rights reserved.