test.plugin.apiavailable
Class DummyAvailableContentTypeSupport

java.lang.Object
  extended by com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport<CustomContentEntityObject>
      extended by com.atlassian.confluence.content.apisupport.CustomContentTypeApiSupport
          extended by test.plugin.apiavailable.DummyAvailableContentTypeSupport
All Implemented Interfaces:
ContentTypeApiSupport<CustomContentEntityObject>

public class DummyAvailableContentTypeSupport
extends CustomContentTypeApiSupport


Field Summary
static ContentType contentType
           
static String moduleKey
           
 
Constructor Summary
DummyAvailableContentTypeSupport(CustomContentApiSupportParams parentParams)
           
 
Method Summary
protected  void createCustomContentEntity(Content content, CustomContentEntityObject newVersion)
          Set the extension properties on the entity.
protected  PageResponse<Content> getChildrenForThisType(CustomContentEntityObject content, LimitedRequest limitedRequest, Expansions expansions, Depth depth)
           
protected  PageResponse<Content> getChildrenOfThisTypeForOtherType(ContentConvertible otherTypeParent, LimitedRequest limitedRequest, Expansions expansions, Depth depth)
           
 Class<CustomContentEntityObject> getEntityClass()
          Get the class of the hibernate object used to persist the content type handled by this api support
 Map<ContentId,Map<String,Object>> getExtensions(Iterable<CustomContentEntityObject> contentEntities, Expansions expansions)
          Get the set of extension properties for the collection of contentEntity Ids.
 ContentType getHandledType()
           
 boolean supportsChildrenForParentType(ContentType parentType)
           
 boolean supportsChildrenOfType(ContentType otherType)
          A check that to allow other ContentTypeApiSupports to provide children for this type
protected  boolean updateCustomContentEntity(Content content, CustomContentEntityObject newVersion, CustomContentEntityObject original)
          Set the extension properties on the entity.
 ValidationResult validateCreate(Content newContent)
          Validate the create operation
 ValidationResult validateUpdate(Content updatedContent, CustomContentEntityObject existingEntity)
          Validate the update operation
 
Methods inherited from class com.atlassian.confluence.content.apisupport.CustomContentTypeApiSupport
create, update
 
Methods inherited from class com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport
getChildren, getChildrenForThisType, getChildrenOfThisTypeForOtherType, getContainer, getLinks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

moduleKey

public static final String moduleKey
See Also:
Constant Field Values

contentType

public static final ContentType contentType
Constructor Detail

DummyAvailableContentTypeSupport

public DummyAvailableContentTypeSupport(CustomContentApiSupportParams parentParams)
Method Detail

getHandledType

public ContentType getHandledType()
Returns:
the ContentType of the Content that this service provides.

getChildrenForThisType

protected PageResponse<Content> getChildrenForThisType(CustomContentEntityObject content,
                                                       LimitedRequest limitedRequest,
                                                       Expansions expansions,
                                                       Depth depth)
Specified by:
getChildrenForThisType in class BaseContentTypeApiSupport<CustomContentEntityObject>

supportsChildrenOfType

public boolean supportsChildrenOfType(ContentType otherType)
Description copied from class: BaseContentTypeApiSupport
A check that to allow other ContentTypeApiSupports to provide children for this type

Specified by:
supportsChildrenOfType in interface ContentTypeApiSupport<CustomContentEntityObject>
Specified by:
supportsChildrenOfType in class BaseContentTypeApiSupport<CustomContentEntityObject>
Parameters:
otherType - - the other Content type that wants to offer children of our type
Returns:
true if the children should be allowed

getChildrenOfThisTypeForOtherType

protected PageResponse<Content> getChildrenOfThisTypeForOtherType(ContentConvertible otherTypeParent,
                                                                  LimitedRequest limitedRequest,
                                                                  Expansions expansions,
                                                                  Depth depth)
Specified by:
getChildrenOfThisTypeForOtherType in class BaseContentTypeApiSupport<CustomContentEntityObject>

supportsChildrenForParentType

public boolean supportsChildrenForParentType(ContentType parentType)
Specified by:
supportsChildrenForParentType in interface ContentTypeApiSupport<CustomContentEntityObject>
Specified by:
supportsChildrenForParentType in class BaseContentTypeApiSupport<CustomContentEntityObject>
Returns:
true if Content of this binding's ContentType can be a child of contentEntity of the given type

getExtensions

public Map<ContentId,Map<String,Object>> getExtensions(Iterable<CustomContentEntityObject> contentEntities,
                                                       Expansions expansions)
Description copied from class: BaseContentTypeApiSupport
Get the set of extension properties for the collection of contentEntity Ids. Dealing with collections here may help reduce the number of db queries we need to execute. Implementors should override to provide extensions for the given contentEntity.

Specified by:
getExtensions in interface ContentTypeApiSupport<CustomContentEntityObject>
Overrides:
getExtensions in class BaseContentTypeApiSupport<CustomContentEntityObject>

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

Specified by:
getEntityClass in interface ContentTypeApiSupport<CustomContentEntityObject>
Overrides:
getEntityClass in class CustomContentTypeApiSupport
Returns:
the class of the entity used to persist changes

updateCustomContentEntity

protected boolean updateCustomContentEntity(Content content,
                                            CustomContentEntityObject newVersion,
                                            CustomContentEntityObject original)
Description copied from class: CustomContentTypeApiSupport
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.

Specified by:
updateCustomContentEntity in class CustomContentTypeApiSupport
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

createCustomContentEntity

protected void createCustomContentEntity(Content content,
                                         CustomContentEntityObject newVersion)
Description copied from class: CustomContentTypeApiSupport
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.

Specified by:
createCustomContentEntity in class CustomContentTypeApiSupport
Parameters:
content - the map of extension properties to set on the entity
newVersion - the entity to update

validateCreate

public ValidationResult validateCreate(Content newContent)
Description copied from interface: ContentTypeApiSupport
Validate the create operation

Specified by:
validateCreate in interface ContentTypeApiSupport<CustomContentEntityObject>
Overrides:
validateCreate in class BaseContentTypeApiSupport<CustomContentEntityObject>
Parameters:
newContent - the content that will be used to create an entity
Returns:
a validation result wrapping any validation errors that were encountered

validateUpdate

public ValidationResult validateUpdate(Content updatedContent,
                                       CustomContentEntityObject existingEntity)
Description copied from interface: ContentTypeApiSupport
Validate the update operation

Specified by:
validateUpdate in interface ContentTypeApiSupport<CustomContentEntityObject>
Overrides:
validateUpdate in class BaseContentTypeApiSupport<CustomContentEntityObject>
Parameters:
updatedContent - the content that will be used to update the entity
existingEntity - the existing entity to be updated
Returns:
a validation result wrapping any validation errors that were encountered


Copyright © 2003–2015 Atlassian. All rights reserved.