org.outerj.daisy.repository.schema
Interface DocumentType


public interface DocumentType

Describes a type of document in the repository.

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 DocumentType is associated with a number of FieldTypes and PartTypes.

The PartTypes and FieldTypes belonging to a DocumentType are ordered collections: the order in which you add them matters. To reorder them, first remove them all and re-add them.

A DocumentType 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 DocumentType object is read-only or not depends on where you retrieved it from. The purpose of read-only DocumentType objects is for caching, i.e. the same object can be used by multiple users who only which to consult the DocumentType information, but not modify it.


Method Summary
 void addFieldType(FieldType type, boolean required)
          The suplied FieldType should already exist in the repository, i.e.
 void addPartType(PartType partType, boolean required)
          Adds a new PartType to this DocumentType.
 void clearFieldTypeUses()
           
 void clearPartTypeUses()
          Removes all PartTypes.
 java.lang.String getDescription(java.util.Locale locale)
           
 java.lang.String getDescriptionExact(java.util.Locale locale)
           
 org.outerx.daisy.x10.DocumentTypeDocument getExtendedXml()
          Same as getXml() but includes the XML description of the used Part Types and Field Types in the generated XML.
 FieldTypeUse getFieldTypeUse(long id)
           
 FieldTypeUse[] getFieldTypeUses()
           
 long getId()
           
 java.lang.String getLabel(java.util.Locale locale)
          Gets the label in the given locale, using the usual locale fallback mechanisms if not found in the exactly specified locale, and finally returning the documenttype's name if no label is available.
 java.lang.String getLabelExact(java.util.Locale locale)
           
 java.util.Date getLastModified()
          When was this DocumentType last changed (persistently).
 long getLastModifier()
          Who (which user) last changed this DocumentType (persistently).
 java.lang.String getName()
           
 PartTypeUse getPartTypeUse(long id)
           
 PartTypeUse[] getPartTypeUses()
          Returns the PartTypes contained by this DocumentType.
 long getUpdateCount()
           
 org.outerx.daisy.x10.DocumentTypeDocument getXml()
           
 boolean hasFieldType(long id)
           
 boolean hasPartType(long id)
          Checks if this DocumentType contains the PartType with the given ID.
 boolean isDeprecated()
           
 void save()
           
 void setAllFromXml(org.outerx.daisy.x10.DocumentTypeDocument.DocumentType documentTypeXml)
           
 void setDeprecated(boolean deprecated)
           
 void setDescription(java.util.Locale locale, java.lang.String description)
           
 void setLabel(java.util.Locale locale, java.lang.String label)
           
 void setName(java.lang.String name)
           
 

Method Detail

getId

public long getId()

getPartTypeUses

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


addPartType

public void addPartType(PartType partType,
                        boolean required)
Adds a new PartType to this DocumentType.

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

The same PartType can be added only once.

A PartType is always added to the end, after the already existing PartTypes.

Throws:
java.lang.IllegalArgumentException - if the partType's id is -1, or if it is already contained by this DocumentType.

clearPartTypeUses

public void clearPartTypeUses()
Removes all PartTypes.


hasPartType

public boolean hasPartType(long id)
Checks if this DocumentType contains the PartType with the given ID.


getPartTypeUse

public PartTypeUse getPartTypeUse(long id)

getFieldTypeUses

public FieldTypeUse[] getFieldTypeUses()

hasFieldType

public boolean hasFieldType(long id)

getFieldTypeUse

public FieldTypeUse getFieldTypeUse(long id)

addFieldType

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

A FieldType is always added to the end, after the already existing FieldTypes.

The same PartType can only be added once.


clearFieldTypeUses

public void clearFieldTypeUses()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getDescription

public java.lang.String getDescription(java.util.Locale locale)

getDescriptionExact

public java.lang.String getDescriptionExact(java.util.Locale locale)

setDescription

public void setDescription(java.util.Locale locale,
                           java.lang.String description)

setLabel

public void setLabel(java.util.Locale locale,
                     java.lang.String label)

getLabel

public java.lang.String getLabel(java.util.Locale locale)
Gets the label in the given locale, using the usual locale fallback mechanisms if not found in the exactly specified locale, and finally returning the documenttype's name if no label is available.


getLabelExact

public java.lang.String getLabelExact(java.util.Locale locale)

isDeprecated

public boolean isDeprecated()

setDeprecated

public void setDeprecated(boolean deprecated)

getLastModified

public java.util.Date getLastModified()
When was this DocumentType last changed (persistently). Returns null on newly created DocumentTypes.


getLastModifier

public long getLastModifier()
Who (which user) last changed this DocumentType (persistently). Returns -1 on newly created DocumentTypes.


getXml

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

getExtendedXml

public org.outerx.daisy.x10.DocumentTypeDocument getExtendedXml()
Same as getXml() but includes the XML description of the used Part Types and Field Types in the generated XML.


setAllFromXml

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

save

public void save()
          throws RepositoryException
Throws:
RepositoryException

getUpdateCount

public long getUpdateCount()


Copyright © -2005 . All Rights Reserved.