Class AttachmentContentTypeApiSupport
- java.lang.Object
-
- com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport<Attachment>
-
- com.atlassian.confluence.api.impl.service.content.typebinding.AttachmentContentTypeApiSupport
-
- All Implemented Interfaces:
ContentTypeApiSupport<Attachment>
public class AttachmentContentTypeApiSupport extends BaseContentTypeApiSupport<Attachment>
Performs API operations forAttachment
s.
-
-
Constructor Summary
Constructors Constructor Description AttachmentContentTypeApiSupport(ContentEntityManager contentEntityManager, ContentFactory contentFactory, AttachmentManagerInternal attachmentManager, PaginationService paginationService, PermissionManager permissionManager, ApiSupportProvider apiSupportProvider, ContentCreator contentCreator, ThumbnailManager thumbnailManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCreateAttachments(ContentEntityObject ceo)
boolean
canRemoveAttachment(Attachment attachment)
PageResponse<Content>
getAttachments(ContentId containerId, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Attachment> predicate, Expansions contentExpansions)
Optional<Content>
getById(ContentId attachmentId, List<ContentStatus> statuses, Expansions expansions)
protected PageResponse<Content>
getChildrenForThisType(Attachment content, LimitedRequest limitedRequest, Expansions expansions, Depth depth)
PageResponse<Content>
getChildrenOfThisTypeForOtherType(ContentConvertible parent, LimitedRequest limitedRequest, Expansions expansions, Depth depth)
Class<Attachment>
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<Attachment> attachments, Expansions expansions)
Get the set of extension properties for the collection of contentEntity Ids.ContentType
getHandledType()
List<Link>
getLinks(Attachment attachment)
Get additional link properties for the _links mapboolean
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.Attachment
update(Content content, Attachment entity)
Updates an existing persistent entity from the given api contentValidationResult
validateCreate(Content newContent)
Validate the create operationValidationResult
validateUpdate(Content updatedContent, Attachment existingEntity)
Validate the update operation-
Methods inherited from class com.atlassian.confluence.content.apisupport.BaseContentTypeApiSupport
create, getChildren, getChildrenForThisType, getChildrenOfThisTypeForOtherType, getContainer, getFilteredChildrenForThisType, getFilteredChildrenOfThisTypeForOtherType
-
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
-
-
-
-
Constructor Detail
-
AttachmentContentTypeApiSupport
public AttachmentContentTypeApiSupport(ContentEntityManager contentEntityManager, ContentFactory contentFactory, AttachmentManagerInternal attachmentManager, PaginationService paginationService, PermissionManager permissionManager, ApiSupportProvider apiSupportProvider, ContentCreator contentCreator, ThumbnailManager thumbnailManager)
-
-
Method Detail
-
getChildrenOfThisTypeForOtherType
public PageResponse<Content> getChildrenOfThisTypeForOtherType(ContentConvertible parent, LimitedRequest limitedRequest, Expansions expansions, Depth depth)
- Specified by:
getChildrenOfThisTypeForOtherType
in classBaseContentTypeApiSupport<Attachment>
-
getAttachments
public PageResponse<Content> getAttachments(ContentId containerId, LimitedRequest limitedRequest, com.google.common.base.Predicate<? super Attachment> predicate, Expansions contentExpansions) throws ServiceException
- Throws:
ServiceException
-
getById
public Optional<Content> getById(ContentId attachmentId, List<ContentStatus> statuses, Expansions expansions)
-
getHandledType
public ContentType getHandledType()
- Returns:
- the
ContentType
of theContent
that this service provides.
-
getChildrenForThisType
protected PageResponse<Content> getChildrenForThisType(Attachment content, LimitedRequest limitedRequest, Expansions expansions, Depth depth)
- Specified by:
getChildrenForThisType
in classBaseContentTypeApiSupport<Attachment>
-
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<Attachment> attachments, 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<Attachment>
- Overrides:
getExtensions
in classBaseContentTypeApiSupport<Attachment>
-
getLinks
public List<Link> getLinks(Attachment attachment)
Description copied from class:BaseContentTypeApiSupport
Get additional link properties for the _links mapImplementors should override and provide links for the given contentEntity
- Specified by:
getLinks
in interfaceContentTypeApiSupport<Attachment>
- Overrides:
getLinks
in classBaseContentTypeApiSupport<Attachment>
-
getEntityClass
public Class<Attachment> 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
-
validateCreate
public ValidationResult validateCreate(Content newContent)
Description copied from interface:ContentTypeApiSupport
Validate the create operation- Specified by:
validateCreate
in interfaceContentTypeApiSupport<Attachment>
- Overrides:
validateCreate
in classBaseContentTypeApiSupport<Attachment>
- 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, Attachment existingEntity)
Description copied from interface:ContentTypeApiSupport
Validate the update operation- Specified by:
validateUpdate
in interfaceContentTypeApiSupport<Attachment>
- Overrides:
validateUpdate
in classBaseContentTypeApiSupport<Attachment>
- 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
-
update
public Attachment update(Content content, Attachment entity)
Description copied from interface:ContentTypeApiSupport
Updates an existing persistent entity from the given api content- Specified by:
update
in interfaceContentTypeApiSupport<Attachment>
- Overrides:
update
in classBaseContentTypeApiSupport<Attachment>
- Parameters:
content
- the updated contententity
- the existing entity- Returns:
- the updated entity
-
canCreateAttachments
public boolean canCreateAttachments(ContentEntityObject ceo)
-
canRemoveAttachment
public boolean canRemoveAttachment(Attachment attachment)
-
-