Daisy Open Source CMS

org.outerj.daisy.repository.schema
Interface DocumentType

All Superinterfaces:
DescriptionEnabled, LabelEnabled

public interface DocumentType
extends LabelEnabled, DescriptionEnabled

Describes a type of document in the repository.

Instances are retrieved from RepositorySchema.

A document type has some general properties like a name (which must be unique), and a locale-sensitive label and description. Next to these, a document type is associated with a number of FieldTypes and PartTypes.

The part types and field types belonging to a document type are ordered collections: the order in which you add them matters. To reorder them, first remove them all and re-add them.

A document type object can be read-only, in which case all state-modifying methods (i.e. all setters and the save method) will throw a RuntimeException. Whether a document type object is read-only or not depends on where you retrieved it from. The purpose of read-only document type objects is for caching, i.e. the same object can be used by multiple users who only which to consult the document type information, but not modify it.

The equals method for DocumentType is supported, two document types are equal if all their defining data is equal, with exception of the ID.


Method Summary
 FieldTypeUse addFieldType(FieldType type, boolean required)
          The suplied field type should already exist in the repository, i.e.
 PartTypeUse addPartType(PartType partType, boolean required)
          Adds a new association with a part type to this document type.
 void clearFieldTypeUses()
           
 void clearPartTypeUses()
          Removes all associations with part types.
 org.outerx.daisy.x10.DocumentTypeDocument getExtendedXml()
          Same as getXml() but includes the full XML description of the associated part types and field types in the generated XML.
 FieldTypeUse getFieldTypeUse(long id)
          Gets a 'field type use' by field type ID.
 FieldTypeUse getFieldTypeUse(String fieldTypeName)
          Gets a 'field type use' by field type name.
 FieldTypeUse[] getFieldTypeUses()
           
 long getId()
           
 Date getLastModified()
          When was this document type last changed (persistently).
 long getLastModifier()
          Who (which user) last changed this document type (persistently).
 String getName()
           
 PartTypeUse getPartTypeUse(long id)
          Gets a 'part type use' by part type ID.
 PartTypeUse getPartTypeUse(String partTypeName)
          Gets a 'part type use' by part type name.
 PartTypeUse[] getPartTypeUses()
          Returns the part types contained by this document type.
 long getUpdateCount()
           
 org.outerx.daisy.x10.DocumentTypeDocument getXml()
           
 boolean hasFieldType(long id)
           
 boolean hasPartType(long id)
          Checks if this document type contains the part type with the given ID.
 boolean isDeprecated()
           
 void save()
           
 void setAllFromXml(org.outerx.daisy.x10.DocumentTypeDocument.DocumentType documentTypeXml)
           
 void setDeprecated(boolean deprecated)
           
 void setName(String name)
           
 
Methods inherited from interface org.outerj.daisy.repository.schema.LabelEnabled
clearLabels, getLabel, getLabelExact, getLabelLocales, setLabel
 
Methods inherited from interface org.outerj.daisy.repository.schema.DescriptionEnabled
clearDescriptions, getDescription, getDescriptionExact, getDescriptionLocales, setDescription
 

Method Detail

getId

long getId()

getPartTypeUses

PartTypeUse[] getPartTypeUses()
Returns the part types contained by this document type. This is an ordered collection. The returned array is a newly created copy, thus modifying the order of the part types in the array, or putting other ones in it, won't modify this document type.


addPartType

PartTypeUse addPartType(PartType partType,
                        boolean required)
Adds a new association with a part type to this document type.

The supplied part type should already exist in the repository, i.e. it should have an id != -1.

The same part type can be added only once.

A part type is always added to the end, after the already existing part types.

Throws:
IllegalArgumentException - if the part type's id is -1, or if it is already contained by this document type.

clearPartTypeUses

void clearPartTypeUses()
Removes all associations with part types.


hasPartType

boolean hasPartType(long id)
Checks if this document type contains the part type with the given ID.


getPartTypeUse

PartTypeUse getPartTypeUse(long id)
Gets a 'part type use' by part type ID.

Parameters:
id - ID of the part type.
Returns:
null if the part type is not associated with this document type

getPartTypeUse

PartTypeUse getPartTypeUse(String partTypeName)
Gets a 'part type use' by part type name.

Returns:
null if the part type is not associated with this document type

getFieldTypeUses

FieldTypeUse[] getFieldTypeUses()

hasFieldType

boolean hasFieldType(long id)

getFieldTypeUse

FieldTypeUse getFieldTypeUse(long id)
Gets a 'field type use' by field type ID.

Parameters:
id - ID of the field type.
Returns:
null if the field type is not associated with this document type

getFieldTypeUse

FieldTypeUse getFieldTypeUse(String fieldTypeName)
Gets a 'field type use' by field type name.

Returns:
null if the field type is not associated with this document type

addFieldType

FieldTypeUse addFieldType(FieldType type,
                          boolean required)
The suplied field type should already exist in the repository, i.e. it should have an id != -1.

A field type is always added to the end, after the already existing field types.

The same field type can only be added once.


clearFieldTypeUses

void clearFieldTypeUses()

getName

String getName()

setName

void setName(String name)

isDeprecated

boolean isDeprecated()

setDeprecated

void setDeprecated(boolean deprecated)

getLastModified

Date getLastModified()
When was this document type last changed (persistently). Returns null on newly created, not-yet-saved, document types.


getLastModifier

long getLastModifier()
Who (which user) last changed this document type (persistently). Returns -1 on newly created, not-yet-saved, document types.


getXml

org.outerx.daisy.x10.DocumentTypeDocument getXml()

getExtendedXml

org.outerx.daisy.x10.DocumentTypeDocument getExtendedXml()
Same as getXml() but includes the full XML description of the associated part types and field types in the generated XML.


setAllFromXml

void setAllFromXml(org.outerx.daisy.x10.DocumentTypeDocument.DocumentType documentTypeXml)

save

void save()
          throws RepositoryException
Throws:
RepositoryException

getUpdateCount

long getUpdateCount()

Daisy Open Source CMS