Clearspace API (1.7.0) Core Javadocs

com.jivesoftware.community
Interface AttachmentManager

All Superinterfaces:
JiveManager

public interface AttachmentManager
extends JiveManager

Manages attachment settings. There are three main properties that can administered with respect to attachments:

See Also:
Attachment

Method Summary
 void addAllowedType(java.lang.String contentType)
          Adds a content type to the list of explicitly allowed types.
 void addDisallowedType(java.lang.String contentType)
          Adds a content type to the list of explicitly disallowed types.
 java.util.List<java.lang.String> getAllowedTypes()
          Returns a List of explicitly allowed types.
 java.util.List<java.lang.String> getAllowedTypesAsFileExtensions()
          Returns a list of explicitly allowed file types by extensions.
 java.util.List<java.lang.String> getDisallowedTypes()
          Returns a List of explicitly disallowed types.
 java.util.List<java.lang.String> getDisallowedTypesAsFileExtensions()
          Returns a list of explicitly disallowed file types by default extensions.
 int getImagePreviewMaxSize()
          Returns the max dimension of generated thumbnails (ie, the max value for the width or height).
 int getMaxAttachmentSize()
          Returns the maximum size of an individual attachment in kilobytes.
 int getMaxAttachmentsPerBlogPost()
          Returns the maximum number of attachments per blog post.
 int getMaxAttachmentsPerDocument()
          Returns the maximum number of attachments per document.
 int getMaxAttachmentsPerMessage()
          Returns the maximum number of attachments per message.
 boolean isAllowAllByDefault()
          Returns true if in the "allow all content types by default" mode.
 boolean isAttachmentsEnabled()
          Returns true if attachments are enabled, false otherwise.
 boolean isImagePreviewEnabled()
          Returns true if image preview support is enabled.
 boolean isImagePreviewRatioEnabled()
          Returns true if the aspect ratio of thumbnails should be preserved.
 boolean isValidType(java.lang.String contentType)
          Returns true if the content type is valid based on the current settings of the allowAllByDefault flag and the allowed and disallowed types list.
 void removeAllowedType(java.lang.String contentType)
          Removes a content type fromt he list of explicitly allowed types.
 void removeDisallowedType(java.lang.String contentType)
          Removes a content type from the list of explicitly disallowed types.
 void setAllowAllByDefault(boolean allowAllByDefault)
          Sets the default allowed content types mode.
 void setAttachmentsEnabled(boolean enabled)
          Sets whether attachments are enabled, false otherwise.
 void setImagePreviewEnabled(boolean imagePreviewEnabled)
          Toggles whether image preview support is enabled.
 void setImagePreviewMaxSize(int imagePreviewMaxSize)
          Sets the max dimension of generated thumbnails (ie, the max value for the width or height).
 void setImagePreviewRatioEnabled(boolean imagePreviewRatioEnabled)
          Toggles whether the aspect ratio of thumbnails should be preserved.
 void setMaxAttachmentSize(int maxAttachmentSize)
          Sets the maximum size of an individual attachment in kilobytes.
 void setMaxAttachmentsPerBlogPost(int maxAttachmentsPerBlogPost)
          Sets the maximum number of attachments per blog post.
 void setMaxAttachmentsPerDocument(int maxAttachmentsPerDocument)
          Sets the maximum number of attachments per document.
 void setMaxAttachmentsPerMessage(int maxAttachmentsPerMessage)
          Sets the maximum number of attachments per message.
 
Methods inherited from interface com.jivesoftware.community.JiveManager
destroy, initialize
 

Method Detail

isAttachmentsEnabled

boolean isAttachmentsEnabled()
Returns true if attachments are enabled, false otherwise.

Returns:
true if attachments are enabled, false otherwise.

setAttachmentsEnabled

void setAttachmentsEnabled(boolean enabled)
                           throws UnauthorizedException
Sets whether attachments are enabled, false otherwise.

Parameters:
enabled - true if attachments are enabled, false otherwise.
Throws:
UnauthorizedException - if not a system administrator.

getMaxAttachmentSize

int getMaxAttachmentSize()
Returns the maximum size of an individual attachment in kilobytes. Trying to create an attachment larger than the max size will fail with an exception. The default maximum attachment size is 1 megabyte, or 1,024 K.

Returns:
the max size in kilobytes of any single attachment.

setMaxAttachmentSize

void setMaxAttachmentSize(int maxAttachmentSize)
                          throws UnauthorizedException
Sets the maximum size of an individual attachment in kilobytes. Trying to create an attachment larger than the max size will fail with an exception. The default maximum attachment size is 1 megabyte, or 1024 K.

Parameters:
maxAttachmentSize - the max size in kilobytes of any single attachment.
Throws:
UnauthorizedException - if not an administrator.

getMaxAttachmentsPerDocument

int getMaxAttachmentsPerDocument()
Returns the maximum number of attachments per document. The default is 5 attachments.

Returns:
the max number of attachments allowed per document.

setMaxAttachmentsPerDocument

void setMaxAttachmentsPerDocument(int maxAttachmentsPerDocument)
                                  throws UnauthorizedException
Sets the maximum number of attachments per document. The default is 5 attachments.

Parameters:
maxAttachmentsPerDocument - the max number of attachments allowed per document.
Throws:
UnauthorizedException - if not an administrator.

isValidType

boolean isValidType(java.lang.String contentType)
Returns true if the content type is valid based on the current settings of the allowAllByDefault flag and the allowed and disallowed types list.

Parameters:
contentType - the content type to test.
Returns:
true if the content type is valid.

addAllowedType

void addAllowedType(java.lang.String contentType)
                    throws UnauthorizedException
Adds a content type to the list of explicitly allowed types.

Parameters:
contentType - a content type to add to the explicitly allowed types list.
Throws:
UnauthorizedException - if not an administrator.

removeAllowedType

void removeAllowedType(java.lang.String contentType)
                       throws UnauthorizedException
Removes a content type fromt he list of explicitly allowed types. If the given content type does not exist in the list, this method does nothing.

Parameters:
contentType - a content type to remove from the explicitly allowed types list.
Throws:
UnauthorizedException - if not an administrator.

getAllowedTypes

java.util.List<java.lang.String> getAllowedTypes()
Returns a List of explicitly allowed types.

Returns:
a List of all explicitly allowed types.

getAllowedTypesAsFileExtensions

java.util.List<java.lang.String> getAllowedTypesAsFileExtensions()
Returns a list of explicitly allowed file types by extensions. For example, image/png would return .png. Since not all allowed mime types may have a ful list of extensions (e.g. application/octet-stream) it's possible that an extension will not be present in the returned list that otherwise will be a valid extension.


addDisallowedType

void addDisallowedType(java.lang.String contentType)
                       throws UnauthorizedException
Adds a content type to the list of explicitly disallowed types.

Parameters:
contentType - a content type to add to the explicitly disallowed types list.
Throws:
UnauthorizedException - if not an administrator.

removeDisallowedType

void removeDisallowedType(java.lang.String contentType)
                          throws UnauthorizedException
Removes a content type from the list of explicitly disallowed types.

Parameters:
contentType - a content type to remove from the explicitly disallowed types list.
Throws:
UnauthorizedException - if not an administrator.

getDisallowedTypes

java.util.List<java.lang.String> getDisallowedTypes()
Returns a List of explicitly disallowed types.

Returns:
a list of all explicitly disallowed types.

getDisallowedTypesAsFileExtensions

java.util.List<java.lang.String> getDisallowedTypesAsFileExtensions()
Returns a list of explicitly disallowed file types by default extensions. For example, image/png would return .png.


isAllowAllByDefault

boolean isAllowAllByDefault()
Returns true if in the "allow all content types by default" mode. The alternative is that all content types are disallowed unless they're on the "allowed" list.

Returns:
true if all content types are allowed by default.

setAllowAllByDefault

void setAllowAllByDefault(boolean allowAllByDefault)
                          throws UnauthorizedException
Sets the default allowed content types mode. The value true means that all content types will be allowed unless they're on the "disallowed list". If false, no content types will be allowed unless on the "allowed list".

Parameters:
allowAllByDefault - true if all content types should be allowed by default.
Throws:
UnauthorizedException - if does not have admin permissions.

isImagePreviewEnabled

boolean isImagePreviewEnabled()
Returns true if image preview support is enabled. When enabled, the JiveServlet will generate thumbnails for image attachments. False by default.

Returns:
true if thumbnail support is enabled.

setImagePreviewEnabled

void setImagePreviewEnabled(boolean imagePreviewEnabled)
                            throws UnauthorizedException
Toggles whether image preview support is enabled. When enabled, the JiveServlet will generate thumbnails for image attachments. False by default.

Parameters:
imagePreviewEnabled - true if thumbnail support should be enabled.
Throws:
UnauthorizedException - if not a system administrator.

getImagePreviewMaxSize

int getImagePreviewMaxSize()
Returns the max dimension of generated thumbnails (ie, the max value for the width or height). The default value is 25.

Returns:
the max dimension of a thumbnail.

setImagePreviewMaxSize

void setImagePreviewMaxSize(int imagePreviewMaxSize)
                            throws UnauthorizedException
Sets the max dimension of generated thumbnails (ie, the max value for the width or height). The default value is 25.

Parameters:
imagePreviewMaxSize - the max dimension of a thumbnail.
Throws:
UnauthorizedException - if not a system administrator.

isImagePreviewRatioEnabled

boolean isImagePreviewRatioEnabled()
Returns true if the aspect ratio of thumbnails should be preserved. When enabled, the aspect ratio of the original image will be preserved when generating the thumbnail. When false, the thumbnail will always be a square (which may distort the image). The default is true..

Returns:
true if the aspect ration should be preserved.

setImagePreviewRatioEnabled

void setImagePreviewRatioEnabled(boolean imagePreviewRatioEnabled)
                                 throws UnauthorizedException
Toggles whether the aspect ratio of thumbnails should be preserved. When enabled, the aspect ratio of the original image will be preserved when generating the thumbnail. When false, the thumbnail will always be a square (which may distort the image). The default is true..

Parameters:
imagePreviewRatioEnabled - true if the aspect ration should be preserved.
Throws:
UnauthorizedException - if not a system administrator.

getMaxAttachmentsPerMessage

int getMaxAttachmentsPerMessage()
Returns the maximum number of attachments per message. The default is 5 attachments.

Returns:
the max number of attachments allowed per message.

setMaxAttachmentsPerMessage

void setMaxAttachmentsPerMessage(int maxAttachmentsPerMessage)
                                 throws UnauthorizedException
Sets the maximum number of attachments per message. The default is 5 attachments.

Parameters:
maxAttachmentsPerMessage - the max number of attachments allowed per message.
Throws:
UnauthorizedException - if not an administrator.

getMaxAttachmentsPerBlogPost

int getMaxAttachmentsPerBlogPost()
Returns the maximum number of attachments per blog post. The default is 5 attachments.

Returns:
the max number of attachments allowed per blog post.

setMaxAttachmentsPerBlogPost

void setMaxAttachmentsPerBlogPost(int maxAttachmentsPerBlogPost)
                                  throws UnauthorizedException
Sets the maximum number of attachments per blog post. The default is 5 attachments.

Parameters:
maxAttachmentsPerBlogPost - the max number of attachments allowed per blog post.
Throws:
UnauthorizedException - if not an administrator.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.