public final class AttachmentResourceHelper extends Object
AttachmentResourceHandler
Modifier and Type | Field and Description |
---|---|
static String |
MULTIPART_FORM_DATA
Form type multipart/form-data.
|
Modifier and Type | Method and Description |
---|---|
static void |
assertAttachmentSize(String contentType,
Long fileSize,
boolean isBase64)
Check attachment size and throw
MaxLengthReachedException |
static AttachmentResource |
buildAttachmentResource(AttachmentData attachment)
Converts a list item describing an attachment into an attachment resource
|
static AttachmentResource |
buildAttachmentResource(AttachmentTO attachment)
Builds an attachment resource for REST-API out of the core attachment.
|
static AttachmentResource[] |
buildAttachmentResources(Collection<AttachmentData> attachments)
Converts a collection of attachment list items into an array of attachment resources
|
static void |
checkAttachmentUploadSessionId(String attachmentUploadSessionId)
Check for attachmentUploadSessionId Parameter and throw
ParameterValidationException |
static javax.ws.rs.core.Response |
getAttachmentAsBinary(AttachmentTO attachment)
Builds a byte array response of a given attachment.
|
static ResourceStoringManagement |
getResourceStoringManagement()
Get the resource storing management.
|
public static final String MULTIPART_FORM_DATA
public static void assertAttachmentSize(String contentType, Long fileSize, boolean isBase64) throws MaxLengthReachedException
MaxLengthReachedException
contentType
- type of contentfileSize
- size of fileisBase64
- is file encodedMaxLengthReachedException
- exception for file is to largepublic static AttachmentResource buildAttachmentResource(AttachmentData attachment)
attachment
- a list item to convertpublic static AttachmentResource buildAttachmentResource(AttachmentTO attachment)
attachment
- the attachment of the corepublic static AttachmentResource[] buildAttachmentResources(Collection<AttachmentData> attachments)
attachments
- the list items to convert, can be null which will result in an empty arraypublic static void checkAttachmentUploadSessionId(String attachmentUploadSessionId) throws ParameterValidationException
ParameterValidationException
attachmentUploadSessionId
- identifier of attribute in sessionParameterValidationException
- attachmentUploadSessionId was not setpublic static javax.ws.rs.core.Response getAttachmentAsBinary(AttachmentTO attachment) throws IOException
attachment
- attachment to be respondedIOException
- if streaming of the attachment failed.public static ResourceStoringManagement getResourceStoringManagement()
Copyright © 2019 Communote team. All rights reserved.