Class DummyAvailableContentTypeSupport
- java.lang.Object
-
- com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport<CustomContentEntityObject>
-
- com.atlassian.confluence.content.apisupport.CustomContentTypeApiSupport
-
- com.atlassian.confluence.it.api.test.plugin.apiavailable.DummyAvailableContentTypeSupport
-
- All Implemented Interfaces:
ContentTypeApiSupport<CustomContentEntityObject>
public class DummyAvailableContentTypeSupport extends CustomContentTypeApiSupport
-
-
Field Summary
Fields Modifier and Type Field Description static ContentType
contentType
static String
moduleKey
-
Constructor Summary
Constructors Constructor Description DummyAvailableContentTypeSupport(CustomContentApiSupportParams parentParams)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
Class<CustomContentEntityObject>
getEntityClass()
Get the class of the hibernate object used to persist the content type handled by this api supportMap<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)
Determines whether this ContentTypeApiSupport will provide children for other types.boolean
supportsChildrenOfType(ContentType otherType)
Determines whether other ContentTypeApiSupports can 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 operationValidationResult
validateUpdate(Content updatedContent, CustomContentEntityObject existingEntity)
Validate the update operation-
Methods inherited from class com.atlassian.confluence.content.apisupport.CustomContentTypeApiSupport
create, getChildrenOfThisTypeForOtherType, getChildrenOfThisTypeForOtherType, update
-
Methods inherited from class com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport
getChildren, getChildrenForThisType, getContainer, getFilteredChildrenForThisType, getFilteredChildrenOfThisTypeForOtherType, getLinks
-
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
container, getFilteredChildren
-
-
-
-
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 theContent
that this service provides.
-
getChildrenForThisType
protected PageResponse<Content> getChildrenForThisType(CustomContentEntityObject content, LimitedRequest limitedRequest, Expansions expansions, Depth depth)
- Specified by:
getChildrenForThisType
in classBaseContentTypeApiSupport<CustomContentEntityObject>
-
supportsChildrenOfType
public boolean supportsChildrenOfType(ContentType otherType)
Description copied from interface:ContentTypeApiSupport
Determines whether other ContentTypeApiSupports can provide children for this type.For children of type
childType
to be allowed as children of this type, this type needs to returntrue
forsupportsChildrenOfType(childType)
, andchildType
needs to returntrue
forsupportsChildrenForParentType(thisType)
.- Parameters:
otherType
- the other Content type that wants to offer children below an instance of our type- Returns:
- true if
Content
ofotherType
'sContentType
should be allowed as children of this type (as far as this type is concerned:childType
also gets a say viaContentTypeApiSupport.supportsChildrenForParentType(ContentType)
) - See Also:
ContentTypeApiSupport.supportsChildrenForParentType(ContentType)
-
supportsChildrenForParentType
public boolean supportsChildrenForParentType(ContentType parentType)
Description copied from interface:ContentTypeApiSupport
Determines whether this ContentTypeApiSupport will provide children for other types.For children of this type to be allowed as children of
parentType
, this type needs to returntrue
forsupportsChildrenForParentType(parentType)
, andparentType
needs to returntrue
forsupportsChildrenOfType(thisType)
.- Parameters:
parentType
- the other Content type that our type is offering children to- Returns:
- true if
Content
of this type'sContentType
should be allowed to be a child ofparentType
(as far as this type is concerned:parentType
also gets a say viaContentTypeApiSupport.supportsChildrenOfType(ContentType)
) - See Also:
ContentTypeApiSupport.supportsChildrenOfType(ContentType)
-
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 interfaceContentTypeApiSupport<CustomContentEntityObject>
- Overrides:
getExtensions
in classBaseContentTypeApiSupport<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 interfaceContentTypeApiSupport<CustomContentEntityObject>
- Overrides:
getEntityClass
in classCustomContentTypeApiSupport
- 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 classCustomContentTypeApiSupport
- Parameters:
content
- the map of extension properties to set on the entitynewVersion
- the entity to updateoriginal
- 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 classCustomContentTypeApiSupport
- Parameters:
content
- the map of extension properties to set on the entitynewVersion
- the entity to update
-
validateCreate
public ValidationResult validateCreate(Content newContent)
Description copied from interface:ContentTypeApiSupport
Validate the create operation- Specified by:
validateCreate
in interfaceContentTypeApiSupport<CustomContentEntityObject>
- Overrides:
validateCreate
in classBaseContentTypeApiSupport<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 interfaceContentTypeApiSupport<CustomContentEntityObject>
- Overrides:
validateUpdate
in classBaseContentTypeApiSupport<CustomContentEntityObject>
- Parameters:
updatedContent
- the content that will be used to update the entityexistingEntity
- the existing entity to be updated- Returns:
- a validation result wrapping any validation errors that were encountered
-
-