Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community
Interface DocumentType

All Superinterfaces:
JiveObject

public interface DocumentType
extends JiveObject

The DocumentType interface provides structure to Documents by defining the fields that make up a document and the creators and presenters to use to create and display it.

Because is possible that one might want to additional information with each document type each document type can have an arbitrary number of properties. For example, a property "customLayoutType" could be stored with each document type for use by a custom skin implementation to customize the UI for each document type.

Security for DocumentType objects is provided by DocumentTypeProxy protection proxy objects.


Method Summary
 DocumentTypeElement addBuiltInElement(DocumentTypeElement.Type type)
          Used to create and add a new built-in type element to this DocumentTypeSectionElement.
 void addDocumentFieldElement(DocumentField documentField)
          Adds a DocumentField to this DocumentTypeSectionElement as an element.
 DocumentTypeSectionElement addDocumentTypeSectionElement()
          Creates and adds a DocumentTypeSectionElement.
 DocumentTypeLabelElement addLabelElement(String value)
          Used to create and add a new Label Element to this DocumentTypeSectionElement
 boolean containsElement(DocumentTypeElement element)
          A convenience method for checking whether the document type contains the specified field
 DocumentPresenter createPresenter(String name)
          Creates a DocumentPresenter and adds it to this DocumentType.
 void deleteDocumentElement(DocumentTypeElement element)
          Removes the specified DocumentTypeElement from this DocumentType
 void deleteDocumentPresenter()
          Deletes the document presenter associated with the given name within the document type.
 AttachmentManager getAttachmentManager()
          Returns an attachment manager that can be used to manage attachment settings for the document type.
 BinaryBodyManager getBinaryBodyManager()
          Returns a binary body manager that can be used to manage binary document body settings.
 String getDescription()
          Retrieve the description of the document type.
 List<DocumentTypeElement> getDocumentElements()
          Returns the elements that make up this document type as a list of DocumentTypeElements.
 List<DocumentTypeElement> getDocumentElements(DocumentTypeElement.Type type)
          Returns the elements that make up this document type and match the given type.
 DocumentPresenter getDocumentPresenter()
          Returns a document presenter with the specified name, or null if no presenter is defined with the specified name.
 String getName()
          Returns the name of the document type.
 Map<String,String> getProperties()
          Retrieve a map of all the extended properties for the document type.
 DocumentTypeValidator getValidator()
          Returns the validator for the document type.
 void save()
          Persists changes to this DocumentType to the database
 void setDescription(String description)
          Set the description of the document type.
 void setDocumentElementIndex(DocumentTypeElement element, int index)
          Sets the index where the specified DocumentTypeElement should appear
 void setDocumentPresenter(DocumentPresenter presenter)
          Sets the document presenter associated with the given name within the document type.
 void setName(String name)
          Set the name of the document type
 void setValidator(DocumentTypeValidator validator)
          Sets the validator for the document type.
 
Methods inherited from interface com.jivesoftware.community.JiveObject
getID, getObjectType
 

Method Detail

getName

String getName()
Returns the name of the document type.

Returns:
the name of the document type

setName

void setName(String name)
             throws UnauthorizedException
Set the name of the document type

Parameters:
name - the name of this document type
Throws:
UnauthorizedException - if not an administrator

getDescription

String getDescription()
Retrieve the description of the document type.

Returns:
the description of the document type.

setDescription

void setDescription(String description)
                    throws UnauthorizedException
Set the description of the document type.

Parameters:
description - the description associated with the document type.
Throws:
UnauthorizedException - if not an administrator.

containsElement

boolean containsElement(DocumentTypeElement element)
A convenience method for checking whether the document type contains the specified field

Parameters:
element - the element to check
Returns:
true if the document type contains the field, false otherwse.

getDocumentPresenter

DocumentPresenter getDocumentPresenter()
Returns a document presenter with the specified name, or null if no presenter is defined with the specified name.

As part of the default skin implementation there are 2 'magic' presenter names that if specified will override the autogenerated output, those being 'default' and 'print'.

Returns:
DocumentPresenter object, or null if no presenter is defined for the given name.

setDocumentPresenter

void setDocumentPresenter(DocumentPresenter presenter)
                          throws UnauthorizedException
Sets the document presenter associated with the given name within the document type. If a presenter already exists for the given name it will be replaced with the presenter provided as part of this method call.

As part of the default skin implementation there are 2 'magic' presenter names that if specified will override the autogenerated output, those being 'default' and 'print'.

Parameters:
presenter - the document presenter
Throws:
UnauthorizedException - if not an administrator.

deleteDocumentPresenter

void deleteDocumentPresenter()
                             throws UnauthorizedException
Deletes the document presenter associated with the given name within the document type. If no presenter with the given name exists in the document type no action will be taken.

Throws:
UnauthorizedException - if not an administrator.

getValidator

DocumentTypeValidator getValidator()
Returns the validator for the document type. A document type validator is useful to validate document input when there are interdepencies between multiple fields. For example: If the document type has two fields, product and version, you may create a validator which verifies that the version provided is a valid version for the selected product.

Returns:
the DocumentValidator for the document type.

setValidator

void setValidator(DocumentTypeValidator validator)
                  throws UnauthorizedException
Sets the validator for the document type.

Parameters:
validator - the validator for the document type.
Throws:
UnauthorizedException - if not an administrator.

getAttachmentManager

AttachmentManager getAttachmentManager()
Returns an attachment manager that can be used to manage attachment settings for the document type. Attachment settings are inherited from the global settings if no settings are made on the document type.

Returns:
an AttachmentManager to manage attachment settings.
See Also:
AttachmentManager

getBinaryBodyManager

BinaryBodyManager getBinaryBodyManager()
Returns a binary body manager that can be used to manage binary document body settings. Binary body settings are inherited from the global settings if no settings are made on the document type.

Returns:
a BinaryBodyManager to manage binary document body settings.
See Also:
BinaryBodyManager

getProperties

Map<String,String> getProperties()
Retrieve a map of all the extended properties for the document type. Each document type can have an arbitrary number of extended properties. This allows for enhanced functionality that is not part of the base interface. The map is alterable if the user is authorized to modify the document type, however only a mapping of key -> getValue is allowed. Null keys and values are not allowed.

Returns:
a map of document type extended properties.

save

void save()
          throws UnauthorizedException
Persists changes to this DocumentType to the database

Throws:
UnauthorizedException - if not an administrator

createPresenter

DocumentPresenter createPresenter(String name)
Creates a DocumentPresenter and adds it to this DocumentType.

Note you must call save on the DocumentPresenter and the DocumentType to persist changes.

Parameters:
name - name of the presenter
Returns:
new DocumentPresenter tied to this DocumentType

getDocumentElements

List<DocumentTypeElement> getDocumentElements()
Returns the elements that make up this document type as a list of DocumentTypeElements.

Returns:
the elements that make up this document type as a list of DocumentTypeElements.

getDocumentElements

List<DocumentTypeElement> getDocumentElements(DocumentTypeElement.Type type)
Returns the elements that make up this document type and match the given type. This would be a subset of the set of elements returned from getDocumentElements(). The list contains DocumentTypeElements.

Parameters:
type - the type of element to match against.
Returns:
the set of elements of this document type that match the given type.

setDocumentElementIndex

void setDocumentElementIndex(DocumentTypeElement element,
                             int index)
                             throws UnauthorizedException
Sets the index where the specified DocumentTypeElement should appear

Parameters:
element - DocumentTypeElement Element in the DocumentType to move
index - index index to move the element too
Throws:
UnauthorizedException - If the user is not an administrator
IllegalArgumentException - if the element is not part of this DocumentType

deleteDocumentElement

void deleteDocumentElement(DocumentTypeElement element)
                           throws UnauthorizedException
Removes the specified DocumentTypeElement from this DocumentType

Parameters:
element - the DocumentTypeElement to remove
Throws:
UnauthorizedException - if the user is not an Administrator
IllegalArgumentException - if the specified element does not belong to this document type

addLabelElement

DocumentTypeLabelElement addLabelElement(String value)
Used to create and add a new Label Element to this DocumentTypeSectionElement

Parameters:
value - string value for the label element
Returns:
the created label element

addBuiltInElement

DocumentTypeElement addBuiltInElement(DocumentTypeElement.Type type)
Used to create and add a new built-in type element to this DocumentTypeSectionElement.

Parameters:
type - built-in type (type.isBuiltIn() must return true)
Returns:
the created built-in type element

addDocumentFieldElement

void addDocumentFieldElement(DocumentField documentField)
Adds a DocumentField to this DocumentTypeSectionElement as an element.

Parameters:
documentField - the document field to add

addDocumentTypeSectionElement

DocumentTypeSectionElement addDocumentTypeSectionElement()
Creates and adds a DocumentTypeSectionElement.

Returns:
the DocumentTypeSectionElement that was created

Clearspace Project Page

Copyright © 1999-2007 Jive Software.